in reply to Re^2: Coping with decimals
in thread Coping with decimals
The standard Perl approach to rounding numbers (with sprintf) amounts to using a string manipulation for what is arguably an arithmetic task. Did you have any particular error in mind?
When I first saw the question, the two solutions I thought of were $x - int( $x ) or indeed something along the lines of $x =~ s/\d+(?=\.)//, and I'm curious about what errors could have resulted from the latter approach.
the lowliest monk
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Coping with decimals
by BrowserUk (Patriarch) on Jun 02, 2005 at 13:28 UTC | |
|
Re^4: Coping with decimals
by mikeraz (Friar) on Jun 02, 2005 at 16:26 UTC | |
by tlm (Prior) on Jun 02, 2005 at 16:47 UTC |