Bug #70568 [Com]: atan2 returns NAN
| From: | n13 at inbox dot ru | Date: | Wed, 30 Sep 2015 20:51:51 +0000 |
| Subject: | Bug #70568 [Com]: atan2 returns NAN | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-196323@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70568&edit=1
ID: 70568
Comment by: n13 at inbox dot ru
Reported by: goodnickoff at gmail dot com
Summary: atan2 returns NAN
Status: Open
Type: Bug
Package: Math related
Operating System: *
PHP Version: *
Block user comment: N
Private report: N
New Comment:
GCC 4.8.1 from MinGW and VS Community 2013 gives the same result
Code:
printf("%lf\n",atan2(-INFINITY,-INFINITY));
printf("%lf\n",atan2(+INFINITY,-INFINITY));
printf("%lf\n",atan2(-INFINITY,+INFINITY));
printf("%lf\n",atan2(+INFINITY,+INFINITY));
Output:
-1.#IND00
-1.#IND00
-1.#IND00
-1.#IND00
Output from gcc 4.9.2 (Debian)
-2.356194
2.356194
-0.785398
0.785398
Previous Comments:
------------------------------------------------------------------------
[2015-09-24 12:05:16] goodnickoff at gmail dot com
This happens on 32 bit php installed on 64 bit OS.
------------------------------------------------------------------------
[2015-09-24 09:24:02] goodnickoff at gmail dot com
Occurs on different versions of PHP
------------------------------------------------------------------------
[2015-09-24 08:59:29] goodnickoff at gmail dot com
Description:
------------
If both parameters are INF or -INF sometimes atan2 function returns NAN but sometimes
-2.3561944901923.
results on different versions of PHP and OS:
-2.3561944901923%
PHP 5.5.27 (cli) (built: Jul 23 2015 00:21:59)
macos 64bit
NAN
PHP 5.4.39 (cli) (built: Mar 19 2015 22:16:19)
Thread Safety enabled
Windows NT 6.1 build 7601 (Windows 7 Business Edition Service Pack 1) i586 x86
-2.3561944901923
PHP Version 5.5.21 Build Date Jan 21 2015 14:38:49
Thread Safety enabled
Windows NT CZC4433C6H-HP 6.1 build 7601 (Windows 7 Business Edition Service Pack 1) AMD64
NAN
PHP 5.6.11 (cli) (built: Jul 9 2015 20:55:40) x86
Thread Safety enabled
Windows NT 10.0; Win64; x64 (Build 10240)
Test script:
---------------
php -r 'echo atan2(-INF, -INF);'
Expected result:
----------------
-2.3561944901923
Actual result:
--------------
NAN
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70568&edit=1