Re: [PHP] Integer question

2007-03-23 Thread Tijnema !

On 3/23/07, Richard Lynch [EMAIL PROTECTED] wrote:

On Thu, March 22, 2007 2:33 pm, Tijnema ! wrote:
  2).  How do you handle numbers that large, while maintaining
 precision.

 keep them as strings - and/or use a 64bit machine?

 a 64bit machine would make the number larger, not unlimited :)

Even GMP (or BC) isn't unlimited...

It's just limited to the number of bytes you have in RAM/swap. :-)


Yeah, well if you have a few TB of space, which you set up as swap,
the number would come really close to unlimited :) But of course it is
limited :P
So if you have 10 TB of swap(I believe current kernels can't handle
that, but that's another story) you could get a number as big as
2^87960930222081
Tell me any example where you would use a number larger than that :)

Tijnema



--
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?




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



[PHP] Integer question

2007-03-22 Thread Matt Carlson
When dealing with large numbers inside of php, I know at the int limit, a 
variable is recast into float.



1).  How do you return the true number of the float when it reaches the upper 
limits of mysql's bigint (9223372036854775807).

2).  How do you handle numbers that large, while maintaining precision.
3).  Is there a php equivalent of unsigned?

Thanks all





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



[PHP] Integer question

2007-03-22 Thread Matt Carlson
When dealing with large numbers inside of php, I know at the int limit, a 
variable is recast into float.



1).  How do you return the true number of the float when it reaches the upper 
limits of mysql's bigint (9223372036854775807).

2).  How do you handle numbers that large, while maintaining precision.
3).  Is there a php equivalent of unsigned?

Thanks all





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



Re: [PHP] Integer question

2007-03-22 Thread Tijnema !

On 3/22/07, Matt Carlson [EMAIL PROTECTED] wrote:

When dealing with large numbers inside of php, I know at the int limit, a 
variable is recast into float.



1).  How do you return the true number of the float when it reaches the upper 
limits of mysql's bigint (9223372036854775807).

2).  How do you handle numbers that large, while maintaining precision.
3).  Is there a php equivalent of unsigned?

Thanks all



Hmm, better have a look at the gmp functions : www.php.net/gmp
if you don't have the gmp math library installed, you might want to
look at the worses alternative bcmath, which is automatically build
into php: www.php.net/bc

Tijnema





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




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



Re: [PHP] Integer question

2007-03-22 Thread Jochem Maas
Matt Carlson wrote:
 When dealing with large numbers inside of php, I know at the int limit, a 
 variable is recast into float.
 
 
 
 1).  How do you return the true number of the float when it reaches the upper 
 limits of mysql's bigint (9223372036854775807).

I can't see how that is possible, once its 'floated' the precise int is gone.
although you might consider returning the given mysql bigint field as a
string 'CAST() AS STRING' (or whatever the syntax is) and then using the string 
inconjunction with
the bc or gmp extensions.

 2).  How do you handle numbers that large, while maintaining precision.

keep them as strings - and/or use a 64bit machine?

 3).  Is there a php equivalent of unsigned?

no

 
 Thanks all
 
 
 
 
 

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



Re: [PHP] Integer question

2007-03-22 Thread Tijnema !

On 3/22/07, Jochem Maas [EMAIL PROTECTED] wrote:

Matt Carlson wrote:
 When dealing with large numbers inside of php, I know at the int limit, a 
variable is recast into float.



 1).  How do you return the true number of the float when it reaches the upper 
limits of mysql's bigint (9223372036854775807).

I can't see how that is possible, once its 'floated' the precise int is gone.
although you might consider returning the given mysql bigint field as a
string 'CAST() AS STRING' (or whatever the syntax is) and then using the string 
inconjunction with
the bc or gmp extensions.

 2).  How do you handle numbers that large, while maintaining precision.

keep them as strings - and/or use a 64bit machine?


a 64bit machine would make the number larger, not unlimited :)



 3).  Is there a php equivalent of unsigned?

no


 Thanks all






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




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



Re: [PHP] Integer question

2007-03-22 Thread Jochem Maas
Tijnema ! wrote:
 On 3/22/07, Jochem Maas [EMAIL PROTECTED] wrote:
 Matt Carlson wrote:
  When dealing with large numbers inside of php, I know at the int
 limit, a variable is recast into float.
 
 
 
  1).  How do you return the true number of the float when it reaches
 the upper limits of mysql's bigint (9223372036854775807).

 I can't see how that is possible, once its 'floated' the precise int
 is gone.
 although you might consider returning the given mysql bigint field as a
 string 'CAST() AS STRING' (or whatever the syntax is) and then using
 the string inconjunction with
 the bc or gmp extensions.

  2).  How do you handle numbers that large, while maintaining precision.

 keep them as strings - and/or use a 64bit machine?
 
 a 64bit machine would make the number larger, not unlimited :)

this I understand, 64bits may give him enough precision
for his needs though.


 

  3).  Is there a php equivalent of unsigned?

 no

 
  Thanks all
 
 
 
 
 

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



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



Re: [PHP] Integer question

2007-03-22 Thread Richard Lynch
On Thu, March 22, 2007 2:33 pm, Tijnema ! wrote:
  2).  How do you handle numbers that large, while maintaining
 precision.

 keep them as strings - and/or use a 64bit machine?

 a 64bit machine would make the number larger, not unlimited :)

Even GMP (or BC) isn't unlimited...

It's just limited to the number of bytes you have in RAM/swap. :-)

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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