> [EMAIL PROTECTED] - Wed Dec 28 14:07:26 2005]:
>
> A quick demonstration of the issue:
>
> --
> #include <stdio.h>
> #include <math.h>
>
> int main ()
> {
> printf("%f\n", atan2(0.0, 0.0));
> printf("%f\n", atan2(-0.0, -0.0));
> }
> --
>
> --
> $ gcc foo.c -lm
> $ ./a.out
> 0.000000
> 0.000000
> --
>
> This is also documented in config/init/hints/solaris.pm:
>
> ################################################################
> # Parrot usually aims for IEEE-754 compliance.
> # For Solaris 8/Sun Workshop Pro 4, both
> # atan2( 0.0, -0.0) and atan2(-0.0, -0.0)
> # return 0, when they should return +PI and -PI respectively.
> # For Sun's compilers, fix this with the -xlibmieee flag.
> # I don't know of an equivalent flag for gcc.
> # (Alternatively, and more generally, perhahs we should run an
> # ieee-conformance test and then call back into a hints-file
trigger
> # to set platform-specific flags.
> # A. Dougherty 7 March 2005
> # We don't know which compiler we're using till after the
gccversion
> # test.
>
>
> The question is, can we get atan2() to 'behave' with gcc or do we need
> to provide our own implementation?
As Sun is the original author of the BSD math libraries, NetBSD,
OpenBSD, and Cygwin are all similarly effected by this problem (see RT#
34549 and 36835). On Solaris, however, they've made the switch from
BSD to AT&T based math libraries, so some #ifdef's are probably needed
for Solaris. The code below is untested, but should solve the problem
you are seeing after the patch for problem #34549 is applied.
--- /dev/null Thu Dec 29 08:50:54 2005
+++ config/gen/platform/solaris/init.c Thu Dec 29 08:50:26 2005
@@ -0,0 +1,4 @@
+#include <math.h>
+#if defined(__GNUC__) && defined(_LIB_VERSION)
+_LIB_VERSION_TYPE _LIB_VERSION = _IEEE_;
+#endif