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

Subversion Repositories or1k

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

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

Line No. Rev Author Line
1 39 lampret
/* 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
            if (_LIB_VERSION == _SVID_)
48
               exc.retval = ( (x>0.0) ? HUGE : -HUGE);
49
            else
50
               exc.retval = ( (x>0.0) ? HUGE_VAL : -HUGE_VAL);
51
            if (_LIB_VERSION == _POSIX_)
52
               errno = ERANGE;
53
            else if (!matherr(&exc)) {
54
               errno = ERANGE;
55
            }
56
            if (exc.err != 0)
57
               errno = exc.err;
58
            return (float)exc.retval;
59
        } else
60
            return z;
61
#endif
62
}
63
 
64
#ifdef _DOUBLE_IS_32BITS
65
 
66
#ifdef __STDC__
67
        double sinh(double x)
68
#else
69
        double sinh(x)
70
        double x;
71
#endif
72
{
73
        return (double) sinhf((float) x);
74
}
75
 
76
#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.