SmallInteger.st
changeset 6067 e4c03d14a5de
parent 6064 04bde2eeb749
child 6092 ff6ac7fb2dee
equal deleted inserted replaced
6066:ca508f7658dc 6067:e4c03d14a5de
   543     "return the integer part of the quotient of the receivers value
   543     "return the integer part of the quotient of the receivers value
   544      and the arguments value. The result is truncated toward negative infinity
   544      and the arguments value. The result is truncated toward negative infinity
   545      and negative, if the operands signs differ.
   545      and negative, if the operands signs differ.
   546      Be careful with negative results: 9 // 4 = 2, 
   546      Be careful with negative results: 9 // 4 = 2, 
   547      while -9 // 4 = -3. 
   547      while -9 // 4 = -3. 
       
   548      The following is always true:
       
   549         (receiver // aNumber) * aNumber + (receiver \\ aNUmber) = receiver
   548      See #quo: which returns -2 in the latter."
   550      See #quo: which returns -2 in the latter."
   549 
   551 
   550 %{  /* NOCONTEXT */
   552 %{  /* NOCONTEXT */
   551 
   553 
   552     /*
   554     /*
   638 
   640 
   639 \\ aNumber
   641 \\ aNumber
   640     "Answer the integer remainder m defined by division with truncation toward
   642     "Answer the integer remainder m defined by division with truncation toward
   641      negative infinity. The remainder has the same sign as aNumber.
   643      negative infinity. The remainder has the same sign as aNumber.
   642      m < |aNumber| AND there is an integer k with (k * aNumber + m) = self
   644      m < |aNumber| AND there is an integer k with (k * aNumber + m) = self
       
   645      The following is always true:
       
   646         (receiver // aNumber) * aNumber + (receiver \\ aNumber) = receiver
   643      Compare with #rem:
   647      Compare with #rem:
   644 
   648 
   645      Redefined for speed."
   649      Redefined for speed."
   646 
   650 
   647 %{  /* NOCONTEXT */
   651 %{  /* NOCONTEXT */
   740 
   744 
   741 quo:aNumber
   745 quo:aNumber
   742     "return the integer part of the quotient of the receivers value
   746     "return the integer part of the quotient of the receivers value
   743      and the arguments value. The result is truncated towards zero
   747      and the arguments value. The result is truncated towards zero
   744      and negative, if the operands signs differ.. 
   748      and negative, if the operands signs differ.. 
       
   749      The following is always true:
       
   750         (receiver quo: aNumber) * aNumber + (receiver rem: aNumber) = receiver
   745      For positive results, this is the same as #//,
   751      For positive results, this is the same as #//,
   746      for negative results, the remainder is ignored.
   752      for negative results, the remainder is ignored.
   747      I.e.: '9 // 4 = 2' and '-9 // 4 = -3'
   753      I.e.: '9 // 4 = 2' and '-9 // 4 = -3'
   748      in contrast: '9 quo: 4 = 2' and '-9 quo: 4 = -2'"
   754      in contrast: '9 quo: 4 = 2' and '-9 quo: 4 = -2'"
   749 
   755 
  3330 ! !
  3336 ! !
  3331 
  3337 
  3332 !SmallInteger class methodsFor:'documentation'!
  3338 !SmallInteger class methodsFor:'documentation'!
  3333 
  3339 
  3334 version
  3340 version
  3335     ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.137 2001-10-02 09:58:50 cg Exp $'
  3341     ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.138 2001-10-02 14:35:20 cg Exp $'
  3336 ! !
  3342 ! !