Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This happens because mysql treats <code>0.339946499848118887e-4</code> as <code>float</code> and treats <code>0.0000339946499848118887</code> as <code>fixed point</code>. </p> <pre><code>mysql&gt; select cast( 0.339946499848118887e-4 as DECIMAL(30, 25)); +----------------------------------------------------+ | cast( 0.339946499848118887e-4 as DECIMAL(30, 25)) | +----------------------------------------------------+ | 0.0000339946499848118900000 | +----------------------------------------------------+ 1 row in set (0.00 sec) mysql&gt; select cast( 0.0000339946499848118887 as DECIMAL(30, 25)); +-----------------------------------------------------+ | cast( 0.0000339946499848118887 as DECIMAL(30, 25)) | +-----------------------------------------------------+ | 0.0000339946499848118887000 | +-----------------------------------------------------+ 1 row in set (0.00 sec) </code></pre> <p>As described in the mysql documentation on <a href="https://dev.mysql.com/doc/refman/5.6/en/precision-math-expressions.html" rel="nofollow">precision math - expression handling</a> -</p> <blockquote> <p>If any approximate values are present, the expression is approximate and is evaluated using floating-point arithmetic. </p> </blockquote> <p>Quoting from, the documentation on <a href="https://dev.mysql.com/doc/refman/5.6/en/precision-math-numbers.html" rel="nofollow">numerical types</a>,</p> <blockquote> <p>Two numbers that look similar may be treated differently. For example, 2.34 is an exact-value (fixed-point) number, whereas 2.34E0 is an approximate-value (floating-point) number. </p> </blockquote>
 

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