Float.st
changeset 7385 852e84340d2b
parent 7381 083208951b37
child 7391 55ca5a24162a
--- a/Float.st	Tue Jun 17 11:10:25 2003 +0200
+++ b/Float.st	Tue Jun 17 11:12:22 2003 +0200
@@ -1117,284 +1117,6 @@
 
 !Float methodsFor:'mathematical functions'!
 
-arcCos
-    "return the arccosine of myself (I am interpreted as radians).
-     Raises an exception, if the receiver is not in -1..1"
-
-%{  /* NOCONTEXT */
-
-    double val, rslt;
-    OBJ newFloat;
-
-    val = __floatVal(self);
-
-#ifdef WIN32 /* dont know (yet) how to suppress the warnBox opened by win32 */
-    if ((val >= -1.0) && (val <= 1.0))
-#endif
-    {
-        __threadErrno = 0;
-        rslt = acos(val);
-#ifdef LINUX /* and maybe others */
-        if (! isnan(rslt))
-#endif
-        {
-            if (__threadErrno == 0) {
-                __qMKFLOAT(newFloat, rslt);
-                RETURN ( newFloat );
-            }
-        }
-    }
-%}.
-    ^ self class
-        raise:#domainErrorSignal
-        receiver:self
-        selector:#arcCos
-        arguments:#()
-        errorString:'bad receiver in arcCos'
-
-    "
-     -10 arcCos
-     1 arcCos 
-    "
-
-    "Modified: / 16.11.2001 / 14:14:13 / cg"
-!
-
-arcCosh
-    "return the hyperbolic arccosine of myself (I am interpreted as radians).
-     Raises an exception, if the receiver is not in -1..1"
-
-%{  /* NOCONTEXT */
-
-    double val, rslt;
-    OBJ newFloat;
-
-    val = __floatVal(self);
-
-#ifdef WIN32 /* dont know (yet) how to suppress the warnBox opened by win32 */
-    if ((val >= -1.0) && (val <= 1.0))
-#endif
-    {
-        __threadErrno = 0;
-        rslt = acosh(val);
-#ifdef LINUX /* and maybe others */
-        if (! isnan(rslt))
-#endif
-        {
-            if (__threadErrno == 0) {
-                __qMKFLOAT(newFloat, rslt);
-                RETURN ( newFloat );
-            }
-        }
-    }
-%}.
-    ^ self class
-        raise:#domainErrorSignal
-        receiver:self
-        selector:#arcCosh
-        arguments:#()
-        errorString:'bad receiver in arcCosh'
-
-    "
-     -10.0 arcCosh
-     1.0 arcCosh  
-    "
-
-    "Modified: / 16.11.2001 / 14:14:13 / cg"
-!
-
-arcSin
-    "return the arcsine of myself (I am interpreted as radians).
-     Raises an exception, if the receiver is not in -1..1"
-
-%{  /* NOCONTEXT */
-
-    double val, rslt;
-    OBJ newFloat;
-
-    val = __floatVal(self);
-
-#ifdef WIN32 /* dont know (yet) how to suppress the warnBox opened by win32 */
-    if ((val >= -1.0) && (val <= 1.0))
-#endif
-    {
-        __threadErrno = 0;
-        rslt = asin(val);
-#ifdef LINUX /* and maybe others */
-        if (! isnan(rslt))
-#endif
-        {
-            if (__threadErrno == 0) {
-                __qMKFLOAT(newFloat, rslt);
-                RETURN ( newFloat );
-            }
-        }
-    }
-%}.
-    ^ self class
-        raise:#domainErrorSignal
-        receiver:self
-        selector:#arcSin
-        arguments:#()
-        errorString:'bad receiver in arcSin'
-
-    "
-     -10 arcSin
-     1 arcSin 
-    "
-
-    "Modified: / 16.11.2001 / 14:14:18 / cg"
-!
-
-arcSinh
-    "return the hyperbolic arcsine of myself (I am interpreted as radians).
-     Raises an exception, if the receiver is not in -1..1"
-
-%{  /* NOCONTEXT */
-
-    double val, rslt;
-    OBJ newFloat;
-
-    val = __floatVal(self);
-
-#ifdef WIN32 /* dont know (yet) how to suppress the warnBox opened by win32 */
-    if ((val >= -1.0) && (val <= 1.0))
-#endif
-    {
-        __threadErrno = 0;
-        rslt = asinh(val);
-#ifdef LINUX /* and maybe others */
-        if (! isnan(rslt))
-#endif
-        {
-            if (__threadErrno == 0) {
-                __qMKFLOAT(newFloat, rslt);
-                RETURN ( newFloat );
-            }
-        }
-    }
-%}.
-    ^ self class
-        raise:#domainErrorSignal
-        receiver:self
-        selector:#arcSinh
-        arguments:#()
-        errorString:'bad receiver in arcSinh'
-
-    "
-     -10.0 arcSinh
-     1.0 arcSinh 
-    "
-!
-
-arcTan
-    "return the arctangent of myself as radians"
-
-%{  /* NOCONTEXT */
-
-    double rslt;
-    OBJ newFloat;
-
-    __threadErrno = 0;
-    rslt = atan(__floatVal(self));
-#ifdef LINUX /* and maybe others */
-    if (! isnan(rslt))
-#endif
-    if (__threadErrno == 0) {
-        __qMKFLOAT(newFloat, rslt);
-        RETURN ( newFloat );
-    }
-%}.
-    ^ self class
-        raise:#domainErrorSignal
-        receiver:self
-        selector:#arcTan
-        arguments:#()
-        errorString:'bad receiver in arcTan'
-
-    "Modified: / 16.11.2001 / 14:14:22 / cg"
-!
-
-arcTanh
-    "return the hyperbolic arctangent of myself as radians"
-
-%{  /* NOCONTEXT */
-
-    double rslt;
-    OBJ newFloat;
-
-    __threadErrno = 0;
-    rslt = atanh(__floatVal(self));
-#ifdef LINUX /* and maybe others */
-    if (! isnan(rslt))
-#endif
-    if (__threadErrno == 0) {
-        __qMKFLOAT(newFloat, rslt);
-        RETURN ( newFloat );
-    }
-%}.
-    ^ self class
-        raise:#domainErrorSignal
-        receiver:self
-        selector:#arcTanh
-        arguments:#()
-        errorString:'bad receiver in arcTanh'
-!
-
-cos
-    "return the cosine of myself interpreted as radians"
-
-%{  /* NOCONTEXT */
-
-    double rslt;
-    OBJ newFloat;
-
-    __threadErrno = 0;
-    rslt = cos(__floatVal(self));
-#ifdef LINUX /* and maybe others */
-    if (! isnan(rslt))
-#endif
-    if (__threadErrno == 0) {
-        __qMKFLOAT(newFloat, rslt);
-        RETURN ( newFloat );
-    }
-%}.
-    ^ self class
-        raise:#domainErrorSignal
-        receiver:self
-        selector:#cos
-        arguments:#()
-        errorString:'bad receiver in cos'
-
-    "Modified: / 16.11.2001 / 14:14:26 / cg"
-!
-
-cosh
-    "return the hyperbolic cosine of myself interpreted as radians"
-
-%{  /* NOCONTEXT */
-
-    double rslt;
-    OBJ newFloat;
-
-    __threadErrno = 0;
-    rslt = cosh(__floatVal(self));
-#ifdef LINUX /* and maybe others */
-    if (! isnan(rslt))
-#endif
-    if (__threadErrno == 0) {
-        __qMKFLOAT(newFloat, rslt);
-        RETURN ( newFloat );
-    }
-%}.
-    ^ self class
-        raise:#domainErrorSignal
-        receiver:self
-        selector:#cosh
-        arguments:#()
-        errorString:'bad receiver in cosh'
-!
-
 exp
     "return e raised to the power of the receiver"
 
@@ -1540,60 +1262,6 @@
     "Modified: / 16.11.2001 / 14:16:51 / cg"
 !
 
-sin
-    "return the sine of myself interpreted as radians"
-
-%{  /* NOCONTEXT */
-
-    double rslt;
-    OBJ newFloat;
-
-    __threadErrno = 0;
-    rslt = sin(__floatVal(self));
-#ifdef LINUX /* and maybe others */
-    if (! isnan(rslt))
-#endif
-    if (__threadErrno == 0) {
-        __qMKFLOAT(newFloat, rslt);
-        RETURN ( newFloat );
-    }
-%}.
-    ^ self class
-        raise:#domainErrorSignal
-        receiver:self
-        selector:#sin
-        arguments:#()
-        errorString:'bad receiver in sin'
-
-    "Modified: / 16.11.2001 / 14:14:37 / cg"
-!
-
-sinh
-    "return the hyperbolic sine of myself interpreted as radians"
-
-%{  /* NOCONTEXT */
-
-    double rslt;
-    OBJ newFloat;
-
-    __threadErrno = 0;
-    rslt = sinh(__floatVal(self));
-#ifdef LINUX /* and maybe others */
-    if (! isnan(rslt))
-#endif
-    if (__threadErrno == 0) {
-        __qMKFLOAT(newFloat, rslt);
-        RETURN ( newFloat );
-    }
-%}.
-    ^ self class
-        raise:#domainErrorSignal
-        receiver:self
-        selector:#sinh
-        arguments:#()
-        errorString:'bad receiver in sinh'
-!
-
 sqrt
     "return the square root of myself.
      Raises an exception, if the receiver is less than zero."
@@ -1635,60 +1303,6 @@
     "
 
     "Modified: / 16.11.2001 / 14:14:43 / cg"
-!
-
-tan
-    "return the tangent of myself interpreted as radians"
-
-%{  /* NOCONTEXT */
-
-    double rslt;
-    OBJ newFloat;
-
-    __threadErrno = 0;
-    rslt = tan(__floatVal(self));
-#ifdef LINUX /* and maybe others */
-    if (! isnan(rslt))
-#endif
-    if (__threadErrno == 0) {
-        __qMKFLOAT(newFloat, rslt);
-        RETURN ( newFloat );
-    }
-%}.
-    ^ self class
-        raise:#domainErrorSignal
-        receiver:self
-        selector:#tan
-        arguments:#()
-        errorString:'bad receiver in tan'
-
-    "Modified: / 16.11.2001 / 14:14:49 / cg"
-!
-
-tanh
-    "return the hyperbolic tangens of myself interpreted as radians"
-
-%{  /* NOCONTEXT */
-
-    double rslt;
-    OBJ newFloat;
-
-    __threadErrno = 0;
-    rslt = tanh(__floatVal(self));
-#ifdef LINUX /* and maybe others */
-    if (! isnan(rslt))
-#endif
-    if (__threadErrno == 0) {
-        __qMKFLOAT(newFloat, rslt);
-        RETURN ( newFloat );
-    }
-%}.
-    ^ self class
-        raise:#domainErrorSignal
-        receiver:self
-        selector:#tanh
-        arguments:#()
-        errorString:'bad receiver in tanh'
 ! !
 
 !Float methodsFor:'printing & storing'!
@@ -2197,6 +1811,394 @@
 
 ! !
 
+!Float methodsFor:'trigonometric'!
+
+arcCos
+    "return the arccosine of myself (I am interpreted as radians).
+     Raises an exception, if the receiver is not in -1..1"
+
+%{  /* NOCONTEXT */
+
+    double val, rslt;
+    OBJ newFloat;
+
+    val = __floatVal(self);
+
+#ifdef WIN32 /* dont know (yet) how to suppress the warnBox opened by win32 */
+    if ((val >= -1.0) && (val <= 1.0))
+#endif
+    {
+        __threadErrno = 0;
+        rslt = acos(val);
+#ifdef LINUX /* and maybe others */
+        if (! isnan(rslt))
+#endif
+        {
+            if (__threadErrno == 0) {
+                __qMKFLOAT(newFloat, rslt);
+                RETURN ( newFloat );
+            }
+        }
+    }
+%}.
+    ^ self class
+        raise:#domainErrorSignal
+        receiver:self
+        selector:#arcCos
+        arguments:#()
+        errorString:'bad receiver in arcCos'
+
+    "
+     -10 arcCos
+     1 arcCos 
+    "
+
+    "Modified: / 16.11.2001 / 14:14:13 / cg"
+!
+
+arcCosh
+    "return the hyperbolic arccosine of myself (I am interpreted as radians).
+     Raises an exception, if the receiver is not in -1..1"
+
+%{  /* NOCONTEXT */
+
+    double val, rslt;
+    OBJ newFloat;
+
+    val = __floatVal(self);
+
+#ifdef WIN32 /* dont know (yet) how to suppress the warnBox opened by win32 */
+    if ((val >= -1.0) && (val <= 1.0))
+#endif
+    {
+        __threadErrno = 0;
+        rslt = acosh(val);
+#ifdef LINUX /* and maybe others */
+        if (! isnan(rslt))
+#endif
+        {
+            if (__threadErrno == 0) {
+                __qMKFLOAT(newFloat, rslt);
+                RETURN ( newFloat );
+            }
+        }
+    }
+%}.
+    ^ self class
+        raise:#domainErrorSignal
+        receiver:self
+        selector:#arcCosh
+        arguments:#()
+        errorString:'bad receiver in arcCosh'
+
+    "
+     -10.0 arcCosh
+     1.0 arcCosh  
+    "
+
+    "Modified: / 16.11.2001 / 14:14:13 / cg"
+!
+
+arcSin
+    "return the arcsine of myself (I am interpreted as radians).
+     Raises an exception, if the receiver is not in -1..1"
+
+%{  /* NOCONTEXT */
+
+    double val, rslt;
+    OBJ newFloat;
+
+    val = __floatVal(self);
+
+#ifdef WIN32 /* dont know (yet) how to suppress the warnBox opened by win32 */
+    if ((val >= -1.0) && (val <= 1.0))
+#endif
+    {
+        __threadErrno = 0;
+        rslt = asin(val);
+#ifdef LINUX /* and maybe others */
+        if (! isnan(rslt))
+#endif
+        {
+            if (__threadErrno == 0) {
+                __qMKFLOAT(newFloat, rslt);
+                RETURN ( newFloat );
+            }
+        }
+    }
+%}.
+    ^ self class
+        raise:#domainErrorSignal
+        receiver:self
+        selector:#arcSin
+        arguments:#()
+        errorString:'bad receiver in arcSin'
+
+    "
+     -10 arcSin
+     1 arcSin 
+    "
+
+    "Modified: / 16.11.2001 / 14:14:18 / cg"
+!
+
+arcSinh
+    "return the hyperbolic arcsine of myself (I am interpreted as radians).
+     Raises an exception, if the receiver is not in -1..1"
+
+%{  /* NOCONTEXT */
+
+    double val, rslt;
+    OBJ newFloat;
+
+    val = __floatVal(self);
+
+#ifdef WIN32 /* dont know (yet) how to suppress the warnBox opened by win32 */
+    if ((val >= -1.0) && (val <= 1.0))
+#endif
+    {
+        __threadErrno = 0;
+        rslt = asinh(val);
+#ifdef LINUX /* and maybe others */
+        if (! isnan(rslt))
+#endif
+        {
+            if (__threadErrno == 0) {
+                __qMKFLOAT(newFloat, rslt);
+                RETURN ( newFloat );
+            }
+        }
+    }
+%}.
+    ^ self class
+        raise:#domainErrorSignal
+        receiver:self
+        selector:#arcSinh
+        arguments:#()
+        errorString:'bad receiver in arcSinh'
+
+    "
+     -10.0 arcSinh
+     1.0 arcSinh 
+    "
+!
+
+arcTan
+    "return the arctangent of myself as radians"
+
+%{  /* NOCONTEXT */
+
+    double rslt;
+    OBJ newFloat;
+
+    __threadErrno = 0;
+    rslt = atan(__floatVal(self));
+#ifdef LINUX /* and maybe others */
+    if (! isnan(rslt))
+#endif
+    if (__threadErrno == 0) {
+        __qMKFLOAT(newFloat, rslt);
+        RETURN ( newFloat );
+    }
+%}.
+    ^ self class
+        raise:#domainErrorSignal
+        receiver:self
+        selector:#arcTan
+        arguments:#()
+        errorString:'bad receiver in arcTan'
+
+    "Modified: / 16.11.2001 / 14:14:22 / cg"
+!
+
+arcTanh
+    "return the hyperbolic arctangent of myself as radians"
+
+%{  /* NOCONTEXT */
+
+    double rslt;
+    OBJ newFloat;
+
+    __threadErrno = 0;
+    rslt = atanh(__floatVal(self));
+#ifdef LINUX /* and maybe others */
+    if (! isnan(rslt))
+#endif
+    if (__threadErrno == 0) {
+        __qMKFLOAT(newFloat, rslt);
+        RETURN ( newFloat );
+    }
+%}.
+    ^ self class
+        raise:#domainErrorSignal
+        receiver:self
+        selector:#arcTanh
+        arguments:#()
+        errorString:'bad receiver in arcTanh'
+!
+
+cos
+    "return the cosine of myself interpreted as radians"
+
+%{  /* NOCONTEXT */
+
+    double rslt;
+    OBJ newFloat;
+
+    __threadErrno = 0;
+    rslt = cos(__floatVal(self));
+#ifdef LINUX /* and maybe others */
+    if (! isnan(rslt))
+#endif
+    if (__threadErrno == 0) {
+        __qMKFLOAT(newFloat, rslt);
+        RETURN ( newFloat );
+    }
+%}.
+    ^ self class
+        raise:#domainErrorSignal
+        receiver:self
+        selector:#cos
+        arguments:#()
+        errorString:'bad receiver in cos'
+
+    "Modified: / 16.11.2001 / 14:14:26 / cg"
+!
+
+cosh
+    "return the hyperbolic cosine of myself interpreted as radians"
+
+%{  /* NOCONTEXT */
+
+    double rslt;
+    OBJ newFloat;
+
+    __threadErrno = 0;
+    rslt = cosh(__floatVal(self));
+#ifdef LINUX /* and maybe others */
+    if (! isnan(rslt))
+#endif
+    if (__threadErrno == 0) {
+        __qMKFLOAT(newFloat, rslt);
+        RETURN ( newFloat );
+    }
+%}.
+    ^ self class
+        raise:#domainErrorSignal
+        receiver:self
+        selector:#cosh
+        arguments:#()
+        errorString:'bad receiver in cosh'
+!
+
+sin
+    "return the sine of myself interpreted as radians"
+
+%{  /* NOCONTEXT */
+
+    double rslt;
+    OBJ newFloat;
+
+    __threadErrno = 0;
+    rslt = sin(__floatVal(self));
+#ifdef LINUX /* and maybe others */
+    if (! isnan(rslt))
+#endif
+    if (__threadErrno == 0) {
+        __qMKFLOAT(newFloat, rslt);
+        RETURN ( newFloat );
+    }
+%}.
+    ^ self class
+        raise:#domainErrorSignal
+        receiver:self
+        selector:#sin
+        arguments:#()
+        errorString:'bad receiver in sin'
+
+    "Modified: / 16.11.2001 / 14:14:37 / cg"
+!
+
+sinh
+    "return the hyperbolic sine of myself interpreted as radians"
+
+%{  /* NOCONTEXT */
+
+    double rslt;
+    OBJ newFloat;
+
+    __threadErrno = 0;
+    rslt = sinh(__floatVal(self));
+#ifdef LINUX /* and maybe others */
+    if (! isnan(rslt))
+#endif
+    if (__threadErrno == 0) {
+        __qMKFLOAT(newFloat, rslt);
+        RETURN ( newFloat );
+    }
+%}.
+    ^ self class
+        raise:#domainErrorSignal
+        receiver:self
+        selector:#sinh
+        arguments:#()
+        errorString:'bad receiver in sinh'
+!
+
+tan
+    "return the tangent of myself interpreted as radians"
+
+%{  /* NOCONTEXT */
+
+    double rslt;
+    OBJ newFloat;
+
+    __threadErrno = 0;
+    rslt = tan(__floatVal(self));
+#ifdef LINUX /* and maybe others */
+    if (! isnan(rslt))
+#endif
+    if (__threadErrno == 0) {
+        __qMKFLOAT(newFloat, rslt);
+        RETURN ( newFloat );
+    }
+%}.
+    ^ self class
+        raise:#domainErrorSignal
+        receiver:self
+        selector:#tan
+        arguments:#()
+        errorString:'bad receiver in tan'
+
+    "Modified: / 16.11.2001 / 14:14:49 / cg"
+!
+
+tanh
+    "return the hyperbolic tangens of myself interpreted as radians"
+
+%{  /* NOCONTEXT */
+
+    double rslt;
+    OBJ newFloat;
+
+    __threadErrno = 0;
+    rslt = tanh(__floatVal(self));
+#ifdef LINUX /* and maybe others */
+    if (! isnan(rslt))
+#endif
+    if (__threadErrno == 0) {
+        __qMKFLOAT(newFloat, rslt);
+        RETURN ( newFloat );
+    }
+%}.
+    ^ self class
+        raise:#domainErrorSignal
+        receiver:self
+        selector:#tanh
+        arguments:#()
+        errorString:'bad receiver in tanh'
+! !
+
 !Float methodsFor:'truncation & rounding'!
 
 ceiling
@@ -2461,7 +2463,7 @@
 !Float class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Float.st,v 1.136 2003-06-17 08:47:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Float.st,v 1.137 2003-06-17 09:11:52 cg Exp $'
 ! !
 
 Float initialize!