Changeset 11728


Ignore:
Timestamp:
04/04/09 21:14:17 (15 years ago)
Author:
ehuelsmann
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/MathFunctions.java

    r11714 r11728  
    633633    }
    634634
    635     private static Method log10Method = null;
    636     static {
    637         try {
    638             log10Method = Class.forName("java.lang.Math")
    639                     .getMethod("log10", new Class[] { Double.TYPE });
    640         }
    641         catch (Throwable t) {
    642             Debug.trace(t);
    643         }
    644     }
    645 
    646635    // ### log
    647636    private static final Primitive LOG =
     
    657646            throws ConditionThrowable
    658647        {
    659             if (number.realp() && !number.minusp() && base.isEqualTo(Fixnum.getInstance(10))) {
    660                 double d = DoubleFloat.coerceToFloat(number).value;
     648            if (number.realp() && !number.minusp()
     649                && base.isEqualTo(Fixnum.getInstance(10))) {
    661650                try {
    662                    if (log10Method != null) {
    663                         Object[] args;
    664                         args = new Object[1];
    665                         args[0] = new Double(d);
    666                         Double result = (Double) log10Method.invoke(null, args);
    667                         if (number instanceof DoubleFloat || base instanceof DoubleFloat)
    668                             return new DoubleFloat(result.doubleValue());
    669                         else
    670                             return new SingleFloat((float)result.doubleValue());
    671                     }
     651                    double d =
     652                        Math.log10(DoubleFloat.coerceToFloat(number).value);
     653                    if (number instanceof DoubleFloat
     654                        || base instanceof DoubleFloat)
     655                        return new DoubleFloat(d);
     656                    else
     657                        return new SingleFloat((float)d);
    672658                }
    673659                catch (Throwable t) {
Note: See TracChangeset for help on using the changeset viewer.