|
From: | Janis Papanagnou |
Subject: | Re: [bug-gawk] atan2(y,x) return value for y = 0 and x = -0 |
Date: | Sat, 18 Jan 2014 15:05:42 +0100 |
Complementary to Herman's view I think that -0 should be handled as +0;
so I'd qualify the first sample below as "Why is the result pi here?", and the second sample as "Works as expected". Either way, I agree that this looks like a bug. Janis > Date: Sat, 18 Jan 2014 14:56:19 +0100 > From: address@hidden > To: address@hidden > CC: address@hidden > Subject: atan2(y,x) return value for y = 0 and x = -0 > > Hi, > > This might be a feature or a bug, but I thought it would be worth reporting. > > # Works as expected > $ awk 'BEGIN{ pi = atan2(0,-0) ; printf "%.16f\n", pi }' > 3.1415926535897931 > > # Why is the result 0 here ? > $ awk -M 'BEGIN{ pi = atan2(0,-0) ; printf "%.16f\n", pi }' > 0.0000000000000000 > > # Works again as expected > $ awk -M 'BEGIN{ pi = atan2(0,-0.1) ; printf "%.16f\n", pi }' > 3.1415926535897931 > > # I used gawk from git on Mac OS X, 10.9.1 > $ awk -V | head -1 > GNU Awk 4.1.60, API: 1.0 (GNU MPFR 3.1.1-p2, GNU MP 5.1.2) > > Hermann |
[Prev in Thread] | Current Thread | [Next in Thread] |