Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Well, let's look at <a href="http://hackage.haskell.org/packages/archive/attoparsec/0.10.4.0/doc/html/Data-Attoparsec-Text.html">the documentation</a>.</p> <ul> <li><p><a href="http://hackage.haskell.org/packages/archive/attoparsec/0.10.4.0/doc/html/Data-Attoparsec-Text.html#v%3adouble"><code>double</code></a></p> <blockquote> <p><em>Note:</em> This function is almost ten times faster than <code>rational</code>, but is slightly less accurate.</p> <p>The <code>Double</code> type supports about 16 decimal places of accuracy. For 94.2% of numbers, this function and <code>rational</code> give identical results, but for the remaining 5.8%, this function loses precision around the 15th decimal place. For 0.001% of numbers, this function will lose precision at the 13th or 14th decimal place. </p> </blockquote></li> <li><p><a href="http://hackage.haskell.org/packages/archive/attoparsec/0.10.4.0/doc/html/Data-Attoparsec-Text.html#v%3anumber"><code>number</code></a></p> <blockquote> <p><em>Note:</em> This function is almost ten times faster than <code>rational</code>. On integral inputs, it gives perfectly accurate answers, and on floating point inputs, it is slightly less accurate than rational. </p> </blockquote></li> </ul> <p>They are both acknowledged to be slightly inaccurate (in exchange for being relatively fast). <code>number</code>'s inaccuracy is not quantified, so the fact that its inaccuracy is not the same as <code>double</code>'s is not a bug. </p> <p>If accuracy is paramount, use <a href="http://hackage.haskell.org/packages/archive/attoparsec/0.10.4.0/doc/html/Data-Attoparsec-Text.html#v%3arational"><code>rational</code></a>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload