home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / LIBC / LIBC-4.6 / LIBC-4 / libc-linux / sysdeps / linux / i386 / math / acosl.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-26  |  1.1 KB  |  42 lines

  1. /* Copyright (C) 1993  Hongjiu Lu
  2.    Changed by Olaf Flebbe for long double
  3. This file is part of the Linux C Library.
  4.  
  5. The Linux C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Library General Public License as
  7. published by the Free Software Foundation; either version 2 of the
  8. License, or (at your option) any later version.
  9.  
  10. The Linux C Library is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13. Library General Public License for more details.  */
  14.  
  15. #include <ansidecl.h>
  16. #include <fp.h>
  17. #include <errno.h>
  18. #include "mathl.h"
  19.  
  20. long double
  21. DEFUN(acosl, (x), long double x)
  22. {
  23.   if (x <= -1.0L ) {
  24.     if (x == -1.0L) {
  25.       return 3.14159265358979323846L;
  26.     }
  27.     return __infnanl( EDOM);
  28.   } 
  29.  
  30.   if (x >= 1.0L ) {
  31.     if (x == 1.0L) {
  32.       return 0.0L;
  33.     }
  34.     return __infnanl( EDOM);
  35.   } 
  36.  
  37.   x = sqrtl ((1.0L - x) / (1.0L + x));
  38.   __asm__ __volatile__ ("fpatan"
  39.             :"=t" (x) : "0" (1.0L), "u" (x));
  40.   return x + x;
  41. }
  42.