Skip to content

Commit

Permalink
Fix fastmath trig functions (#497)
Browse files Browse the repository at this point in the history
  • Loading branch information
giordano authored Nov 8, 2021
1 parent 1e3b270 commit 955fc05
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Unitful"
uuid = "1986cc42-f94f-5a68-af5c-568840ba703d"
version = "1.9.1"
version = "1.9.2"

[deps]
ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
Expand Down
12 changes: 6 additions & 6 deletions src/fastmath.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,17 @@ import Base.FastMath: @fastmath,
le_fast,
pow_fast,
sqrt_fast,
cos_fast,
sin_fast,
tan_fast,
atan_fast,
hypot_fast,
max_fast,
min_fast,
minmax_fast,
cis_fast,
angle_fast,
fast_op,
libm
fast_op

sub_fast(x::Quantity{T}) where {T <: FloatTypes} = typeof(x)(neg_float_fast(x.val))

Expand Down Expand Up @@ -166,10 +168,8 @@ sqrt_fast(x::Quantity{T}) where {T <: FloatTypes} =
for f in (:cos, :sin, :tan)
f_fast = fast_op[f]
@eval begin
$f_fast(x::DimensionlessQuantity{Float32,U}) where {U} =
ccall(($(string(f,"f")),libm), Float32, (Float32,), uconvert(x,NoUnits))
$f_fast(x::DimensionlessQuantity{Float64,U}) where {U} =
ccall(($(string(f)),libm), Float64, (Float64,), uconvert(x,NoUnits))
$(f_fast)(x::DimensionlessQuantity{<:Union{Float32,Float64}}) =
$(f_fast)(uconvert(NoUnits, x))
end
end

Expand Down

2 comments on commit 955fc05

@sostock
Copy link
Collaborator

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/48663

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.9.2 -m "<description of version>" 955fc05fe049a12c15b1372a16eb7d8685a8bd50
git push origin v1.9.2

Please sign in to comment.