On 8/27/06, John Cowan <[EMAIL PROTECTED]> wrote:
Shawn Rutledge scripsit:

> impl.c:
>
> #include <math.h>
>
> float baz(int i)
> {
>        return (((float)i) / 15.2);
> }

Note that "float" in Chicken foreign types is a synonym for "double",
whereas "float" in C means single-float and "double" means double-float.
So you need to change the C code to say "double" in both place
in order to get this to work at all (except by luck).

That doesn't seem to be enough.

double baz(int i)
{
       return (double)i / 2.35;
}

(define baz (foreign-lambda float "baz" int))
(display baz)
(display (baz 42))

./callit
#<procedure (baz a25)>42.0


_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to