Skip to content

Commit

Permalink
Use cbrt() instead of powf(1./3.) (#6481)
Browse files Browse the repository at this point in the history
# Objective

- Use cube root library function instead of handrolling.

## Solution

- Instead of `powf(1./3.)` use `cbrt()`.
  • Loading branch information
targrub committed Nov 5, 2022
1 parent 40ea5b4 commit 96c9c60
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/bevy_ui/src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ pub fn extract_text_uinodes(
.get(&text_glyph.atlas_info.texture_atlas)
.unwrap();
let texture = atlas.texture.clone_weak();
let index = text_glyph.atlas_info.glyph_index as usize;
let index = text_glyph.atlas_info.glyph_index;
let rect = atlas.textures[index];
let atlas_size = Some(atlas.size);

Expand Down
2 changes: 1 addition & 1 deletion examples/ecs/iter_combinations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ fn generate_bodies(
rng.gen_range(-1.0..1.0),
)
.normalize()
* rng.gen_range(0.2f32..1.0).powf(1. / 3.)
* rng.gen_range(0.2f32..1.0).cbrt()
* 15.;

commands.spawn(BodyBundle {
Expand Down

0 comments on commit 96c9c60

Please sign in to comment.