Hi,every one, I've try to use dev c++ and minwg+code::block
but both side have same result...Is something wrong about zlib1.dll?
I have two computer ,one OS is winxp and one win2000,
all have same problem,in witches window catch value of double always
be wrong , if anyone know why, please save me, thank you!!
I have print screen and past on my facebook. https://www.facebook.com/olive4953
Floating point values are not 100% precise for all values.
there is a tenbyte (80 bit) type on many compilers (its nonstandardish) and you can do the math with 2 of those, and put that into a double, and it MIGHT come out exact, or it may not, but it improves your odds.
The general rule of thumb is don't use == for double apart from checking zero, and even then, its not always the best thing to do.
there is a tiny value in limits or one of the headers, I think it is called eps or epsilon (epsilon is often used symbol for error bounding in math) so you can check
value-eps < value < value + eps or the like, depending on what you need.
Epsilon is a specific value: it is the difference between 1.0 and the next representable number. So it is not directly suitable for that specific task.
A simple way to check for equality, take the absolute value of the difference between number and the expected number, and see if it is less than some precision value: 0.01 say.