Skip to content

Commit

Permalink
feat(math): add math/base/special/round10f
Browse files Browse the repository at this point in the history
  • Loading branch information
vivekmaurya001 committed Dec 6, 2024
1 parent 5664767 commit a88eff8
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ float stdlib_base_round10f( const float x ) {
}

// Solve the equation `10^p = x` for `p`:
p = stdlib_base_logf( xc, 10.0 );
p = stdlib_base_logf( xc, 10.0f );

// Find the previous and next integer powers:
p1 = stdlib_base_floorf( p );
Expand All @@ -81,8 +81,8 @@ float stdlib_base_round10f( const float x ) {
}

// Compute previous and next powers of 10:
y1 = stdlib_base_pow( 10.0, (float)p1 );
y2 = stdlib_base_pow( 10.0, (float)p2 );
y1 = stdlib_base_pow( 10.0, p1 );
y2 = stdlib_base_pow( 10.0, p2 );

// Find the closest power of 10:
half = ( y2 - y1 ) / 2.0;
Expand Down

0 comments on commit a88eff8

Please sign in to comment.