#FEATURE by exept
authorClaus Gittinger <cg@exept.de>
Wed, 20 Nov 2019 16:33:50 +0100
changeset 24932 606ca39a5e38
parent 24931 843e3aaea193
child 24933 13f40732617d
#FEATURE by exept class: LongFloat class definition class: LongFloat class added: #phi
LongFloat.st
--- a/LongFloat.st	Wed Nov 20 16:33:31 2019 +0100
+++ b/LongFloat.st	Wed Nov 20 16:33:50 2019 +0100
@@ -19,7 +19,7 @@
 	instanceVariableNames:''
 	classVariableNames:'DefaultPrintFormat DefaultPrintfFormat LongFloatZero LongFloatOne
 		Pi E Epsilon NaN PositiveInfinity NegativeInfinity Halfpi
-		HalfpiNegative'
+		HalfpiNegative Phi'
 	poolDictionaries:''
 	category:'Magnitude-Numbers'
 !
@@ -570,6 +570,19 @@
     "Modified (comment): / 09-06-2019 / 12:53:25 / Claus Gittinger"
 !
 
+phi
+    "return the constant phi as LongFloat"
+
+    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
+
+    "Modified (format): / 06-06-2019 / 17:10:22 / Claus Gittinger"
+!
+
 pi
     "return the constant pi as LongFloat"