Number.st
changeset 22279 3b4d8c69aa0d
parent 22143 b634ad282d1c
child 22287 df6101a1d351
equal deleted inserted replaced
22278:dd1e56c2ad85 22279:3b4d8c69aa0d
   590     ^ Integer readFrom:aStream radix:radix
   590     ^ Integer readFrom:aStream radix:radix
   591 
   591 
   592     "Modified (comment): / 08-06-2017 / 13:58:36 / mawalch"
   592     "Modified (comment): / 08-06-2017 / 13:58:36 / mawalch"
   593 ! !
   593 ! !
   594 
   594 
   595 
       
   596 !Number class methodsFor:'constants'!
   595 !Number class methodsFor:'constants'!
   597 
   596 
   598 e
   597 e
   599     "return the closest approximation of the irrational number e"
   598     "return the closest approximation of the irrational number e"
   600 
   599 
   832     "
   831     "
   833      Integer displayRadix:16. 123456 inspect
   832      Integer displayRadix:16. 123456 inspect
   834      Integer displayRadix:10. 123456 inspect
   833      Integer displayRadix:10. 123456 inspect
   835     "
   834     "
   836 ! !
   835 ! !
   837 
       
   838 
   836 
   839 !Number class methodsFor:'private'!
   837 !Number class methodsFor:'private'!
   840 
   838 
   841 readMantissaAndScaleFrom:aStream radix:radix
   839 readMantissaAndScaleFrom:aStream radix:radix
   842     "helper for readFrom: -
   840     "helper for readFrom: -
   928      Abstract subclasses must redefine this again."
   926      Abstract subclasses must redefine this again."
   929 
   927 
   930     ^ self == Number
   928     ^ self == Number
   931 ! !
   929 ! !
   932 
   930 
   933 
       
   934 !Number methodsFor:'Compatibility-Squeak'!
   931 !Number methodsFor:'Compatibility-Squeak'!
   935 
   932 
   936 asSmallAngleDegrees
   933 asSmallAngleDegrees
   937     "Return the receiver normalized to lie within the range (-180, 180)"
   934     "Return the receiver normalized to lie within the range (-180, 180)"
   938 
   935 
  1086      (2 asFixedPoint:4) sqrtWithErrorLessThan:0.001
  1083      (2 asFixedPoint:4) sqrtWithErrorLessThan:0.001
  1087     "
  1084     "
  1088 
  1085 
  1089     "Modified: / 25-07-2017 / 15:58:46 / cg"
  1086     "Modified: / 25-07-2017 / 15:58:46 / cg"
  1090 ! !
  1087 ! !
  1091 
       
  1092 
       
  1093 
  1088 
  1094 !Number methodsFor:'coercing & converting'!
  1089 !Number methodsFor:'coercing & converting'!
  1095 
  1090 
  1096 i
  1091 i
  1097     "return a complex number, with the receiver as imaginary part, 0 as real part"
  1092     "return a complex number, with the receiver as imaginary part, 0 as real part"
  1359      10 seconds
  1354      10 seconds
  1360      10 minutes
  1355      10 minutes
  1361     "
  1356     "
  1362 !
  1357 !
  1363 
  1358 
       
  1359 milliSeconds
       
  1360     "return a TimeDuration representing this number of milliseconds
       
  1361      Same as milliseconds, for compatibility"
       
  1362 
       
  1363     ^ TimeDuration fromMilliseconds:self
       
  1364 
       
  1365     "
       
  1366      1000 milliSeconds
       
  1367     "
       
  1368 
       
  1369     "Created: / 21-09-2017 / 17:26:32 / cg"
       
  1370 !
       
  1371 
  1364 milliseconds
  1372 milliseconds
  1365     "return a TimeDuration representing this number of milliseconds"
  1373     "return a TimeDuration representing this number of milliseconds.
       
  1374      Same as milliSeconds, for compatibility"
  1366 
  1375 
  1367     ^ TimeDuration fromMilliseconds:self
  1376     ^ TimeDuration fromMilliseconds:self
  1368 
  1377 
  1369     "
  1378     "
  1370      1000 milliseconds
  1379      1000 milliseconds
  1371     "
  1380     "
       
  1381 
       
  1382     "Modified (comment): / 21-09-2017 / 17:37:18 / cg"
  1372 !
  1383 !
  1373 
  1384 
  1374 minutes
  1385 minutes
  1375     "return a TimeDuration representing this number of minutes"
  1386     "return a TimeDuration representing this number of minutes"
  1376 
  1387 
  1764     "the minimum possible value taking me as a measurement with possible error;
  1775     "the minimum possible value taking me as a measurement with possible error;
  1765      as I am exact, that's myself"
  1776      as I am exact, that's myself"
  1766 
  1777 
  1767     ^ self
  1778     ^ self
  1768 ! !
  1779 ! !
       
  1780 
       
  1781 
       
  1782 
  1769 
  1783 
  1770 !Number methodsFor:'printing & storing'!
  1784 !Number methodsFor:'printing & storing'!
  1771 
  1785 
  1772 displayOn:aGCOrStream
  1786 displayOn:aGCOrStream
  1773     "return a string to display the receiver.
  1787     "return a string to display the receiver.
  3310 
  3324 
  3311     "Created: / 28.10.1998 / 17:14:56 / cg"
  3325     "Created: / 28.10.1998 / 17:14:56 / cg"
  3312     "Modified: / 5.11.2001 / 17:54:22 / cg"
  3326     "Modified: / 5.11.2001 / 17:54:22 / cg"
  3313 ! !
  3327 ! !
  3314 
  3328 
  3315 
       
  3316 !Number class methodsFor:'documentation'!
  3329 !Number class methodsFor:'documentation'!
  3317 
  3330 
  3318 version
  3331 version
  3319     ^ '$Header$'
  3332     ^ '$Header$'
  3320 !
  3333 !