in reply to Re: sprintf() returning incorrect value (%.0f)
in thread sprintf() returning incorrect value

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

  • Comment on Re^2: sprintf() returning incorrect value (%.0f)

Replies are listed 'Best First'.
Re^3: sprintf() returning incorrect value (%.0f)
by ikegami (Patriarch) on Jul 15, 2015 at 16:17 UTC
    While %d truncates (114.999... ⇒ 114), %f rounds (114.999... ⇒ 115).