![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Floating point exception !!! | ssk01 | Linux | 3 | 12-24-2008 02:20 PM |
| Rounding off the value of Floating point value | damansingh | Shell Programming and Scripting | 7 | 05-21-2008 10:46 AM |
| floating point problem | vijlak | High Level Programming | 4 | 03-08-2007 04:18 AM |
| floating point addition | ravi raj kumar | Shell Programming and Scripting | 8 | 12-22-2006 02:47 AM |
| Floating Point Division | gsatch | Shell Programming and Scripting | 1 | 07-25-2002 05:03 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
|
|
||||
|
Floating point error in C
Hi,
see the simple code below double i; i=8080.9940; printf(" val :%.30f\n",i); output i m getting is val :8080.993999999999700000000000000 when i m expecting val :8080.9940 what happens?how can i avoid it? thanks... |
|
|||||
|
Hi,
You can try this code and will give the exact output which you are expecting double i; i=8080.9940; printf(" val :%.4f\n",i); Why because if you given %.30f it will consider 30 digit for fraction value so instead of %.30f we can use %.4f. Let me know in case of any dificulties Regards, MPS |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|