in reply to Math::BigFloat Rounding

As far as the current docs are concerned, there is no "common" mode:

All rounding functions take as a second parameter a rounding mode from one of the following: 'even', 'odd', '+inf', '-inf', 'zero' or 'trunc'

I would guess you'd want to use 'odd' or '+inf'.

Also note that always rounding "up" at .X5 (i.e. common rounding, or '+inf' for positive numbers) can cause statistical errors, so using 'odd' or 'even' is probably better, with the default of 'even' having the advantage of being the (or a) standard.

See http://en.wikipedia.org/wiki/Rounding

update: the wiki page also claims that using round-to-even (instead of round-to-odd) helps when the final result tends to near 0. That seems to make sense to me.

Replies are listed 'Best First'.
Re^2: Math::BigFloat Rounding
by BarMeister (Beadle) on May 23, 2007 at 00:46 UTC
    When I looked at the docs I was actually looking at the BigInt docs which does have a common method which gives the same error though...BigFloat uses BigInt's round_method method. I am not going for any statistical relevance with this rounding...I am just trying to emulate the way in which MySQL rounds its float data types. Basically if it is >= 5 round up, < 5 round down.