On Monday, February 26, 2018 18:33:13 H. S. Teoh via Digitalmars-d-learn wrote: > Well, the way I deal with floating point is, design my code with the > assumption that things will be inaccurate, and compensate accordingly.
The way that I usually deal with it is to simply not use floating point numbers, because for most things that I do, I don't need them. Now, for those where I do need them, I'm forced to do like you're discussing and plan for the fact that FP math is inaccurate, but fortunately, I rarely need floating point values. Obviously, that's not true for everyone. But it's certainly the case that I advocate avoiding FP when it's not actually necessary, whereas some folks use it frequently when it's not necessary. One case that I found interesting was that in writing core.time.convClockFreq so that it didn't require floating point values, it not only avoided the inaccuracies caused by using FP, but it even was able to cover a larger range of values than FP because of how it splits out the whole number and fractional portions to do the math. - Jonathan M Davis