#BUGFIX by cg expecco_19_1_0 expecco_19_1_0_final1
authorClaus Gittinger <cg@exept.de>
Wed, 05 Jun 2019 20:08:48 +0200
changeset 24257 3d3652e1f81c
parent 24256 6dfccbe099d3
child 24258 1c723f4dbc1a
#BUGFIX by cg class: LargeFloat NaN and Inf fixes comment/format in: #negative changed: #asFloat #asTrueFraction #positive
LargeFloat.st
--- a/LargeFloat.st	Wed Jun 05 18:35:08 2019 +0200
+++ b/LargeFloat.st	Wed Jun 05 20:08:48 2019 +0200
@@ -711,7 +711,7 @@
     mantissa == 0 ifTrue:[
         "/ INF or NAN
         ^ self class
-            raise:#conversionErrorSignal
+            raise:#domainErrorSignal
             receiver:self
             selector:#asTrueFraction
             arguments:#()
@@ -748,6 +748,8 @@
      LargeFloat infinity asTrueFraction          -> error
      LargeFloat negativeInfinity asTrueFraction  -> error
     "
+
+    "Modified: / 05-06-2019 / 20:06:20 / Claus Gittinger"
 !
 
 coerce:aNumber
@@ -812,10 +814,13 @@
 !LargeFloat methodsFor:'converting'!
 
 asFloat
-	"Convert to a IEEE 754 double precision floating point."
-	
-	precision > Float precision ifTrue: [^(self copy setPrecisionTo: Float precision) asFloat].
-	^mantissa asFloat timesTwoPower: biasedExponent
+        "Convert to a IEEE 754 double precision floating point."
+
+        mantissa == 0 ifTrue:[^ Float NaN].
+        precision > Float precision ifTrue: [^(self copy setPrecisionTo: Float precision) asFloat].
+        ^mantissa asFloat timesTwoPower: biasedExponent
+
+    "Modified: / 05-06-2019 / 20:06:36 / Claus Gittinger"
 !
 
 asFraction
@@ -2653,12 +2658,17 @@
 negative
     "return true if the receiver is negative"
 
-    mantissa == 0 ifTrue:[ ^ biasedExponent negative].
+    mantissa == 0 ifTrue:[ ^ biasedExponent negative]. "/ +/-INF  
     ^ mantissa negative
+
+    "Modified (comment): / 05-06-2019 / 20:08:19 / Claus Gittinger"
 !
 
 positive
-	^mantissa positive
+    mantissa == 0 ifTrue:[^ biasedExponent positive]. "/ +/-INF
+    ^ mantissa positive
+
+    "Modified (comment): / 05-06-2019 / 20:08:07 / Claus Gittinger"
 !
 
 sign