Changeset 8753


Ignore:
Timestamp:
03/12/05 15:57:01 (16 years ago)
Author:
piso
Message:

Removed ftruncate().

File:
1 edited

Legend:

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

    r8284 r8753  
    22 * LispFloat.java
    33 *
    4  * Copyright (C) 2003-2004 Peter Graves
    5  * $Id: LispFloat.java,v 1.82 2004-12-23 12:29:29 piso Exp $
     4 * Copyright (C) 2003-2005 Peter Graves
     5 * $Id: LispFloat.java,v 1.83 2005-03-12 15:57:01 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    412412    }
    413413
    414     public LispObject ftruncate(LispObject obj) throws ConditionThrowable
    415     {
    416         final LispThread thread = LispThread.currentThread();
    417         double divisor, quotient, remainder;
    418         if (obj instanceof Fixnum) {
    419             divisor = ((Fixnum)obj).value;
    420         } else if (obj instanceof LispFloat) {
    421             divisor = ((LispFloat)obj).value;
    422         } else {
    423             return signal(new LispError("LispFloat.ftruncate(): not implemented: " +
    424                                         obj.typeOf().writeToString()));
    425         }
    426         quotient = value / divisor;
    427         remainder = value % divisor;
    428         if (quotient == 0 ||
    429             quotient == Double.POSITIVE_INFINITY ||
    430             quotient == Double.NEGATIVE_INFINITY)
    431         {
    432             return thread.setValues(new LispFloat(quotient),
    433                                     new LispFloat(remainder));
    434         }
    435         if (quotient == remainder) {
    436             // "The quotient represents the mathematical integer of the
    437             // same sign as the mathematical quotient, and that has the
    438             // greatest integral magnitude not greater than that of the
    439             // mathematical quotient."
    440             return thread.setValues(new LispFloat(quotient < 0 ? -0.0 : 0.0),
    441                                     new LispFloat(remainder));
    442         }
    443         return thread.setValues(new LispFloat(quotient - remainder),
    444                                 new LispFloat(remainder));
    445     }
    446 
    447414    public int hashCode()
    448415    {
Note: See TracChangeset for help on using the changeset viewer.