Changeset 6009


Ignore:
Timestamp:
02/27/04 14:35:54 (17 years ago)
Author:
piso
Message:

Moved TRUNCATE to truncate.java.

File:
1 edited

Legend:

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

    r6001 r6009  
    33 *
    44 * Copyright (C) 2002-2004 Peter Graves
    5  * $Id: Primitives.java,v 1.585 2004-02-27 02:43:31 piso Exp $
     5 * $Id: Primitives.java,v 1.586 2004-02-27 14:35:54 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    37973797    }
    37983798
    3799     // ### truncate
    3800     private static final Primitive TRUNCATE = new Primitive("truncate","number &optional divisor") {
    3801         public LispObject execute(LispObject[] args) throws ConditionThrowable
    3802         {
    3803             final int length = args.length;
    3804             if (length < 1 || length > 2) {
    3805                 signal(new WrongNumberOfArgumentsException(this));
    3806                 return NIL;
    3807             }
    3808             LispObject n = args[0];
    3809             LispObject d = length == 1 ? Fixnum.ONE : args[1];
    3810             if (n instanceof Fixnum)
    3811                 return ((Fixnum)n).truncate(d);
    3812             if (n instanceof Bignum)
    3813                 return ((Bignum)n).truncate(d);
    3814             if (n instanceof Ratio)
    3815                 return ((Ratio)n).truncate(d);
    3816             if (n instanceof LispFloat)
    3817                 return ((LispFloat)n).truncate(d);
    3818             signal(new TypeError(n, "number"));
    3819             return NIL;
    3820         }
    3821     };
    3822 
    38233799    // ### expt
    38243800    // expt base-number power-number => result
Note: See TracChangeset for help on using the changeset viewer.