10 let rec fix fun:f :eq x =
15 let eq_float x y = abs_float (x -. y) < 1e-13
18 let top = Window.create `TOPLEVEL in
19 GtkSignal.connect sig:Object.Signals.destroy top callback:Main.quit;
20 let hbox = Box.create `VERTICAL in
21 Container.add top hbox;
22 let entry = Entry.create () in
23 Entry.set entry max_length:20;
24 let tips = Tooltips.create () in
25 Tooltips.set_tip tips entry text:"Initial value for fix-point";
26 let result = Entry.create () in
27 Entry.set result max_length:20 editable:false;
31 GtkSignal.connect sig:Editable.Signals.activate entry callback:
33 let x = try float_of_string (Entry.get_text entry) with _ -> 0.0 in
34 Entry.set entry text:(string_of_float (cos x));
35 let res = fix fun:cos eq:eq_float x in
36 Entry.set result text:(string_of_float res)