diff options
author | Marcus Haehnel <marcus.haehnel@kernkonzept.com> | 2024-07-09 09:38:40 +0200 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2024-07-09 09:53:20 +0200 |
commit | 5820f4b5860f97c66b01bc8e25ea876ae4f07478 (patch) | |
tree | 026ab686123461d5f89258d0fc41221285679002 /libc | |
parent | 6271f8e869a4369b3bbcdd8a58ccce876eeae49b (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 'libc')
-rw-r--r-- | libc/stdio/_fpmaxtostr.c | 4 | ||||
-rw-r--r-- | libc/stdlib/_strtod.c | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/libc/stdio/_fpmaxtostr.c b/libc/stdio/_fpmaxtostr.c index b06b25aa0..1f268fdaa 100644 --- a/libc/stdio/_fpmaxtostr.c +++ b/libc/stdio/_fpmaxtostr.c @@ -318,8 +318,8 @@ ssize_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info, #else /* __UCLIBC_HAS_HEXADECIMAL_FLOATS__ */ -#define lower_bnd 1e8 -#define upper_bnd 1e9 +#define lower_bnd (__fpmax_t)1e8 +#define upper_bnd (__fpmax_t)1e9 #define power_table exp10_table #define dpb DIGITS_PER_BLOCK #define base 10 diff --git a/libc/stdlib/_strtod.c b/libc/stdlib/_strtod.c index c4c79e511..483551e64 100644 --- a/libc/stdlib/_strtod.c +++ b/libc/stdlib/_strtod.c @@ -256,7 +256,7 @@ __fpmax_t attribute_hidden __XL_NPP(__strtofpmax)(const Wchar *str, Wchar **endp } #endif - number = 0.; + number = (__fpmax_t)0; #ifdef _STRTOD_NEED_NUM_DIGITS num_digits = -1; #endif @@ -339,7 +339,7 @@ __fpmax_t attribute_hidden __XL_NPP(__strtofpmax)(const Wchar *str, Wchar **endp while ((pos[j] | 0x20) == nan_inf_str[i+1+j]) { ++j; if (!nan_inf_str[i+1+j]) { - number = i / 0.; + number = i / (__fpmax_t)0.; if (negative) { /* Correct for sign. */ number = -number; } @@ -414,7 +414,7 @@ __fpmax_t attribute_hidden __XL_NPP(__strtofpmax)(const Wchar *str, Wchar **endp } #ifdef _STRTOD_ZERO_CHECK - if (number == 0.) { + if (number == (__fpmax_t)0.) { goto DONE; } #endif @@ -515,7 +515,7 @@ float __XL_NPP(strtof)(const Wchar *str, Wchar **endptr __LOCALE_PARAM ) x = __XL_NPP(__strtofpmax)(str, endptr, 0 __LOCALE_ARG ); y = (float) x; - __fp_range_check(y, x); + __fp_range_check((__fpmax_t)y, x); return y; #endif @@ -549,7 +549,7 @@ double __XL_NPP(strtod)(const Wchar *__restrict str, x = __XL_NPP(__strtofpmax)(str, endptr, 0 __LOCALE_ARG ); y = (double) x; - __fp_range_check(y, x); + __fp_range_check((__fpmax_t)y, x); return y; #endif |