Click to See Complete Forum and Search --> : Double datatype roundoff


pradeepkurian
March 26th, 2008, 01:11 AM
Hi ,

I have a problem with storing value as double data type in C++.

Please refer the below example for more clarity

double dVal = 10.23541453;
cout<<"Value is "<<dVal<<endl;

The out put will be 10.2354
The part after 10.2354 is getting round off.
But for my particular requirement I need the whole value, means I need to avoid the round off.
Please help me

Thanks
Pradeep Kurian

laitinen
March 26th, 2008, 02:49 AM
Please read these: What are different number representations? (http://www.codeguru.com/forum/showthread.php?t=316299) and How is floating point representated? (http://www.codeguru.com/forum/showthread.php?t=323835)

Laitinen

Lindley
March 26th, 2008, 07:20 AM
It's only being rounded during output. Its value within the program remains the same.