Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This looks like an extreme case in the parser. The <code>XeY</code> format is described in <a href="http://cran.r-project.org/doc/manuals/R-lang.html#Literal-constants">Section 10.3.1: Literal Constants</a> of the <a href="http://cran.r-project.org/doc/manuals/R-lang.html">R Language Definition</a> and points to <code>?NumericConstants</code> for "up-to-date information on the currently accepted formats".</p> <p>The problem seems to be how the parser handles the exponent. The numeric constant is handled by <code>NumericValue</code> (line 4361 of <code>main/gram.c</code>), which calls <code>mkFloat</code> (line 4124 of <code>main/gram.c</code>), which calls <code>R_atof</code> (line 1584 of <code>main/util.c</code>), which calls <code>R_strtod4</code> (line 1461 of <code>main/util.c</code>). (All as of revision 60052.)</p> <p>Line 1464 of <code>main/utils.c</code> shows <code>expn</code> declared as <code>int</code> and it will overflow at line 1551 if the exponent is too large. The signed integer overflow causes undefined behavior.</p> <p>For example, the code below produces values for exponents &lt; 308 or so and <code>Inf</code> for exponents > 308.</p> <pre><code>const &lt;- paste0("1e",2^(1:31)-2) for(n in const) print(eval(parse(text=n))) </code></pre> <p>You can see the undefined behavior for exponents > 2^31 (R hangs for an exponent = 2^31):</p> <pre><code>const &lt;- paste0("1e",2^(31:61)+1) for(n in const) print(eval(parse(text=n))) </code></pre> <p>I doubt this will get any attention from R-core because R can only store numeric values between about 2e-308 to 2e+308 (see <code>?double</code>) and this number is <em>way</em> beyond that.</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