ArithmeticValue.st
changeset 22358 101b2548022b
parent 22289 32494a092b95
child 22723 5e9e074b1c0f
equal deleted inserted replaced
22357:41ce380a6c5a 22358:101b2548022b
   488      Abstract subclasses must redefine this again."
   488      Abstract subclasses must redefine this again."
   489 
   489 
   490     ^ self == ArithmeticValue
   490     ^ self == ArithmeticValue
   491 ! !
   491 ! !
   492 
   492 
       
   493 
   493 !ArithmeticValue methodsFor:'arithmetic'!
   494 !ArithmeticValue methodsFor:'arithmetic'!
   494 
   495 
   495 * something
   496 * something
   496     "return the product of the receiver and the argument."
   497     "return the product of the receiver and the argument."
   497 
   498 
   514     "return the quotient of the receiver and the argument"
   515     "return the quotient of the receiver and the argument"
   515 
   516 
   516     ^ self subclassResponsibility
   517     ^ self subclassResponsibility
   517 !
   518 !
   518 
   519 
   519 // something
   520 // aNumber
   520     "return the integer quotient of dividing the receiver by aNumber with
   521     "return the integer quotient of dividing the receiver by aNumber with
   521      truncation towards negative infinity.
   522      truncation towards negative infinity.
   522      
   523 
   523      Please be aware of the effect of truncation on negative receivers,
   524      Please be aware of the effect of truncation on negative receivers,
   524      and understand the difference between '//' vs. 'quo:'
   525      and understand the difference between '//' vs. 'quo:'
   525      and the corresponding '\\' vs. 'rem:'"
   526      and the corresponding '\\' vs. 'rem:'"
   526 
   527 
   527     "/ Note: '^ (self / something) floor' may lead to infinite recursion
   528     "/ Note: '^ (self / aNumber) floor' may lead to infinite recursion
   528 
   529 
   529     ^ self subclassResponsibility
   530     ^ self subclassResponsibility
   530 
   531 
   531     "Modified: / 5.11.1996 / 11:46:27 / cg"
   532     "Modified: / 05-11-1996 / 11:46:27 / cg"
   532     "Modified: / 12.2.1998 / 16:31:36 / stefan"
   533     "Modified: / 12-02-1998 / 16:31:36 / stefan"
       
   534     "Modified (comment): / 16-11-2017 / 11:26:13 / mawalch"
   533 !
   535 !
   534 
   536 
   535 \\ something
   537 \\ something
   536     "return the receiver modulo something.
   538     "return the receiver modulo something.
   537      The remainder has the same sign as the argument, something.
   539      The remainder has the same sign as the argument, something.
  1732     "return receiver * receiver"
  1734     "return receiver * receiver"
  1733 
  1735 
  1734     ^ self * self
  1736     ^ self * self
  1735 ! !
  1737 ! !
  1736 
  1738 
  1737 
       
  1738 !ArithmeticValue methodsFor:'queries'!
  1739 !ArithmeticValue methodsFor:'queries'!
  1739 
  1740 
  1740 respondsToArithmetic
  1741 respondsToArithmetic
  1741     "return true, if the receiver responds to arithmetic messages"
  1742     "return true, if the receiver responds to arithmetic messages"
  1742 
  1743