Changeset 12950


Ignore:
Timestamp:
10/04/10 10:11:13 (12 years ago)
Author:
ehuelsmann
Message:

Add two functions to disable signalling of over- and underflow
conditions in floating point calculations; working toward CLHS
compliance while keeping Maxima fixed (it was, as of last weekend).

Location:
trunk/abcl/src/org/armedbear/lisp
Files:
2 edited

Legend:

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

    r12932 r12950  
    57785778    };
    57795779
     5780    /* Added to ABCL because Maxima wants to be able to turn off
     5781     * underflow conditions. However, the Hyperspec says we have to
     5782     * signal them. So, we went for CLHS compliant with a switch for
     5783     * Maxima.
     5784     */
     5785    // ### float-underflow-mode
     5786    private static final Primitive FLOAT_UNDERFLOW_MODE
     5787        = new pf_float_underflow_mode();
     5788    private static final class pf_float_underflow_mode extends Primitive {
     5789        pf_float_underflow_mode() {
     5790            super(Symbol.FLOAT_UNDERFLOW_MODE, "&optional boolean");
     5791        }
     5792
     5793        @Override
     5794        public LispObject execute() {
     5795            return Lisp.TRAP_UNDERFLOW ? T : NIL;
     5796        }
     5797
     5798        @Override
     5799        public LispObject execute(LispObject arg) {
     5800            Lisp.TRAP_UNDERFLOW = (arg != NIL);
     5801            return arg;
     5802        }
     5803    };
     5804
     5805    /* Implemented for symmetry with the underflow variant. */
     5806    // ### float-overflow-mode
     5807    private static final Primitive FLOAT_OVERFLOW_MODE
     5808        = new pf_float_overflow_mode();
     5809    private static final class pf_float_overflow_mode extends Primitive {
     5810        pf_float_overflow_mode() {
     5811            super(Symbol.FLOAT_OVERFLOW_MODE, "&optional boolean");
     5812        }
     5813
     5814        @Override
     5815        public LispObject execute() {
     5816            return Lisp.TRAP_OVERFLOW ? T : NIL;
     5817        }
     5818
     5819        @Override
     5820        public LispObject execute(LispObject arg) {
     5821            Lisp.TRAP_OVERFLOW = (arg != NIL);
     5822            return arg;
     5823        }
     5824    };
     5825
    57805826}
  • trunk/abcl/src/org/armedbear/lisp/Symbol.java

    r12932 r12950  
    29832983  public static final Symbol FORWARD_REFERENCED_CLASS =
    29842984    PACKAGE_SYS.addExternalSymbol("FORWARD-REFERENCED-CLASS");
     2985  public static final Symbol FLOAT_UNDERFLOW_MODE =
     2986    PACKAGE_SYS.addExternalSymbol("FLOAT-UNDERFLOW-MODE");
     2987  public static final Symbol FLOAT_OVERFLOW_MODE =
     2988    PACKAGE_SYS.addExternalSymbol("FLOAT-OVERFLOW-MODE");
    29852989  public static final Symbol CLASS_BYTES =
    29862990    PACKAGE_SYS.addExternalSymbol("CLASS-BYTES");
Note: See TracChangeset for help on using the changeset viewer.