home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / glibc-1.06 / sysdeps / mips / sqrt.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-14  |  1.3 KB  |  40 lines

  1. /* Copyright (C) 1992 Free Software Foundation, Inc.
  2.    Contributed by Brendan Kehoe (brendan@cs.widener.edu).
  3.  
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public License as
  6. published by the Free Software Foundation; either version 2 of the
  7. License, or (at your option) any later version.
  8.  
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. Library General Public License for more details.
  13.  
  14. You should have received a copy of the GNU Library General Public
  15. License along with the GNU C Library; see the file COPYING.LIB.  If
  16. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. Cambridge, MA 02139, USA.  */
  18.  
  19. #ifndef HAVE_GNU_AS
  20. #include <ansidecl.h>
  21. #include <errno.h>
  22. #include <math.h>
  23.  
  24. #ifndef    __GNUC__
  25.   #error This file uses GNU C extensions; you must compile with GCC.
  26. #endif
  27.  
  28. /* Return the square root of X.  */
  29. double
  30. DEFUN(sqrt, (x), double x)
  31. {
  32.   register double result;
  33.   asm("sqrt.d %1, %0" : "=f" (result) : "f" (x));
  34.   return result;
  35. }
  36. #else
  37. /* GAS (2.0) can't handle the `sqrt.d' synthetic instruction.  */
  38. #include <sysdeps/ieee754/sqrt.c>
  39. #endif
  40.