Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You are not clear if you mean floating point literal as part of the source code (for the compiler to parse into architecture-dependent binary representation), or scanned by library functions, such as <code>scanf()</code>, <code>atof()</code>, <code>strtol()</code>, <code>strtod()</code> and <code>strtold()</code> (at run-time, to convert to in-memory <code>float</code>, <code>double</code> or <code>long double</code> value).</p> <p>In the first case, it is part of ISO/IEC 9899:1999 (ISO C99), §6.4.4.2 "Floating constants". It defines both the lexicon and how it should be interpreted.</p> <p>In the second case, the behavior of the library functions are defined in §7.20.1 "Numeric conversion functions".</p> <p>I don't have a hard copy of the previous standard (ANSI C, 1989), but I'm pretty sure it also defines very precisely how floating point numbers are parsed and converted.</p> <p>In the case you want to know if there is a standard to represent these values in binary format, in-memory, the answer is no. The C language is intended to be close to the architecture, and not impose constraints over it. So the in-memory representation is always architecture-dependent. But the C standard defines how arithmetic should be performed over floating point values. It follows IEC 60559 standard. In the ISO C99 standard, it is described in Annex F (normative), "IEC 60559 floating-point arithmetic". The implementation may or may not implement this standard. If it does, it must define the <code>__STDC_IEC_559__</code> preprocessor name.</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