I just noticed that my expressions such as
double x = 60/21
returns incorrect values.
I found out that this is because 60 and 21 are integers. I should be using
double x = 60.0/21.0
Is there a way to work around the need for adding the .0
to every integer to get accurate results?
Basically I don't want to add the decimal point to every integer in my code. I want double x = 60/21
to always be treated as double x = 60.0/21.0
Is there any way to do this?
UPDATE: Thanks for the great answers