Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

163 lines
7.7KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <title>wcstod (The Red Hat newlib C Library)</title>
  7. <meta name="description" content="wcstod (The Red Hat newlib C Library)">
  8. <meta name="keywords" content="wcstod (The Red Hat newlib C Library)">
  9. <meta name="resource-type" content="document">
  10. <meta name="distribution" content="global">
  11. <meta name="Generator" content="makeinfo">
  12. <link href="index.html#Top" rel="start" title="Top">
  13. <link href="Document-Index.html#Document-Index" rel="index" title="Document Index">
  14. <link href="Document-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
  15. <link href="Stdlib.html#Stdlib" rel="up" title="Stdlib">
  16. <link href="wcstol.html#wcstol" rel="next" title="wcstol">
  17. <link href="wcsrtombs.html#wcsrtombs" rel="prev" title="wcsrtombs">
  18. <style type="text/css">
  19. <!--
  20. a.summary-letter {text-decoration: none}
  21. blockquote.indentedblock {margin-right: 0em}
  22. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  23. blockquote.smallquotation {font-size: smaller}
  24. div.display {margin-left: 3.2em}
  25. div.example {margin-left: 3.2em}
  26. div.lisp {margin-left: 3.2em}
  27. div.smalldisplay {margin-left: 3.2em}
  28. div.smallexample {margin-left: 3.2em}
  29. div.smalllisp {margin-left: 3.2em}
  30. kbd {font-style: oblique}
  31. pre.display {font-family: inherit}
  32. pre.format {font-family: inherit}
  33. pre.menu-comment {font-family: serif}
  34. pre.menu-preformatted {font-family: serif}
  35. pre.smalldisplay {font-family: inherit; font-size: smaller}
  36. pre.smallexample {font-size: smaller}
  37. pre.smallformat {font-family: inherit; font-size: smaller}
  38. pre.smalllisp {font-size: smaller}
  39. span.nolinebreak {white-space: nowrap}
  40. span.roman {font-family: initial; font-weight: normal}
  41. span.sansserif {font-family: sans-serif; font-weight: normal}
  42. ul.no-bullet {list-style: none}
  43. -->
  44. </style>
  45. </head>
  46. <body lang="en">
  47. <a name="wcstod"></a>
  48. <div class="header">
  49. <p>
  50. Next: <a href="wcstol.html#wcstol" accesskey="n" rel="next">wcstol</a>, Previous: <a href="wcsrtombs.html#wcsrtombs" accesskey="p" rel="prev">wcsrtombs</a>, Up: <a href="Stdlib.html#Stdlib" accesskey="u" rel="up">Stdlib</a> &nbsp; [<a href="Document-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Document-Index.html#Document-Index" title="Index" rel="index">Index</a>]</p>
  51. </div>
  52. <hr>
  53. <a name="wcstod_002c-wcstof_002c-wcstold_002c-wcstod_005fl_002c-wcstof_005fl_002c-wcstold_005fl_002d_002d_002dwide-char-string-to-double-or-float"></a>
  54. <h3 class="section">2.43 <code>wcstod</code>, <code>wcstof</code>, <code>wcstold</code>, <code>wcstod_l</code>, <code>wcstof_l</code>, <code>wcstold_l</code>&mdash;wide char string to double or float</h3>
  55. <a name="index-wcstod"></a>
  56. <a name="index-wcstof"></a>
  57. <a name="index-wcstold"></a>
  58. <a name="index-wcstod_005fl"></a>
  59. <a name="index-wcstof_005fl"></a>
  60. <a name="index-wcstold_005fl"></a>
  61. <a name="index-_005fwcstod_005fr"></a>
  62. <a name="index-_005fwcstof_005fr"></a>
  63. <p><strong>Synopsis</strong>
  64. </p><div class="example">
  65. <pre class="example">#include &lt;stdlib.h&gt;
  66. double wcstod(const wchar_t *__restrict <var>str</var>,
  67. wchar_t **__restrict <var>tail</var>);
  68. float wcstof(const wchar_t *__restrict <var>str</var>,
  69. wchar_t **__restrict <var>tail</var>);
  70. long double wcstold(const wchar_t *__restrict <var>str</var>,
  71. wchar_t **__restrict <var>tail</var>);
  72. #include &lt;stdlib.h&gt;
  73. double wcstod_l(const wchar_t *__restrict <var>str</var>,
  74. wchar_t **__restrict <var>tail</var>, locale_t <var>locale</var>);
  75. float wcstof_l(const wchar_t *__restrict <var>str</var>,
  76. wchar_t **__restrict <var>tail</var>, locale_t <var>locale</var>);
  77. long double wcstold_l(const wchar_t *__restrict <var>str</var>,
  78. wchar_t **__restrict <var>tail</var>,
  79. locale_t <var>locale</var>);
  80. double _wcstod_r(void *<var>reent</var>,
  81. const wchar_t *<var>str</var>, wchar_t **<var>tail</var>);
  82. float _wcstof_r(void *<var>reent</var>,
  83. const wchar_t *<var>str</var>, wchar_t **<var>tail</var>);
  84. </pre></div>
  85. <p><strong>Description</strong><br>
  86. <code>wcstod</code>, <code>wcstof</code>, <code>wcstold</code> parse the wide-character string
  87. <var>str</var>, producing a substring which can be converted to a double,
  88. float, or long double value. The substring converted is the longest
  89. initial subsequence of <var>str</var>, beginning with the first non-whitespace
  90. character, that has one of these formats:
  91. </p><div class="smallexample">
  92. <pre class="smallexample">[+|-]<var>digits</var>[.[<var>digits</var>]][(e|E)[+|-]<var>digits</var>]
  93. [+|-].<var>digits</var>[(e|E)[+|-]<var>digits</var>]
  94. [+|-](i|I)(n|N)(f|F)[(i|I)(n|N)(i|I)(t|T)(y|Y)]
  95. [+|-](n|N)(a|A)(n|N)[&lt;(&gt;[<var>hexdigits</var>]&lt;)&gt;]
  96. [+|-]0(x|X)<var>hexdigits</var>[.[<var>hexdigits</var>]][(p|P)[+|-]<var>digits</var>]
  97. [+|-]0(x|X).<var>hexdigits</var>[(p|P)[+|-]<var>digits</var>]
  98. </pre></div>
  99. <p>The substring contains no characters if <var>str</var> is empty, consists
  100. entirely of whitespace, or if the first non-whitespace
  101. character is something other than <code>+</code>, <code>-</code>, <code>.</code>, or a
  102. digit, and cannot be parsed as infinity or NaN. If the platform
  103. does not support NaN, then NaN is treated as an empty substring.
  104. If the substring is empty, no conversion is done, and
  105. the value of <var>str</var> is stored in <code>*<var>tail</var></code>. Otherwise,
  106. the substring is converted, and a pointer to the final string
  107. (which will contain at least the terminating null character of
  108. <var>str</var>) is stored in <code>*<var>tail</var></code>. If you want no
  109. assignment to <code>*<var>tail</var></code>, pass a null pointer as <var>tail</var>.
  110. </p>
  111. <p>This implementation returns the nearest machine number to the
  112. input decimal string. Ties are broken by using the IEEE
  113. round-even rule. However, <code>wcstof</code> is currently subject to
  114. double rounding errors.
  115. </p>
  116. <p><code>wcstod_l</code>, <code>wcstof_l</code>, <code>wcstold_l</code> are like <code>wcstod</code>,
  117. <code>wcstof</code>, <code>wcstold</code> but perform the conversion based on the
  118. locale specified by the locale object locale. If <var>locale</var> is
  119. LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is
  120. undefined.
  121. </p>
  122. <p>The alternate functions <code>_wcstod_r</code> and <code>_wcstof_r</code> are
  123. reentrant versions of <code>wcstod</code> and <code>wcstof</code>, respectively.
  124. The extra argument <var>reent</var> is a pointer to a reentrancy structure.
  125. </p>
  126. <br>
  127. <p><strong>Returns</strong><br>
  128. Return the converted substring value, if any. If
  129. no conversion could be performed, 0 is returned. If the
  130. correct value is out of the range of representable values,
  131. plus or minus <code>HUGE_VAL</code> is returned, and <code>ERANGE</code> is
  132. stored in errno. If the correct value would cause underflow, 0
  133. is returned and <code>ERANGE</code> is stored in errno.
  134. </p>
  135. <br>
  136. <p><strong>Portability</strong><br>
  137. <code>wcstod</code> is ANSI.
  138. <code>wcstof</code>, <code>wcstold</code> are C99.
  139. <code>wcstod_l</code>, <code>wcstof_l</code>, <code>wcstold_l</code> are GNU extensions.
  140. </p>
  141. <p>Supporting OS subroutines required: <code>close</code>, <code>fstat</code>, <code>isatty</code>,
  142. <code>lseek</code>, <code>read</code>, <code>sbrk</code>, <code>write</code>.
  143. </p>
  144. <br>
  145. <hr>
  146. <div class="header">
  147. <p>
  148. Next: <a href="wcstol.html#wcstol" accesskey="n" rel="next">wcstol</a>, Previous: <a href="wcsrtombs.html#wcsrtombs" accesskey="p" rel="prev">wcsrtombs</a>, Up: <a href="Stdlib.html#Stdlib" accesskey="u" rel="up">Stdlib</a> &nbsp; [<a href="Document-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Document-Index.html#Document-Index" title="Index" rel="index">Index</a>]</p>
  149. </div>
  150. </body>
  151. </html>