Skip to content

Commit

Permalink
Use MPFR on 32 bit systems (#46)
Browse files Browse the repository at this point in the history
* Use MPFR on 32 bit systems

It seems the existing crlibm binaries are broken on 32 bit, as they
don't pass crlibm's own tests. Therefore, just fall back to MPFR on
these systems for safety.

* Bump version to 1.0.1
  • Loading branch information
c42f authored Feb 25, 2021
1 parent be395be commit 6a091d8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "CRlibm"
uuid = "96374032-68de-5a5b-8d9e-752f78720389"
version = "1.0.0"
version = "1.0.1"

[deps]
CRlibm_jll = "4e9b3aee-d8a1-5a3d-ad8b-7d824db253f0"
Expand Down
5 changes: 4 additions & 1 deletion src/CRlibm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ const MPFR_function_names = split("""exp expm1 log log1p log2 log10

const MPFR_functions = map(Symbol, MPFR_function_names)

use_MPFR = setup()
# The underlying crlibm tests fail on 32 bit build - just use MPFR there (see #45)
is_32_bit = Int == Int32

use_MPFR = setup(is_32_bit)

end # module
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ using Test
@test CRlibm.cos(Float16(1.6), RoundDown) == Float16(-0.02882)
@test CRlibm.cos(Float16(0.5)) == CRlibm.cos(Float16(0.5), RoundNearest)

# One failing example from #45
@test CRlibm.log10(10.0, RoundUp) == 1.0

function my_eps(prec::Int)
ldexp(eps(Float64), 53-prec)
end
Expand Down

2 comments on commit 6a091d8

@dpsanders
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/30790

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.0.1 -m "<description of version>" 6a091d8fd25fb205faf4b3785dfa32505602021d
git push origin v1.0.1

Please sign in to comment.