/ log.s (emx+gcc) -- Copyright (c) 1991-2000 by Eberhard Mattes

#include <emx/asm386.h>

#define FUNC    MATHSUFFIX1(log)

        .globl  LABEL(FUNC)

        .text

        ALIGN

/ double log (double x)

#define x       4(%esp)

LABEL(FUNC):
        PROFILE_NOFRAME
        FLD     x                       /* x */
        fxam
        fstsww %ax
        andb    $0x47, %ah
        cmpb    $5, %ah
        je      Lreturn                 /* x = +INF => return x */
        fldl2e
        fdivrl  __const_ONE
        fxch    %st(1)
        fyl2x
        _xam
        j_nan   Lerror
        j_inf   Lerror
Lreturn:EPILOGUE(FUNC)

        ALIGN
Lerror: SET_ERRNO_CONST($EDOM)
        jmp     Lreturn
