close Warning: Can't synchronize with repository "(default)" (/project/cmucl/public_html/git/cmucl.git does not appear to be a Git repository.). Look in the Trac log for more information.

Opened 3 years ago

Closed 3 years ago

#92 closed defect (invalid)

Type-derivation for log is inconsistent

Reported by: rtoy Owned by: somebody
Priority: major Milestone:
Component: Core Version: 2014-02
Keywords: Cc:

Description

Consider

(defun foo (x)
  (declare (type (double-float 0d0) x))
  (log x))

When compiled, the compiler says the return type for foo is (OR DOUBLE-FLOAT (COMPLEX DOUBLE-FLOAT)). This is inconsistent with the return value of (log 0d0) and (log -0d0) which is EXT:DOUBLE-FLOAT-NEGATIVE-INFINITY (when the :DIVIDE-BY-ZERO trap is disabled).

The correct derived type should be just DOUBLE-FLOAT.

Change History (3)

comment:1 Changed 3 years ago by toy.raymond@…

  • Resolution set to fixed
  • Status changed from new to closed

commit 8970ad11b03f863b40a9ee352d3aced52b783cce Author: Raymond Toy <toy.raymond@…> Date: Sun Feb 9 09:53:11 2014 -0800

Fix ticket:92

Type derivation for log fixed to be consistent with the actual returned values.

  • src/compiler/float-tran.lisp:
    • Update LOG-DERIVE-TYPE-AUX-1 to compute the correct type.

  • tests/trac.lisp:

comment:2 Changed 3 years ago by rtoy

  • Resolution fixed deleted
  • Status changed from closed to reopened

This is actually incorrect. We really want log(-0) to return -inf + i*pi so that the branch cuts of special functions can be computed correctly from the definition.

comment:3 Changed 3 years ago by rtoy

  • Resolution set to invalid
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.