BigFloat loses precision on simple operations

Consider the following operation, effectively raising 1.0003 to the zeroth power, which should give 1 to high precision. But the output answer is correct only to 2 digits. What am I doing wrong?

setprecision(BigFloat, 2048) do
    N = BigFloat("1.0003")
    S = N^2
    T = S^BigFloat("-2")
    println(S)
    println(T)
    @show N.prec
    @show S.prec
    @show T.prec
end

1.00060009000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006
0.998800899460283363981209766821321428156826636405424484661643582132123833869202023941249413307299194267877540193491761251973877782287932256911154666379139503538676939375046908448816853422361662343762039258796959186150590922100709574753779447800773573318277742654515673496936793187681961445711493463612642920501001030401197976389749419078717542211077880390587563193868612391879372663858784504235958579674789390475785580413842269254173277611464659432178456393544620005898511928430355155204871700689570839489110507083202535467976028287920518240107473247937569049542696259772380374569992504464097465007950669492921731039225
N.prec = 2048
S.prec = 2048
T.prec = 2048

First of all: welcome to our community!

Second, my math may be rusty, but I think there is no reason why, for any number x, (x ^ 2) ^ -2 should give 1.

julia> x = 11//10 
11//10

julia> x ^ 2
121//100

julia> (x ^ 2) ^ -2
10000//14641

julia> float((x ^ 2) ^ -2)
0.6830134553650707

I think you are thinking about multiplying the square root of x with x squared.

julia> (x^2) * (x ^ -2)
1//1
4 Likes

This is what Mathematica says
Screen Shot 2020-11-23 at 4.48.45 AM

1 Like

wow guys, thanks, Iā€™m really sorry for such a dumb mistake.

1 Like

No worries! Perhaps you could select the best answer and mark the question as solved?

1 Like