OSDN Git Service

99b5fd6fab3f72ec445e2c10c464db3cf07a268b
[nxt-jsp/lejos_nxj.git] / nxtOSEK / lejos_nxj / docs / apidocs / java / lang / Float.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <!--NewPage-->
3 <HTML>
4 <HEAD>
5 <!-- Generated by javadoc (build 1.5.0_09) on Sun Jul 15 14:27:35 BST 2007 -->
6 <TITLE>
7 Float (leJOS NXT API documentation)
8 </TITLE>
9
10 <META NAME="keywords" CONTENT="java.lang.Float class">
11
12 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
13
14 <SCRIPT type="text/javascript">
15 function windowTitle()
16 {
17     parent.document.title="Float (leJOS NXT API documentation)";
18 }
19 </SCRIPT>
20 <NOSCRIPT>
21 </NOSCRIPT>
22
23 </HEAD>
24
25 <BODY BGCOLOR="white" onload="windowTitle();">
26
27
28 <!-- ========= START OF TOP NAVBAR ======= -->
29 <A NAME="navbar_top"><!-- --></A>
30 <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
31 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
32 <TR>
33 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
34 <A NAME="navbar_top_firstrow"><!-- --></A>
35 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
36   <TR ALIGN="center" VALIGN="top">
37   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
38   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
39   <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
40   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
41   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
42   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
43   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
44   </TR>
45 </TABLE>
46 </TD>
47 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
48 </EM>
49 </TD>
50 </TR>
51
52 <TR>
53 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
54 &nbsp;<A HREF="../../java/lang/Exception.html" title="class in java.lang"><B>PREV CLASS</B></A>&nbsp;
55 &nbsp;<A HREF="../../java/lang/IllegalArgumentException.html" title="class in java.lang"><B>NEXT CLASS</B></A></FONT></TD>
56 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
57   <A HREF="../../index.html?java/lang/Float.html" target="_top"><B>FRAMES</B></A>  &nbsp;
58 &nbsp;<A HREF="Float.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
59 &nbsp;<SCRIPT type="text/javascript">
60   <!--
61   if(window==top) {
62     document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
63   }
64   //-->
65 </SCRIPT>
66 <NOSCRIPT>
67   <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
68 </NOSCRIPT>
69
70
71 </FONT></TD>
72 </TR>
73 <TR>
74 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
75   SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
76 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
77 DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
78 </TR>
79 </TABLE>
80 <A NAME="skip-navbar_top"></A>
81 <!-- ========= END OF TOP NAVBAR ========= -->
82
83 <HR>
84 <!-- ======== START OF CLASS DATA ======== -->
85 <H2>
86 <FONT SIZE="-1">
87 java.lang</FONT>
88 <BR>
89 Class Float</H2>
90 <PRE>
91 <A HREF="../../java/lang/Object.html" title="class in java.lang">java.lang.Object</A>
92   <IMG SRC="../../resources/inherit.gif" ALT="extended by "><B>java.lang.Float</B>
93 </PRE>
94 <HR>
95 <DL>
96 <DT><PRE>public final class <B>Float</B><DT>extends <A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></DL>
97 </PRE>
98
99 <P>
100 Minimal Float implementation that supports 
101  floatToIntBits and intBitsToFloat
102 <P>
103
104 <P>
105 <DL>
106 <DT><B>Author:</B></DT>
107   <DD>Lawrie Griffiths</DD>
108 </DL>
109 <HR>
110
111 <P>
112
113 <!-- ========== METHOD SUMMARY =========== -->
114
115 <A NAME="method_summary"><!-- --></A>
116 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
117 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
118 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
119 <B>Method Summary</B></FONT></TH>
120 </TR>
121 <TR BGCOLOR="white" CLASS="TableRowColor">
122 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
123 <CODE>static&nbsp;int</CODE></FONT></TD>
124 <TD><CODE><B><A HREF="../../java/lang/Float.html#floatToIntBits(float)">floatToIntBits</A></B>(float&nbsp;value)</CODE>
125
126 <BR>
127 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the bit represention of a single-float value.</TD>
128 </TR>
129 <TR BGCOLOR="white" CLASS="TableRowColor">
130 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
131 <CODE>static&nbsp;float</CODE></FONT></TD>
132 <TD><CODE><B><A HREF="../../java/lang/Float.html#intBitsToFloat(int)">intBitsToFloat</A></B>(int&nbsp;value)</CODE>
133
134 <BR>
135 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the single-float corresponding to a given bit represention.</TD>
136 </TR>
137 </TABLE>
138 &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
139 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
140 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
141 <TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></B></TH>
142 </TR>
143 <TR BGCOLOR="white" CLASS="TableRowColor">
144 <TD><CODE><A HREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../java/lang/Object.html#toString()">toString</A>, <A HREF="../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../java/lang/Object.html#wait(long)">wait</A></CODE></TD>
145 </TR>
146 </TABLE>
147 &nbsp;
148 <P>
149
150 <!-- ============ METHOD DETAIL ========== -->
151
152 <A NAME="method_detail"><!-- --></A>
153 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
154 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
155 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
156 <B>Method Detail</B></FONT></TH>
157 </TR>
158 </TABLE>
159
160 <A NAME="floatToIntBits(float)"><!-- --></A><H3>
161 floatToIntBits</H3>
162 <PRE>
163 public static int <B>floatToIntBits</B>(float&nbsp;value)</PRE>
164 <DL>
165 <DD>Returns the bit represention of a single-float value.
166  The result is a representation of the floating-point argument 
167  according to the IEEE 754 floating-point "single 
168  precision" bit layout. 
169  <ul>
170  <li>Bit 31 (the bit that is selected by the mask 
171  <code>0x80000000</code>) represents the sign of the floating-point 
172  number. 
173  <li>Bits 30-23 (the bits that are selected by the mask 
174  <code>0x7f800000</code>) represent the exponent. 
175  <li>Bits 22-0 (the bits that are selected by the mask 
176  <code>0x007fffff</code>) represent the significand (sometimes called 
177  the mantissa) of the floating-point number. 
178  <li>If the argument is positive infinity, the result is 
179  <code>0x7f800000</code>. 
180  <li>If the argument is negative infinity, the result is 
181  <code>0xff800000</code>.
182  <p>
183  If the argument is NaN, the result is the integer
184  representing the actual NaN value.  The lejos implementation 
185  behaves like floatToRawIntBits and does not collapse NaN values.
186  </ul>
187  In all cases, the result is an integer that, when given to the 
188  <A HREF="../../java/lang/Float.html#intBitsToFloat(int)"><CODE>intBitsToFloat(int)</CODE></A> method, will produce a floating-point 
189  value equal to the argument to <code>floatToRawIntBits</code>.
190 <P>
191 <DD><DL>
192 <DT><B>Parameters:</B><DD><CODE>value</CODE> - a floating-point number.
193 <DT><B>Returns:</B><DD>the bits that represent the floating-point number.</DL>
194 </DD>
195 </DL>
196 <HR>
197
198 <A NAME="intBitsToFloat(int)"><!-- --></A><H3>
199 intBitsToFloat</H3>
200 <PRE>
201 public static float <B>intBitsToFloat</B>(int&nbsp;value)</PRE>
202 <DL>
203 <DD>Returns the single-float corresponding to a given bit represention.
204  The argument is considered to be a representation of a
205  floating-point value according to the IEEE 754 floating-point
206  "single precision" bit layout.
207  <p>
208  If the argument is <code>0x7f800000</code>, the result is positive
209  infinity.
210  <p>
211  If the argument is <code>0xff800000</code>, the result is negative
212  infinity.
213  <p>
214  If the argument is any value in the range <code>0x7f800001</code> 
215  through <code>0x7fffffff</code> or in the range 
216  <code>0xff800001</code> through <code>0xffffffff</code>, the result is 
217  NaN. All IEEE 754 NaN values of type <code>float</code> are, in effect,
218  lumped together by the Java programming language into a single 
219  <code>float</code> value called NaN.  Distinct values of NaN are only
220  accessible by use of the <code>Float.floatToRawIntBits</code> method.
221  <p>
222  In all other cases, let <i>s</i>, <i>e</i>, and <i>m</i> be three 
223  values that can be computed from the argument: 
224  <blockquote><pre>
225  int s = ((bits >> 31) == 0) ? 1 : -1;
226  int e = ((bits >> 23) & 0xff);
227  int m = (e == 0) ?
228                  (bits & 0x7fffff) << 1 :
229                  (bits & 0x7fffff) | 0x800000;
230  </pre></blockquote>
231  Then the floating-point result equals the value of the mathematical 
232  expression <i>s&#183;m&#183;2<sup>e-150</sup></i>.
233 <P>
234 <DD><DL>
235 <DT><B>Parameters:</B><DD><CODE>value</CODE> - an integer.
236 <DT><B>Returns:</B><DD>the single-format floating-point value with the same bit
237           pattern.</DL>
238 </DD>
239 </DL>
240 <!-- ========= END OF CLASS DATA ========= -->
241 <HR>
242
243
244 <!-- ======= START OF BOTTOM NAVBAR ====== -->
245 <A NAME="navbar_bottom"><!-- --></A>
246 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
247 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
248 <TR>
249 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
250 <A NAME="navbar_bottom_firstrow"><!-- --></A>
251 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
252   <TR ALIGN="center" VALIGN="top">
253   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
254   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
255   <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
256   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
257   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
258   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
259   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
260   </TR>
261 </TABLE>
262 </TD>
263 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
264 </EM>
265 </TD>
266 </TR>
267
268 <TR>
269 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
270 &nbsp;<A HREF="../../java/lang/Exception.html" title="class in java.lang"><B>PREV CLASS</B></A>&nbsp;
271 &nbsp;<A HREF="../../java/lang/IllegalArgumentException.html" title="class in java.lang"><B>NEXT CLASS</B></A></FONT></TD>
272 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
273   <A HREF="../../index.html?java/lang/Float.html" target="_top"><B>FRAMES</B></A>  &nbsp;
274 &nbsp;<A HREF="Float.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
275 &nbsp;<SCRIPT type="text/javascript">
276   <!--
277   if(window==top) {
278     document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
279   }
280   //-->
281 </SCRIPT>
282 <NOSCRIPT>
283   <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
284 </NOSCRIPT>
285
286
287 </FONT></TD>
288 </TR>
289 <TR>
290 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
291   SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
292 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
293 DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
294 </TR>
295 </TABLE>
296 <A NAME="skip-navbar_bottom"></A>
297 <!-- ======== END OF BOTTOM NAVBAR ======= -->
298
299 <HR>
300
301 </BODY>
302 </HTML>