Closed Angluca closed 4 months ago
Hey! Thanks for the PR. I don't think f32::eq
should be doing checks with any tolerance, it's supposed to be for exact floating point matches (we would expect it to only be true for the same number). This trait is used by the hashmaps/etc for equality testing, and not having the equality testing be strict would break it.
We could add an almost_eq()
method to floats, which takes in an epsilon as a default argument if this is something you need! If you can make that change, I'm happy to merge this.
Floating points are less precise in the game, so it's better to choose a range.
I saw ocen std has sdl opengl
library, so I thought of this. ( add eq_epsilon()
function)
Just a suggestion, but I'm newbie T_T maybe there's a better way to calculate it, I'm not good at maths.
I don't know a lot about ocen, Maybe it's not necessary to add this fn.
I made cherry-picked your commits onto master your behalf, including your fix for test.py
and adding f32::is_close()
and f64::is_close()
APIs in std::math
. Thanks a lot!
Very nice !!! 👍 👍 👍