Skip to content

Commit

Permalink
Merge 20c74d4 into 4861e35
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasnoack committed Feb 13, 2019
2 parents 4861e35 + 20c74d4 commit 30684c9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/rules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,12 @@ end
@define_diffrule NaNMath.log1p(x) = :( inv($x + 1) )
@define_diffrule NaNMath.lgamma(x) = :( SpecialFunctions.digamma($x) )


# binary #
#--------#

@define_diffrule NaNMath.pow(x, y) = :( $y * NaNMath.pow($x, ($y - 1)) ), :( NaNMath.pow($x, $y) * NaNMath.log($x) )
@define_diffrule NaNMath.max(x, y) = :(ifelse(($y > $x) | (signbit($y) < signbit($x)), ifelse(isnan($y), one($x), zero($x)), ifelse(isnan($x), zero($x), one($x)))),
:(ifelse(($y > $x) | (signbit($y) < signbit($x)), ifelse(isnan($y), zero($y), one($y)), ifelse(isnan($x), one($y), zero($y))))
@define_diffrule NaNMath.min(x, y) = :(ifelse(($y < $x) | (signbit($y) > signbit($x)), ifelse(isnan($y), one($x), zero($x)), ifelse(isnan($x), zero($x), one($x)))),
:(ifelse(($y < $x) | (signbit($y) > signbit($x)), ifelse(isnan($y), zero($y), one($y)), ifelse(isnan($x), one($x), zero($x))))

0 comments on commit 30684c9

Please sign in to comment.