|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33991 Bug test #25665 fails on Solaris
Submitted: 2005-08-04 02:19 UTC Modified: 2005-08-05 11:08 UTC
From: akim at freedom dot com Assigned:
Status: Closed Package: Math related
PHP Version: 5CVS-2005-08-05 OS: Solaris 2.9 / SPARC
Private report: No CVE-ID: None
 [2005-08-04 02:19 UTC] akim at freedom dot com
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: =>         /www/freetds063/lib/ =>   /lib/ =>        /lib/ =>     /lib/ =>        /lib/ =>     /lib/ =>    /lib/ =>     /lib/ =>  /usr/local/lib/ =>       /lib/ =>         /usr/local/lib/ =>         /usr/local/lib/ =>    /lib/
        /usr/platform/SUNW,UltraAX-i2/lib/ =>        /lib/ =>    /lib/ =>   /lib/ =>   /lib/

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:

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-05 01:07 UTC]
What does this output for you:

# php -r 'var_dump(is_nan(acos(1.01)));'

 [2005-08-05 01:39 UTC] akim at freedom dot com

bash-2.05$ php -r 'var_dump(is_nan(acos(1.01)));'

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
 [2005-08-05 10:59 UTC]
Are you using GCC or some other compiler?

 [2005-08-05 11:08 UTC]
Nevermind, you use GCC. :) I'll change the test to be skipped on solaris, which has this broken behaviour. (all other OSes return NAN here)

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jun 23 22:01:29 2024 UTC