Skip to content

Commit

Permalink
Merge 8b83a5a into b089af5
Browse files Browse the repository at this point in the history
  • Loading branch information
chriselrod committed Dec 25, 2018
2 parents b089af5 + 8b83a5a commit a1d06e1
Show file tree
Hide file tree
Showing 11 changed files with 708 additions and 510 deletions.
39 changes: 39 additions & 0 deletions Manifest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This file is machine-generated - editing it directly is not advised

[[Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

[[Distributed]]
deps = ["Random", "Serialization", "Sockets"]
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"

[[InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"

[[Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"

[[Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"

[[Random]]
deps = ["Serialization"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[[SIMD]]
deps = ["InteractiveUtils", "Test"]
git-tree-sha1 = "c6f6f4a8103e69c66b06def75f04904f72111c51"
uuid = "fdea26ae-647d-5447-a871-4b548cad5224"
version = "2.2.0"

[[Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"

[[Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"

[[Test]]
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
9 changes: 6 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ name = "SLEEF"
uuid = "3e6341c9-01f6-5312-b33f-f8894a2e817a"
license = "MIT"
repo = "https://github.com/musm/SLEEF.jl.git"
version = "v0.5.1"
version = "0.5.1"

[deps]
SIMD = "fdea26ae-647d-5447-a871-4b548cad5224"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test","Printf"]
test = ["Test", "Printf"]
22 changes: 22 additions & 0 deletions src/SLEEF.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,28 @@ module SLEEF

using Base.Math: uinttype, @horner, exponent_bias, exponent_mask, significand_bits, IEEEFloat, exponent_raw_max

using SIMD
using SIMD: vifelse

const FloatType64 = Union{Float64,Vec{<:Any,Float64}}
const FloatType32 = Union{Float32,Vec{<:Any,Float32}}
const FloatType = Union{FloatType64,FloatType32}
const IntegerType64 = Union{Int64,Vec{<:Any,Int64}}
const IntegerType32 = Union{Int32,Vec{<:Any,Int32}}
const IntegerType = Union{IntegerType64,IntegerType32}

EquivalentInteger(::Type{Float64}) = Int64
EquivalentInteger(::Type{Float32}) = Int32
EquivalentInteger(::Type{Vec{N,Float64}}) where N = Vec{N,Int64}
EquivalentInteger(::Type{Vec{N,Float32}}) where N = Vec{N,Int32}

@generated function Base.unsafe_trunc(::Type{I}, x::Vec{N,T}) where {N,T,I}
quote
$(Expr(:meta,:inline))
Vec{$N,$I}($(Expr(:tuple, [:(Core.VecElement(unsafe_trunc($I, x[$n]))) for n 1:N]...)))
end
end

## constants

const MLN2 = 6.931471805599453094172321214581765680755001343602552541206800094933936219696955e-01 # log(2)
Expand Down

0 comments on commit a1d06e1

Please sign in to comment.