⍝ Fast multi-digit power using FFT:

⍝ xpower requires a version of the interpreter that supports complex arithmetic:

⍝ Fast multi-digit power using FFT:

    6 5 5 3 6 xpower 2      ⍝ digits * num.
4 2 9 4 9 6 7 2 9 6

    16 xpower 4             ⍝ num * num
6 5 5 3 6

    1 6 xpower 4            ⍝ digits * num
6 5 5 3 6

    ↑{⎕D[⍵+⎕IO]}¨ 2 xpower¨2*0 to 8     ⍝ powers of powers of 2.
2                                                                             
4                                                                             
16                                                                            
256                                                                           
65536                                                                         
4294967296                                                                    
18446744073709551616                                                          
340282366920938463463374607431768211456                                       
115792089237316195423570985008687907853269984665640564039457584007913129639936

Back to: code

Back to: Workspaces