Skip to content

Commit

Permalink
nuttx/libm: switch from integer to double constants in pow
Browse files Browse the repository at this point in the history
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
  • Loading branch information
pkarashchenko committed Sep 29, 2024
1 parent 22200e2 commit 7478862
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions libs/libm/libm/lib_pow.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@
#ifdef CONFIG_HAVE_DOUBLE
double pow(double b, double e)
{
if (b > 0)
if (b > 0.0)
{
return exp(e * log(b));
}
else if (b < 0 && e == (int)e)
else if (b < 0.0 && e == (int)e)
{
if ((int)e % 2 == 0)
{
Expand All @@ -57,6 +57,6 @@ double pow(double b, double e)
}
}

return 0;
return 0.0;
}
#endif
6 changes: 3 additions & 3 deletions libs/libm/libm/lib_powf.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@

float powf(float b, float e)
{
if (b > 0.0)
if (b > 0.0f)
{
return expf(e * logf(b));
}
else if (b < 0.0 && e == (int)e)
else if (b < 0.0f && e == (int)e)
{
if ((int)e % 2 == 0)
{
Expand All @@ -53,5 +53,5 @@ float powf(float b, float e)
}
}

return 0.0;
return 0.0f;
}

0 comments on commit 7478862

Please sign in to comment.