|
Posted by vendredi5h on 06/12/06 16:28
Kimmo Laine a écrit :
> I did a little more testing and by golly, it seems actually to be working, I
> get the same result out what goes in
>
> $x = unpack('L2long', pack('d',999999.999999));
> $y = unpack('ddouble', pack('L2',$x['long1'],$x['long2']));
>
> print_r($x);
> print_r($y);
>
> So apparently the pack and it's evil twin sister unpack offer a workaround
> for splitting numbers to high and low end.
Hello Kimmo,
I'll have to look at both functions syntax in order to understand how
it works, but it works!
Thanks for that.
And I agree with Tom when he says that PHP has not been created for
that kind of work. Doing that in C, I used an union to reach
float/double's bits.
Thanks guys for your time.
Yannick
[Back to original message]
|