Number.st
changeset 24934 27110d4e4a5e
parent 24896 421293afdb60
child 24938 3d1e65070dce
--- a/Number.st	Wed Nov 20 16:34:11 2019 +0100
+++ b/Number.st	Wed Nov 20 16:43:37 2019 +0100
@@ -1001,6 +1001,21 @@
     "Created: / 16-06-2017 / 11:00:38 / cg"
 !
 
+phi
+    "return Phi in my representation (and accuracy)."
+
+    ^ self subclassResponsibility
+
+
+!
+
+phiDigits
+    "return th printString of the irrational number pi,
+     with enough digits so that instances with different precision can read from it"
+
+    ^ '1.618033988749894848204586834365638117720309179805762862135'
+!
+
 pi
     "return Pi in my representation (and accuracy)."
 
@@ -2036,6 +2051,17 @@
     "Modified: / 05-07-2017 / 17:23:36 / cg"
 !
 
+fibPhi
+    ^ (1 / 5 sqrt) * ((self class phi raisedTo:self) - ((-1 / self class phi) raisedTo:self))
+
+    "
+     3 fib      
+     3.0 fibPhi   
+     100 fib     
+     100.0 fibPhi  
+    "
+!
+
 floorLog:radix
     "return the logarithm truncated as an integer"