Yeppp.jl icon indicating copy to clipboard operation
Yeppp.jl copied to clipboard

Wrong result using 32-bit Julia on 64-bit system

Open panlanfeng opened this issue 9 years ago • 5 comments

Yeppp.exp! gives wrong result without any warning if using 32-bit Julia if the system is actually 64-bit.

I am not sure how to decide if the system is 64-bit or 32-bit. So now the dependency will not be installed if Sys.ARCH is not :x86_64 to be safe. The user should choose the library themselves if they use 32-bit Julia.

panlanfeng avatar Aug 24 '15 04:08 panlanfeng

Cc: @Maratyszcza

ViralBShah avatar Aug 24 '15 06:08 ViralBShah

I'd be surprised if there were any difference between using 32 bit yeppp on a 32 bit machine vs using 32 bit yeppp on a 64 bit machine.

tkelman avatar Aug 24 '15 07:08 tkelman

I can reproduce the problem. The cause is not clear yet.

Maratyszcza avatar Aug 24 '15 15:08 Maratyszcza

I tested on both 32-bit julia and 64-bit julia on a 64-bit windows. Yeppp.exp! on 32-bit julia calling x86 Yeppp! library gives the wrong result.

julia> versioninfo()
Julia Version 0.3.11
Commit 483dbf5* (2015-07-27 06:18 UTC)
Platform Info:
  System: Windows (i686-w64-mingw32)
  CPU: Intel(R) Xeon(R) CPU           E5540  @ 2.53GHz
  WORD_SIZE: 32
  BLAS: libopenblas (DYNAMIC_ARCH NO_AFFINITY Nehalem)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

julia> x = [1.0,2.0,3.0,4.0];

julia> xtmp = ones(4);

julia> using Yeppp

julia> Yeppp.exp!(xtmp, x)
4-element Array{Float64,1}:
  1.99976
  8.00076
 15.9996
 63.9904

The result seems to be the power of 2. But if I force it to use x86_64 Yeppp! library then it is fine.

panlanfeng avatar Aug 24 '15 15:08 panlanfeng

ARM is affected too. It appears that the problem is in the reference implementation of exp function.

Maratyszcza avatar Aug 24 '15 17:08 Maratyszcza