Re: [PHP] Re: negative numbers

2004-12-28 Thread Jason Wong
On Tuesday 28 December 2004 01:13, Ford, Mike wrote: > > abs(): > > > > $doo = -20; > > for ($i = 1; $i < 1000; $i++) { > > $dah = abs($doo); > > } > > That's not a valid benchmark, since only on the first pass through the loop > is $doo negative. I'm not sure what you m

Re: [PHP] Re: negative numbers

2004-12-27 Thread Curt Zirzow
* Thus wrote Ford, Mike: > To view the terms under which this email is distributed, please go to > http://disclaimer.leedsmet.ac.uk/email.htm > > > > > -Original Message- > > From: Jason Wong > > Sent: 27/12/04 10:16 > > > > On Monday 27 December 2004 12:40, Richard Lynch wrote: > > >

RE: [PHP] Re: negative numbers

2004-12-27 Thread Ford, Mike
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm > -Original Message- > From: Jason Wong > Sent: 27/12/04 10:16 > > On Monday 27 December 2004 12:40, Richard Lynch wrote: > > > If you want to mimic the behaviour of abs (a

Re: [PHP] Re: negative numbers

2004-12-27 Thread Greg Donald
On Mon, 27 Dec 2004 18:16:21 +0800, Jason Wong <[EMAIL PROTECTED]> wrote: > ternary: > >$doo = -20; >for ($i = 1; $i < 1000; $i++) { >$dah = ($doo < 0) ? - $doo : $doo; >} > > abs(): > >$doo = -20; >for ($i = 1; $i < 1000; $i++) { >$dah = abs($doo); >

Re: [PHP] Re: negative numbers

2004-12-27 Thread Jason Wong
On Monday 27 December 2004 12:40, Richard Lynch wrote: > If you want to mimic the behaviour of abs (allowing for positive numbers) > and performance was an issue, that: > $x = ($x < 0) ? - $x : $x; > > is most likely faster than abs() Having nothing better to do I decided to benchmark this: tern