Does Processing Understand Scientific Notation?

Does processing know that when I type 6.673e-11 as a float it should come out 0.00000000006673 ?

Thanks.

1 Like

Within β€œ.pde” files, any literal w/ a dot . or an e in it is treated as a float primitive datatype: :face_with_monocle:
https://Processing.org/reference/float.html
If you wish for a double instead, suffix them all w/ a d: 6.673e-11d :man_student:
https://Processing.org/reference/double.html

1 Like

The best way to answer questions like this is to just put together a little example program that tests it out:

float x = 6.673e-11;
float y =  0.00000000006673;
println(x == y);

This prints out true. But be mindful of floating point accuracy.

1 Like