Hello,
My question is like in subject. Where doubleValueOfOne is calculated from operation: 0.4 + 0.4 + 0.4 - 1.0 +0.4 + 0.4 So on the end it’s 1.0.
I know it’s the case of not ideal precision of double.
So I suppose I could use something like: double valueOfOne > 1.00000001
But I feel it’s not good solution. And I’ve heard on different machines there could be various precision of double. I am not sure if it’s true. But I need some good and smart solution.
Could anyone give some hint?
Thanks in advance for any help.
Best Regards
Floats are troubling you lately, aren’t they?
To that question there are many many answers or approaches. But without knowing the context or the behavior you want to achieve, we can’t give you the best solution for your problem. Could you tell us about your specific application?
In general: there is something called eps, which is the smallest possible number representable with floats, basically the resolution of floating point if you want so. In most cases, you could use that
danielrudrich. Yes it looks like float bothering me
You are asking about context. Sorry it’s too complicated for me to explain (not worth your time and my time) I am just still testing some strange variations of FFT, and I met described problem when tried to interpolate some zero padding FFT output. But I am even not sure what I want to do. I just like that
I think I will try solutions from ford004 link. Thanks.