MikeLankamp / fpm

C++ header-only fixed-point math library
https://mikelankamp.github.io/fpm
MIT License
673 stars 85 forks source link

Signed lowest value may cause stack overflow #31

Open UFOylzj opened 2 years ago

UFOylzj commented 2 years ago

For example, in the atan function, if x is signed and x is the lowest value, -x will be equal to x. So the function will keep calling itself and cause a stack overflow.

vladipus commented 1 year ago

Maybe a mere comparison in the method would do?

SirNate0 commented 11 months ago

Or possibly swap the function to be implemented for x<=0, as then there would be no attempt to negate that value.