JuliaStats / LogExpFunctions.jl

Julia package for various special functions based on `log` and `exp`.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some tests failing on macOS

cossio opened this issue · comments

Running the test suite on macOS I get:

log2mexp: Test Failed at ~/Julia/Forks/LogExpFunctions.jl/test/basicfuns.jl:173
  Expression: log2mexp(-(T(1))) ≈ log(2 - exp(-(T(1))))
   Evaluated: 0.23447205f0 ≈ 0.48988014f0

Tests pass on Ubuntu (which the only platform currently covered by CI).

Possibly caused by the bug fixed in JuliaLang/julia#50989 (see the discussion in #74)? Can you try with Julia 1.10 or master?

You can check whether you're Julia version is affected by the bug e.g. by

for T in (Float32, Float16)
    @test expm1(T(-1.1))  expm1(big(T(-1.1)))
end

(the test added in the Julia bugfix) or checking the output of

julia> Float16(expm1(-exp(big(Float16(0.1)))))
Float16(-0.669)

julia> expm1(-exp(Float16(0.1)))
Float16(-0.338)

julia> Float32(expm1(-exp(big(Float32(0.1)))))
-0.6688457f0

julia> expm1(-exp(Float32(0.1)))
-0.3376915f0

Yes, this fails locally (Julia v1.9.3, macOS Apple Silicon).

julia> for T in (Float32, Float16)
           @test expm1(T(-1.1)) ≈ expm1(big(T(-1.1)))
       end
Test Failed at REPL[2]:2
  Expression: expm1(T(-1.1)) ≈ expm1(big(T(-1.1)))
   Evaluated: 0.3314843f0 ≈ -0.6671289242381854320328428151544398867406350331677158671036144147852732255543603

Feel free to close this issue. I could try 1.10 when the stable comes out.

It will also be part of Julia 1.9.4: JuliaLang/julia@v1.9.3...release-1.9