Opened 11 years ago

Closed 10 years ago

#458 closed defect (fixed)

decode-float and negative arguments

Reported by: rme Owned by: rme
Priority: normal Milestone:
Component: ANSI CL Compliance Version: trunk
Keywords: Cc:

Description

According to the spec, the following should be true for any floating-point number f:

 (multiple-value-bind (signif expon sign)
                      (decode-float f)
   (* (scale-float signif expon) sign))
==  f

http://www.lispworks.com/documentation/HyperSpec/Body/f_dec_fl.htm

If f is negative, we appear to leave an extra minus sign in the results:

CCL> (decode-float -1.0d0)
-0.5D0
1
-1.0D0

and thus:

CCL> (let ((f -1.0d0))
       (multiple-value-bind (signif expon sign)
	   (decode-float f)
	 (* (scale-float signif expon) sign)))

1.0D0

Probably we should ensure that the significand is non-negative in all cases.

Change History (2)

comment:1 Changed 10 years ago by rme

  • Owner changed from gb to rme
  • Status changed from new to assigned

comment:2 Changed 10 years ago by rme

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

r12418 tries to address this.

Note: See TracTickets for help on using tickets.