Thanks Alex,
Upon reading your email, the next thing that I tried was...
(printf "float %g\n" (long@ [0.5 + 0.5]))
... which also doesn't work, probably because I'm on a 32-bit
platform, so long@ dereferences a value of the wrong size (I see in
object/st80/Float.st that Float represents a double-precision float).
My real question is: how can I pass floating-point arguments to
native library functions obtained by using dlopen/dlsym?
Thanks,
Josh
On May 28, 2007, at 2:24 AM, Alessandro Warth wrote:
Hi Josh,
Floating-point support does work, it just doesn't work the way you
think it does. The number 0.5 isn't a C-compatible float or double;
it's an object. So instead of writing
(+ 0.5 0.5)
you should write
[0.5 + 0.5]
The message-send expression above evaluates to a floating-point
object... to print it, you should write:
[StdOut print: [0.5 + 0.5]]
Otherwise what you'll see is the address of that object in memory.
Now, even if floating-point numbers weren't objects, it still
wouldn't make sense to add them using (+ ...), because (+ ...)
stands for native integer addition, and floating-point addition is
a different operation.
Cheers,
Alex
On 5/27/07, Joshua Gargus <[EMAIL PROTECTED]> wrote:
Hi,
I was dabbing a bit with jolt, and noticed that the floating-point
support is broken.
.(+ 0.5 0.5)
=> 272077144
I don't remember if Ian claimed that floating point actually worked
at some point, or if I misread SVN commit comments that were only
about partial steps towards floating point support. Anyone?
Thanks,
Josh
_______________________________________________
fonc mailing list
[email protected]
http://vpri.org/mailman/listinfo/fonc
_______________________________________________
fonc mailing list
[email protected]
http://vpri.org/mailman/listinfo/fonc