Skip to content

Commit

Permalink
Merge d579820 into fbc4850
Browse files Browse the repository at this point in the history
  • Loading branch information
willtebbutt committed Mar 3, 2018
2 parents fbc4850 + d579820 commit f5c5a0e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/rules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
@define_diffrule Base.lgamma(x) = :( digamma($x) )
@define_diffrule Base.Math.JuliaLibm.log1p(x) = :( inv($x + 1) )
@define_diffrule Base.transpose(x) = :( 1 )
@define_diffrule Base.abs(x) = :( $x > 0 ? one($x) : -one($x) )

# binary #
#--------#
Expand All @@ -76,6 +77,8 @@
@define_diffrule Base.mod(x, y) = :( first(promote(ifelse(isinteger($x / $y), NaN, 1), NaN)) ), :( z = $x / $y; first(promote(ifelse(isinteger(z), NaN, -floor(z)), NaN)) )
@define_diffrule Base.rem(x, y) = :( first(promote(ifelse(isinteger($x / $y), NaN, 1), NaN)) ), :( z = $x / $y; first(promote(ifelse(isinteger(z), NaN, -trunc(z)), NaN)) )
@define_diffrule Base.rem2pi(x, r) = :( 1 ), :NaN
@define_diffrule Base.max(x, y) = :( $x > $y ? one($x) : zero($x) ), :( $x > $y ? zero($y) : one($y) )
@define_diffrule Base.min(x, y) = :( $x > $y ? zero($x) : one($x) ), :( $x > $y ? one($y) : zero($y) )

####################
# SpecialFunctions #
Expand Down

0 comments on commit f5c5a0e

Please sign in to comment.