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 / sqrtl.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-26  |  981 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. /* Return the sqrt root of x.  */
  21.  
  22. long double
  23. DEFUN(sqrtl, (x), long double x)
  24. {
  25.   const long double zero = 0.0L;
  26.  
  27.   if (x >= zero) {
  28.     if (x != zero) {
  29.     __asm__ __volatile__ ("fsqrt"
  30.               :"=t" (x) : "0" (x));
  31.     }
  32.     return x;
  33.   }
  34.   else return __infnanl( EDOM);
  35. }
  36.