On Sun, Aug 12, 2012 at 08:19:41AM +0200, Alexander Burger wrote:
> > ...
> > | : (native "/home/my/folder/libR.so" "sqrt" 1.0 16)
> > | -> 1
> > ...

## Advertising

> I would recommend in general to call (load "@lib/math.l") before any
> floating point math, which sets the scale to 6 by default (unless it is
> set to another value beforehand).
And, one more point: 'sqrt' expects a double, so you must pass a cons
pair with the scale. In total, this should work (I didn't try, though):
(load "@lib/math.l")
(native "libR.so" "sqrt" 1.0 (16.0 . 1.0))
This will probably return 4000000 (4.0 as a scaled fixpoint number). To
get more readable results, try
(round (native "libR.so" "sqrt" 1.0 (16.0 . 1.0)))
Cheers,
- Alex
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe