JuliaMath / NaNMath.jl

Julia math built-ins which return NaN and accumulator functions which ignore NaN
Other
52 stars 26 forks source link

Fix bug in `extrema` #22

Closed anowacki closed 7 years ago

anowacki commented 7 years ago

The existing implementation of extrema would not find the maximum value if it was the first in the list because of the elseif control flow. This PR fixes this and adds a test. I tentatively suggest that future tests should not always use monotonically-increasing positive whole values!

I found this when using GR with Plots.jl, and my zcolor values had the maximum as the first value, leading to numbers 'normalised' larger than 1.

mlubin commented 7 years ago

CC @mkborregaard

anowacki commented 7 years ago

(By the way, the build for Julia nightly on macOS appears to be an intermittent network issue in downloading the Julia disk image, rather than the PR itself. Tests are fine on all the other combos of OS and Julia version.)