How to convert Array{Int64} to Array{BigInt}

Is there any function to do it?

v=[1,2,3]
BigInt.(v)

Broadcasting is your friend here.

3 Likes

WOW! What a awesome functionality!

Thanks!

It’s important to note that broadcasting is generic, ie if I write

function my_random_function(x)
    ... Do stuff... 
    return blahblahblah
end

then my_random_function.(v) will just work.

3 Likes

You can also just write

big.(v)

This will convert Int to BigInt and floats to BigFloat.

3 Likes