/ cos.s (emx+gcc) -- Copyright (c) 1992-1993 by Steffen Haecker
/                    Modified 1993 by Eberhard Mattes

#include <libm.h>

        .globl  FUN(cos)

        .text

        .align  2, 0x90

/ double cos (double x)
/
/ |x| >= 2^63 results in #NAN; errno is set to EDOM
/

#define x       4(%esp)

DEF(cos)
        FLD     x                       / x
        fcos                            / cos(x)
        fstsww  %ax
        testb   $0x04, %ah                              
        jnz     1f                      / C2 != 0 ?
        ret

1:      fldl    __const_NAN             / #NAN
        fstp    %st(1)
        SETERRNO($EDOM)
        ret
