s_cacosl.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* $OpenBSD: s_cacosl.c,v 1.3 2011/07/20 21:02:51 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. /* cacosl()
  18. *
  19. * Complex circular arc cosine
  20. *
  21. *
  22. *
  23. * SYNOPSIS:
  24. *
  25. * long double complex cacosl();
  26. * long double complex z, w;
  27. *
  28. * w = cacosl( z );
  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. * DEC -10,+10 5200 1.6e-15 2.8e-16
  45. * IEEE -10,+10 30000 1.8e-14 2.2e-15
  46. */
  47. #include <openlibm_complex.h>
  48. #include <openlibm_math.h>
  49. static const long double PIO2L = 1.570796326794896619231321691639751442098585L;
  50. long double complex
  51. cacosl(long double complex z)
  52. {
  53. long double complex w;
  54. w = casinl(z);
  55. w = (PIO2L - creall(w)) - cimagl(w) * I;
  56. return (w);
  57. }