File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 66<?php
77echo "Test 1: Factorial of 2^50 + 1 \n" ;
88try {
9- $ value = 2 ** 50 + 1 ;
10- echo "Calculating factorial of: $ value \n" ;
9+ $ value = gmp_add ( gmp_pow ( 2 , 50 ), 1 ) ;
10+ echo "Calculating factorial of: " , gmp_strval ( $ value), " \n" ;
1111 $ result = gmp_fact ($ value );
1212 echo "Result: " . gmp_strval ($ result ) . "\n" ;
1313} catch (\ValueError $ e ) {
1818
1919echo "\nTest 2: Another large value \n" ;
2020try {
21- $ value = 1000000000000 ; // 1 trillion
22- echo "Calculating factorial of: $ value \n" ;
21+ $ value = gmp_init ( ' 1000000000000 ' ) ; // 1 trillion
22+ echo "Calculating factorial of: " , gmp_strval ( $ value), " \n" ;
2323 $ result = gmp_fact ($ value );
2424 echo "Result: " . gmp_strval ($ result ) . "\n" ;
2525} catch (\ValueError $ e ) {
@@ -55,4 +55,4 @@ Test 3: Moderately large value that should work
5555Calculating factorial of: 100
5656Result length: 158 digits
5757
58- Done
58+ Done
You can’t perform that action at this time.
0 commit comments