Hi Thorsten,

> I'm trying to call statistic program R (http://www.r-project.org/) with
> the 'native' function (http://software-lab.de/doc/native.html).
> 
> I found a libR.so in my R distribution, copied it to my home folder and
> changed the owner form root to my own user:
> 
> ,---------------------------------------------------------
> | -rwxr-xr-x     1 me  users 3143048 30. Jun 09:10 libR.so
> `---------------------------------------------------------

OK, though it would probably not be necessary to copy it. If the
original lib is included in your load library path, you don't even need
to specify the full pathname.


> I can make 'native' work, but I don't really understand the outcomes: 
> 
> ,---------------------------------------------------
> | : (native "/home/my/folder/libR.so" "sqrt" 1.0 16)
> | -> 1
> | : (native "/home/my/folder/libR.so" "sqrt" 'N 16)
> | -> 140734293053190
> | : (native "/home/my/folder/libR.so" "sqrt" 'I 16)
> | -> 1099665158
> | : (native "/home/my/folder/libR.so" "sqrt" 'S 16)
> | -> NIL
> `---------------------------------------------------

The first call is correct, because I assume that 'sqrt' wants to return
a "double" value.

The problem is just that you probably didn't set the scale value, so it
defaults to zero. Try (scl 6) or (scl 15) initially.

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).


> Might the [1] in '[1] 4' be the culprit, that is always returned, no
> matter whats the actual argument/result? 

This is only the debugging output, not part of the result.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to