home *** CD-ROM | disk | FTP | other *** search
- / hypot.s (emx+gcc) -- Copyright (c) 1992-1993 by Eberhard Mattes
-
- / As the arguments are double and the computation is done in extended
- / format, an interative method is not required to avoid overflow.
-
- #include <libm.h>
-
- .globl _hypot
-
- .text
-
- .align 2, 0x90
-
- / double hypot (double x, double y)
-
- #define x 4(%esp)
- #define y 12(%esp)
-
- _hypot:
- fldl x / x
- fld %st / x, x
- fmulp / x*x
- fldl y / y, x*x
- fld %st / y, y, x*x
- fmulp / y*y, x*x
- faddp / y*y + x*x
- fsqrt / hypot (x, y)
- fstpl x / convert to double
- fldl x
- _xam
- j_inf 1f
- ret
-
- .align 2, 0x90
- 1: SETERRNO($ERANGE)
- ret
-