We are about to switch to a new forum software. Until then we have removed the registration on this forum.
In my java program I would like for the compiler to not automatically round my float values. I believe by default it rounds to 6 decimal places. Since I am using quite a complex formula involving sin and cos functions I would like to keep quite a few decimal places. How do I prevent it from automatically rounding. Maybe like: float x=3.123443234 float y=frozenFloat(x + 0.00000001) //x==3.123443244
Answers
Use
double
type: https://Processing.org/reference/double.htmlAnd suffix all your fractional literals w/
d
:For math functions, prefix all of them w/
Math.
:http://docs.Oracle.com/javase/8/docs/api/java/lang/Math.html
This helps me a lot! Thanks