Re: Re: #41401 [Opn->Bgs]: Order of Operations error on divide by negative

From: Date: Wed, 16 May 2007 14:08:29 +0000
Subject: Re: Re: #41401 [Opn->Bgs]: Order of Operations error on divide by negative
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-29464@lists.php.net to get a copy of this message
On 16/05/07, Uwe Schindler <thetaphi@php.net> wrote:
Should all these three examples give the same result? $ php -r 'var_dump(-1/2*5, 1/-2*5, 1/2*-5);' float(-2.5) float(-0.1) float(-2.5) They should all give -2.5! But I think "normal programmers" will use braces in such situations... -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
If you use variables, then this works fine ... php -r "$a = 1; $b = -2; $c = 5; var_dump($a/$b*$c);" float(-2.5) -- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!"

« previous php.internals (#29464) next »