Arbitrary-precision integers (included): Difference between revisions
Arbitrary-precision integers (included) (view source)
Revision as of 11:54, 27 May 2022
, 2 years agono edit summary
(fix name) |
No edit summary |
||
Line 2,333:
n digits = 183231
Iterative elasped: 2412.5477 milliseconds.</pre>'''Remarks:''' Not much difference in execution times for three methods. But the exponents are relatively small. If one does need to evaluate an exponent greater than '''Int32.MaxValue''', the execution time will be measured in hours.
=={{header|Vlang}}==
<lang vlang>import math.big
import math
fn main() {
mut x := u32(math.pow(3,2))
x = u32(math.pow(4,x))
mut y := big.integer_from_int(5)
y = y.pow(x)
str := y.str()
println("5^(4^(3^2)) has $str.len digits: ${str[..20]} ... ${str[str.len-20..]}")
}</lang>
{{out}}
<pre>
5^(4^(3^2)) has 183231 digits: 62060698786608744707 ... 9225625991821289062
</pre>
=={{header|Wren}}==
|