tarcieri / micromath

Embedded Rust arithmetic, 2D/3D vector, and statistics library
Apache License 2.0
401 stars 21 forks source link

Prevent overflows in F32::inv #110

Closed sunsided closed 4 months ago

sunsided commented 4 months ago

As was pointed out in #106, large floats, but also special floats such as NaN, result in a panic when calling F32::inv() on them.

This adds a somewhat more complex check for these edge cases which in general should be easily skippable by the compiler or target.

I have defined the following: