Opened 11 years ago

Closed 10 years ago

#272 closed defect (invalid)

(coerce (/ pi 2) 'single-float) incorrect

Reported by: gz Owned by: gb
Priority: minor Milestone:
Component: ANSI CL Compliance Version:
Keywords: Cc:

Description

? (/ pi 2)
1.5707963267948966D0
? (coerce * 'single-float)
1.5707964
? 

Change History (1)

comment:1 Changed 10 years ago by rme

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

I don't think this is a bug. It seems to be a consequence of the binary floating point representation.

Looking at the (scaled) significands, we see:

CCL> (format t "~b" (integer-decode-float (/ pi 2)))
11001001000011111101101010100010001000010110100011000
CCL> (format t "~b" (integer-decode-float (coerce (/ pi 2) 'single-float)))
110010010000111111011011

which seems correct to me.

Note: See TracTickets for help on using tickets.