[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Why do some math functions return -0
- From: David Kastrup <dak@...>
- Date: Mon, 20 Sep 2010 16:22:48 +0200
Mike McGonagle <mjmogo@gmail.com> writes:
> Thanks everyone for such a lively discussion on this simple topic. I
> was suspecting that this is a Mac OS X thing, but when I compiled and
> used version 5.1.4, it still produced the same results. BUT, as Tony
> says here that it does not do the same thing with 10.6.4 of Mac OS X,
> I guess it really doesn't matter much. Especially when you consider
> that when I use %d (instead of %f in the string.format), it prints out
> 0 (and not -0).
>
> So, I am sure that this issue has something to do with the old
> implementation of floor on the Mac. It could also have something to do
> with my processor being an older G4, and not an Intel...
And/or the operating system not properly initializing/restoring floating
point state. There were early versions of the Linux kernel, for
example, that did not bother at all with floating point registers. If
you had more than one process using floating point at a time, you would
be in a pretty bad mess.
--
David Kastrup