Number.st
changeset 16406 967b6c76169a
parent 16267 beef1cb9c801
child 16450 9a81e708b188
equal deleted inserted replaced
16405:0d357280097a 16406:967b6c76169a
   435     "
   435     "
   436      Number readSmalltalkSyntaxFrom:'foo' onError:123   
   436      Number readSmalltalkSyntaxFrom:'foo' onError:123   
   437     "
   437     "
   438 ! !
   438 ! !
   439 
   439 
       
   440 
   440 !Number class methodsFor:'constants'!
   441 !Number class methodsFor:'constants'!
   441 
   442 
   442 decimalPointCharacter 
   443 decimalPointCharacter 
   443     "printed"
   444     "printed"
   444 
   445 
   662         errorString:'foo bar test'
   663         errorString:'foo bar test'
   663     "
   664     "
   664 
   665 
   665     "Modified: / 16.11.2001 / 14:13:16 / cg"
   666     "Modified: / 16.11.2001 / 14:13:16 / cg"
   666 ! !
   667 ! !
       
   668 
   667 
   669 
   668 !Number class methodsFor:'private'!
   670 !Number class methodsFor:'private'!
   669 
   671 
   670 readMantissaAndScaleFrom:aStream radix:radix
   672 readMantissaAndScaleFrom:aStream radix:radix
   671     "helper for readFrom: -
   673     "helper for readFrom: -
   737      Abstract subclasses must redefine again."
   739      Abstract subclasses must redefine again."
   738 
   740 
   739     ^ self == Number
   741     ^ self == Number
   740 ! !
   742 ! !
   741 
   743 
       
   744 
   742 !Number methodsFor:'*StateSpecs-Specs'!
   745 !Number methodsFor:'*StateSpecs-Specs'!
   743 
   746 
   744 isEqual: aNumber within: accuracy 
   747 isEqual: aNumber within: accuracy 
   745         ^(self - aNumber) abs < accuracy
   748         ^(self - aNumber) abs < accuracy
   746 ! !
   749 ! !
   865     "Return the cosine of the receiver taken as an angle in degrees."
   868     "Return the cosine of the receiver taken as an angle in degrees."
   866     
   869     
   867     ^ self degreesToRadians tan
   870     ^ self degreesToRadians tan
   868 !
   871 !
   869 
   872 
   870 newTileMorphRepresentative
       
   871         ^ TileMorph new addArrows; setLiteral: self; addSuffixIfCan
       
   872 !
       
   873 
       
   874 rounded:n
   873 rounded:n
   875     "Answer the float rounded with n digits of precision"
   874     "Answer the float rounded with n digits of precision"
   876 
   875 
   877     | mult |
   876     | mult |
   878 
   877 
   891 !
   890 !
   892 
   891 
   893 stringForReadout
   892 stringForReadout
   894     ^ self rounded printString
   893     ^ self rounded printString
   895 ! !
   894 ! !
       
   895 
       
   896 
   896 
   897 
   897 !Number methodsFor:'coercing & converting'!
   898 !Number methodsFor:'coercing & converting'!
   898 
   899 
   899 i
   900 i
   900     "return a complex number, with the receiver as imaginary part, 0 as real part"
   901     "return a complex number, with the receiver as imaginary part, 0 as real part"
  1140      1 days 
  1141      1 days 
  1141      1 weeks 
  1142      1 weeks 
  1142     "
  1143     "
  1143 
  1144 
  1144     "Created: / 05-09-2011 / 11:17:59 / cg"
  1145     "Created: / 05-09-2011 / 11:17:59 / cg"
       
  1146 ! !
       
  1147 
       
  1148 !Number methodsFor:'double dispatching'!
       
  1149 
       
  1150 differenceFromTimestamp:aTimestamp
       
  1151     "I am to be interpreted as seconds, return the timestamp this number of seconds
       
  1152      before aTimestamp"
       
  1153 
       
  1154     ^ aTimestamp subtractMilliseconds:(self * 1000) truncated.
       
  1155 
       
  1156     "
       
  1157      Timestamp now differenceFromTimestamp:aTimestamp   
       
  1158      100.0 differenceFromTimestamp:Timestamp now 
       
  1159 
       
  1160      |t1 t2|
       
  1161      t1 := Timestamp now. 
       
  1162      t2 := 1.5 differenceFromTimestamp:t1.
       
  1163      t1 inspect. t2 inspect.
       
  1164     "
  1145 ! !
  1165 ! !
  1146 
  1166 
  1147 !Number methodsFor:'intervals'!
  1167 !Number methodsFor:'intervals'!
  1148 
  1168 
  1149 downTo:stop
  1169 downTo:stop
  2354 
  2374 
  2355     "Created: / 28.10.1998 / 17:14:56 / cg"
  2375     "Created: / 28.10.1998 / 17:14:56 / cg"
  2356     "Modified: / 5.11.2001 / 17:54:22 / cg"
  2376     "Modified: / 5.11.2001 / 17:54:22 / cg"
  2357 ! !
  2377 ! !
  2358 
  2378 
       
  2379 
  2359 !Number class methodsFor:'documentation'!
  2380 !Number class methodsFor:'documentation'!
  2360 
  2381 
  2361 version
  2382 version
  2362     ^ '$Header: /cvs/stx/stx/libbasic/Number.st,v 1.146 2014-03-18 10:07:02 cg Exp $'
  2383     ^ '$Header: /cvs/stx/stx/libbasic/Number.st,v 1.147 2014-05-07 14:32:05 stefan Exp $'
  2363 !
  2384 !
  2364 
  2385 
  2365 version_CVS
  2386 version_CVS
  2366     ^ '$Header: /cvs/stx/stx/libbasic/Number.st,v 1.146 2014-03-18 10:07:02 cg Exp $'
  2387     ^ '$Header: /cvs/stx/stx/libbasic/Number.st,v 1.147 2014-05-07 14:32:05 stefan Exp $'
  2367 ! !
  2388 ! !
  2368 
  2389