cherry-pick 8f31c4e764a26d685cd0d96587802761e891f27f
fixed NaN test for fdim
added failing NaN test for fdim
fixed agrad/rev/fdim so gradients return nan for input nan
Merge branch 'feature/issue-845-fdim-nan' into feature/issue-847-fwd-functions-nan