Changeset 3645


Ignore:
Timestamp:
09/10/03 01:23:30 (19 years ago)
Author:
piso
Message:

FLOAT-SIGN

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

Legend:

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

    r3610 r3645  
    22;;;
    33;;; Copyright (C) 2003 Peter Graves
    4 ;;; $Id: autoloads.lisp,v 1.17 2003-09-08 02:24:46 piso Exp $
     4;;; $Id: autoloads.lisp,v 1.18 2003-09-10 01:23:30 piso Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    7474(autoload 'make-pathname)
    7575(autoload '(signum floor ceiling round rem mod ftruncate ffloor fceiling fround
    76             rational rationalize gcd isqrt phase)
     76            rational rationalize gcd isqrt float-sign phase)
    7777          "numbers.lisp")
  • trunk/j/src/org/armedbear/lisp/numbers.lisp

    r3610 r3645  
    22;;;
    33;;; Copyright (C) 2003 Peter Graves
    4 ;;; $Id: numbers.lisp,v 1.12 2003-09-08 02:24:05 piso Exp $
     4;;; $Id: numbers.lisp,v 1.13 2003-09-10 01:22:57 piso Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    156156         (error 'type-error "wrong type: ~S is not a real number" x))))
    157157
     158
    158159;;; FIXME
    159160(defun rationalize (x)
    160161  (rational x))
    161 
    162 (when (and (find-package "JVM")
    163            (fboundp 'jvm::jvm-compile))
    164   (mapcar #'jvm::jvm-compile '(floor
    165                                ceiling
    166                                round
    167                                rem
    168                                ftruncate
    169                                ffloor
    170                                fceiling
    171                                fround
    172                                rational
    173                                rationalize)))
    174 
    175162
    176163
     
    213200
    214201
     202(defun float-sign (float1 &optional (float2 (float 1 float1)))
     203  "Returns a floating-point number that has the same sign as
     204   float1 and, if float2 is given, has the same absolute value
     205   as float2."
     206  (* (if (minusp float1)
     207   (float -1 float1)
     208   (float 1 float1))
     209     (abs float2)))
     210
     211
    215212(defun phase (number)
    216213  "Returns the angle part of the polar representation of a complex number.
     
    233230             (complex
    234231              (atan (imagpart number) (realpart number)))))
     232
     233
     234(when (and (find-package "JVM")
     235           (fboundp 'jvm::jvm-compile))
     236  (mapcar #'jvm::jvm-compile '(floor
     237                               ceiling
     238                               round
     239                               rem
     240                               ftruncate
     241                               ffloor
     242                               fceiling
     243                               fround
     244                               rational
     245                               rationalize)))
Note: See TracChangeset for help on using the changeset viewer.