[armedbear-cvs] r11728 - trunk/abcl/src/org/armedbear/lisp

Erik Huelsmann ehuelsmann at common-lisp.net
Sat Apr 4 21:14:18 UTC 2009


Author: ehuelsmann
Date: Sat Apr  4 17:14:17 2009
New Revision: 11728

Log:
java.lang.Math has the 'log10()' function since 1.5. Our minimal target is 1.5, so,
stop working around its absense.


Modified:
   trunk/abcl/src/org/armedbear/lisp/MathFunctions.java

Modified: trunk/abcl/src/org/armedbear/lisp/MathFunctions.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/MathFunctions.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/MathFunctions.java	Sat Apr  4 17:14:17 2009
@@ -632,17 +632,6 @@
         return type_error(obj, Symbol.NUMBER);
     }
 
-    private static Method log10Method = null;
-    static {
-        try {
-            log10Method = Class.forName("java.lang.Math")
-                    .getMethod("log10", new Class[] { Double.TYPE });
-        }
-        catch (Throwable t) {
-            Debug.trace(t);
-        }
-    }
-
     // ### log
     private static final Primitive LOG =
         new Primitive("log", "number &optional base")
@@ -656,19 +645,16 @@
         public LispObject execute(LispObject number, LispObject base)
             throws ConditionThrowable
         {
-            if (number.realp() && !number.minusp() && base.isEqualTo(Fixnum.getInstance(10))) {
-                double d = DoubleFloat.coerceToFloat(number).value;
+            if (number.realp() && !number.minusp()
+                && base.isEqualTo(Fixnum.getInstance(10))) {
                 try {
-                   if (log10Method != null) {
-                        Object[] args;
-                        args = new Object[1];
-                        args[0] = new Double(d);
-                        Double result = (Double) log10Method.invoke(null, args);
-                        if (number instanceof DoubleFloat || base instanceof DoubleFloat)
-                            return new DoubleFloat(result.doubleValue());
-                        else
-                            return new SingleFloat((float)result.doubleValue());
-                    }
+                    double d =
+                        Math.log10(DoubleFloat.coerceToFloat(number).value);
+                    if (number instanceof DoubleFloat
+                        || base instanceof DoubleFloat)
+                        return new DoubleFloat(d);
+                    else
+                        return new SingleFloat((float)d);
                 }
                 catch (Throwable t) {
                     Debug.trace(t);




More information about the armedbear-cvs mailing list