in reply to Re^2: log() and int() problem
in thread log() and int() problem
I solved my issue with adding and subtracting 1 from the returned value
Sorry, but that's a terrible "solution".
Your example floating point
inaccuracy happens to be slightly greater than three.
Since the int function truncates,
consider what happens if the inaccuracy happens
to be slightly less than three.
Though a crude fix would be to
add 0.5 (i.e. int($l+0.5)
instead of int($l)),
the perl documentation advises against using int
for rounding and suggests sprintf and the POSIX
floor and ceil functions as sounder alternatives.
Still don't understand why you don't go with