Your Ad Here Your Ad Here
Results 1 to 5 of 5

Thread: Multiplying In Php

  1. #1
    vivitron 15's Avatar Poster
    Join Date
    Jan 2003
    Location
    North East England, UK
    Posts
    1,772
    I have a project which relies on a php form multiplying 2 large numbers but Im having a problem with the output:

    Originally posted by my_code

    <? &#036;number1=123456789012;
    &#036;number2 = 9876543214327;
    &#036;numbertotal=&#036;number1*&#036;number2;

    &#036;shouldbe=1219326311779068734574924;

    print(&#036;numbertotal . "
    " . &#036;shouldbe);

    if (&#036;numbertotal==&#036;shouldbe) {
    &nbsp; &nbsp; print("
    YES");
    } else {
    &nbsp; &nbsp; print("
    NO");
    };

    ?>
    now the output i get is &#036;numbertotal=1.21932 E 24 and NO.

    anyone know how i get rid of the exponential description and get it expressed as a simple integer?
    <insert signature here>

  2. Internet, Programming and Graphics   -   #2
    Poster
    Join Date
    Jun 2003
    Location
    Yet to be determined
    Posts
    1,076
    Code:
    &#60;?php
    &#036;numone=123456789012;
    &#036;numtwo = 9876543214327;
    echo bcmul&#40;&#036;numtwo, &#036;numone&#41; . &#34;&#092;n&#34;;
    ?&#62;

  3. Internet, Programming and Graphics   -   #3
    vivitron 15's Avatar Poster
    Join Date
    Jan 2003
    Location
    North East England, UK
    Posts
    1,772
    when i try this i get no output - just a blank screen
    <insert signature here>

  4. Internet, Programming and Graphics   -   #4
    Poster
    Join Date
    Jun 2003
    Location
    Yet to be determined
    Posts
    1,076
    You will prboally need to install BCMath..

    http://php.us.themoes.org/manual/en/ref.bc.php

  5. Internet, Programming and Graphics   -   #5
    vivitron 15's Avatar Poster
    Join Date
    Jan 2003
    Location
    North East England, UK
    Posts
    1,772
    ah, k thanks...

    Ill have to speak with my ISP i guess
    <insert signature here>

Bookmarks

Posting Permissions

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