math-library-conversion-functions.html 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <html lang="en">
  2. <head>
  3. <title>math library conversion functions - avram - a virtual machine code interpreter</title>
  4. <meta http-equiv="Content-Type" content="text/html">
  5. <meta name="description" content="avram - a virtual machine code interpreter">
  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="prev" href="math-library-predicates.html#math-library-predicates" title="math library predicates">
  10. <link rel="next" href="math-library-exceptions.html#math-library-exceptions" title="math library exceptions">
  11. <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
  12. <meta http-equiv="Content-Style-Type" content="text/css">
  13. <style type="text/css"><!--
  14. pre.display { font-family:inherit }
  15. pre.format { font-family:inherit }
  16. pre.smalldisplay { font-family:inherit; font-size:smaller }
  17. pre.smallformat { font-family:inherit; font-size:smaller }
  18. pre.smallexample { font-size:smaller }
  19. pre.smalllisp { font-size:smaller }
  20. span.sc { font-variant:small-caps }
  21. span.roman { font-family:serif; font-weight:normal; }
  22. span.sansserif { font-family:sans-serif; font-weight:normal; }
  23. --></style>
  24. </head>
  25. <body>
  26. <div class="node">
  27. <a name="math-library-conversion-functions"></a>
  28. <p>
  29. Next:&nbsp;<a rel="next" accesskey="n" href="math-library-exceptions.html#math-library-exceptions">math library exceptions</a>,
  30. Previous:&nbsp;<a rel="previous" accesskey="p" href="math-library-predicates.html#math-library-predicates">math library predicates</a>,
  31. Up:&nbsp;<a rel="up" accesskey="u" href="math.html#math">math</a>
  32. <hr>
  33. </div>
  34. <h4 class="subsection">D.11.3 <code>math</code> library conversion functions</h4>
  35. <p>The conversion function <code>strtod</code> takes a string representing a
  36. <a name="index-strtod-769"></a>floating point number in C format to its representation. This function
  37. is the primary means of creating or initializing floating point
  38. numbers in virtual code. A value of floating point 0.0 is returned if
  39. the string is not valid, but no exception is raised.
  40. <p>The conversion <code>asprintf</code> is similar to the one by that name in
  41. <a name="index-asprintf-770"></a>C, but requires a pair <code>(</code><var>f</var><code>,</code><var>x</var><code>)</code> as an argument. The
  42. left side <var>f</var> is a character string containing a C style format
  43. conversion for exactly one double precision floating point number,
  44. such as <code>'%0.4e'</code>, and the parameter <var>x</var> is a floating point
  45. number. The result returned will be a character string expressing the
  46. number in the specified format.
  47. </body></html>