Negative Zero issues

Andrew Whitworth wknight8111 at gmail.com
Fri Jan 8 19:10:42 UTC 2010


I've been trying to do some testing on some "exotic" platforms
recently, and one issue I am running into consistently is the negative
zero problem. Several platform/compiler combinations I have tried do
not seem to have proper negative zero support, which causes parrot to
fail several tests (several similar tests spread across several test
files, which I find particularly annoying).

So the question I have is this: How do we go about fixing this problem
for platforms where the math libraries don't handle negative zero the
way we want? Do we add in runtime checks to all our arithmetic ops to
ensure that we get negative zero values when we should? Runtime checks
could be expensive for math-heavy programs. We could use preprocessor
#ifdef sections to only insert these checks on platforms where it's
known to be an issue, but we would need support from Configure.pl to
detect this and define the macros properly. Is there another solution
somewhere that I am not thinking about?

If we fixed the negative zero issue we could have a few new platforms
with 100% test success, which would be a very good thing for us to
have by 2.0 or, more likely, shortly thereafter.

--Andrew Whitworth


More information about the parrot-dev mailing list