OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-newlib/] [newlib-1.17.0/] [newlib/] [libm/] [math/] [wf_cosh.c] - Blame information for rev 14

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 jlechner
/* wf_cosh.c -- float version of w_cosh.c.
2
 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
3
 */
4
 
5
/*
6
 * ====================================================
7
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
8
 *
9
 * Developed at SunPro, a Sun Microsystems, Inc. business.
10
 * Permission to use, copy, modify, and distribute this
11
 * software is freely granted, provided that this notice
12
 * is preserved.
13
 * ====================================================
14
 */
15
 
16
/*
17
 * wrapper coshf(x)
18
 */
19
 
20
#include "fdlibm.h"
21
#include <errno.h>
22
 
23
#ifdef __STDC__
24
        float coshf(float x)            /* wrapper coshf */
25
#else
26
        float coshf(x)                  /* wrapper coshf */
27
        float x;
28
#endif
29
{
30
#ifdef _IEEE_LIBM
31
        return __ieee754_coshf(x);
32
#else
33
        float z;
34
        struct exception exc;
35
        z = __ieee754_coshf(x);
36
        if(_LIB_VERSION == _IEEE_ || isnanf(x)) return z;
37
        if(fabsf(x)>(float)8.9415985107e+01) {
38
            /* coshf(finite) overflow */
39
#ifndef HUGE_VAL
40
#define HUGE_VAL inf
41
            double inf = 0.0;
42
 
43
            SET_HIGH_WORD(inf,0x7ff00000);      /* set inf to infinite */
44
#endif
45
            exc.type = OVERFLOW;
46
            exc.name = "coshf";
47
            exc.err = 0;
48
            exc.arg1 = exc.arg2 = (double)x;
49
            if (_LIB_VERSION == _SVID_)
50
               exc.retval = HUGE;
51
            else
52
               exc.retval = HUGE_VAL;
53
            if (_LIB_VERSION == _POSIX_)
54
               errno = ERANGE;
55
            else if (!matherr(&exc)) {
56
               errno = ERANGE;
57
            }
58
            if (exc.err != 0)
59
               errno = exc.err;
60
            return (float)exc.retval;
61
        } else
62
            return z;
63
#endif
64
}
65
 
66
#ifdef _DOUBLE_IS_32BITS
67
 
68
#ifdef __STDC__
69
        double cosh(double x)
70
#else
71
        double cosh(x)
72
        double x;
73
#endif
74
{
75
        return (double) coshf((float) x);
76
}
77
 
78
#endif /* defined(_DOUBLE_IS_32BITS) */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.