mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 23:40:19 +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
|
#ifdef CONFIG_HAVE_DOUBLE
|
||||||
double pow(double b, double e)
|
double pow(double b, double e)
|
||||||
{
|
{
|
||||||
if (b > 0)
|
if (b > 0.0)
|
||||||
{
|
{
|
||||||
return exp(e * log(b));
|
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)
|
if ((int)e % 2 == 0)
|
||||||
{
|
{
|
||||||
@@ -57,6 +57,6 @@ double pow(double b, double e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -37,11 +37,11 @@
|
|||||||
|
|
||||||
float powf(float b, float e)
|
float powf(float b, float e)
|
||||||
{
|
{
|
||||||
if (b > 0.0)
|
if (b > 0.0f)
|
||||||
{
|
{
|
||||||
return expf(e * logf(b));
|
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)
|
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