mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 12:43:34 +00:00
2893fc3e8b
# Objective - built-in `f32::round `is slow - splits from #14064 ## Solution - using a simple floor instead of round ## Testing - I am not an expert on floating-point values, but I enumerated all f32 values to test for potential errors compared to the previous function. [rust playground](https://play.rust-lang.org/?version=stable&mode=release&edition=2021&gist=0d8ed5604499e7bd9c61ce57d47e8c06) three cases where the behavior differs between the new and previous functions: | value | previous | new | |---|---|---| | [-0.5,0) | -0 | +0 | | 0.49999997 | 0 | 1 | | +-8388609 | 8388609 | 8388610 | ## Performance ![image](https://github.com/bevyengine/bevy/assets/45868716/1910f342-e55b-4f5c-851c-24a142d5c72e) |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
README.md |