You might prefer to multiply by 1.0 because adding 0.0 changes -0.0.

Cheers,
Jon.

> Some black magic is needed:
> 
> let r = ref 0.0 in
> for i = 0 to 1000_000_000 do r := float i done;
> Printf.printf "%f\n" (!r +. 0.);
> Printf.printf "words: %f\n" (Gc.stat ()).Gc.minor_words
> 
> and the reference will be placed in a register (Caml heap will not be
> used inside the loop)
> 
> - Dmitry Bely


_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to