6 lines
255 B
Erlang
6 lines
255 B
Erlang
fixed_point(F, Guess, Tolerance) ->
|
|
fixed_point(F, Guess, Tolerance, F(Guess)).
|
|
fixed_point(_, Guess, Tolerance, Next) when abs(Guess - Next) < Tolerance ->
|
|
Next;
|
|
fixed_point(F, _, Tolerance, Next) ->
|
|
fixed_point(F, Next, Tolerance, F(Next)).
|