ArithmeticValue.st
changeset 12576 47985f127034
parent 11735 60aa644effbe
child 12578 6cb12eb8eb59
equal deleted inserted replaced
12575:aa30728c3045 12576:47985f127034
   199     "Return if this class is an abstract class.
   199     "Return if this class is an abstract class.
   200      True is returned for ArithmeticValue here; false for subclasses.
   200      True is returned for ArithmeticValue here; false for subclasses.
   201      Abstract subclasses must redefine again."
   201      Abstract subclasses must redefine again."
   202 
   202 
   203     ^ self == ArithmeticValue
   203     ^ self == ArithmeticValue
       
   204 ! !
       
   205 
       
   206 !ArithmeticValue methodsFor:'arithmethic destructive'!
       
   207 
       
   208 *= aNumber
       
   209     "Return the product of self multiplied by aNumber.
       
   210      The receiver MAY, but NEED NOT be changed to contain the product.
       
   211      So this method must be used as: 'a := a *= 5'.
       
   212      This method can be redefined for constructed datatypes to do optimisations"
       
   213 
       
   214     ^ self * aNumber
       
   215 
       
   216     "Created: / 28.4.1999 / 11:46:11 / stefan"
       
   217     "Modified: / 28.4.1999 / 11:53:28 / stefan"
       
   218 !
       
   219 
       
   220 += aNumber
       
   221     "Return the sum of self and aNumber.
       
   222      The receiver MAY, but NEED NOT be changed to contain the sum.
       
   223      So this method must be used as: 'a := a += 5'.
       
   224      This method can be redefined for constructed datatypes to do optimisations"
       
   225 
       
   226     ^ self + aNumber
       
   227 
       
   228     "Created: / 28.4.1999 / 10:13:41 / stefan"
       
   229     "Modified: / 28.4.1999 / 11:54:11 / stefan"
       
   230 !
       
   231 
       
   232 -= aNumber
       
   233     "Return the difference of self and aNumber.
       
   234      The receiver MAY, but NEED NOT be changed to contain the difference.
       
   235      So this method must be used as: 'a := a -= 5'.
       
   236      This method can be redefined for constructed datatypes to do optimisations"
       
   237 
       
   238     ^ self - aNumber
       
   239 
       
   240     "Created: / 28.4.1999 / 10:13:58 / stefan"
       
   241     "Modified: / 28.4.1999 / 11:54:37 / stefan"
       
   242 !
       
   243 
       
   244 /= aNumber
       
   245     "Return the quotient of self and aNumber.
       
   246      The receiver MAY, but NEED NOT be changed to contain the quotient.
       
   247      So this method must be used as: 'a := a /= 5'.
       
   248      This method can be redefined for constructed datatypes to do optimisations"
       
   249 
       
   250     ^ self / aNumber
       
   251 
       
   252     "Created: / 28.4.1999 / 11:46:22 / stefan"
       
   253     "Modified: / 28.4.1999 / 11:55:06 / stefan"
       
   254 !
       
   255 
       
   256 div2
       
   257     "Return the quotient of self divided by 2.
       
   258      The receiver MAY, but NEED NOT be changed to contain the result.
       
   259      So this method must be used as: 'a := a div2.
       
   260      This method can be redefined for constructed datatypes to do optimisations"
       
   261 
       
   262     ^ self // 2
       
   263 
       
   264     "Created: / 28.4.1999 / 10:12:44 / stefan"
       
   265     "Modified: / 28.4.1999 / 11:56:09 / stefan"
       
   266 !
       
   267 
       
   268 mul2
       
   269     "Return the product of self multiplied by 2.
       
   270      The receiver MAY, but NEED NOT be changed to contain the result.
       
   271      So this method must be used as: 'a := a mul2.
       
   272      This method can be redefined for constructed datatypes to do optimisations"
       
   273 
       
   274     ^ self * 2
       
   275 
       
   276     "Created: / 28.4.1999 / 10:12:55 / stefan"
       
   277     "Modified: / 28.4.1999 / 11:56:38 / stefan"
   204 ! !
   278 ! !
   205 
   279 
   206 !ArithmeticValue methodsFor:'arithmetic'!
   280 !ArithmeticValue methodsFor:'arithmetic'!
   207 
   281 
   208 * something
   282 * something
   538 
   612 
   539 radiansToDegrees
   613 radiansToDegrees
   540     "interpreting the receiver as degrees, return the radians"
   614     "interpreting the receiver as degrees, return the radians"
   541 
   615 
   542     ^ self asFloat radiansToDegrees
   616     ^ self asFloat radiansToDegrees
   543 ! !
       
   544 
       
   545 !ArithmeticValue methodsFor:'destructive arithmethic'!
       
   546 
       
   547 *= aNumber
       
   548     "Return the product of self multiplied by aNumber.
       
   549      The receiver MAY, but NEED NOT be changed to contain the product.
       
   550      So this method must be used as: 'a := a *= 5'.
       
   551      This method can be redefined for constructed datatypes to do optimisations"
       
   552 
       
   553     ^ self * aNumber
       
   554 
       
   555     "Created: / 28.4.1999 / 11:46:11 / stefan"
       
   556     "Modified: / 28.4.1999 / 11:53:28 / stefan"
       
   557 !
       
   558 
       
   559 += aNumber
       
   560     "Return the sum of self and aNumber.
       
   561      The receiver MAY, but NEED NOT be changed to contain the sum.
       
   562      So this method must be used as: 'a := a += 5'.
       
   563      This method can be redefined for constructed datatypes to do optimisations"
       
   564 
       
   565     ^ self + aNumber
       
   566 
       
   567     "Created: / 28.4.1999 / 10:13:41 / stefan"
       
   568     "Modified: / 28.4.1999 / 11:54:11 / stefan"
       
   569 !
       
   570 
       
   571 -= aNumber
       
   572     "Return the difference of self and aNumber.
       
   573      The receiver MAY, but NEED NOT be changed to contain the difference.
       
   574      So this method must be used as: 'a := a -= 5'.
       
   575      This method can be redefined for constructed datatypes to do optimisations"
       
   576 
       
   577     ^ self - aNumber
       
   578 
       
   579     "Created: / 28.4.1999 / 10:13:58 / stefan"
       
   580     "Modified: / 28.4.1999 / 11:54:37 / stefan"
       
   581 !
       
   582 
       
   583 /= aNumber
       
   584     "Return the quotient of self and aNumber.
       
   585      The receiver MAY, but NEED NOT be changed to contain the quotient.
       
   586      So this method must be used as: 'a := a /= 5'.
       
   587      This method can be redefined for constructed datatypes to do optimisations"
       
   588 
       
   589     ^ self / aNumber
       
   590 
       
   591     "Created: / 28.4.1999 / 11:46:22 / stefan"
       
   592     "Modified: / 28.4.1999 / 11:55:06 / stefan"
       
   593 !
       
   594 
       
   595 div2
       
   596     "Return the quotient of self divided by 2.
       
   597      The receiver MAY, but NEED NOT be changed to contain the result.
       
   598      So this method must be used as: 'a := a div2.
       
   599      This method can be redefined for constructed datatypes to do optimisations"
       
   600 
       
   601     ^ self // 2
       
   602 
       
   603     "Created: / 28.4.1999 / 10:12:44 / stefan"
       
   604     "Modified: / 28.4.1999 / 11:56:09 / stefan"
       
   605 !
       
   606 
       
   607 mul2
       
   608     "Return the product of self multiplied by 2.
       
   609      The receiver MAY, but NEED NOT be changed to contain the result.
       
   610      So this method must be used as: 'a := a mul2.
       
   611      This method can be redefined for constructed datatypes to do optimisations"
       
   612 
       
   613     ^ self * 2
       
   614 
       
   615     "Created: / 28.4.1999 / 10:12:55 / stefan"
       
   616     "Modified: / 28.4.1999 / 11:56:38 / stefan"
       
   617 ! !
   617 ! !
   618 
   618 
   619 !ArithmeticValue methodsFor:'double dispatching'!
   619 !ArithmeticValue methodsFor:'double dispatching'!
   620 
   620 
   621 differenceFromComplex:aComplex
   621 differenceFromComplex:aComplex
  1282 ! !
  1282 ! !
  1283 
  1283 
  1284 !ArithmeticValue class methodsFor:'documentation'!
  1284 !ArithmeticValue class methodsFor:'documentation'!
  1285 
  1285 
  1286 version
  1286 version
  1287     ^ '$Header: /cvs/stx/stx/libbasic/ArithmeticValue.st,v 1.82 2009-05-26 06:38:16 cg Exp $'
  1287     ^ '$Header: /cvs/stx/stx/libbasic/ArithmeticValue.st,v 1.83 2009-12-01 22:08:29 cg Exp $'
       
  1288 !
       
  1289 
       
  1290 version_CVS
       
  1291     ^ '$Header: /cvs/stx/stx/libbasic/ArithmeticValue.st,v 1.83 2009-12-01 22:08:29 cg Exp $'
  1288 ! !
  1292 ! !
  1289 
  1293 
  1290 ArithmeticValue initialize!
  1294 ArithmeticValue initialize!