Version française
Home     About     Download     Resources     Contact us    
Browse thread
Constructing all float tuples in C
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Daniel_Bünzli <daniel.buenzli@e...>
Subject: Re: [Caml-list] Constructing all float tuples in C
You are allocating an array of floats. But a tuple of floats is not  
an array of floats. In a tuple of floats, floats are boxed. Floats  
are unboxed only in records with float fields only or in arrays of  
floats.

So it should your code should be something like :

CAMLlocal1(t);
t = alloc_tuple (3);
Store_field (t, 0, copy_double(obj[0]));
Store_field (t, 1, copy_double(obj[1]));
Store_field (t, 2, copy_double(obj[2]));

Daniel