From 5e702c552753357c2d489e83464cd323ec9e9751 Mon Sep 17 00:00:00 2001 From: ceriel Date: Wed, 24 Feb 1993 15:12:49 +0000 Subject: [PATCH] Added some code to check for Nan/Inf --- lang/m2/libm2/RealConver.mod | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lang/m2/libm2/RealConver.mod b/lang/m2/libm2/RealConver.mod index 493dc914b..c663f5ed0 100644 --- a/lang/m2/libm2/RealConver.mod +++ b/lang/m2/libm2/RealConver.mod @@ -56,6 +56,12 @@ IMPLEMENTATION MODULE RealConversions; pointpos := 0; sign := r < 0.0D; IF sign THEN r := -r END; + ok := TRUE; + IF NOT (r / 10.0D < r) THEN + (* assume Nan or Infinity *) + r := 0.0D; + ok := FALSE; + END; IF r # 0.0D THEN IF r >= 10.0D THEN FOR i := 1 TO 6 DO @@ -81,7 +87,6 @@ IMPLEMENTATION MODULE RealConversions; INC(pointpos); END; ind1 := 0; - ok := TRUE; ind2 := ndigits+1; IF NOT ecvtflag THEN