Click here to Skip to main content
15,890,670 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All, I am using visual studio 2008 and maniplulating double addition.
C#
double a = 1.5000010 ;
double b = 0.0000090;
double c = a+b;

The output I am expecting here is 1.5000100 but the actual output comes as 1.5000099999999998.

I dont have to consider more than 7 fractional points so the output comes like 1.5000099.

How do i convert or store this in to the format which i like? that means 1.5000100.

Is there any built-in method or win32 API available to do this?

Thanks in advance.
Posted

1 solution

HI check this link,

it might be helpful..

http://stackoverflow.com/questions/274439/built-in-net-algorithm-to-round-value-up-to-the-nearest-10-interval[^]

hope it helps

have a smile :)
 
Share this answer
 
Comments
Albert Holguin 7-Dec-11 9:22am    
Your link is for C#, question is clearly tagged C++/MFC.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900