title: Is there a bug in the minimum function?
body: <p>I have a list <code>mins</code> of 415920 numbers, all supposed to be closed to <code>0.1</code>:</p>
  
  <pre><code>Prelude Lib&gt; take 5 mins
  [9.83610706554002e-2,9.847021825032128e-2,9.847021825032128e-2,9.898395035483082e-2,9.898395035483082e-2]
  </code></pre>
  
  <p>However:</p>
  
  <pre><code>Prelude Lib&gt; minimum mins
  0.10087849151477328
  </code></pre>
  
  <p>The <code>minimum</code> function is not supposed to return the minimum ?</p>
  
  <p>This result sounds plausible:</p>
  
  <pre><code>Prelude Lib&gt; foldr min 100000 mins
  1.1763616593045858e-4
  </code></pre>
  
  <p>Is it a bug, or I misunderstand <code>minimum</code> ?</p>
  
  <p>Similar issue with <code>maximum</code>:</p>
  
  <pre><code>Prelude Lib&gt; maximum mins
  3261145.0627630088
  Prelude Lib&gt; foldr max 0 mins
  0.1207868227600914
  </code></pre>
  
  <p>Sorting the list yields a third result for the maximum:</p>
  
  <pre><code>Prelude Lib&gt; import Data.List as L
  Prelude Lib L&gt; mins' = sort mins
  Prelude Lib L&gt; head mins'
  1.1763616593045858e-4
  Prelude Lib L&gt; last mins'
  0.10295664278431726
  </code></pre>
  
  <p>And applying <code>minimum</code> and <code>maximum</code> on the sorted list yields a third result for the minimum:</p>
  
  <pre><code>Prelude Lib L&gt; minimum mins'
  0.10045801977483232
  Prelude Lib L&gt; maximum mins'
  3261145.0627630088
  </code></pre>
  
  <h1>Edit</h1>
  
  <p>After @max630's comment, I've searched in the list with a text editor. The <code>3261145.0627630088</code> is indeed here, and there are some <code>NaN</code>:</p>
  
  <pre><code>NaN,NaN,3261145.0627630088
  </code></pre>
  
  <p><em>Conclusion:</em> it looks like <code>minimum</code> gives a wrong result, and <code>maximum</code> gives the correct result.</p>
  
  <p><code>foldr max</code> gives a wrong result, <code>foldl max</code> gives the good one:</p>
  
  <pre><code>&gt; foldl max 0 mins
  3261145.0627630088
  </code></pre>