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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libm/] [math/] [wf_sinh.c] - Blame information for rev 1773

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

Line No. Rev Author Line
1 1010 ivang
/* wf_sinh.c -- float version of w_sinh.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 sinhf(x)
18
 */
19
 
20
#include "fdlibm.h"
21
#include <errno.h>
22
 
23
#ifdef __STDC__
24
        float sinhf(float x)            /* wrapper sinhf */
25
#else
26
        float sinhf(x)                  /* wrapper sinhf */
27
        float x;
28
#endif
29
{
30
#ifdef _IEEE_LIBM
31
        return __ieee754_sinhf(x);
32
#else
33
        float z;
34
        struct exception exc;
35
        z = __ieee754_sinhf(x);
36
        if(_LIB_VERSION == _IEEE_) return z;
37
        if(!finitef(z)&&finitef(x)) {
38
            /* sinhf(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 = "sinhf";
47
            exc.err = 0;
48
            exc.arg1 = exc.arg2 = (double)x;
49
            if (_LIB_VERSION == _SVID_)
50
               exc.retval = ( (x>0.0) ? HUGE : -HUGE);
51
            else
52
               exc.retval = ( (x>0.0) ? HUGE_VAL : -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 sinh(double x)
70
#else
71
        double sinh(x)
72
        double x;
73
#endif
74
{
75
        return (double) sinhf((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.