diff options
| author | Craig Jennings <c@cjennings.net> | 2025-08-14 22:58:58 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-08-14 22:58:58 -0500 |
| commit | 82ba818ff456bcd6d56a06226e3f27e98fbb55c3 (patch) | |
| tree | 158cfc17b2f644a10f063cb546752cfaae12c97f /devdocs/c/numeric%2Fmath%2Fmodf.html | |
| parent | 9278ddd4ea1a8b1a4c1edaa8894516e3f48d245b (diff) | |
| download | dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.tar.gz dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.zip | |
removing all downloaded devdocs files
Diffstat (limited to 'devdocs/c/numeric%2Fmath%2Fmodf.html')
| -rw-r--r-- | devdocs/c/numeric%2Fmath%2Fmodf.html | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/devdocs/c/numeric%2Fmath%2Fmodf.html b/devdocs/c/numeric%2Fmath%2Fmodf.html deleted file mode 100644 index 7ee360cd..00000000 --- a/devdocs/c/numeric%2Fmath%2Fmodf.html +++ /dev/null @@ -1,78 +0,0 @@ - <h1 id="firstHeading" class="firstHeading">modf, modff, modfl</h1> <table class="t-dcl-begin"> <tr class="t-dsc-header"> <th> Defined in header <code><math.h></code> </th> <th> </th> <th> </th> </tr> <tr class="t-dcl t-since-c99"> <td> <pre data-language="c">float modff( float arg, float* iptr );</pre> -</td> <td> (1) </td> <td> <span class="t-mark-rev t-since-c99">(since C99)</span> </td> </tr> <tr class="t-dcl"> <td> <pre data-language="c">double modf( double arg, double* iptr );</pre> -</td> <td> (2) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl t-since-c99"> <td> <pre data-language="c">long double modfl( long double arg, long double* iptr );</pre> -</td> <td> (3) </td> <td> <span class="t-mark-rev t-since-c99">(since C99)</span> </td> </tr> </table> <div class="t-li1"> -<span class="t-li">1-3)</span> Decomposes given floating point value <code>arg</code> into integral and fractional parts, each having the same type and sign as <code>arg</code>. The integral part (in floating-point format) is stored in the object pointed to by <code>iptr</code>.</div> <h3 id="Parameters"> Parameters</h3> <table class="t-par-begin"> <tr class="t-par"> <td> arg </td> <td> - </td> <td> floating point value </td> -</tr> <tr class="t-par"> <td> iptr </td> <td> - </td> <td> pointer to floating point value to store the integral part to </td> -</tr> -</table> <h3 id="Return_value"> Return value</h3> <p>If no errors occur, returns the fractional part of <code>x</code> with the same sign as <code>x</code>. The integral part is put into the value pointed to by <code>iptr</code>.</p> -<p>The sum of the returned value and the value stored in <code>*iptr</code> gives <code>arg</code> (allowing for rounding).</p> -<h3 id="Error_handling"> Error handling</h3> <p>This function is not subject to any errors specified in <a href="math_errhandling" title="c/numeric/math/math errhandling">math_errhandling</a>.</p> -<p>If the implementation supports IEEE floating-point arithmetic (IEC 60559),</p> -<ul> -<li> If <code>arg</code> is ±0, ±0 is returned, and ±0 is stored in <code>*iptr</code>. </li> -<li> If <code>arg</code> is ±∞, ±0 is returned, and ±∞ is stored in <code>*iptr</code>. </li> -<li> If <code>arg</code> is NaN, NaN is returned, and NaN is stored in <code>*iptr</code>. </li> -<li> The returned value is exact, <a href="../fenv/fe_round" title="c/numeric/fenv/FE round">the current rounding mode</a> is ignored </li> -</ul> <h3 id="Notes"> Notes</h3> <p>This function behaves as if implemented as follows:</p> -<div class="c source-c"><pre data-language="c">double modf(double value, double *iptr) -{ -#pragma STDC FENV_ACCESS ON - int save_round = fegetround(); - fesetround(FE_TOWARDZERO); - *iptr = std::nearbyint(value); - fesetround(save_round); - return copysign(isinf(value) ? 0.0 : value - (*iptr), value); -}</pre></div> <h3 id="Example"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include <stdio.h> -#include <math.h> -#include <float.h> - -int main(void) -{ - double f = 123.45; - printf("Given the number %.2f or %a in hex,\n", f, f); - - double f3; - double f2 = modf(f, &f3); - printf("modf() makes %.2f + %.2f\n", f3, f2); - - int i; - f2 = frexp(f, &i); - printf("frexp() makes %f * 2^%d\n", f2, i); - - i = ilogb(f); - printf("logb()/ilogb() make %f * %d^%d\n", f/scalbn(1.0, i), FLT_RADIX, i); - - // special values - f2 = modf(-0.0, &f3); - printf("modf(-0) makes %.2f + %.2f\n", f3, f2); - f2 = modf(-INFINITY, &f3); - printf("modf(-Inf) makes %.2f + %.2f\n", f3, f2); -}</pre></div> <p>Possible output:</p> -<div class="text source-text"><pre data-language="c">Given the number 123.45 or 0x1.edccccccccccdp+6 in hex, -modf() makes 123.00 + 0.45 -frexp() makes 0.964453 * 2^7 -logb()/ilogb() make 1.92891 * 2^6 -modf(-0) makes -0.00 + -0.00 -modf(-Inf) makes -INF + -0.00</pre></div> </div> <h3 id="References"> References</h3> <ul> -<li> C11 standard (ISO/IEC 9899:2011): </li> -<ul> -<li> 7.12.6.12 The modf functions (p: 246-247) </li> -<li> F.10.3.12 The modf functions (p: 523) </li> -</ul> -<li> C99 standard (ISO/IEC 9899:1999): </li> -<ul> -<li> 7.12.6.12 The modf functions (p: 227) </li> -<li> F.9.3.12 The modf functions (p: 460) </li> -</ul> -<li> C89/C90 standard (ISO/IEC 9899:1990): </li> -<ul><li> 4.5.4.6 The modf function </li></ul> -</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="trunc" title="c/numeric/math/trunc"> <span class="t-lines"><span>trunc</span><span>truncf</span><span>truncl</span></span></a></div> -<div><span class="t-lines"><span><span class="t-mark-rev t-since-c99">(C99)</span></span><span><span class="t-mark-rev t-since-c99">(C99)</span></span><span><span class="t-mark-rev t-since-c99">(C99)</span></span></span></div> </td> <td> rounds to nearest integer not greater in magnitude than the given value <br> <span class="t-mark">(function)</span> </td> -</tr> <tr class="t-dsc"> <td colspan="2"> <span><a href="https://en.cppreference.com/w/cpp/numeric/math/modf" title="cpp/numeric/math/modf">C++ documentation</a></span> for <code>modf</code> </td> -</tr> </table> <div class="_attribution"> - <p class="_attribution-p"> - © cppreference.com<br>Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.<br> - <a href="https://en.cppreference.com/w/c/numeric/math/modf" class="_attribution-link">https://en.cppreference.com/w/c/numeric/math/modf</a> - </p> -</div> |
