#FEATURE by cg
class: LongFloat
class definition
class: LongFloat class
added:
#NaN
#infinity
#negativeInfinity
--- a/LongFloat.st Tue Jun 20 13:36:16 2017 +0200
+++ b/LongFloat.st Tue Jun 20 13:54:48 2017 +0200
@@ -15,7 +15,8 @@
LimitedPrecisionReal variableByteSubclass:#LongFloat
instanceVariableNames:''
- classVariableNames:'DefaultPrintFormat LongFloatZero LongFloatOne Pi E Epsilon'
+ classVariableNames:'DefaultPrintFormat LongFloatZero LongFloatOne Pi E Epsilon NaN
+ PositiveInfinity NegativeInfinity'
poolDictionaries:''
category:'Magnitude-Numbers'
!
@@ -512,6 +513,21 @@
!LongFloat class methodsFor:'constants'!
+NaN
+ "return a longFloat which represents not-a-Number (i.e. an invalid number)"
+
+ NaN isNil ifTrue:[
+ NaN := super NaN
+ ].
+ ^ NaN
+
+ "
+ LongFloat NaN
+ "
+
+ "Created: / 20-06-2017 / 13:52:58 / cg"
+!
+
e
"return the constant e as LongFloat"
@@ -524,6 +540,36 @@
^ E
!
+infinity
+ "return a shortFloat which represents positive infinity"
+
+ PositiveInfinity isNil ifTrue:[
+ PositiveInfinity := Float infinity asLongFloat
+ ].
+ ^ PositiveInfinity
+
+ "
+ LongFloat infinity
+ "
+
+ "Created: / 20-06-2017 / 13:53:45 / cg"
+!
+
+negativeInfinity
+ "return a shortFloat which represents positive infinity"
+
+ NegativeInfinity isNil ifTrue:[
+ NegativeInfinity := Float negativeInfinity asLongFloat
+ ].
+ ^ NegativeInfinity
+
+ "
+ LongFloat negativeInfinity
+ "
+
+ "Created: / 20-06-2017 / 13:54:19 / cg"
+!
+
pi
"return the constant pi as LongFloat"