You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, nf() can be used for standard righthand-only formatting to limit decimal / floating point precision -- e.g.
println(nf(1.23456, 0, 3)); // prints 1.235
Despite this being one of the most common forms of number formatting, this usage is not shown on the nf reference page, confusing people who are looking for it. In fact, the reference suggests that 0 is not a valid value for the left argument, saying:
"The values for the digits, left, and right parameters should always be positive integers."
...which is not true.
As a result, over the years, the question of how to do this comes up over and over on the forums -- and people sometimes develop unneeded elaborate workarounds.
Update the page with an example and correct the argument text.
The text was updated successfully, but these errors were encountered:
jeremydouglass
changed the title
Update nf() page to indicate show floating point formatting
Update nf() page to indicate show righthand-only formatting
Sep 11, 2019
Issue description
Currently,
nf()
can be used for standard righthand-only formatting to limit decimal / floating point precision -- e.g.Despite this being one of the most common forms of number formatting, this usage is not shown on the nf reference page, confusing people who are looking for it. In fact, the reference suggests that 0 is not a valid value for the left argument, saying:
"The values for the digits, left, and right parameters should always be positive integers."
...which is not true.
As a result, over the years, the question of how to do this comes up over and over on the forums -- and people sometimes develop unneeded elaborate workarounds.
URL(s) of affected page(s)
https://processing.org/reference/nf_.html
Proposed fix
Update the page with an example and correct the argument text.
The text was updated successfully, but these errors were encountered: