|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-08-04 02:19 UTC] akim at freedom dot com
Description:
------------
acos() function returns "0" rather than "NAN" for values of |x| > 1. Among other things this causes test ext/standard/tests/math/bug25665.phpt to fail.
This may be caused by ambiguous handling of out-of-range arguments in the Solaris implementation of acos(). From the acos() man page: "If the value of x is not in the range [-1,1], and is not +-Inf or NaN, either 0.0 or NaN is returned and errno is set to EDOM."
Configure line:
./configure --with-apxs=/www/apache/bin/apxs --with-mssql=/www/freetds063 --enable-ftp
Dependencies:
libsybdb.so.5 => /www/freetds063/lib/libsybdb.so.5
libnsl.so.1 => /lib/libnsl.so.1
libsocket.so.1 => /lib/libsocket.so.1
libc.so.1 => /lib/libc.so.1
libresolv.so.2 => /lib/libresolv.so.2
libm.so.1 => /lib/libm.so.1
libdl.so.1 => /lib/libdl.so.1
libz.so.1 => /lib/libz.so.1
libxml2.so.2 => /usr/local/lib/libxml2.so.2
libpthread.so.1 => /lib/libpthread.so.1
libiconv.so.2 => /usr/local/lib/libiconv.so.2
libgcc_s.so.1 => /usr/local/lib/libgcc_s.so.1
libmp.so.2 => /lib/libmp.so.2
/usr/platform/SUNW,UltraAX-i2/lib/libc_psr.so.1
libthread.so.1 => /lib/libthread.so.1
librt.so.1 => /lib/librt.so.1
libaio.so.1 => /lib/libaio.so.1
libmd5.so.1 => /lib/libmd5.so.1
/usr/platform/SUNW,UltraAX-i2/lib/libmd5_psr.so.1
gcc -v output:
Reading specs from /usr/local/lib/gcc/sparc-sun-solaris2.9/3.4.2/specs
Configured with: ../configure --with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/ld --disable-nls
Thread model: posix
gcc version 3.4.2
Reproduce code:
---------------
<?php
set_time_limit(5);
var_dump(acos(1.01));
var_dump(log(0));
?>
Expected result:
----------------
float(NAN)
float(-INF)
Actual result:
--------------
float(0)
float(-INF)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 20:00:01 2025 UTC |
Output: bash-2.05$ php -r 'var_dump(is_nan(acos(1.01)));' bool(false) I also cooked this up to test the hypothesis: #include <stdio.h> #include <math.h> void main() { double a; a = 1.01; printf("The value of acos(%f) is %f\n", a, acos(a)); } Output from this is: The value of acos(1.010000) is 0.000000