chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH] Distinguish between positive and negative


From: John Cowan
Subject: Re: [Chicken-hackers] [PATCH] Distinguish between positive and negative zero in flonums
Date: Mon, 29 Jul 2019 13:30:21 -0400



On Mon, Jul 29, 2019 at 5:39 AM <address@hidden> wrote:


> (signum -0.0) => 0.0 seems totally right to me.
>

I wholeheartily disagree.

Here's my argument:  The signum function's definition guarantees that if its argument is equal to zero, its result is equal to zero.  Since (= 0.0 -0.0) => #t, that guarantee is preserved.  However, in the case that you want the sign of an underflowed value (which is the whole point of negative zero), you can detect it if you want to.  For example, you can use (/ 1.0 result), which produces +inf.0 or -inf.0 respectively.


John Cowan          http://vrici.lojban.org/~cowan        address@hidden
You are a child of the universe no less than the trees and all other acyclic
graphs; you have a right to be here.  --DeXiderata by Sean McGrath

reply via email to

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