Question about how to do 10^-1

Cornelius Riemenschneider c.r1 at gmx.de
Tue Jan 29 20:09:00 CET 2008


Hi,
for school I want to implement a little program with the Heron way of
computing square roots
Xn+1=1/2(Xn+A/Xn)
a>0,X0>0
Because this is an iterative method, I need a break-condition,
which is |(X(n+1)-Xn)|/Xn<=0,*precision*
Xn+1 is the newly computed value, Xn the one computed in the run before.
I want to tell the user do this with precision 10, 100,x, so I need to
get a value for
*precision*
normally, I'd just do precision=10^-(entered positive value), but the
power func of GMP only allows unsigned input. Can you hekp me or provide
 me some info's how to do this?
The precision variable needs to look after this operation for entered value
0,00001
Any help is greatly appreciated!
Cornelius


More information about the gmp-discuss mailing list