How to print with 2 decimals?

I need to print a float variable with 2 decimals. I couldn’t find on processing reference :expressionless:

1 Like

with the
can say how many decimals you want show in a string

println( nf( 0.1234567,0,2) );

Not your fault – the reference documentation for nf is actually misleading here.

For further examples and past discussion, also see:

1 Like

…proposed an update to the reference to help answer this perennial question.


and for the reference page i have 2 more ideas

-a- i like the header menu from the
so you could just jump directly to the “String Functions” group.

-b- HTML has some more features now,
how about show some “tool tip” when you are over the link?

because, if you NOT know the command nf()

  • how can you find it
  • why you should click on it.