I am finding the cube root of a big number. When I raise the answer to the power of 3, I ended up with a different number.
julia> y = 2205316413931134031046440767620541984801091216351222789180535786851451917462804449135087209259828503848304180574549372616172217553002988241140344023060716738565104171296716554122734607654513009667720334889869007276287692856645210293194853
2205316413931134031046440767620541984801091216351222789180535786851451917462804449135087209259828503848304180574549372616172217553002988241140344023060716738565104171296716554122734607654513009667720334889869007276287692856645210293194853
julia> x = BigInt(BigInt(y) ^ (BigInt(1)/BigInt(3)))
13016382529449106065839070830454998857466392684017754632233814825405652260970880
julia> x ^ BigInt(3)
2205316413931134031046440767620541984801091216351222789180535786851451917468010747269793145541333050162118216925368707794887629451553641866690547562191367342837416208560274377321512108411649807242343108436126660405507526307305662185472000
julia> x ^ BigInt(3) == y
false
Let’s try this:
julia> z = 13016382529449106065839070830454998857466392684017754632233814825405652260960637
13016382529449106065839070830454998857466392684017754632233814825405652260960637
julia> z ^ BigInt(3)
2205316413931134031046440767620541984801091216351222789180535786851451917462804449135087209259828503848304180574549372616172217553002988241140344023060716738565104171296716554122734607654513009667720334889869007276287692856645210293194853
julia> z ^ BigInt(3) == y
true
You may wonder how I obtain the value of z
. It came from our old friend Python:
>>> from decimal import *
>>> getcontext().prec = 100
>>> Decimal(2205316413931134031046440767620541984801091216351222789180535786851451917462804449135087209259828503848304180574549372616172217553002988241140344023060716738565104171296716554122734607654513009667720334889869007276287692856645210293194853) ** (Decimal(1)/Decimal(3))
Decimal('13016382529449106065839070830454998857466392684017754632233814825405652260960636.99999999999999999976')