1<html lang="en"> 2<head> 3<title>version - Untitled</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Untitled"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="up" href="Math.html#Math" title="Math"> 9<link rel="next" href="acos.html#acos" title="acos"> 10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 11<meta http-equiv="Content-Style-Type" content="text/css"> 12<style type="text/css"><!-- 13 pre.display { font-family:inherit } 14 pre.format { font-family:inherit } 15 pre.smalldisplay { font-family:inherit; font-size:smaller } 16 pre.smallformat { font-family:inherit; font-size:smaller } 17 pre.smallexample { font-size:smaller } 18 pre.smalllisp { font-size:smaller } 19 span.sc { font-variant:small-caps } 20 span.roman { font-family:serif; font-weight:normal; } 21 span.sansserif { font-family:sans-serif; font-weight:normal; } 22--></style> 23<link rel="stylesheet" type="text/css" href="../cs.css"> 24</head> 25<body> 26<div class="node"> 27<a name="version"></a> 28<p> 29Next: <a rel="next" accesskey="n" href="acos.html#acos">acos</a>, 30Up: <a rel="up" accesskey="u" href="Math.html#Math">Math</a> 31<hr> 32</div> 33 34<h3 class="section">1.1 Error Handling</h3> 35 36<p>There are four different versions of the math library routines: IEEE, 37POSIX, X/Open, or SVID. The version may be selected at runtime by 38setting the global variable <code>_LIB_VERSION</code>, defined in 39<samp><span class="file">math.h</span></samp>. It may be set to one of the following constants defined 40in <samp><span class="file">math.h</span></samp>: <code>_IEEE_</code>, <code>_POSIX_</code>, <code>_XOPEN_</code>, or 41<code>_SVID_</code>. The <code>_LIB_VERSION</code> variable is not specific to any 42thread, and changing it will affect all threads. 43 44 <p>The versions of the library differ only in how errors are handled. 45 46 <p>In IEEE mode, the <code>matherr</code> function is never called, no warning 47messages are printed, and <code>errno</code> is never set. 48 49 <p>In POSIX mode, <code>errno</code> is set correctly, but the <code>matherr</code> 50function is never called and no warning messages are printed. 51 52 <p>In X/Open mode, <code>errno</code> is set correctly, and <code>matherr</code> is 53called, but warning message are not printed. 54 55 <p>In SVID mode, functions which overflow return 3.40282346638528860e+38, 56the maximum single-precision floating-point value, rather than infinity. 57Also, <code>errno</code> is set correctly, <code>matherr</code> is called, and, if 58<code>matherr</code> returns 0, warning messages are printed for some errors. 59For example, by default ‘<samp><span class="samp">log(-1.0)</span></samp>’ writes this message on standard 60error output: 61 62<pre class="example"> log: DOMAIN error 63</pre> 64 <p>The library is set to X/Open mode by default. 65 66 <p>The aforementioned error reporting is the supported Newlib libm error 67handling method. However, the majority of the functions are written 68so as to produce the floating-point exceptions (e.g. "invalid", 69"divide-by-zero") as required by the C and POSIX standards, for 70floating-point implementations that support them. Newlib does not provide 71the floating-point exception access routines defined in the standards 72for fenv.h, though, which is why they are considered unsupported. It is 73mentioned in case you have separately-provided access routines so that 74you are aware that they can be caused. 75 76<h3 class="section">1.2 Standards Compliance And Portability</h3> 77 78<p>Most of the individual function descriptions describe the standards to which 79each function complies. However, these descriptions are mostly out of date, 80having been written before C99 was released. One of these days we'll get 81around to updating the rest of them. (If you'd like to help, please let us 82know.) 83 84 <p>“C99” refers to ISO/IEC 9899:1999, “Programming languages–C”. 85“POSIX” refers to IEEE Standard 1003.1. POSIX® is a 86registered trademark of The IEEE. 87 88<!-- To sort the include list easily, keep the indentation right because want to --> 89<!-- skip the s_|w_ at the start of most-but not all-of the file names. --> 90<!-- (e.g., isgreater.def does not have a leading s nor w.) Then, sort --> 91<!-- based on the column. For example: "sort -t@ -k3.17" --> 92<!-- A few hand-edits might be appropriate after a sort, although not necessary --> 93<!-- and are a nuisance as ought to be kept in sync with menu list above: --> 94<!-- atan2 after atan, exp2 after exp, log first in log list, and w_j0 to place --> 95<!-- to reflect function name of Bessel (as opposed to j; e.g. after atanh, --> 96<!-- before cbrt). --> 97 </body></html> 98 99