diff options
Diffstat (limited to 'src/print.c')
-rw-r--r-- | src/print.c | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/src/print.c b/src/print.c index add21609cc5..34c7fa12b6e 100644 --- a/src/print.c +++ b/src/print.c @@ -40,7 +40,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ #include <ftoastr.h> #include <math.h> -#if HAVE_IEEE754_H +#if IEEE_FLOATING_POINT # include <ieee754.h> #endif @@ -1013,34 +1013,15 @@ float_to_string (char *buf, double data) strcpy (buf, minus_infinity_string + positive); return sizeof minus_infinity_string - 1 - positive; } +#if IEEE_FLOATING_POINT if (isnan (data)) { -#if HAVE_IEEE754_H union ieee754_double u = { .d = data }; uprintmax_t hi = u.ieee_nan.mantissa0; return sprintf (buf, &"-%"pMu".0e+NaN"[!u.ieee_nan.negative], (hi << 31 << 1) + u.ieee_nan.mantissa1); -#else - /* Prepend "-" if the NaN's sign bit is negative. - The sign bit of a double is the bit that is 1 in -0.0. */ - static char const NaN_string[] = "0.0e+NaN"; - int i; - union { double d; char c[sizeof (double)]; } u_data, u_minus_zero; - bool negative = 0; - u_data.d = data; - u_minus_zero.d = - 0.0; - for (i = 0; i < sizeof (double); i++) - if (u_data.c[i] & u_minus_zero.c[i]) - { - *buf = '-'; - negative = 1; - break; - } - - strcpy (buf + negative, NaN_string); - return negative + sizeof NaN_string - 1; -#endif } +#endif if (NILP (Vfloat_output_format) || !STRINGP (Vfloat_output_format)) |