cexp.3 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. .\" Copyright (c) 2011 David Schultz <[email protected]>
  2. .\" All rights reserved.
  3. .\"
  4. .\" Redistribution and use in source and binary forms, with or without
  5. .\" modification, are permitted provided that the following conditions
  6. .\" are met:
  7. .\" 1. Redistributions of source code must retain the above copyright
  8. .\" notice, this list of conditions and the following disclaimer.
  9. .\" 2. Redistributions in binary form must reproduce the above copyright
  10. .\" notice, this list of conditions and the following disclaimer in the
  11. .\" documentation and/or other materials provided with the distribution.
  12. .\"
  13. .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  14. .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  15. .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  16. .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  17. .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  18. .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  19. .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  20. .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  21. .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  22. .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. .\" SUCH DAMAGE.
  24. .\"
  25. .\" $FreeBSD: src/lib/msun/man/cexp.3,v 1.1 2011/03/07 03:09:24 das Exp $
  26. .\"
  27. .Dd March 6, 2011
  28. .Dt CEXP 3
  29. .Os
  30. .Sh NAME
  31. .Nm cexp ,
  32. .Nm cexpf
  33. .Nd complex exponential functions
  34. .Sh LIBRARY
  35. .Lb libm
  36. .Sh SYNOPSIS
  37. .In complex.h
  38. .Ft double complex
  39. .Fn cexp "double complex z"
  40. .Ft float complex
  41. .Fn cexpf "float complex z"
  42. .Sh DESCRIPTION
  43. The
  44. .Fn cexp
  45. and
  46. .Fn cexpf
  47. functions compute the complex exponential of
  48. .Fa z ,
  49. also known as
  50. .Em cis Ns ( Ns
  51. .Fa z Ns )
  52. .Sh RETURN VALUES
  53. For real numbers
  54. .Fa x
  55. and
  56. .Fa y ,
  57. .Fn cexp
  58. behaves according to Euler's formula:
  59. .Bd -ragged -offset indent
  60. .Fn cexp "x + I*y"
  61. =
  62. .Ns ( Sy e Ns ** Ns
  63. .Fa x *
  64. .Em cos Ns ( Ns
  65. .Fa y Ns )) + ( Ns
  66. .Sy I
  67. *
  68. .Sy e Ns ** Ns
  69. .Fa x
  70. *
  71. .Em sin Ns ( Ns
  72. .Fa y Ns ))
  73. .Ed
  74. .Pp
  75. Generally speaking, infinities, zeroes and \*(Nas are handled as would
  76. be expected from this identity given the usual rules of floating-point
  77. arithmetic.
  78. However, care is taken to avoid generating \*(Nas when they are not deserved.
  79. For example, mathematically we expect that
  80. .Fo cimag
  81. .Fn cexp "x + I*0" Fc
  82. = 0 regardless of the value of
  83. .Fa x ,
  84. and
  85. .Fn cexp
  86. preserves this identity even if
  87. .Fa x
  88. is \*(If or \*(Na.
  89. Likewise,
  90. .Fn cexp "-\*(If + I*y"
  91. = 0 and
  92. .Fo creal
  93. .Fn cexp "\*(If + I*y" Fc
  94. = \*(If
  95. for any
  96. .Fa y
  97. (even though the latter property is only mathematically true for
  98. representable
  99. .Fa y . )
  100. If
  101. .Fa y
  102. is not finite, the sign of the result is indeterminate.
  103. .Sh SEE ALSO
  104. .Xr complex 3 ,
  105. .Xr exp 3 ,
  106. .Xr math 3 ,
  107. .Sh STANDARDS
  108. The
  109. .Fn cexp
  110. and
  111. .Fn cexpf
  112. functions conform to
  113. .St -isoC-99 .