|Perl Monk, Perl Meditation|
Re^3: log() and int() problemby eyepopslikeamosquito (Chancellor)
|on Dec 25, 2012 at 22:40 UTC||Need Help??|
I solved my issue with adding and subtracting 1 from the returned valueSorry, 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 moritz's solution.