#FEATURE by exept
authorClaus Gittinger <cg@exept.de>
Wed, 20 Nov 2019 16:34:22 +0100
changeset 5264 e01656e04937
parent 5263 350d509151c9
child 5265 5f6a992925c2
#FEATURE by exept class: QuadFloat class definition class: QuadFloat class added: #phi
QuadFloat.st
--- a/QuadFloat.st	Tue Nov 19 15:31:59 2019 +0100
+++ b/QuadFloat.st	Wed Nov 20 16:34:22 2019 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "{ Package: 'stx:libbasic2' }"
 
 "{ NameSpace: Smalltalk }"
@@ -5,7 +7,7 @@
 LimitedPrecisionReal variableByteSubclass:#QuadFloat
 	instanceVariableNames:''
 	classVariableNames:'QuadFloatZero QuadFloatOne Pi E Epsilon NaN PositiveInfinity
-		NegativeInfinity Halfpi HalfpiNegative'
+		NegativeInfinity Halfpi HalfpiNegative Phi'
 	poolDictionaries:''
 	category:'Magnitude-Numbers'
 !
@@ -2470,6 +2472,19 @@
     "Created: / 08-06-2019 / 14:05:50 / Claus Gittinger"
 !
 
+phi
+    "return the constant phi as quadFloat"
+
+    Phi isNil ifTrue:[
+        "/ phiDigits has enough digits for 128bit IEEE quads
+        "/ do not use as a literal constant here - we cannot depend on the underlying C-compiler here...
+        Phi  := self readFrom:(Number phiDigits)
+    ].
+    ^ Phi
+
+
+!
+
 pi
     "return the constant pi as quadFloat"