Skip to content

Commit 2e4bbef

Browse files
authored
Fix #69 (#71)
1 parent b938c64 commit 2e4bbef

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Static"
22
uuid = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
33
authors = ["chriselrod", "ChrisRackauckas", "Tokazama"]
4-
version = "0.7.2"
4+
version = "0.7.3"
55

66
[deps]
77
IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173"

src/Static.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,9 @@ Base.:(+)(::StaticInt{N}, y::Ptr) where {N} = y + N
328328

329329
@generated Base.sqrt(::StaticNumber{N}) where {N} = :($(static(sqrt(N))))
330330

331-
Base.div(::StaticNumber{X}, ::StaticNumber{Y}) where {X,Y} = static(div(X, Y))
332-
Base.div(x::Real, ::StaticNumber{Y}) where {Y} = div(x, Y)
333-
Base.div(::StaticNumber{X}, y::Real) where {X} = div(X, y)
331+
Base.div(::StaticNumber{X}, ::StaticNumber{Y}, m::RoundingMode) where {X,Y} = static(div(X, Y, m))
332+
Base.div(x::Real, ::StaticNumber{Y}, m::RoundingMode) where {Y} = div(x, Y, m)
333+
Base.div(::StaticNumber{X}, y::Real, m::RoundingMode) where {X} = div(X, y, m)
334334
Base.div(x::StaticBool, y::False) = throw(DivideError())
335335
Base.div(x::StaticBool, y::True) = x
336336

test/runtests.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ end
6161
@test @inferred(*(Zero(), 3)) === @inferred(*(3, Zero())) === *(Zero(), Zero())
6262

6363
@test float(StaticInt(8)) === static(8.0)
64+
@test @inferred(cld(40, static(4))) === cld(40, 4)
65+
@test @inferred(fld(40, static(4))) === fld(40, 4)
66+
@test @inferred(cld(static(40), static(4))) === static(cld(40, 4))
67+
@test @inferred(fld(static(40), static(4))) === static(fld(40, 4))
68+
6469

6570
# test specific promote rules to ensure we don't cause ambiguities
6671
SI = StaticInt{1}

0 commit comments

Comments
 (0)