Double calculation problem
Hi,
I can't get the result right for the float computation. Does anyone help me to fix it.
Caution: If the computation not right, it is kinda
dangerous to operate the nuclear reactor with this program. :-)
Code:
int main()
{
long double init_temperature;
long double temp_detect;
long double final_temp;
/* Initial temperature */
init_temperature = 25.0000000;
/* Get temperature from sensor */
temp_detect = 0.0000001; /* call getTemp()*/
final_temp = init_temperature + temp_detect;
printf("Final temperature is %lf", final_temp);
if (final_temp > init_temperature)
shutdown_nuclear_reactor(); /*this func */
return 0;
}
Coconut