mirror of
https://github.com/apache/nuttx.git
synced 2026-02-06 12:42:21 +08:00
nuttx/libm: switch from integer to double constants in pow
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
committed by
Xiang Xiao
parent
776035ee9e
commit
f0cbcb95ff
@@ -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)
|
||||
{
|
||||
@@ -57,6 +57,6 @@ double pow(double b, double e)
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0.0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
@@ -53,5 +53,5 @@ float powf(float b, float e)
|
||||
}
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user