waTeim / node-julia

Fast and simple access to Julia embedded in node
MIT License
80 stars 15 forks source link

Failed with Typed Array allocated by V8 as input argument #33

Open complyue opened 8 years ago

complyue commented 8 years ago

Typed array as input argument works correctly if returned from Julia:

> var a=julia.eval('[1.1,2.2,3.3]'); a
Float64Array [ 1.1, 2.2, 3.3 ]
> julia.exec('identity',a)
Float64Array [ 1.1, 2.2, 3.3 ]
>

But if created by V8:

> a=new Float64Array([1.1,2.2,3.3]),a
Float64Array [ 1.1, 2.2, 3.3 ]
> julia.exec('identity',a)
Float64Array [ 0, 0, 3.2999999999883594 ]
> 

Test env FYI.

cymp:datatags cyue$ uname -a
Darwin cymp.local 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64
cymp:datatags cyue$ node
> process.version
'v6.2.2'
> const julia=require('node-julia')
undefined
> julia.eval('VERSION')
JRef { build: null, major: 0, minor: 4, patch: 6, prerelease: null }
>