Number.st
changeset 24934 27110d4e4a5e
parent 24896 421293afdb60
child 24938 3d1e65070dce
equal deleted inserted replaced
24933:13f40732617d 24934:27110d4e4a5e
   999     ^ self subclassResponsibility
   999     ^ self subclassResponsibility
  1000 
  1000 
  1001     "Created: / 16-06-2017 / 11:00:38 / cg"
  1001     "Created: / 16-06-2017 / 11:00:38 / cg"
  1002 !
  1002 !
  1003 
  1003 
       
  1004 phi
       
  1005     "return Phi in my representation (and accuracy)."
       
  1006 
       
  1007     ^ self subclassResponsibility
       
  1008 
       
  1009 
       
  1010 !
       
  1011 
       
  1012 phiDigits
       
  1013     "return th printString of the irrational number pi,
       
  1014      with enough digits so that instances with different precision can read from it"
       
  1015 
       
  1016     ^ '1.618033988749894848204586834365638117720309179805762862135'
       
  1017 !
       
  1018 
  1004 pi
  1019 pi
  1005     "return Pi in my representation (and accuracy)."
  1020     "return Pi in my representation (and accuracy)."
  1006 
  1021 
  1007     ^ self subclassResponsibility
  1022     ^ self subclassResponsibility
  1008 
  1023 
  2032     ].
  2047     ].
  2033     "/ very slow fallback
  2048     "/ very slow fallback
  2034     ^ self exp_withAccuracy:self epsilon
  2049     ^ self exp_withAccuracy:self epsilon
  2035 
  2050 
  2036     "Modified: / 05-07-2017 / 17:23:36 / cg"
  2051     "Modified: / 05-07-2017 / 17:23:36 / cg"
       
  2052 !
       
  2053 
       
  2054 fibPhi
       
  2055     ^ (1 / 5 sqrt) * ((self class phi raisedTo:self) - ((-1 / self class phi) raisedTo:self))
       
  2056 
       
  2057     "
       
  2058      3 fib      
       
  2059      3.0 fibPhi   
       
  2060      100 fib     
       
  2061      100.0 fibPhi  
       
  2062     "
  2037 !
  2063 !
  2038 
  2064 
  2039 floorLog:radix
  2065 floorLog:radix
  2040     "return the logarithm truncated as an integer"
  2066     "return the logarithm truncated as an integer"
  2041 
  2067