php.net |  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: akim at freedom dot com
New email:
PHP Version: OS:

 

 [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)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-05 01:07 UTC] sniper@php.net
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
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
 [2005-08-05 10:59 UTC] sniper@php.net
Are you using GCC or some other compiler?


 [2005-08-05 11:08 UTC] sniper@php.net
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-2022 The PHP Group
All rights reserved.
Last updated: Sun Nov 27 00:03:58 2022 UTC