Bug #78627 [NEW]: acos(1) is giving NAN instead of 0
| From: | me at gmorel dot io | Date: | Thu, 03 Oct 2019 10:10:46 +0000 |
| Subject: | Bug #78627 [NEW]: acos(1) is giving NAN instead of 0 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-223015@lists.php.net to get a copy of this message | ||
From: me at gmorel dot io
Operating system: Linux Debian
PHP version: 7.2.23
Package: *Math Functions
Bug Type: Bug
Bug description:acos(1) is giving NAN instead of 0
Description:
------------
---
From manual page: https://php.net/function.acos
---
Hi,
Thanks for all your work.
Since the PHP 7.2.20 the acos function seems to have a regression. We
have first isolated the bug in 7.2.23
In the case of
$dist = sin(deg2rad(45.9007)) * sin(deg2rad(45.9007)) +
cos(deg2rad(45.9007)) * cos(deg2rad(45.9007));
Before acos($dist) => 0
After acos($dist) => NAN
uname -a
Linux 609379a2965b 5.0.0-29-generic #31-Ubuntu SMP Thu Sep 12 13:05:32
UTC 2019 x86_64 GNU/Linux
php -v
PHP 7.2.23 (cli) (built: Sep 26 2019 23:37:50) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.23, Copyright (c) 1999-2018, by Zend
Technologies
with Xdebug v2.7.2, Copyright (c) 2002-2019, by Derick Rethans
php -m
[PHP Modules]
Core
ctype
curl
date
dom
fileinfo
filter
ftp
hash
iconv
json
libxml
mbstring
mysqlnd
openssl
pcre
PDO
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
sodium
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zlib
[Zend Modules]
âKeep up the good work
â
Test script:
---------------
PHP 7.2.18 (sorry they didn't have 7.2.19)
http://sandbox.onlinephpfunctions.com/code/e59e94fa7aee04d67cbacf2990773c1658e4d1c2
It seems to have no issue in 7.3.5
But it appears also in 7.3.10 (cli)
Expected result:
----------------
$dist = sin(deg2rad(45.9007)) * sin(deg2rad(45.9007)) +
cos(deg2rad(45.9007)) * cos(deg2rad(45.9007));
var_dump(acos($dist)); // float(0)
Actual result:
--------------
$dist = sin(deg2rad(45.9007)) * sin(deg2rad(45.9007)) +
cos(deg2rad(45.9007)) * cos(deg2rad(45.9007));
var_dump(acos($dist)); // double(NAN)
--
Edit bug report at https://bugs.php.net/bug.php?id=78627&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78627&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78627&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78627&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78627&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78627&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78627&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78627&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78627&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78627&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78627&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78627&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78627&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78627&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78627&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78627&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78627&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78627&r=mysqlcfg