Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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