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

From: Date: Mon, 20 Mar 2006 19:09:42 +0000
Subject: Re: IntVal(float) Returns Different Values (Porting Delphi code to mix a block of data)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-232246@lists.php.net to get a copy of this message
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

« previous php.general (#232246) next »