Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post number_format stops calculating?

    can any one let me know how to get my script to calculate past 18 quintrillion it seems to stop at a little over that amount

    this is a little of the script in the number area

    function net ($id){
    global $tab;
    $pmp = mysql_fetch_array(mysql_query("SELECT whore,thug FROM $tab[pimp] WHERE id='$id';"));
    $net=($pmp[0]*67+$pmp[1]*15);
    $net=number_format(($net), 2, '.', '');

    return"$net";
    }

    function money ($trn)
    {
    global $id, $tab;
    $pmp = mysql_fetch_array(mysql_query("SELECT hoe,payout FROM $tab[pimp] WHERE id='$id';"));
    $rand1=(rand(4, 8));$rand2=(rand(5, 10));
    $money=$trn*(rand($rand1, $rand2));
    $money=($money*$pmp[0]);
    $tax=round($money*($pmp[1]/50));
    $money=number_format(($money-$tax), 2, '.', '');

    return"$money";
    }

    but i cant seem to get the amount in the round to go past the 18 quintrillion mark

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Is the number:
    18 446 744 073 709 551 615
    ?
    If so, nothing is wrong with your code. You've simply exceeded the value of a double value.
    Anyway, if this is the case, you need to start using a string representation of your number, and figuring out a way to calculate the value from there. I have no current suggestions for you, as I've never needed to deal with numbers that large (I have never exceeded the requirements of a 32 bit real number).
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    As per the board rules, which you agreed to when you joined, I would suggest you make every effort to avoid posting inappropriate material. I understand that it happened to be hard-coded into your script, but at codingforums, people of all ages participate, including children, and this type of material is not acceptable.

    Also, I just want to point out that tho I am not a minor, I find this material to be very repulsive and vulgar.

    Regards
    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •