chicken-janitors
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-janitors] #1627: Negative zero literals are miscompiled


From: Chicken Trac
Subject: [Chicken-janitors] #1627: Negative zero literals are miscompiled
Date: Fri, 28 Jun 2019 02:49:03 -0000

#1627: Negative zero literals are miscompiled
----------------------------------+--------------------------------
 Reporter:  johnwcowan            |                 Owner:
     Type:  defect                |                Status:  new
 Priority:  minor                 |             Milestone:  someday
Component:  unknown               |               Version:  5.1.0
 Keywords:  float, negative zero  |  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.

--
Ticket URL: <https://bugs.call-cc.org/ticket/1627>
CHICKEN Scheme <https://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]