Changeset 11955


Ignore:
Timestamp:
05/26/09 18:59:27 (13 years ago)
Author:
ehuelsmann
Message:

Fix some failures in ABCL's own test suite; some by fixing the
expected output.

Location:
trunk/abcl
Files:
4 edited

Legend:

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

    r11754 r11955  
    485485            double divisor = ((SingleFloat)obj).value;
    486486            double quotient = value / divisor;
     487            if (value != 0)
     488                MathFunctions.OverUnderFlowCheck(quotient);
    487489            if (quotient >= Integer.MIN_VALUE && quotient <= Integer.MAX_VALUE) {
    488490                int q = (int) quotient;
     
    517519//             Debug.trace("divisor = " + divisor);
    518520            double quotient = value / divisor;
     521            if (value != 0)
     522                MathFunctions.OverUnderFlowCheck(quotient);
    519523//             Debug.trace("quotient = " + quotient);
    520524            if (quotient >= Integer.MIN_VALUE && quotient <= Integer.MAX_VALUE) {
  • trunk/abcl/src/org/armedbear/lisp/MathFunctions.java

    r11731 r11955  
    772772    }
    773773
     774    /** Checks number for over- or underflow values.
     775     *
     776     * @param number
     777     * @return number or signals an appropriate error
     778     * @throws org.armedbear.lisp.ConditionThrowable
     779     */
     780    final static float OverUnderFlowCheck(float number)
     781            throws ConditionThrowable
     782    {
     783        if (TRAP_OVERFLOW) {
     784            if (Float.isInfinite(number))
     785                error(new FloatingPointOverflow(NIL));
     786        }
     787        if (TRAP_UNDERFLOW) {
     788            if (number == 0)
     789                error(new FloatingPointUnderflow(NIL));
     790        }
     791        return number;
     792    }
     793
     794    /** Checks number for over- or underflow values.
     795     *
     796     * @param number
     797     * @return number or signals an appropriate error
     798     * @throws org.armedbear.lisp.ConditionThrowable
     799     */
     800    public final static double OverUnderFlowCheck(double number)
     801            throws ConditionThrowable
     802    {
     803        if (TRAP_OVERFLOW) {
     804            if (Double.isInfinite(number))
     805                error(new FloatingPointOverflow(NIL));
     806        }
     807        if (TRAP_UNDERFLOW) {
     808            if (number == 0)
     809                error(new FloatingPointUnderflow(NIL));
     810        }
     811        return number;
     812    }
    774813    // Adapted from SBCL.
    775814    /** Return the exponent of base taken to the integer exponent power
  • trunk/abcl/src/org/armedbear/lisp/SingleFloat.java

    r11754 r11955  
    490490            float divisor = ((SingleFloat)obj).value;
    491491            float quotient = value / divisor;
     492            if (value != 0)
     493                MathFunctions.OverUnderFlowCheck(quotient);
    492494            if (quotient >= Integer.MIN_VALUE && quotient <= Integer.MAX_VALUE) {
    493495                int q = (int) quotient;
     
    520522            double divisor = ((DoubleFloat)obj).value;
    521523            double quotient = value / divisor;
     524            if (value != 0)
     525                MathFunctions.OverUnderFlowCheck(quotient);
    522526            if (quotient >= Integer.MIN_VALUE && quotient <= Integer.MAX_VALUE) {
    523527                int q = (int) quotient;
  • trunk/abcl/test/lisp/abcl/math-tests.lisp

    r11599 r11955  
    306306(deftest expt.15
    307307  (expt 1 1/2)
    308   #+clisp 1
    309   #-clisp 1.0)
     308  #+(or clisp abcl) 1
     309  #-(or clisp abcl) 1.0)
    310310
    311311(deftest expt.16
     
    430430(deftest atanh.1
    431431  (atanh 2)
    432   #C(0.54930615 1.5707964))
     432  #C(0.54930615 -1.5707964))
    433433
    434434(deftest atanh.2
    435435  (atanh -2)
    436   #C(-0.54930615 -1.5707964))
     436  #C(-0.54930615 1.5707964))
    437437
    438438(deftest truncate.1
Note: See TracChangeset for help on using the changeset viewer.