1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
5 <!-- Generated by javadoc (build 1.5.0_09) on Sun Jul 15 14:27:35 BST 2007 -->
7 Float (leJOS NXT API documentation)
10 <META NAME="keywords" CONTENT="java.lang.Float class">
12 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
14 <SCRIPT type="text/javascript">
15 function windowTitle()
17 parent.document.title="Float (leJOS NXT API documentation)";
25 <BODY BGCOLOR="white" onload="windowTitle();">
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="">
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> </TD>
38 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
39 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
40 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
42 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
43 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
47 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
53 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
54 <A HREF="../../java/lang/Exception.html" title="class in java.lang"><B>PREV CLASS</B></A>
55 <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>
58 <A HREF="Float.html" target="_top"><B>NO FRAMES</B></A>
59 <SCRIPT type="text/javascript">
62 document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
67 <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
74 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
75 SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
76 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
77 DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
80 <A NAME="skip-navbar_top"></A>
81 <!-- ========= END OF TOP NAVBAR ========= -->
84 <!-- ======== START OF CLASS DATA ======== -->
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>
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>
100 Minimal Float implementation that supports
101 floatToIntBits and intBitsToFloat
106 <DT><B>Author:</B></DT>
107 <DD>Lawrie Griffiths</DD>
113 <!-- ========== METHOD SUMMARY =========== -->
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>
121 <TR BGCOLOR="white" CLASS="TableRowColor">
122 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
123 <CODE>static int</CODE></FONT></TD>
124 <TD><CODE><B><A HREF="../../java/lang/Float.html#floatToIntBits(float)">floatToIntBits</A></B>(float value)</CODE>
127 Returns the bit represention of a single-float value.</TD>
129 <TR BGCOLOR="white" CLASS="TableRowColor">
130 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
131 <CODE>static float</CODE></FONT></TD>
132 <TD><CODE><B><A HREF="../../java/lang/Float.html#intBitsToFloat(int)">intBitsToFloat</A></B>(int value)</CODE>
135 Returns the single-float corresponding to a given bit represention.</TD>
138 <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>
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>
150 <!-- ============ METHOD DETAIL ========== -->
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>
160 <A NAME="floatToIntBits(float)"><!-- --></A><H3>
163 public static int <B>floatToIntBits</B>(float value)</PRE>
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.
170 <li>Bit 31 (the bit that is selected by the mask
171 <code>0x80000000</code>) represents the sign of the floating-point
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>.
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.
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>.
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>
198 <A NAME="intBitsToFloat(int)"><!-- --></A><H3>
201 public static float <B>intBitsToFloat</B>(int value)</PRE>
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.
208 If the argument is <code>0x7f800000</code>, the result is positive
211 If the argument is <code>0xff800000</code>, the result is negative
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.
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:
225 int s = ((bits >> 31) == 0) ? 1 : -1;
226 int e = ((bits >> 23) & 0xff);
228 (bits & 0x7fffff) << 1 :
229 (bits & 0x7fffff) | 0x800000;
231 Then the floating-point result equals the value of the mathematical
232 expression <i>s·m·2<sup>e-150</sup></i>.
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
240 <!-- ========= END OF CLASS DATA ========= -->
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="">
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> </TD>
254 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
255 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
256 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
257 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
258 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
259 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
263 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
269 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
270 <A HREF="../../java/lang/Exception.html" title="class in java.lang"><B>PREV CLASS</B></A>
271 <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>
274 <A HREF="Float.html" target="_top"><B>NO FRAMES</B></A>
275 <SCRIPT type="text/javascript">
278 document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
283 <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
290 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
291 SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
292 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
293 DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
296 <A NAME="skip-navbar_bottom"></A>
297 <!-- ======== END OF BOTTOM NAVBAR ======= -->