caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Int32 vs float unboxing
@ 2011-08-22  7:19 Dmitry Bely
  2011-08-22  7:58 ` Alain Frisch
  2011-08-24  8:10 ` [Caml-list] " Dmitry Bely
  0 siblings, 2 replies; 4+ messages in thread
From: Dmitry Bely @ 2011-08-22  7:19 UTC (permalink / raw)
  To: Caml List

In the code below "s" reference is unboxed in sum_float loop, but not
in sum_in32. Why?

let sum_int32 v =
  let s = ref 0l in
  for i=0 to (Array.length v)-1 do
    s := Int32.add !s (Array.unsafe_get v i)
  done;
  Int32.add !s Int32.zero

let sum_float v =
  let s = ref 0. in
  for i=0 to (Array.length v)-1 do
    s := !s +. (Array.unsafe_get v i)
  done;
  !s +. 0.

- Dmitry Bely

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-08-24  8:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-22  7:19 [Caml-list] Int32 vs float unboxing Dmitry Bely
2011-08-22  7:58 ` Alain Frisch
2011-08-22  8:33   ` Dmitry Bely
2011-08-24  8:10 ` [Caml-list] " Dmitry Bely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).