[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gawk] atan2(y,x) return value for y = 0 and x = -0
From: |
Hermann Peifer |
Subject: |
[bug-gawk] atan2(y,x) return value for y = 0 and x = -0 |
Date: |
Sat, 18 Jan 2014 14:56:19 +0100 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.2.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