Opened 5 years ago

Closed 8 months ago

#1627 closed defect (worksforme)

Negative zero literals are miscompiled

Reported by: johnwcowan Owned by:
Priority: minor Milestone: 6.0.0
Component: unknown Version: 5.1.0
Keywords: float, negative zero Cc:
Estimated difficulty: easy


All versions of the Chicken compiler and interpreter (since 5.0 at least) treat the Scheme literal value -0.0 incorrectly. This inexact value is distinct from 0.0 in certain ways: for example, (/ 1.0 0.0) => +inf.0, but (/ 1.0 -0.0) => -inf.0.

Unfortunately, C treats the expression -0.0 as a synonym for 0.0, because in C a prefixed minus sign is always the negation operator and not part of a literal. So generating -0.0 as the C representation of Scheme -0.0 is incorrect. Instead, the C expression (1.0 / (-INFINITY)), where INFINITY is a constant from math.h, should be generated instead.

Change History (3)

comment:1 Changed 8 months ago by felix winkelmann

Milestone: someday6.0.0

comment:2 Changed 8 months ago by felix winkelmann

Is this still relevant? I can't seem to reproduce the problem.

comment:3 Changed 8 months ago by felix winkelmann

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.