Re: [perl #34549] t/op/trans.t failure on OpenBSD
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.00 atan2: Undefined error: 0 atan2(-0.0, 0.0) = 0.00 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 -
Re: [perl #34549] t/op/trans.t failure on OpenBSD
Steve Peters [EMAIL PROTECTED] wrote: 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. [ ... ] _LIB_VERSION = _IEEE_; Fine. Thanks for the research. It should probably suffice to set the _LIB_VERSION once. As this is platform-specific this belongs into config/gen/platform/*bsd/init.c where the new file init.c should contain a function void Parrot_platform_init(Interp *i) { _LIB_VERSION = _IEEE_; } or some such. The fallback generic/init.c should do nothing. I think the configure system will pick up these files automatically, we just have to call the init function during interpreter startup. Header definition should go into platform/platform_interface.h. Comments, takers? Do we need a test, if _LIB_VERSION is compiled into libm? leo
[perl #34549] t/op/trans.t failure on OpenBSD
[leo - Thu Mar 24 07:07:31 2005]: Comments, takers? Since I'm fixing this in Perl, I take a whack at it in Parrot as well. Steve
[perl #34549] t/op/trans.t failure on OpenBSD
# New Ticket Created by Steve Peters # Please include the string: [perl #34549] # in the subject line of all future correspondence about this issue. # URL: https://rt.perl.org/rt3/Ticket/Display.html?id=34549 When running testing parrot-HEAD, I get a test failure in t/op/trans.t on OpenBSD. Running the same tests on Linux seem to work just fine... perl -Ilib t/op/trans.t 1..19 ok 1 - sin ok 2 - cos ok 3 - tan ok 4 - sec ok 5 - atan ok 6 - asin ok 7 - acos ok 8 - asec ok 9 - cosh ok 10 - sinh ok 11 - tanh ok 12 - sech not ok 13 - atan2 # Failed test (t/op/trans.t at line 307) # got: 'ok 1 # ok 2 # ok 3 # ok 4 # ok 5 # ok 6 # ok 7 # ok 8 # ok 9 # ok 10 # ok 11 # ok 12 # ok 13 # ok 14 # ok 15 # ok 16 # not 0.00ok 17 # ' # expected: 'ok 1 # ok 2 # ok 3 # ok 4 # ok 5 # ok 6 # ok 7 # ok 8 # ok 9 # ok 10 # ok 11 # ok 12 # ok 13 # ok 14 # ok 15 # ok 16 # ok 17 # ' ok 14 - log2 ok 15 - log10 ok 16 - ln ok 17 - exp ok 18 - pow ok 19 - sqrt # Looks like you failed 1 tests of 19.
Re: [perl #34549] t/op/trans.t failure on OpenBSD
Steve Peters [EMAIL PROTECTED] wrote: # New Ticket Created by Steve Peters # Please include the string: [perl #34549] # in the subject line of all future correspondence about this issue. # URL: https://rt.perl.org/rt3/Ticket/Display.html?id=34549 When running testing parrot-HEAD, I get a test failure in t/op/trans.t on OpenBSD. Running the same tests on Linux seem to work just fine... perl -Ilib t/op/trans.t not ok 13 - atan2 # Failed test (t/op/trans.t at line 307) # got: 'ok 1 # not 0.00ok 17 atan N4, -0.0, -0.0 Obviously another broken C system. What says your perl: $ perl -le'print atan2(-0.0,-0.0)' -3.14159265358979324 leo
Re: [perl #34549] t/op/trans.t failure on OpenBSD
On Wed, Mar 23, 2005 at 04:00:45PM -, Leopold Toetsch via RT wrote: Steve Peters [EMAIL PROTECTED] wrote: # New Ticket Created by Steve Peters # Please include the string: [perl #34549] # in the subject line of all future correspondence about this issue. # URL: https://rt.perl.org/rt3/Ticket/Display.html?id=34549 When running testing parrot-HEAD, I get a test failure in t/op/trans.t on OpenBSD. Running the same tests on Linux seem to work just fine... perl -Ilib t/op/trans.t not ok 13 - atan2 # Failed test (t/op/trans.t at line 307) # got: 'ok 1 # not 0.00ok 17 atan N4, -0.0, -0.0 Obviously another broken C system. What says your perl: $ perl -le'print atan2(-0.0,-0.0)' -3.14159265358979324 Tasty :-/ On OpenBSD, I get perl -le'print atan2(-0.0,-0.0)' 0 Steve
Re: [perl #34549] t/op/trans.t failure on OpenBSD
Steve Peters [EMAIL PROTECTED] wrote: On Wed, Mar 23, 2005 at 04:00:45PM -, Leopold Toetsch via RT wrote: atan N4, -0.0, -0.0 Obviously another broken C system. What says your perl: $ perl -le'print atan2(-0.0,-0.0)' -3.14159265358979324 Tasty :-/ On OpenBSD, I get perl -le'print atan2(-0.0,-0.0)' 0 Time to start some more OS-specific docs that summarize such features? Steve leo