s_cacosf.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* $OpenBSD: s_cacosf.c,v 1.2 2011/07/20 19:28:33 martynas Exp $ */
  2. /*
  3. * Copyright (c) 2008 Stephen L. Moshier <steve@moshier.net>
  4. *
  5. * Permission to use, copy, modify, and distribute this software for any
  6. * purpose with or without fee is hereby granted, provided that the above
  7. * copyright notice and this permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  10. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  12. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  13. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  14. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  15. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. */
  17. /* cacosf()
  18. *
  19. * Complex circular arc cosine
  20. *
  21. *
  22. *
  23. * SYNOPSIS:
  24. *
  25. * void cacosf();
  26. * cmplxf z, w;
  27. *
  28. * cacosf( &z, &w );
  29. *
  30. *
  31. *
  32. * DESCRIPTION:
  33. *
  34. *
  35. * w = arccos z = PI/2 - arcsin z.
  36. *
  37. *
  38. *
  39. *
  40. * ACCURACY:
  41. *
  42. * Relative error:
  43. * arithmetic domain # trials peak rms
  44. * IEEE -10,+10 30000 9.2e-6 1.2e-6
  45. *
  46. */
  47. #include <openlibm_complex.h>
  48. #include <openlibm_math.h>
  49. float complex
  50. cacosf(float complex z)
  51. {
  52. float complex w;
  53. w = casinf( z );
  54. w = ((float)M_PI_2 - crealf (w)) - cimagf (w) * I;
  55. return (w);
  56. }