Re: INF behavior
| From: | Julien Pauli | Date: | Tue, 31 May 2011 19:39:59 +0000 |
| Subject: | Re: INF behavior | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-52572@lists.php.net to get a copy of this message | ||
Agree with Derick, strictly speaking, in maths science, INF != INF.
But I dont care if PHP tells me than yes, because PHP is not designed
to solve high level maths problems :)
Cheer,
Julien.Pauli
On Fri, May 27, 2011 at 4:48 PM, Derick Rethans <derick@php.net> wrote:
> On Thu, 26 May 2011, Scott MacVicar wrote:
>
>> On 26 May 2011, at 20:03, Philip Olson <philip@roshambo.org> wrote:
>>
>> > Hello geeks,
>> >
>> > A geek is needed to clarify PHP bug #45712. This is an edge case but the test
>> > (bug45712.phpt) contains code similar to the following:
>> >
>> > <?php
>> > $inf = pow(0, -2);
>> >
>> > var_dump($inf); // float(INF)
>> > var_dump($inf == $inf); // bool(false)
>> > var_dump($inf === $inf); // bool(true)
>> > ?>
>> >
>> > That's how it's behaved since ~forever (AFAICT) and remains in 5.3.7-dev,
>> > but PHP 5.4.0-dev changes behavior so both now return true.
>> >
>> > Is this is how we want it? And how should this be documented/explained?
>>
>> I think I changes this :-)
>>
>> It didn't make sense that == and === produce different results..
>>
>> Though if someone has a better understanding of maths then we can fix it..
>
> I think it does make sense. == is the equal operator, and INF is not
> equal to INF (just like SQL NULL is not equal to NULL). However, they
> are identical (like you can test in SQL with NULL IS NULL).
>
> cheers,
> Derick
>
> --
> http://derickrethans.nl |
> http://xdebug.org
> Like Xdebug? Consider a donation: http://xdebug.org/donate.php
> twitter: @derickr and @xdebug
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>