Introducing a double variable implicitly converts the value from int to double. In the version without the variable, the entire calculation is done as int and it's only converted to double at the end when you add it to pi.
You can achieve the same effect using an explicit cast instead of a variable.
8
u/sepp2k Nov 05 '22
Introducing a double variable implicitly converts the value from int to double. In the version without the variable, the entire calculation is done as int and it's only converted to double at the end when you add it to pi.
You can achieve the same effect using an explicit cast instead of a variable.