summaryrefslogtreecommitdiff
path: root/libm
diff options
context:
space:
mode:
authorMarcus Haehnel <marcus.haehnel@kernkonzept.com>2024-07-09 09:38:40 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2024-07-09 09:53:20 +0200
commit5820f4b5860f97c66b01bc8e25ea876ae4f07478 (patch)
tree026ab686123461d5f89258d0fc41221285679002 /libm
parent6271f8e869a4369b3bbcdd8a58ccce876eeae49b (diff)
uclibc: Fix double promotion warning
Add casts where necessary to convince clang that the promotion of float to double is intentional. Co-authored-by: Sven Linker <sven.linker@kernkonzept.com> Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
Diffstat (limited to 'libm')
-rw-r--r--libm/cexp.c6
-rw-r--r--libm/float_wrappers.c2
-rw-r--r--libm/nan.c4
-rw-r--r--libm/w_cabs.c2
4 files changed, 7 insertions, 7 deletions
diff --git a/libm/cexp.c b/libm/cexp.c
index 87512b7c5..a08d12d4e 100644
--- a/libm/cexp.c
+++ b/libm/cexp.c
@@ -38,10 +38,10 @@ libm_hidden_proto(cexpf)
__complex__ float cexpf(__complex__ float z)
{
__complex__ float ret;
- double r_exponent = exp(__real__ z);
+ double r_exponent = exp((double)__real__ z);
- __real__ ret = r_exponent * cosf(__imag__ z);
- __imag__ ret = r_exponent * sinf(__imag__ z);
+ __real__ ret = r_exponent * (double) cosf(__imag__ z);
+ __imag__ ret = r_exponent * (double) sinf(__imag__ z);
return ret;
}
diff --git a/libm/float_wrappers.c b/libm/float_wrappers.c
index 948f6bc14..35887dde2 100644
--- a/libm/float_wrappers.c
+++ b/libm/float_wrappers.c
@@ -230,7 +230,7 @@ long_WRAPPER1(lround)
float modff (float x, float *iptr)
{
double y, result;
- result = modf( x, &y );
+ result = modf( (double)x, &y );
*iptr = (float)y;
return (float) result;
}
diff --git a/libm/nan.c b/libm/nan.c
index 454734b6f..9c2cd6e90 100644
--- a/libm/nan.c
+++ b/libm/nan.c
@@ -28,7 +28,7 @@ double nan (const char *tagp)
sprintf (buf, "NAN(%s)", tagp);
return strtod (buf, NULL);
}
- return NAN;
+ return (double)NAN;
}
libm_hidden_def(nan)
@@ -53,7 +53,7 @@ long double nanl (const char *tagp)
sprintf (buf, "NAN(%s)", tagp);
return strtold (buf, NULL);
}
- return NAN;
+ return (long double)NAN;
}
libm_hidden_def(nanl)
#endif
diff --git a/libm/w_cabs.c b/libm/w_cabs.c
index b2592484c..546b6affa 100644
--- a/libm/w_cabs.c
+++ b/libm/w_cabs.c
@@ -17,7 +17,7 @@ libm_hidden_def(cabs)
libm_hidden_proto(cabsf)
float cabsf(float _Complex z)
{
- return (float) hypot(__real__ z, __imag__ z);
+ return (float) hypot((double)__real__ z, (double)__imag__ z);
}
libm_hidden_def(cabsf)