双精度值 [英] double value precision
本文介绍了双精度值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,我正在使用Visual Studio 2008并操纵双重加法.
Hello All, I am using visual studio 2008 and maniplulating double addition.
double a = 1.5000010 ;
double b = 0.0000090;
double c = a+b;
我在这里期望的输出是1.5000100,但实际输出为1.5000099999999998.
我不必考虑超过7个小数点,因此输出结果为1.5000099.
如何将其转换或存储为我喜欢的格式?表示1.5000100.
是否有任何内置方法或win32 API可以做到这一点?
预先感谢.
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.
推荐答案
HI检查此链接,
这可能会有所帮助..
http://stackoverflow. com/questions/274439/built-in-net-algorithm-to-round-value-up-to-the-nearest-10-interval [
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 :)
这篇关于双精度值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文