Opened 10 years ago

Closed 10 years ago

#671 closed defect (invalid)

INTEGER-DECODE-FLOAT not consistent with DECODE-FLOAT

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

Description (last modified by rme)

I get the following return values from INTEGER-DECODE-FLOAT. (Version 1.4-r13122 (WindowsX8632))

? (integer-decode-float 0s0)
0
-150
1
? (integer-decode-float 0f0)
0
-150
1
? (integer-decode-float 0d0)
0
-1074
1
? (integer-decode-float 0l0)
0
-1074
1

In contrast:

? (decode-float 0s0)
0.0
0
1.0
? (decode-float 0f0)
0.0
0
1.0
? (decode-float 0d0)
0.0D0
0
1.0D0
? (decode-float 0l0)
0.0D0
0
1.0D0

CLHS states that INTEGER-DECODE-FLOAT returns "the same last two values that are returned by decode-float". Observed behavior seems otherwise.

Change History (2)

comment:1 Changed 10 years ago by rme

  • Component changed from IDE to ANSI CL Compliance
  • Description modified (diff)
  • Owner set to gb

Are you expecting the last two values from (integer-decode-float 0f0) and (decode-float 0f0) to be numerically equal?

Where the spec says "the same last two values", I interpret that to mean "exponent and sign" such that

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

is true.

comment:2 Changed 10 years ago by gb

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

CLtL2 isn't a binding language standard in the sense that CLHS is, but it often says the same things as CLHS does but says it much more clearly.

See http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node130.html#SECTION001660000000000000000

CLHS's use of the language "the same values" does seem to invite the interpretation that Robert made, but there's too much contradictory language on that page to support the belief that CLtL2 and CLHS were describing different behavior.

Note: See TracTickets for help on using tickets.