#REFACTORING by cg
authorClaus Gittinger <cg@exept.de>
Sun, 09 Jun 2019 13:21:39 +0200
changeset 24301 bf2a904cbeda
parent 24300 9d2d154ca84b
child 24302 ad24f2aec0c9
#REFACTORING by cg class: ArithmeticValue changed: #uncheckedDivide: (send #positiveInfinity instead of #infinity) class: ArithmeticValue class added: #positiveInfinity comment/format in: #negativeInfinity changed: #infinity #trapOverflow: (send #positiveInfinity instead of #infinity)
ArithmeticValue.st
--- a/ArithmeticValue.st	Sat Jun 08 17:23:57 2019 +0200
+++ b/ArithmeticValue.st	Sun Jun 09 13:21:39 2019 +0200
@@ -241,11 +241,14 @@
 !
 
 infinity
-    "return something which represents positive infinity (for my instances)"
+    "return something which represents positive infinity.
+     Warning: do not compare equal against infinities;
+     instead, check using isFinite or isInfinite"
 
     ^ Infinity positive
 
     "Modified (comment): / 20-06-2017 / 13:45:23 / cg"
+    "Modified (comment): / 09-06-2019 / 12:56:30 / Claus Gittinger"
 !
 
 nan
@@ -255,9 +258,23 @@
 !
 
 negativeInfinity
-    "return something which represents negative infinity (for my instances)"
+    "return something which represents negative infinity.
+     Warning: do not compare equal against infinities;
+     instead, check using isFinite or isInfinite"
 
     ^ Infinity negative
+
+    "Modified (comment): / 09-06-2019 / 12:56:36 / Claus Gittinger"
+!
+
+positiveInfinity
+    "return something which represents positive infinity.
+     Warning: do not compare equal against infinities;
+     instead, check using isFinite or isInfinite"
+
+    ^ self infinity
+
+    "Created: / 09-06-2019 / 12:49:31 / Claus Gittinger"
 !
 
 unity
@@ -452,7 +469,7 @@
             
             msgSend := ex parameter.
             rcvr := msgSend receiver.
-            ex proceedWith:(rcvr class infinity)
+            ex proceedWith:(rcvr class positiveInfinity)
         ] do: 
             aBlock
 
@@ -465,6 +482,7 @@
     "
 
     "Created: / 07-07-2017 / 13:08:06 / cg"
+    "Modified: / 09-06-2019 / 12:53:55 / Claus Gittinger"
 !
 
 trapUnderflow:aBlock
@@ -502,6 +520,7 @@
     ^ self == ArithmeticValue
 ! !
 
+
 !ArithmeticValue methodsFor:'arithmetic'!
 
 * something
@@ -681,11 +700,12 @@
         
         self isZero ifTrue:[^ self class NaN].
         self negative ifTrue:[^ self class negativeInfinity].
-        ^ self class infinity.
+        ^ self class positiveInfinity.
     ].
     ^ self / aNumber
 
     "Modified (format): / 18-06-2017 / 23:43:13 / cg"
+    "Modified: / 09-06-2019 / 12:53:47 / Claus Gittinger"
 ! !
 
 !ArithmeticValue methodsFor:'arithmetic destructive'!