g++/gcc : Floating point issue

abuzer.salik@tcs.com abuzer.salik@tcs.com
Wed Jul 26 14:53:00 GMT 2006


Hi,

I have an application which uses double values a lot. If I try to put say
401.74 in a double variable it is getting stored as 401.74000000000001
which creates problem in the calculations down the line. ( I am checking
these values using gdb debugger).

So, I am wondering if there is a way by which I can store the correct
values (i.e. 401.74) in the double.

We are using g++ compiler on Linux box.

Do we need to look for another compiler/hardware or current setup can
handle this?

Any suggestion/solution is highly appreciated.

Regards,
Abuzer Salik
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you




More information about the Gcc-help mailing list