Changeset 9941


Ignore:
Timestamp:
09/05/05 14:07:26 (16 years ago)
Author:
piso
Message:

ABS(), divideBy(): (/ MOST-NEGATIVE-FIXNUM -1) is a bignum.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/Fixnum.java

    r9869 r9941  
    33 *
    44 * Copyright (C) 2002-2005 Peter Graves
    5  * $Id: Fixnum.java,v 1.126 2005-08-15 23:24:40 piso Exp $
     5 * $Id: Fixnum.java,v 1.127 2005-09-05 14:07:26 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    205205        if (value >= 0)
    206206            return this;
    207         return number(-((long)value));
     207        if (value > Integer.MIN_VALUE)
     208            return new Fixnum(-value);
     209        return new Bignum(-((long)Integer.MIN_VALUE));
    208210    }
    209211
     
    427429            if (obj instanceof Fixnum) {
    428430                final int divisor = ((Fixnum)obj).value;
    429                 if (value % divisor == 0)
    430                     return new Fixnum(value / divisor);
     431                // (/ MOST-NEGATIVE-FIXNUM -1) is a bignum.
     432                if (value > Integer.MIN_VALUE)
     433                    if (value % divisor == 0)
     434                        return new Fixnum(value / divisor);
    431435                return number(BigInteger.valueOf(value),
    432436                              BigInteger.valueOf(divisor));
Note: See TracChangeset for help on using the changeset viewer.