Skip to content

Commit

Permalink
Specialize mod for real arguments (#107)
Browse files Browse the repository at this point in the history
* Specialize mod for real arguments

* bump version to 0.8.6
  • Loading branch information
jishnub authored Mar 16, 2023
1 parent e6e38fb commit f2d944f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Static"
uuid = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
authors = ["chriselrod", "ChrisRackauckas", "Tokazama"]
version = "0.8.5"
version = "0.8.6"

[deps]
IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173"
Expand Down
2 changes: 2 additions & 0 deletions src/Static.jl
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,8 @@ Base.rem(::StaticNumber{X}, ::StaticNumber{Y}) where {X, Y} = static(rem(X, Y))
Base.rem(x::Real, ::StaticInteger{Y}) where {Y} = rem(x, Y)
Base.rem(::StaticInteger{X}, y::Real) where {X} = rem(X, y)
Base.mod(::StaticNumber{X}, ::StaticNumber{Y}) where {X, Y} = static(mod(X, Y))
Base.mod(x::Real, ::StaticNumber{Y}) where {Y} = mod(x, Y)
Base.mod(::StaticNumber{X}, y::Real) where {X} = mod(X, y)

Base.:(==)(::StaticNumber{X}, ::StaticNumber{Y}) where {X, Y} = ==(X, Y)

Expand Down
7 changes: 7 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ end

@test real(static(3)) === static(3)
@test imag(static(3)) === static(0)

@test mod(static(3), static(3)) === static(0)
@test mod(static(3), 3) == 0
@test mod(3, static(3)) == 0
@test mod(static(3), static(2)) === static(1)
@test mod(static(3), 2) == 1
@test mod(3, static(2)) == 1
end

@testset "StaticBool" begin
Expand Down

2 comments on commit f2d944f

@Tokazama
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/79715

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 v0.8.6 -m "<description of version>" f2d944f0116af9b5fee0f703be50fa8146009d56
git push origin v0.8.6

Please sign in to comment.