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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [newlib/] [libm/] [math/] [s_ldexp.c] - Blame information for rev 158

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

Line No. Rev Author Line
1 148 jeremybenn
 
2
/* @(#)s_ldexp.c 5.1 93/09/24 */
3
/*
4
 * ====================================================
5
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6
 *
7
 * Developed at SunPro, a Sun Microsystems, Inc. business.
8
 * Permission to use, copy, modify, and distribute this
9
 * software is freely granted, provided that this notice
10
 * is preserved.
11
 * ====================================================
12
 */
13
 
14
/*
15
FUNCTION
16
       <<ldexp>>, <<ldexpf>>---load exponent
17
 
18
INDEX
19
        ldexp
20
INDEX
21
        ldexpf
22
 
23
ANSI_SYNOPSIS
24
       #include <math.h>
25
       double ldexp(double <[val]>, int <[exp]>);
26
       float ldexpf(float <[val]>, int <[exp]>);
27
 
28
TRAD_SYNOPSIS
29
       #include <math.h>
30
 
31
       double ldexp(<[val]>, <[exp]>)
32
              double <[val]>;
33
              int <[exp]>;
34
 
35
       float ldexpf(<[val]>, <[exp]>)
36
              float <[val]>;
37
              int <[exp]>;
38
 
39
 
40
DESCRIPTION
41
<<ldexp>> calculates the value
42
@ifnottex
43
<[val]> times 2 to the power <[exp]>.
44
@end ifnottex
45
@tex
46
$val\times 2^{exp}$.
47
@end tex
48
<<ldexpf>> is identical, save that it takes and returns <<float>>
49
rather than <<double>> values.
50
 
51
RETURNS
52
<<ldexp>> returns the calculated value.
53
 
54
Underflow and overflow both set <<errno>> to <<ERANGE>>.
55
On underflow, <<ldexp>> and <<ldexpf>> return 0.0.
56
On overflow, <<ldexp>> returns plus or minus <<HUGE_VAL>>.
57
 
58
PORTABILITY
59
<<ldexp>> is ANSI. <<ldexpf>> is an extension.
60
 
61
*/
62
 
63
#include "fdlibm.h"
64
#include <errno.h>
65
 
66
#ifndef _DOUBLE_IS_32BITS
67
 
68
#ifdef __STDC__
69
        double ldexp(double value, int exp)
70
#else
71
        double ldexp(value, exp)
72
        double value; int exp;
73
#endif
74
{
75
        if(!finite(value)||value==0.0) return value;
76
        value = scalbn(value,exp);
77
        if(!finite(value)||value==0.0) errno = ERANGE;
78
        return value;
79
}
80
 
81
#endif /* _DOUBLE_IS_32BITS */

powered by: WebSVN 2.1.0

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