Number.st
changeset 21833 5276dd24e7c0
parent 21828 d1a7e7c21694
child 21839 4a29e408440a
equal deleted inserted replaced
21832:ea2680fc4ea9 21833:5276dd24e7c0
  1466     ^ 0
  1466     ^ 0
  1467 
  1467 
  1468     "Modified: / 9.7.1998 / 10:17:24 / cg"
  1468     "Modified: / 9.7.1998 / 10:17:24 / cg"
  1469 !
  1469 !
  1470 
  1470 
       
  1471 ldexp:exp
       
  1472     "multiply the receiver by an integral power of 2.
       
  1473      I.e. return self * (2 ^ exp)"
       
  1474 
       
  1475     ^ self * (2 raisedTo:exp)
       
  1476 
       
  1477     "Created: / 19-06-2017 / 01:43:35 / cg"
       
  1478 !
       
  1479 
  1471 ln
  1480 ln
  1472     "return the natural logarithm of myself.
  1481     "return the natural logarithm of myself.
  1473      Raises an exception, if the receiver is less or equal to zero."
  1482      Raises an exception, if the receiver is less or equal to zero."
  1474 
  1483 
  1475     "/ if I am not a Float (or a less general lpReal),
  1484     "/ if I am not a Float (or a less general lpReal),
  1476     "/ retry after converting to float
  1485     "/ retry after converting to float
  1477     (self isLimitedPrecisionReal not
  1486     (self isLimitedPrecisionReal not
  1478     or:[self generality < 1.0 generality]) ifTrue:[
  1487     or:[self generality < 1.0 generality]) ifTrue:[
  1479 	^ self asLongFloat ln.
  1488         ^ self asLongFloat ln.
  1480     ].
  1489     ].
  1481     "/ very slow fallback
  1490     "/ very slow fallback
  1482     ^ self ln_withAccuracy:self epsilon
  1491     ^ self ln_withAccuracy:self epsilon
  1483 
  1492 
  1484     "
  1493     "
  1485 	(10 raisedTo:1000) ln
  1494      (10 raisedTo:1000) ln
  1486     "
  1495     "
       
  1496 
       
  1497     "Modified (comment): / 18-06-2017 / 23:31:57 / cg"
  1487 !
  1498 !
  1488 
  1499 
  1489 log
  1500 log
  1490     "return log base 10 of the receiver.
  1501     "return log base 10 of the receiver.
  1491      Alias for log:10."
  1502      Alias for log:10."