1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
<html>
<head>
<title>
Handbuch der Java-Programmierung, 5. Auflage
</title>
</head>
<body>
<a name="startofbody"></a>
<script language="JavaScript" src="hjp4lib.js">
</script>
<script language="JavaScript">
installKbdHandler("97,#startofbody;101,#endofbody;116,cover.html;122,k100003.html;115,search.html;105,index.html;100,JDKDOCS;112,APIDOCS;104,k100114.html;106,k100115.html;107,k100117.html;108,k100120.html");
</script>
<table border=0 cellpadding=0 cellspacing=1 width="100%">
<tr bgcolor="#EEFFCC">
<td width="7%" align=center bgcolor="#DDCC99"><a href="cover.html"> Titel </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100003.html"> Inhalt </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="search.html"> Suchen </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="index.html"> Index </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="../jdkdocs/index.html" onClick="this.href=getDocIndex()"> DOC </a>
<td align="right">Handbuch der Java-Programmierung, 5. Auflage
<tr bgcolor="#EEFFCC">
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100114.html"> << </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100115.html"> < </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100117.html"> > </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100120.html"> >> </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="../jdkdocs/api/index.html" onClick="this.href=getApiIndex()"> API </a>
<td align="right">Kapitel 17 - Utility-Klassen II
</table>
<hr>
<!-- Section -->
<a name="sectlevel2id017002"></a>
<h2>17.2 Die Klasse Math </h2>
<hr>
<ul>
<li><a href="k100116.html#sectlevel2id017002">17.2 Die Klasse Math</a>
<ul>
<li><a href="k100116.html#sectlevel3id017002001">17.2.1 Winkelfunktionen</a>
<li><a href="k100116.html#sectlevel3id017002002">17.2.2 Minimum und Maximum</a>
<li><a href="k100116.html#sectlevel3id017002003">17.2.3 Arithmetik</a>
<li><a href="k100116.html#sectlevel3id017002004">17.2.4 Runden und Abschneiden</a>
</ul>
</ul>
<hr>
<p>
Die Klasse <a name="ixa101145"><a href="index_m.html#ixb100436"><font color=#000080><tt>Math</tt></font></a></a>
aus dem Paket <a href="index_j.html#ixb100188"><font color=#000080><tt>java.lang</tt></font></a>
enthält Methoden zur Fließkomma-Arithmetik. Alle Methoden
dieser Klasse sind <a href="index_s.html#ixb100422"><font color=#000080><tt>static</tt></font></a>
und können daher ohne konkretes Objekt verwendet werden. Nachfolgend
wollen wir die wichtigsten von ihnen auflisten und eine kurze Beschreibung
ihrer Funktionsweise geben.
<!-- Section -->
<a name="sectlevel3id017002001"></a>
<h3>17.2.1 <a name="ixa101146">Winkelfunktionen</a></h3>
<p>
<a href="index_m.html#ixb100436"><font color=#000080><tt>java.lang.Math</tt></font></a>
stellt die üblichen Winkelfunktionen und ihre Umkehrungen zur
Verfügung. Winkelwerte werden dabei im Bogenmaß übergeben.
<a name="ixa101147"></a> <a name="ixa101148"></a> <a name="ixa101149"></a>
<a name="ixa101150"></a> <a name="ixa101151"></a> <a name="ixa101152"></a>
<p>
<table border=0 cellspacing=0 cellpadding=0 width=100% bgcolor="#EEFFCC">
<tr>
<td valign=top width=100%>
<font color="#660066">
<pre>
public static double sin(double x)
public static double cos(double x)
public static double tan(double x)
public static double asin(double x)
public static double acos(double x)
public static double atan(double x)
</pre>
</font>
</td>
<td valign=top>
<a href="../jdkdocs/api/java/lang/Math.html" onClick="this.href=getApiDoc('java.lang.Math')"><font color="#660066" size=-1>java.lang.Math</font></a></td>
</tr>
</table>
<!-- Section -->
<a name="sectlevel3id017002002"></a>
<h3>17.2.2 <a name="ixa101153">Minimum und Maximum</a></h3>
<p>
Die Methoden <a name="ixa101154"><a href="index_m.html#ixb100881"><font color=#000080><tt>min</tt></font></a></a>
und <a name="ixa101155"><a href="index_m.html#ixb100882"><font color=#000080><tt>max</tt></font></a></a>
erwarten zwei numerische Werte als Argument und geben das kleinere
bzw. größere von beiden zurück.
<p>
<table border=0 cellspacing=0 cellpadding=0 width=100% bgcolor="#EEFFCC">
<tr>
<td valign=top width=100%>
<font color="#660066">
<pre>
public static int min(int a, int b)
public static long min(long a, long b)
public static float min(float a, float b)
public static double min(double a, double b)
public static int max(int a, int b)
public static long max(long a, long b)
public static float max(float a, float b)
public static double max(double a, double b)
</pre>
</font>
</td>
<td valign=top>
<a href="../jdkdocs/api/java/lang/Math.html" onClick="this.href=getApiDoc('java.lang.Math')"><font color="#660066" size=-1>java.lang.Math</font></a></td>
</tr>
</table>
<!-- Section -->
<a name="sectlevel3id017002003"></a>
<h3>17.2.3 Arithmetik </h3>
<p>
Die nachfolgend aufgelisteten Methoden dienen zur Berechnung der <a name="ixa101156">Exponentialfunktion</a>
zur Basis <i>e</i>, zur Berechnung des natürlichen <a name="ixa101157">Logarithmus</a>
und zur Berechnung der Exponentialfunktion zu einer beliebigen Basis.
Mit <a href="index_s.html#ixb100437"><font color=#000080><tt>sqrt</tt></font></a>
kann die Quadratwurzel berechnet werden. <a name="ixa101158"></a>
<a name="ixa101159"></a> <a name="ixa101160"></a> <a name="ixa101161"></a>
<p>
<table border=0 cellspacing=0 cellpadding=0 width=100% bgcolor="#EEFFCC">
<tr>
<td valign=top width=100%>
<font color="#660066">
<pre>
public static double exp(double a)
public static double log(double a)
throws ArithmeticException
public static double pow(double a, double b)
throws ArithmeticException
public static double sqrt(double a)
throws ArithmeticException
</pre>
</font>
</td>
<td valign=top>
<a href="../jdkdocs/api/java/lang/Math.html" onClick="this.href=getApiDoc('java.lang.Math')"><font color="#660066" size=-1>java.lang.Math</font></a></td>
</tr>
</table>
<!-- Section -->
<a name="sectlevel3id017002004"></a>
<h3>17.2.4 <a name="ixa101162">Runden und Abschneiden</a></h3>
<p>
Mit Hilfe der Methode <a name="ixa101163"><a href="index_a.html#ixb100790"><font color=#000080><tt>abs</tt></font></a></a>
wird der absolute Betrag eines numerischen Werts bestimmt. <a name="ixa101164"><a href="index_c.html#ixb100889"><font color=#000080><tt>ceil</tt></font></a></a>
liefert die kleinste ganze Zahl größer und <a name="ixa101165"><a href="index_f.html#ixb100890"><font color=#000080><tt>floor</tt></font></a></a>
die größte ganze Zahl kleiner oder gleich dem übergebenen
Argument. Mit Hilfe von <a name="ixa101166"><a href="index_r.html#ixb100891"><font color=#000080><tt>round</tt></font></a></a>
kann ein Wert gerundet werden.
<p>
<table border=0 cellspacing=0 cellpadding=0 width=100% bgcolor="#EEFFCC">
<tr>
<td valign=top width=100%>
<font color="#660066">
<pre>
public static int abs(int a)
public static long abs(long a)
public static float abs(float a)
public static double abs(double a)
public static double ceil(double a)
public static double floor(double a)
public static int round(float a)
</pre>
</font>
</td>
<td valign=top>
<a href="../jdkdocs/api/java/lang/Math.html" onClick="this.href=getApiDoc('java.lang.Math')"><font color="#660066" size=-1>java.lang.Math</font></a></td>
</tr>
</table>
<hr>
<table border=0 cellpadding=0 cellspacing=1 width="100%">
<tr bgcolor="#EEFFCC">
<td width="7%" align=center bgcolor="#DDCC99"><a href="cover.html"> Titel </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100003.html"> Inhalt </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="search.html"> Suchen </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="index.html"> Index </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="../jdkdocs/index.html" onClick="this.href=getDocIndex()"> DOC </a>
<td align="right">Handbuch der Java-Programmierung, 5. Auflage, Addison
Wesley, Version 5.0.1
<tr bgcolor="#EEFFCC">
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100114.html"> << </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100115.html"> < </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100117.html"> > </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="k100120.html"> >> </a>
<td width="7%" align=center bgcolor="#DDCC99"><a href="../jdkdocs/api/index.html" onClick="this.href=getApiIndex()"> API </a>
<td align="right">© 1998, 2007 Guido Krüger & Thomas
Stark, <a href="http://www.javabuch.de">http://www.javabuch.de</a>
</table>
<a name="endofbody"></a>
</body>
</html>
|