[R] Logical inconsistency
Wacek Kusnierczyk
Waclaw.Marcin.Kusnierczyk at idi.ntnu.no
Sun Dec 7 21:24:12 CET 2008
Stavros Macrakis wrote:
> On Sun, Dec 7, 2008 at 3:51 AM, Wacek Kusnierczyk <
> Waclaw.Marcin.Kusnierczyk at idi.ntnu.no> wrote:
>
>
>>>> (* (/ 2.0 3.0) 3.0) is not exact either, as aren't (* (/ 2.0 2.0)
>>>>
>> 2.0)...
>>
>>> Actually, they *are* all exact in any system using IEEE floats.
>>>
>> not per definitionem of exactness as of r6rs, as of my understanding.
>> (exact? 2.0) is false there.
>>
>>
>
> Perhaps you are trolling after all.
got used to it.
> We're not discussing Scheme semantics
> here, so the technical meaning of "exact" in Scheme is not in question.
>
> The point is simply that in IEEE floating-point, (2.0/3.0)*3.0 is exactly
> equal to 2.
>
ok.
>
> PS You can easily explore the behavior of IEEE floating division using R:
>
> divtest <- function(a,b)
> { with( pairs <- expand.grid(a=a,b=b),
> pairs[ (a/b)*b != a, ] ) }
>
> divtest(1:30,1:30)
i find it more enlightening to examine and compare the representations
bitwise rather than to see just the results. but thanks anyway.
vQ
More information about the R-help
mailing list