Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. I check, compile and run every program. Contact me at: aviboots(AT)netvision.net.il

Hostgator - Save 50% Off Your New Optimized WordPress Hosting With Coupon: WDA50

BlueHost Web Hosting

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

Dedicated Hosting Superb Internet

simplilearn big data and analytics

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

Buy Cool Shirts

getflywheel wordpress hosting


Distribute your Resume to 500+ Job Boards & Recruiters


6,300 questions

8,938 answers

573 users

How to output (print) large integers and doubles in PHP

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial


7 views
asked Sep 3 by avibootz

1 Answer

0 votes
echo "\n</br>";
foreach ([1, 2, 3, 4, 5, 7, 11, 14] as $n) 
{
    $pw = pow(1024, $n);
    printf("pow(1024, %d) = (%9s) %20s %40.0F", $n, gettype($pw), $pw, $pw);
    echo "  ", $pw, "\n</br>";
}


/*
run: 
 
pow(1024, 1) = ( integer) 1024 1024 1024 
pow(1024, 2) = ( integer) 1048576 1048576 1048576 
pow(1024, 3) = ( integer) 1073741824 1073741824 1073741824 
pow(1024, 4) = ( double) 1099511627776 1099511627776 1099511627776 
pow(1024, 5) = ( double) 1.1258999068426E+15 1125899906842624 1.1258999068426E+15 
pow(1024, 7) = ( double) 1.1805916207174E+21 1180591620717411303424 1.1805916207174E+21 
pow(1024, 11) = ( double) 1.2980742146337E+33 1298074214633706907132624082305024 1.2980742146337E+33 
pow(1024, 14) = ( double) 1.3937965749082E+42 1393796574908163946345982392040522594123776 1.3937965749082E+42 
 
*/

 




answered Sep 3 by avibootz
edited Sep 3 by avibootz
...