All pastes #350598 Raw Edit

Someone

public text v1 · immutable
·published 2007-02-11 16:02 UTC
rendered paste body
--- server/asobj/Number.cpp.orig        Sun Feb 11 10:42:24 2007
+++ server/asobj/Number.cpp     Sun Feb 11 11:30:51 2007
@@ -201,17 +201,17 @@ number_val_to_str(double _val, char *_st
 
        // Handle non-numeric values.
        // "printf" gives "nan", "inf", "-inf", so we check explicitly
-       switch (fpclassify(_val)) {
-       case FP_NAN:
-               strcpy(_str, "NaN");
-               break;
-       case FP_INFINITE:
+
+  if (isnan(_val))
+    strcpy(_str, "NaN");
+
+  else if (isinf(_val))
                // isinf() cannot be relied on to distinguish -Infinity
-               strcpy(_str, _val < 0 ? "-Infinity" : "Infinity");
-               break;
-       default:        // FP_ZERO, FP_NORMAL and FP_SUBNORMAL
-               if (fabs(_val) < 0.0001 &&
-                   fabs(_val) >= 0.00001) {
+    strcpy(_str, _val < 0 ? "-Infinity" : "Infinity");
+
+  else {       // FP_ZERO, FP_NORMAL and FP_SUBNORMAL
+    if (fabs(_val) < 0.0001 &&
+       fabs(_val) >= 0.00001) {
                        // This is the range for which %.15g gives scientific
                        // notation but for which we must give decimal.
                        // We can't easily use %f bcos it prints a fixed number
@@ -267,7 +267,8 @@ number_val_to_str(double _val, char *_st
                        }
                }
        }
-}
+    }
+
 
 static void
 number_ctor(const fn_call& fn)