ArithmeticValue.st
changeset 4138 c5030c520941
parent 3982 22fdd79b2d9d
child 4453 721c9dd0e0c6
--- a/ArithmeticValue.st	Tue May 04 12:57:50 1999 +0200
+++ b/ArithmeticValue.st	Tue May 04 12:59:13 1999 +0200
@@ -10,8 +10,6 @@
  hereby transferred.
 "
 
-'From Smalltalk/X, Version:3.4.1 on 13-feb-1998 at 15:51:14'                    !
-
 Magnitude subclass:#ArithmeticValue
 	instanceVariableNames:''
 	classVariableNames:'DivisionByZeroSignal DomainErrorSignal OverflowSignal
@@ -391,6 +389,86 @@
     ^ self asFloat radiansToDegrees
 ! !
 
+!ArithmeticValue methodsFor:'destructive arithmethic'!
+
+*= aNumber
+    "Return the product of self multiplied by aNumber. 
+     Self MAY, but NEED NOT be changed to contain the product.
+     So this method must be used: 'a := a *= 5'.
+     This method can be redefined for constructed datatypes
+     to do optimisations"
+
+    ^ self * aNumber
+
+    "Created: / 28.4.1999 / 11:46:11 / stefan"
+    "Modified: / 28.4.1999 / 11:53:28 / stefan"
+!
+
++= aNumber
+    "Return the sum of self and aNumber. 
+     Self MAY, but NEED NOT be changed to contain the product.
+     So this method must be used: 'a := a += 5'.
+     This method can be redefined for constructed datatypes
+     to do optimisations"
+
+    ^ self + aNumber
+
+    "Created: / 28.4.1999 / 10:13:41 / stefan"
+    "Modified: / 28.4.1999 / 11:54:11 / stefan"
+!
+
+-= aNumber
+    "Return the difference of self and aNumber. 
+     Self MAY, but NEED NOT be changed to contain the product.
+     So this method must be used: 'a := a -= 5'.
+     This method can be redefined for constructed datatypes
+     to do optimisations"
+
+    ^ self - aNumber
+
+    "Created: / 28.4.1999 / 10:13:58 / stefan"
+    "Modified: / 28.4.1999 / 11:54:37 / stefan"
+!
+
+/= aNumber
+    "Return the quotient of self and aNumber. 
+     Self MAY, but NEED NOT be changed to contain the product.
+     So this method must be used: 'a := a /= 5'.
+     This method can be redefined for constructed datatypes
+     to do optimisations"
+
+    ^ self / aNumber
+
+    "Created: / 28.4.1999 / 11:46:22 / stefan"
+    "Modified: / 28.4.1999 / 11:55:06 / stefan"
+!
+
+div2
+    "Return the quotient of self divided by 2. 
+     Self MAY, but NEED NOT be changed to contain the product.
+     So this method must be used: 'a := a div2.
+     This method can be redefined for constructed datatypes
+     to do optimisations"
+
+    ^ self // 2
+
+    "Created: / 28.4.1999 / 10:12:44 / stefan"
+    "Modified: / 28.4.1999 / 11:56:09 / stefan"
+!
+
+mul2
+    "Return the product of self multiplied by 2. 
+     Self MAY, but NEED NOT be changed to contain the product.
+     So this method must be used: 'a := a mul2.
+     This method can be redefined for constructed datatypes
+     to do optimisations"
+
+    ^ self * 2
+
+    "Created: / 28.4.1999 / 10:12:55 / stefan"
+    "Modified: / 28.4.1999 / 11:56:38 / stefan"
+! !
+
 !ArithmeticValue methodsFor:'double dispatching'!
 
 differenceFromFixedPoint:aFixedPoint
@@ -819,6 +897,6 @@
 !ArithmeticValue class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ArithmeticValue.st,v 1.29 1999-02-14 10:31:13 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ArithmeticValue.st,v 1.30 1999-05-04 10:59:13 stefan Exp $'
 ! !
 ArithmeticValue initialize!