Skip to content

Commit 832b3cb

Browse files
authored
feat: import rules for modulo from chainrules.jl (#863)
1 parent 08b9a80 commit 832b3cb

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Mooncake"
22
uuid = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
33
authors = ["Will Tebbutt, Hong Ge, and contributors"]
4-
version = "0.4.178"
4+
version = "0.4.179"
55

66
[deps]
77
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"

src/rrules/low_level_maths.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
@from_chainrules MinimalCtx Tuple{typeof(atan),P,P} where {P<:IEEEFloat}
7575
@from_chainrules MinimalCtx Tuple{typeof(max),P,P} where {P<:IEEEFloat}
7676
@from_chainrules MinimalCtx Tuple{typeof(min),P,P} where {P<:IEEEFloat}
77+
@from_chainrules MinimalCtx Tuple{typeof(mod),P,P} where {P<:IEEEFloat}
7778

7879
@is_primitive MinimalCtx Tuple{typeof(mod2pi),IEEEFloat}
7980
function frule!!(::Dual{typeof(mod2pi)}, x::Dual{P}) where {P<:IEEEFloat}
@@ -283,6 +284,8 @@ function hand_written_rule_test_cases(rng_ctor, ::Val{:low_level_maths})
283284
(deg2rad, P(185.4)),
284285
(rad2deg, P(0.45)),
285286
(mod2pi, P(0.1)),
287+
(mod, P(7.5), P(2.3)),
288+
(mod, P(10.2), P(3.1)),
286289
(^, P(4.0), P(5.0)),
287290
(atan, P(4.3), P(0.23)),
288291
(hypot, P(4.0), P(5.0)),

0 commit comments

Comments
 (0)