in reply to sprintf() returning incorrect value

% say "sprintf '%07.0f', 114.6" 0000115

- tye        

Replies are listed 'Best First'.
Re^2: sprintf() returning incorrect value (%.0f)
by ppeel (Novice) on Jul 15, 2015 at 15:37 UTC

    Using this syntax works! "sprintf ('%07.0f', $nfc_amt)". Thank you!

      While %d truncates (114.999... ⇒ 114), %f rounds (114.999... ⇒ 115).