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 / acoshl.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-26  |  987 b   |  36 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(acoshl, (x), long double x)
  22. {
  23.   if (x <= 1.0L ) {
  24.     if (x == 1.0L) return 0.0L;
  25.     return __infnanl( EDOM);
  26.   } 
  27.  
  28.   x = x + sqrtl (x * x - 1.0L);
  29.  
  30.   __asm__ __volatile__ ("fldln2\n\t"
  31.               "fxch %%st(1)\n\t"
  32.               "fyl2x"
  33.             :"=t" (x) : "0" (x));
  34.   return x;
  35. }
  36.