LOGO-L> Newton with Logo and Real-Types

It's ugly but it works.

make "x 555.123456789

show (int :x*power 10 4)/power 10 4

555.1234

show (int :x*power 10 5)/power 10 5

555.12345

It's always risky comparing floating point numbers

unless they are derived in EXACTLY the same manner so

you end up with the same approximations (errors).

Quote:

> Hi,

> i've write a short programm that calculate the 0-device with newton.

> x(n+1) = x(n) - f(x) / f'(x)

> I try to check the x(n) and x(n+1), if they are equal, the program

> should be stoped, but it doesn't work.

> My Syntax: until [:xnold=:xn][newton]

> How I can round (?) my variables at 15 numbers after the comma.

> In my Pascal Programm:

> Repeat

> xold := x;

> Writeln(x:5:10);

> x := newton(x);

> until xold = x;

> x and xold are variables of the type "extended", a real type with 20

> numbers after the comma

> Thanks a lot

> Phil

> ---------------------------------------------------------------

---------------------------------------------------------------