Author Topic: integer range - out of range..etc  (Read 688 times)

Offline Wakish

  • Level 14
  • *
  • Posts: 111
  • Reputation: +0/-1
    • View Profile
    • Wakish Wonderz
integer range - out of range..etc
« on: January 29, 2008, 03:42:54 AM »
I'm having a problem with integer range with php/mysql
Setting mysql integer value to bigint increases the range to a high enough value, but the problem is when php outputs it, it gets out of range (1.2542+E - something like this)

How do you cope with this?

Offline Zeggy

  • Global Moderator
  • Level 35
  • *****
  • Posts: 1,187
  • Reputation: +13/-4
    • View Profile
Re: integer range - out of range..etc
« Reply #1 on: January 29, 2008, 04:58:57 AM »
Try the intval() function :)

Offline Wakish

  • Level 14
  • *
  • Posts: 111
  • Reputation: +0/-1
    • View Profile
    • Wakish Wonderz
Re: integer range - out of range..etc
« Reply #2 on: January 29, 2008, 11:03:38 AM »
But the integer will be limited to 2147483647 only?

Offline Zeggy

  • Global Moderator
  • Level 35
  • *****
  • Posts: 1,187
  • Reputation: +13/-4
    • View Profile
Re: integer range - out of range..etc
« Reply #3 on: January 29, 2008, 12:08:46 PM »
Get a 64 bit system :D

lol, j/k.

hmm, interesting problem...

You can use the set of GMP functions:
http://nl.php.net/gmp

The one you need is this one I think:
http://nl.php.net/manual/en/function.gmp-strval.php

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal