Chris Wagner wrote: > OP was trying to round for display. In this case whatever rounding function > u use has to output a string consistent with human rounding principles. > Floating point numbers that a machine uses internally have no real relation > to the real numbers that humans use. And the conversion is lossy.
Do 'human rounding principles' say that you would expect 10 / 3 rounded to 2 DP would produce 3.34 or 3.33? How about -10 / 3? I assume that if you asked someone to calculate the digits of pi, you'd expect them to stop some time. How do 'human rounding principles' say they should deal with that. My point was just that I can't think of a single practical case where you would be worried about whether 1.5 displayed as 1 or 2, and floating point numbers would have any place in your calculation. If your floating point answer is crud, then fiddling with it at the end of your calculation so it looks pretty just makes it cruddier. You need to do your calculation with precision and scale. Not format your answer so that it looks like that was what happened. _______________________________________________ Perl-Win32-Users mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
