in reply to Re: Strange log behavior?
in thread Strange log behavior?

What is the correct way to round the floating point number to 3?

Replies are listed 'Best First'.
Re^3: Strange log behavior?
by johngg (Canon) on Sep 07, 2013 at 17:36 UTC

    sprintf seems to do the right thing.

    perl -E ' say sprintf q{%.0f}, $_ for 2.99999, 2.49999, 3, -2.99999, -2.49999, 5279.8012;' 3 2 3 -3 -2 5280 $

    I hope this is helpful.

    Cheers,

    JohnGG

      Thanks, just what I needed.