Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Use cbrt() instead of powf(1./3.) #6481

Closed
wants to merge 2 commits into from

Conversation

targrub
Copy link
Contributor

@targrub targrub commented Nov 5, 2022

Objective

  • Use cube root library function instead of handrolling.

Solution

  • Instead of powf(1./3.) use cbrt().

@alice-i-cecile alice-i-cecile added the C-Code-Quality A section of code that is hard to understand or change label Nov 5, 2022
@alice-i-cecile
Copy link
Member

Merging as trivial.

bors r+

bors bot pushed a commit that referenced this pull request Nov 5, 2022
# Objective

- Use cube root library function instead of handrolling.

## Solution

- Instead of `powf(1./3.)` use `cbrt()`.
@bors bors bot changed the title Use cbrt() instead of powf(1./3.) [Merged by Bors] - Use cbrt() instead of powf(1./3.) Nov 5, 2022
@bors bors bot closed this Nov 5, 2022
@james7132
Copy link
Member

This is fine in an example, but I don't think the implementation for cbrt is well defined in Rust stdlib, nor in the IEEE-754 spec. If we want to maintain Bevy's use for deterministic/reproducible simulation, we should avoid stepping outside of those bounds in actual engine code.

@alice-i-cecile
Copy link
Member

Oof, that's really frustrating. Noted!

@targrub
Copy link
Contributor Author

targrub commented Nov 6, 2022

I understand what you're saying (and I know Alice does as well, since we're both Factorio fans), but...
Is this an explicit, documented goal of Bevy?

@alice-i-cecile
Copy link
Member

Explicit yes, documented not really. We should probably add it to the contributing guide.

@ManevilleF ManevilleF mentioned this pull request Nov 10, 2022
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
# Objective

- Use cube root library function instead of handrolling.

## Solution

- Instead of `powf(1./3.)` use `cbrt()`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Code-Quality A section of code that is hard to understand or change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants