LongFloat.st
changeset 7728 b63953d180f5
parent 7471 c5d4bd612d9f
child 7731 abbf80b3913b
--- a/LongFloat.st	Thu Oct 30 16:09:18 2003 +0100
+++ b/LongFloat.st	Thu Oct 30 16:10:46 2003 +0100
@@ -706,6 +706,28 @@
     ^ aNumber quotientFromLongFloat:self
 !
 
+abs
+    "return the absolute value of the receiver
+     reimplemented here for speed"
+
+%{  /* NOCONTEXT */
+
+    OBJ newFloat;
+    LONGFLOAT val = __longFloatVal(self);
+
+    if (val < (LONGFLOAT)0.0) {
+        __qMKLFLOAT(newFloat, -val);
+        RETURN ( newFloat );
+    }
+    RETURN (self);
+%}.
+
+    "
+     3.0 asLongFloat abs
+     -3.0 asLongFloat abs
+    "
+!
+
 negated
     "return myself negated"
 
@@ -2323,7 +2345,7 @@
 !LongFloat class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/LongFloat.st,v 1.42 2003-07-02 09:52:34 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/LongFloat.st,v 1.43 2003-10-30 15:10:46 stefan Exp $'
 ! !
 
 LongFloat initialize!