in reply to Proper monetary rounding
What you really ought to do is pick an epsilon that represents how much off your floating point number may be from what the actual infinitely precise value would have been - taking into account both the inaccuracy of floating point representation and any round-off errors involved in calculations that led to the number in question. Given the latter factor, there is no one epsilon that will suit any problem. Then you apply the round-to-even rule if your number is within epsilon of 1/20th, 1/200th, etc.
I have the suspicion that the ffround is working because at some point the number is converted to string form, and then to a bigfloat internal form, and the conversion to string does a slight amount of rounding for you. If so, it won't necessarily work 100% of the time.
I'm looking for a job.
|
|---|