Changeset 14224


Ignore:
Timestamp:
Aug 30, 2010, 2:34:27 AM (9 years ago)
Author:
gb
Message:

%DF-ATAN2 and (32-bit) %SF-ATAN2!: arg Y may be stack-consed, so
don't return it. These functions have (at most) one caller and
that caller doesn't preallocate a result argument, so don't accept
one.

%SF-ATAN2/%SF-ATAN2!: use single-float version of PI.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/level-0/l0-float.lisp

    r14151 r14224  
    915915
    916916(eval-when (:execute :compile-toplevel)
     917  (defconstant single-float-pi (coerce pi 'single-float))
    917918  (defconstant double-float-half-pi (asin 1.0d0))
    918919  (defconstant single-float-half-pi (asin 1.0f0))
     
    968969
    969970
    970 (defun %df-atan2 (y x &optional result)
     971(defun %df-atan2 (y x)
    971972  (if (zerop x)
    972973    (if (zerop y)
    973974      (if (plusp (float-sign x))
    974         y
     975        (if (eql y -0.0d0)
     976          -0.0d0
     977          0.0d0)
    975978        (float-sign y pi))
    976979      (float-sign y double-float-half-pi))
    977     (%double-float-atan2! y x (or result (%make-dfloat)))))
     980    (%double-float-atan2! y x (%make-dfloat))))
    978981
    979982#+32-bit-target
    980 (defun %sf-atan2! (y x &optional result)
     983(defun %sf-atan2! (y x)
    981984  (if (zerop x)
    982985    (if (zerop y)
    983986      (if (plusp (float-sign x))
    984         y
    985         (float-sign y pi))
     987        ;; Don't return Y (which may be stack-consed) here.
     988        ;; We know that (ZEROP Y) is true, so:
     989        (if (eql y -0.0s0)
     990          -0.0s0
     991          0.0s0)
     992        (float-sign y single-float-pi))
    986993      (float-sign y single-float-half-pi))
    987     (%single-float-atan2! y x (or result (%make-sfloat)))))
     994    (%single-float-atan2! y x (%make-sfloat))))
    988995
    989996#+64-bit-target
     
    9931000      (if (plusp (float-sign x))
    9941001        y
    995         (float-sign y pi))
     1002        (float-sign y single-float-pi))
    9961003      (float-sign y single-float-half-pi))
    9971004    (%single-float-atan2 y x)))
Note: See TracChangeset for help on using the changeset viewer.