Imported Upstream version 2.50.2
[platform/upstream/glib.git] / docs / reference / glib / html / glib-Numerical-Definitions.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>Numerical Definitions: GLib Reference Manual</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="index.html" title="GLib Reference Manual">
8 <link rel="up" href="glib-fundamentals.html" title="GLib Fundamentals">
9 <link rel="prev" href="glib-Bounds-checked-integer-arithmetic.html" title="Bounds-checking integer arithmetic">
10 <link rel="next" href="glib-Miscellaneous-Macros.html" title="Miscellaneous Macros">
11 <meta name="generator" content="GTK-Doc V1.25.1 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 </head>
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
16 <td width="100%" align="left" class="shortcuts">
17 <a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
18                   <a href="#glib-Numerical-Definitions.description" class="shortcut">Description</a></span>
19 </td>
20 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
21 <td><a accesskey="u" href="glib-fundamentals.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
22 <td><a accesskey="p" href="glib-Bounds-checked-integer-arithmetic.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
23 <td><a accesskey="n" href="glib-Miscellaneous-Macros.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
24 </tr></table>
25 <div class="refentry">
26 <a name="glib-Numerical-Definitions"></a><div class="titlepage"></div>
27 <div class="refnamediv"><table width="100%"><tr>
28 <td valign="top">
29 <h2><span class="refentrytitle"><a name="glib-Numerical-Definitions.top_of_page"></a>Numerical Definitions</span></h2>
30 <p>Numerical Definitions — mathematical constants, and floating point decomposition</p>
31 </td>
32 <td class="gallery_image" valign="top" align="right"></td>
33 </tr></table></div>
34 <div class="refsect1">
35 <a name="glib-Numerical-Definitions.other"></a><h2>Types and Values</h2>
36 <div class="informaltable"><table class="informaltable" width="100%" border="0">
37 <colgroup>
38 <col width="150px" class="name">
39 <col class="description">
40 </colgroup>
41 <tbody>
42 <tr>
43 <td class="define_keyword">#define</td>
44 <td class="function_name"><a class="link" href="glib-Numerical-Definitions.html#G-IEEE754-FLOAT-BIAS:CAPS" title="G_IEEE754_FLOAT_BIAS">G_IEEE754_FLOAT_BIAS</a></td>
45 </tr>
46 <tr>
47 <td class="define_keyword">#define</td>
48 <td class="function_name"><a class="link" href="glib-Numerical-Definitions.html#G-IEEE754-DOUBLE-BIAS:CAPS" title="G_IEEE754_DOUBLE_BIAS">G_IEEE754_DOUBLE_BIAS</a></td>
49 </tr>
50 <tr>
51 <td class="datatype_keyword">union</td>
52 <td class="function_name"><a class="link" href="glib-Numerical-Definitions.html#GFloatIEEE754" title="union GFloatIEEE754">GFloatIEEE754</a></td>
53 </tr>
54 <tr>
55 <td class="datatype_keyword">union</td>
56 <td class="function_name"><a class="link" href="glib-Numerical-Definitions.html#GDoubleIEEE754" title="union GDoubleIEEE754">GDoubleIEEE754</a></td>
57 </tr>
58 <tr>
59 <td class="define_keyword">#define</td>
60 <td class="function_name"><a class="link" href="glib-Numerical-Definitions.html#G-E:CAPS" title="G_E">G_E</a></td>
61 </tr>
62 <tr>
63 <td class="define_keyword">#define</td>
64 <td class="function_name"><a class="link" href="glib-Numerical-Definitions.html#G-LN2:CAPS" title="G_LN2">G_LN2</a></td>
65 </tr>
66 <tr>
67 <td class="define_keyword">#define</td>
68 <td class="function_name"><a class="link" href="glib-Numerical-Definitions.html#G-LN10:CAPS" title="G_LN10">G_LN10</a></td>
69 </tr>
70 <tr>
71 <td class="define_keyword">#define</td>
72 <td class="function_name"><a class="link" href="glib-Numerical-Definitions.html#G-PI:CAPS" title="G_PI">G_PI</a></td>
73 </tr>
74 <tr>
75 <td class="define_keyword">#define</td>
76 <td class="function_name"><a class="link" href="glib-Numerical-Definitions.html#G-PI-2:CAPS" title="G_PI_2">G_PI_2</a></td>
77 </tr>
78 <tr>
79 <td class="define_keyword">#define</td>
80 <td class="function_name"><a class="link" href="glib-Numerical-Definitions.html#G-PI-4:CAPS" title="G_PI_4">G_PI_4</a></td>
81 </tr>
82 <tr>
83 <td class="define_keyword">#define</td>
84 <td class="function_name"><a class="link" href="glib-Numerical-Definitions.html#G-SQRT2:CAPS" title="G_SQRT2">G_SQRT2</a></td>
85 </tr>
86 <tr>
87 <td class="define_keyword">#define</td>
88 <td class="function_name"><a class="link" href="glib-Numerical-Definitions.html#G-LOG-2-BASE-10:CAPS" title="G_LOG_2_BASE_10">G_LOG_2_BASE_10</a></td>
89 </tr>
90 </tbody>
91 </table></div>
92 </div>
93 <div class="refsect1">
94 <a name="glib-Numerical-Definitions.includes"></a><h2>Includes</h2>
95 <pre class="synopsis">#include &lt;glib.h&gt;
96 </pre>
97 </div>
98 <div class="refsect1">
99 <a name="glib-Numerical-Definitions.description"></a><h2>Description</h2>
100 <p>GLib offers mathematical constants such as <a class="link" href="glib-Numerical-Definitions.html#G-PI:CAPS" title="G_PI"><span class="type">G_PI</span></a> for the value of pi;
101 many platforms have these in the C library, but some don't, the GLib
102 versions always exist.</p>
103 <p>The <a class="link" href="glib-Numerical-Definitions.html#GFloatIEEE754" title="union GFloatIEEE754"><span class="type">GFloatIEEE754</span></a> and <a class="link" href="glib-Numerical-Definitions.html#GDoubleIEEE754" title="union GDoubleIEEE754"><span class="type">GDoubleIEEE754</span></a> unions are used to access the
104 sign, mantissa and exponent of IEEE floats and doubles. These unions are
105 defined as appropriate for a given platform. IEEE floats and doubles are
106 supported (used for storage) by at least Intel, PPC and Sparc. See
107 <a class="ulink" href="http://en.wikipedia.org/wiki/IEEE_float" target="_top">IEEE 754-2008</a>
108 for more information about IEEE number formats.</p>
109 </div>
110 <div class="refsect1">
111 <a name="glib-Numerical-Definitions.functions_details"></a><h2>Functions</h2>
112 <p></p>
113 </div>
114 <div class="refsect1">
115 <a name="glib-Numerical-Definitions.other_details"></a><h2>Types and Values</h2>
116 <div class="refsect2">
117 <a name="G-IEEE754-FLOAT-BIAS:CAPS"></a><h3>G_IEEE754_FLOAT_BIAS</h3>
118 <pre class="programlisting">#define G_IEEE754_FLOAT_BIAS (127)
119 </pre>
120 <p>The bias by which exponents in single-precision floats are offset.</p>
121 </div>
122 <hr>
123 <div class="refsect2">
124 <a name="G-IEEE754-DOUBLE-BIAS:CAPS"></a><h3>G_IEEE754_DOUBLE_BIAS</h3>
125 <pre class="programlisting">#define G_IEEE754_DOUBLE_BIAS (1023)
126 </pre>
127 <p>The bias by which exponents in double-precision floats are offset.</p>
128 </div>
129 <hr>
130 <div class="refsect2">
131 <a name="GFloatIEEE754"></a><h3>union GFloatIEEE754</h3>
132 <p>The <a class="link" href="glib-Numerical-Definitions.html#GFloatIEEE754" title="union GFloatIEEE754"><span class="type">GFloatIEEE754</span></a> and <a class="link" href="glib-Numerical-Definitions.html#GDoubleIEEE754" title="union GDoubleIEEE754"><span class="type">GDoubleIEEE754</span></a> unions are used to access the sign,
133 mantissa and exponent of IEEE floats and doubles. These unions are defined
134 as appropriate for a given platform. IEEE floats and doubles are supported
135 (used for storage) by at least Intel, PPC and Sparc.</p>
136 <div class="refsect3">
137 <a name="GFloatIEEE754.members"></a><h4>Members</h4>
138 <div class="informaltable"><table class="informaltable" width="100%" border="0">
139 <colgroup>
140 <col width="300px" class="union_members_name">
141 <col class="union_members_description">
142 <col width="200px" class="union_members_annotations">
143 </colgroup>
144 <tbody></tbody>
145 </table></div>
146 </div>
147 </div>
148 <hr>
149 <div class="refsect2">
150 <a name="GDoubleIEEE754"></a><h3>union GDoubleIEEE754</h3>
151 <p>The <a class="link" href="glib-Numerical-Definitions.html#GFloatIEEE754" title="union GFloatIEEE754"><span class="type">GFloatIEEE754</span></a> and <a class="link" href="glib-Numerical-Definitions.html#GDoubleIEEE754" title="union GDoubleIEEE754"><span class="type">GDoubleIEEE754</span></a> unions are used to access the sign,
152 mantissa and exponent of IEEE floats and doubles. These unions are defined
153 as appropriate for a given platform. IEEE floats and doubles are supported
154 (used for storage) by at least Intel, PPC and Sparc.</p>
155 <div class="refsect3">
156 <a name="GDoubleIEEE754.members"></a><h4>Members</h4>
157 <div class="informaltable"><table class="informaltable" width="100%" border="0">
158 <colgroup>
159 <col width="300px" class="union_members_name">
160 <col class="union_members_description">
161 <col width="200px" class="union_members_annotations">
162 </colgroup>
163 <tbody><tr>
164 <td class="union_member_name"><p><a class="link" href="glib-Basic-Types.html#gdouble" title="gdouble"><span class="type">gdouble</span></a> <em class="structfield"><code><a name="GDoubleIEEE754.v-double"></a>v_double</code></em>;</p></td>
165 <td class="union_member_description"><p>the double value</p></td>
166 <td class="union_member_annotations"> </td>
167 </tr></tbody>
168 </table></div>
169 </div>
170 </div>
171 <hr>
172 <div class="refsect2">
173 <a name="G-E:CAPS"></a><h3>G_E</h3>
174 <pre class="programlisting">#define G_E     2.7182818284590452353602874713526624977572470937000
175 </pre>
176 <p>The base of natural logarithms.</p>
177 </div>
178 <hr>
179 <div class="refsect2">
180 <a name="G-LN2:CAPS"></a><h3>G_LN2</h3>
181 <pre class="programlisting">#define G_LN2   0.69314718055994530941723212145817656807550013436026
182 </pre>
183 <p>The natural logarithm of 2.</p>
184 </div>
185 <hr>
186 <div class="refsect2">
187 <a name="G-LN10:CAPS"></a><h3>G_LN10</h3>
188 <pre class="programlisting">#define G_LN10  2.3025850929940456840179914546843642076011014886288
189 </pre>
190 <p>The natural logarithm of 10.</p>
191 </div>
192 <hr>
193 <div class="refsect2">
194 <a name="G-PI:CAPS"></a><h3>G_PI</h3>
195 <pre class="programlisting">#define G_PI    3.1415926535897932384626433832795028841971693993751
196 </pre>
197 <p>The value of pi (ratio of circle's circumference to its diameter).</p>
198 </div>
199 <hr>
200 <div class="refsect2">
201 <a name="G-PI-2:CAPS"></a><h3>G_PI_2</h3>
202 <pre class="programlisting">#define G_PI_2  1.5707963267948966192313216916397514420985846996876
203 </pre>
204 <p>Pi divided by 2.</p>
205 </div>
206 <hr>
207 <div class="refsect2">
208 <a name="G-PI-4:CAPS"></a><h3>G_PI_4</h3>
209 <pre class="programlisting">#define G_PI_4  0.78539816339744830961566084581987572104929234984378
210 </pre>
211 <p>Pi divided by 4.</p>
212 </div>
213 <hr>
214 <div class="refsect2">
215 <a name="G-SQRT2:CAPS"></a><h3>G_SQRT2</h3>
216 <pre class="programlisting">#define G_SQRT2 1.4142135623730950488016887242096980785696718753769
217 </pre>
218 <p>The square root of two.</p>
219 </div>
220 <hr>
221 <div class="refsect2">
222 <a name="G-LOG-2-BASE-10:CAPS"></a><h3>G_LOG_2_BASE_10</h3>
223 <pre class="programlisting">#define G_LOG_2_BASE_10             (0.30102999566398119521)
224 </pre>
225 <p>Multiplying the base 2 exponent by this number yields the base 10 exponent.</p>
226 </div>
227 </div>
228 </div>
229 <div class="footer">
230 <hr>Generated by GTK-Doc V1.25.1</div>
231 </body>
232 </html>