aboutsummaryrefslogtreecommitdiffstats
path: root/src/print.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/print.c')
-rw-r--r--src/print.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/print.c b/src/print.c
index a9c83ea821d..e3fbc393fea 100644
--- a/src/print.c
+++ b/src/print.c
@@ -956,6 +956,26 @@ float_to_string (buf, data)
956 unsigned char *cp; 956 unsigned char *cp;
957 int width; 957 int width;
958 958
959 /* Check for plus infinity in a way that won't lose
960 if there is no plus infinity. */
961 if (data == data / 2 && data > 1.0)
962 {
963 strcpy (buf, "1.0e+INF");
964 return;
965 }
966 /* Likewise for minus infinity. */
967 if (data == data / 2 && data < -1.0)
968 {
969 strcpy (buf, "-1.0e+INF");
970 return;
971 }
972 /* Check for NaN in a way that won't fail if there are no NaNs. */
973 if (! (data * 0.0 >= 0.0))
974 {
975 strcpy (buf, "0.0e+NaN");
976 return;
977 }
978
959 if (NILP (Vfloat_output_format) 979 if (NILP (Vfloat_output_format)
960 || !STRINGP (Vfloat_output_format)) 980 || !STRINGP (Vfloat_output_format))
961 lose: 981 lose: