Here's the responce from the OpenBSD folks. It seems that turning on a define prior to the atan2() call will set the flags correctly for OpenBSD. My guess is that NetBSD will behave similarly.
> >Number: 4154 > >Category: library > >Synopsis: atan2(-0.0, -0.0) returning incorrect result Our libm is compiled in multi mode and defaults to posix mode, which sets errno and returns 0 if both args are (+-)0.0. IEEE mode does what you want. Check lib/libm/Makfile and lib/lib/src/{e,w}w_atan2.c for some background info. If you force libm to IEEE mode, you'll get the expected results: (on macppc, same results on i386): [EMAIL PROTECTED]:9]$ cat x.c #include <errno.h> #include <stdio.h> #include <math.h> int main() { double res; _LIB_VERSION = _IEEE_; errno = 0; res = atan2(0.0, 0.0); perror("atan2"); printf("atan2(0.0, 0.0) = %f\n", res); errno = 0; res = atan2(-0.0, 0.0); perror("atan2"); printf("atan2(-0.0, 0.0) = %f\n", res); errno = 0; res = atan2(0.0, -0.0); perror("atan2"); printf("atan2(0.0, -0.0) = %f\n", res); errno = 0; res = atan2(-0.0, -0.0); perror("atan2"); printf("atan2(-0.0, -0.0) = %f\n", res); } [EMAIL PROTECTED]:10]$ a.out atan2: Undefined error: 0 atan2(0.0, 0.0) = 0.000000 atan2: Undefined error: 0 atan2(-0.0, 0.0) = 0.000000 atan2: Undefined error: 0 atan2(0.0, -0.0) = 3.141593 atan2: Undefined error: 0 atan2(-0.0, -0.0) = -3.141593 [EMAIL PROTECTED]:11]$ ----- End forwarded message -----