complex.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <html lang="en">
  2. <head>
  3. <title>complex - 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="External-Libraries.html#External-Libraries" title="External Libraries">
  9. <link rel="prev" href="bes.html#bes" title="bes">
  10. <link rel="next" href="fftw.html#fftw" title="fftw">
  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="complex"></a>
  28. <p>
  29. Next:&nbsp;<a rel="next" accesskey="n" href="fftw.html#fftw">fftw</a>,
  30. Previous:&nbsp;<a rel="previous" accesskey="p" href="bes.html#bes">bes</a>,
  31. Up:&nbsp;<a rel="up" accesskey="u" href="External-Libraries.html#External-Libraries">External Libraries</a>
  32. <hr>
  33. </div>
  34. <h3 class="section">D.2 <code>complex</code></h3>
  35. <p>Complex numbers are represented according to the ISO C standard as
  36. <a name="index-complex-numbers-711"></a>arrays of two IEEE double precision floating point numbers of 8 bytes
  37. each, with the number representing the real part first.
  38. <p>A small selection of operations on complex numbers is available by
  39. function calls of the form <code>library('complex',f)</code>. These
  40. functions are implemented by the host system's C library.
  41. <p>One example is <code>library('complex','create')</code> which takes a pair
  42. of floating point numbers <code>(</code><var>x</var><code>,</code><var>y</var><code>)</code> to a complex number
  43. whose real part is <var>x</var> and whose imaginary part is <var>y</var>.
  44. See <a href="math.html#math">math</a> for information about constructing floating point
  45. numbers.
  46. <p>Other than that, the <code>complex</code> library functions <code>f</code> fall
  47. into three main groups, which are the real valued unary operations,
  48. the complex valued unary operations, and the complex valued binary
  49. operations. All of these operations are designated by their standard C
  50. names as documented elsewhere, such as the GNU <code>libc</code> reference
  51. manual, except as noted.
  52. <dl>
  53. <dt>&bull; real valued unary operations<dd>
  54. <pre class="example">
  55. creal cimag cabs carg
  56. </pre>
  57. <br><dt>&bull; complex valued unary operations<dd>
  58. <pre class="example">
  59. ccos cexp clog conj csin csqrt
  60. ctan csinh ccosh ctanh casinh cacosh
  61. catanh casin cacos catan
  62. </pre>
  63. <br><dt>&bull; complex valued binary operations<dd>
  64. <pre class="example">
  65. cpow vid bus mul add sub div
  66. </pre>
  67. </dl>
  68. <p>The last four correspond to the C language operators <code>*</code>,
  69. <code>+</code>, <code>-</code>, and <code>/</code> for complex numbers. The functions
  70. named <code>vid</code> and <code>bus</code> are similar to <code>div</code> and
  71. <code>sub</code>, respectively, but with the operands interchanged. That is,
  72. <pre class="example"> library('complex','vid') (x,y)
  73. </pre>
  74. <p class="noindent">is equivalent to
  75. <pre class="example"> library('complex','div') (y,x)
  76. </pre>
  77. <p>All functions in this library taking complex numbers as input may also
  78. operate on real numbers, and binary operators can have either or both
  79. operands real. For real operands, a value of zero is inferred as the
  80. imaginary part. The result type of the function is the same
  81. regardless.
  82. </body></html>