Very strange SIN and COS results *FIXED*
I have a problem I can't find a solution to.
I use some functions with a cos and sin function
For example I have a function : sh = sinf(h);
h is of type float
when I hardcode h = 1.570796325;
sh will be 1 (that's correct)
When I run my code h is nearly 90 degrees (there are some conversions that makes it not exactly 90, but that is not a problem)
first I convert to radians by this function h = h * M_PI / 180.0;
Than the result is: 1.250 (or another result > 1 it's not always the same)
1.250 is an invalid result as the sin function cannot be greater then 1
I tried many things, cast it as a double, convert it to a double and use sin instead of sinf
Everytime I get 1.250 as a result.
Other values give sometimes correct values, sometimes incorrect values.
I'm really out of options.
What could be the cause of this?
post edited by Skydec - 2020/03/31 07:53:51