[Chicago-talk] (no subject)
joel.a.berger at gmail.com
Fri Apr 27 21:09:20 PDT 2012
Perhaps I'm mistaken about something, but it should "round half to even".
Still, if you look up round in perlfaq4 it gives a little more information
about what you are seeing (perldoc -q round).
You may have to take its advice and implement your own rounding algorithm,
but I'm sure there must be something on CPAN for this.
On Fri, Apr 27, 2012 at 8:54 PM, Michael Potter <michael at potter.name> wrote:
> I am looking for a graceful way to round numbers.
> The following program
> sub myround
> my $src = shift;
> printf("%.2f\n", $src);
> outputs this:
> $ perl ./round.pl
> I know why. It has to do with the well known side effects of using
> floating point.
> What I don't know is a graceful way to round.
> I would like to use something that already comes with perl and void
> adding any modules.
> Chicago-talk mailing list
> Chicago-talk at pm.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Chicago-talk