You are here: Re: [PHP] Calculation error - PHP not following math hierarchi ??? « PHP « IT news, forums, messages
Re: [PHP] Calculation error - PHP not following math hierarchi ???

Posted by Rene Brehmer on 08/03/05 21:24

Documented research indicate that on Wed, 3 Aug 2005 16:38:08 +0100, Robin
Vickery wrote:

> On 8/3/05, Rene Brehmer <piv@metalbunny.net> wrote:
>> Using this function:
>>
>> function calc_distance($curX,$curY,$newX,$newY) {
>> // calculate distance to new location
>> $distX = abs($curX - $newX);
>> $distY = abs($curY - $newY);
>>
>> if ($distX <= 150 && $distY <= 150) {
>> $dist = sqrt($distX^2 + $distY^2);
>
> I don't think you really want to do a bitwise xor there.
>
> http://www.php.net/manual/en/language.operators.bitwise.php
>
> Try pow() instead
>
> http://www.php.net/manual/en/function.pow.php

Thanks. I didn't know it was a bitwise operator ... Was trying to find the
right way to go about it in the manual, but when you don't know what it's
called in English, it's a bit of a problem ... and since the Danish version
of the manual isn't up to date, I don't really use it...

But thanks, looks like what I want ... thank you...


Rene

--
Rene Brehmer
aka Metalbunny

We have nothing to fear from free speech and free information on the
Internet, but pop-up advertising!

http://metalbunny.net/
My little mess of things...

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация