Re: IntVal(float) Returns Different Values (Porting Delphi code to mix a block of data)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 20, 2006 at 10:13:21AM -0500, Bruce wrote:
> I am having trouble porting some code originally written in Borland Delphi
> to PHP. The Delphi code expects certain behavior on integer overflows that I
> can only duplicate on some PHP systems. For example:
> 
> $BB = -2181087916;
> $AA = (int)$BB;
> $AA = intval($BB);
> 
> On some systems, $AA will be (int)-2147483648, however, on most systems, $AA
> will be (int)2113879380, which is the same value truncated at 32 bits. It is
> this latter behavior that I need to properly port the Delphi code.

Two modules that come to mind:

  http://php.net/bcmath
  http://php.net/gmp


Since your code does some or and xoring gmp sounds like the GMP
method will be the  best one. The down fall is it will add the
requirement to add the library and rebuild php with it.

Curt.
-- 
cat .signature: No such file or directory

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux