Fix #negated and #reciprocal
authorStefan Vogel <sv@exept.de>
Tue, 11 Jun 2002 12:06:09 +0200
changeset 6570 1d115f1687e3
parent 6569 f8336e46ec9f
child 6571 101905a14870
Fix #negated and #reciprocal
FixedPoint.st
--- a/FixedPoint.st	Mon Jun 10 14:37:10 2002 +0200
+++ b/FixedPoint.st	Tue Jun 11 12:06:09 2002 +0200
@@ -579,6 +579,25 @@
 
      Transcript show:'float (inexact): '; showCR:(1 / 0.9999999).
     "
+!
+
+negated
+    "have to redefine it from Fraction"
+
+    ^ self class 
+        numerator:(numerator negated)
+        denominator:denominator
+        scale:scale
+!
+
+reciprocal
+    "have to redefine it from Fraction"
+
+    numerator == 1 ifTrue:[^ denominator].
+    ^ self class 
+        numerator:denominator
+        denominator:numerator
+        scale:scale
 ! !
 
 !FixedPoint methodsFor:'coercing & converting'!
@@ -906,5 +925,5 @@
 !FixedPoint class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/FixedPoint.st,v 1.12 2001-11-27 17:30:54 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/FixedPoint.st,v 1.13 2002-06-11 10:06:09 stefan Exp $'
 ! !