There is a problem with square roots in mathlib.sma The conversion to string in binary in estimateroot function will give a string too long error
Try taking square root of 45.053164859997081458307!
Below is a possible fix. Newton’s method. The first estimate is estimate on integer part of n, using what was already written.
// n = number for which to find squareroot
// est = first estimate using what was written already on the integer part of n
// i = int(n)
// est = sqrt(i,2)
number n, est, num, denom, sub, sqroot, fixed
integer i, precount
// 45.053164859997081458307
n = 45053164859997081458307/1000000000000000000000
i = int(n)
precount = 0
est = sqrt(i,2)
while fixed <> .fix(est,100000000000000)
fixed = .fix(est,100000000000000)
num = raisetopower(est,2) – n
denom = 2*est
sub = (num/denom)
sqroot = est – sub
est = sqroot
precount = precount + 1
end while