mathematics (int64, float, double??)


i have to calculate a value using this

(1/825 - (6401 (x - 16500))/777297576000) x

it for the angle calculation of a machine powered by a stepper x are the stepps and the result is the angle... But if i use double or float it doesent work... The stepps are int32_t.. Thanks

1/825 is 0 using integer arithmetic. Using named constants (perhaps with decimal points) instead of magic numbers would be useful. At least, then we could see what that is really trying to do.

777297576000 is longer than a long - maybe long long works: 777297576000LL (although I think you should be using float everyhwere: (1/825.0 - (6401.0 * (x - 16500)) / 777297576000.0) * x

Thanks, float works now...