Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You need to use an external program or a PHP extension (library).</p> <p>I've just tested it with <a href="http://php.net/manual/en/book.bc.php" rel="nofollow">BC Math</a> and <a href="http://php.net/manual/en/ref.gmp.php" rel="nofollow">GMP</a> using the <a href="http://php.net/manual/en/function.bcpow.php" rel="nofollow">bcpow()</a>/<a href="http://php.net/manual/en/function.gmp-pow.php" rel="nofollow">gmp_pow()</a> functions and it works perfectly:</p> <pre><code>&lt;?php // both output 26588814358957503287787 echo bcpow('3', '47'); echo gmp_strval( gmp_pow('3', '47') ); </code></pre> <p>The PHP.net documentation has a nice section about that topic:</p> <blockquote> <h3>Floating point precision</h3> <p>Floating point numbers have limited precision. Although it depends on the system, PHP typically uses the IEEE 754 double precision format, which will give a maximum relative error due to rounding in the order of 1.11e-16. Non elementary arithmetic operations may give larger errors, and, of course, error propagation must be considered when several operations are compounded.</p> <p>Additionally, rational numbers that are exactly representable as floating point numbers in base 10, like <strong>0.1</strong> or <strong>0.7</strong>, do not have an exact representation as floating point numbers in base 2, which is used internally, no matter the size of the mantissa. Hence, they cannot be converted into their internal binary counterparts without a small loss of precision. This can lead to confusing results: for example, <strong>floor((0.1+0.7)*10)</strong> will usually return <strong>7</strong> instead of the expected <strong>8</strong>, since the internal representation will be something like <strong>7.9999999999999991118...</strong>.</p> <p>So never trust floating number results to the last digit, and do not compare floating point numbers directly for equality. If higher precision is necessary, the <a href="http://www.php.net/manual/en/ref.bc.php" rel="nofollow">arbitrary precision math functions</a> and <a href="http://www.php.net/manual/en/ref.gmp.php" rel="nofollow">gmp</a> functions are available.</p> <p>For a "simple" explanation, see the <a href="http://floating-point-gui.de/" rel="nofollow">» floating point guide</a> that's also titled "Why don’t my numbers add up?" <br /> &mdash; <a href="http://php.net/manual/en/language.types.float.php" rel="nofollow">http://php.net/manual/en/language.types.float.php</a></p> </blockquote> <p>Note that the <a href="http://www.php.net/manual/en/language.types.float.php#110766" rel="nofollow">php.ini configuration value 'precision'</a> can also modify the precision when converting from floats to strings.</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