- Messages
- 14
- Country

Have this code which is part of a string callback:
FLOAT64 angle, alt, alt1, alt2;
lookup_var(&baro_alt);
alt = (FLOAT64)baro_alt.var_value.n;
alt1 = 20936200;
alt2 = alt1 + alt;
angle = alt1 / alt2;
sprint(pelemnt->string, "%6.3f" , angle);
return angle;
if the altitude is 10000 ft the anwser for angle should be .999522586
it always return 1.0 no matter what I do. I get the correct value at alt2 but it is when I divide it doesnt come out correct.
I need the precision of the decimal places for this string.
Any suggestions to get it to stop rounding up or losing my decimal spaces?
Thanks,
Chris
FLOAT64 angle, alt, alt1, alt2;
lookup_var(&baro_alt);
alt = (FLOAT64)baro_alt.var_value.n;
alt1 = 20936200;
alt2 = alt1 + alt;
angle = alt1 / alt2;
sprint(pelemnt->string, "%6.3f" , angle);
return angle;
if the altitude is 10000 ft the anwser for angle should be .999522586
it always return 1.0 no matter what I do. I get the correct value at alt2 but it is when I divide it doesnt come out correct.
I need the precision of the decimal places for this string.
Any suggestions to get it to stop rounding up or losing my decimal spaces?
Thanks,
Chris

