History log of /libcore/luni/src/main/java/java/lang/Float.java
Revision Date Author Comments
0d4daefcf389b6433a0af481ef44a84a2546541a 21-May-2011 Elliott Hughes <enh@google.com> Suppress some FindBugs warnings.

Also globally replace "for(" with "for (".

Change-Id: I27fe17460e6745b9ca823f42e57c86fe8af31979
dc915c69ba2495dd2cf965d16058d0b13762142c 20-May-2011 Elliott Hughes <enh@google.com> Move the floating-point parsing code, and tidy up some documentation.

Change-Id: Ibdc1716847f4c6a85a7c24766feffc8768819cef
e26ba79900d471d02d656f686926918ef7dc751f 08-Feb-2011 Elliott Hughes <enh@google.com> Use int.class instead of Integer.TYPE (et cetera) for clarity.

I've also removed some small amount of duplication and a few unused imports.

Change-Id: Ie52477484bade74c80a348ad1261b596f9053cf6
750d24b13461035a89c9af8ec7555588da1cc3d0 27-Jan-2011 Elliott Hughes <enh@google.com> Better tests for Float.parseFloat/Double.parseDouble, plus some fixes.

I'm not happy with the magic 1024s, and I had hoped to have one hack to
cover both harmony bugs. But this passes all our existing tests, all
harmony's existing tests, and the new tests I wrote while looking at
the code. (The new tests all pass on the RI too.)

I've also made a few doc comments slightly less unclear.

Change-Id: Ib72fd20bb3b157c7db5a09913247eed3cc746a2e
8890504f824eca28560987cc23d0b18e8a62bbaa 26-Oct-2010 Elliott Hughes <enh@google.com> Fix Float.parseFloat (et cetera) javadoc.

None of these constructors or decode/parse.*/valueOf methods throw
NumberFormatException when passed null, so they shouldn't claim to do so.

Bug: http://code.google.com/p/android/issues/detail?id=12114
Change-Id: I813cad4457d5db11617b615488efa8f5b4beb1cf
82a495ad44d76aac37f54bbbe7c31608d1054f84 31-Aug-2010 Elliott Hughes <enh@google.com> Move Integer and Long's toString methods into a new class.

I've reverted the old optimizations that used shifting and addition instead
of multiplication, because that's been slower for a while now. I've also
switched to more consistently using DIGITS. Otherwise, this code is unchanged.

I've also changed Float.toHexString to use StringBuilder.append(int) instead
of calling Integer.toString manually (with an eye to taking advantage of future
more efficient implementations of StringBuilder.append(int)).

[cherry-pick of 6151feb53344092a7fb7e1e3f417d23adaf2f6c2 from dalvik-dev to gingerbread; plus build fix]

Bug: 2302920
Change-Id: I4d65d98b79ac299208102f0753960727b77e81ce
10a17e23b22dc0ff6363d15bce67d668b6d44dd0 27-Aug-2010 Elliott Hughes <enh@google.com> Speed up Float.toString (and Double.toString).

The special cases (NaN, infinities, and zeros) go from 30us to 1us.

There are basically three other paths through the code, depending on the value:

The small case goes from 60us to 30us.
The medium case goes from 70us to 31us.
The large case goes from 100us to 50us.

There's way less garbage produced, and now we're using StringBuilder, we're
in a position to take advantage of future optimization of
StringBuilder.append(int).

[cherry-pick of 2164031488f9788e5ee9ad2545b3aec34b65e06c from dalvik-dev to gingerbread]

Bug: 2934304
706de1164836051ab31cc69eb77a6bba1a723896 27-Aug-2010 Elliott Hughes <enh@google.com> Minor tidy-up of Float.toString and Double.toString.

This patch looks larger than it is. I've moved duplicated constants out of
Math and StrictMath and into Float and Double where they belong. I've also
moved a table out of BigDecimal so I can reuse it in NumberConverter, which
I've renamed to RealToString.

The main active ingredient here is that there's no longer StringBuilder usage
to prepend '-'. This actually brings us down from 74ns to 62ns for an easy
case like 123.45f.

[cherry-pick of 910106e29fe98f14b2c36312a7498287273ba826 from dalvik-dev to gingerbread; plus build fix]

Bug: 2934304
Change-Id: Id79a6fb0d739e673b7428d240fc48bdae9b8bb43
6151feb53344092a7fb7e1e3f417d23adaf2f6c2 31-Aug-2010 Elliott Hughes <enh@google.com> Move Integer and Long's toString methods into a new class.

I've reverted the old optimizations that used shifting and addition instead
of multiplication, because that's been slower for a while now. I've also
switched to more consistently using DIGITS. Otherwise, this code is unchanged.

I've also changed Float.toHexString to use StringBuilder.append(int) instead
of calling Integer.toString manually (with an eye to taking advantage of future
more efficient implementations of StringBuilder.append(int)).

Bug: 2302920
Change-Id: I4244081456baf29aefbf974ca7220fdba5656e1d
2164031488f9788e5ee9ad2545b3aec34b65e06c 27-Aug-2010 Elliott Hughes <enh@google.com> Speed up Float.toString (and Double.toString).

The special cases (NaN, infinities, and zeros) go from 30us to 1us.

There are basically three other paths through the code, depending on the value:

The small case goes from 60us to 30us.
The medium case goes from 70us to 31us.
The large case goes from 100us to 50us.

There's way less garbage produced, and now we're using StringBuilder, we're
in a position to take advantage of future optimization of
StringBuilder.append(int).

Bug: 2934304
Change-Id: Ib7441e064557973dd0c6247a149275d6367d55ea
910106e29fe98f14b2c36312a7498287273ba826 27-Aug-2010 Elliott Hughes <enh@google.com> Minor tidy-up of Float.toString and Double.toString.

This patch looks larger than it is. I've moved duplicated constants out of
Math and StrictMath and into Float and Double where they belong. I've also
moved a table out of BigDecimal so I can reuse it in NumberConverter, which
I've renamed to RealToString.

The main active ingredient here is that there's no longer StringBuilder usage
to prepend '-'. This actually brings us down from 74ns to 62ns for an easy
case like 123.45f.

Bug: 2934304
Change-Id: I65461753247eeb9ff890ffe66b0bc79d66d2ec9c
7023c8ff547217ec58f062255a850e54bfefc681 23-Aug-2010 Elliott Hughes <enh@google.com> Fix error in Float.floatToIntBits documentation.

Change-Id: I33cd839c3fc18f9308efe214a66ed00284853726
162a12c1442641a95fe95859fa4e561b22db049f 25-May-2010 Elliott Hughes <enh@google.com> Remove @hide from Java 6 API.

I've left the two new spi packages @hidden, because I think we shouldn't
support them without convincing demand from developers (and I don't
believe there could be such a thing --- they just don't make sense, and
if we add anything, it should be the ability to provide extra ICU data).

Also fix a handful of javadoc syntax errors in Arrays.java and TreeMap.java.

Bug: 2497395
Change-Id: I4176b72daff0face4ed6c7ee1d1f4267d52006b4
f33eae7e84eb6d3b0f4e86b59605bb3de73009f3 13-May-2010 Elliott Hughes <enh@google.com> Remove all trailing whitespace from the dalvik team-maintained parts of libcore.

Gentlemen, you may now set your editors to "strip trailing whitespace"...

Change-Id: I85b2f6c80e5fbef1af6cab11789790b078c11b1b
fd6bb3510c2f94d636f3572dcf5f7f4dcd1a2726 13-May-2010 Elliott Hughes <enh@google.com> Remove //$NON-NLS-\d$ cruft.

Mostly done by perl(1), with manual cleanup of the few misspelled instances.
This makes our trailing whitespace slightly worse, but I'll fix all that with
a follow-on change.

Change-Id: I0b4ca98819be6f9519c4ba980d759bd1ee1a0303
b43c9fb9c581d94304e9a54ec96cf4d752e8d917 10-Mar-2010 Elliott Hughes <enh@google.com> Add Java 6 additions to Double, Enum, Float, and String.

I rewrote the documentation for Double, Enum, and Float, but the "code" is the
same as harmony's. I rewrote the String code and wrote some tests to ensure
that a malicious Charset can't subvert String immutability.

I've also extracted the Android-specific bits of StringTest (which weren't
testing String at all) and brought back the latest harmony StringTest.java.

(The Class and Package changes are just to placate our API comparison tools.)

Bug: 2497395
Change-Id: Id57bda806891c3c85adfcb3b85eea8a8fad2c7b4
438d9883775e6ee31c097e2103a25571d2426cd9 09-Mar-2010 Elliott Hughes <enh@google.com> Minor documentation improvements.

Based on user-submitted bugs that were just misunderstandings, plus
implementation bugs caused by the intended behavior being somewhat
subtle.

Change-Id: Ic2606b5e57dadc95a35c2d0a977c01434a2fa28a
726ac583d69b37db03c6279af5b36df7b837ede1 15-Dec-2009 Joshua Bloch <jjb@google.com> Rewrote all the toString and bit twiddling code in Integer and Long using
state-of-the-art recipes. The resulting code is much faster than what it
replaced, as well as being more concise. While I was in the neighborhood
I also cleaned up a few other things in the boxed primitives (TYPE fields,
small-value caches, etc.).

Addressed review comments.
4fefecee9d4a5d2a4510f516b4015607b19e8d09 13-Nov-2009 Jean-Baptiste Queru <jbq@google.com> eclair snapshot
f5597e626ecf7949d249dea08c1a2964d890ec11 25-Jul-2009 Jesse Wilson <jessewilson@google.com> Integrate luni module (but not tests) to Harmony r772995.

Notable changes
- Stripped "@since Android 1.0" from many files. Most files
are now 100% the same in Dalvik and Harmony.
- AbstractStringBuilder.reverse() supports surrogates
- AbstractStringBuilder shares less to waste less memory
- Bitset optimized
- BufferedInputStream changed to support unsynchronized close()
- BufferedOutputStream does flushInternal
- BufferedReader supports EBCDIC NEL
- Collections.synchronizedList().indexOf() does a copy for more concurrency
- Classes in nio module changed: DatagramChannelImpl, SocketChannelImpl
and ServerSocketChannelImpl (these depend on internal APIs changed in
this update)
- DataInputStream/DataOutputStream now use a small buffer to limit the
number of times the underlying stream is accessed
- Date now has a minutes offset, more efficient toString()
- ExposedByteArrayInputStream: new internal class
- DeleteOnExit moved to top-level class
- FileDescriptor.isValid() now non-native
- Float, Double lessThan optimized (fix for compare(-0.0F, 0.0F) still pending)
- FileURLConnection now guesses content types from streams
- HashMap iterator changes
- Hashtable iterator changes
- INetworkSystem
- removes bind2(), createMulticastSocket, sendStream(),
- renames createSocket to createStreamSocket
- JarURLConnection rewritten
- LinkedHashMap: new iterator
- Locale, Currency, TimeZone: now use ICU in Harmony, plain Java in Dalvik
- ObjectInputStream: Accessor objects in Harmony, direct native in Dalvik
- ProxyClassFile - many changes
- String - optimized ascii for toLowerCase, toUpperCase, compare
- Timer - rewritten
- TreeMap - rewritten
- URLClassLoader - new
- URLConnection - new guessContentTypeFromStream(), uses org.apache.harmony.awt.www.content
to lookup content type handlers
adc854b798c1cfe3bfd4c27d68d5cee38ca617da 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
1c0fed63c71ddb230f3b304aac12caffbedf2f21 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
dd828f42a5c83b4270d4fbf6fce2da1878f1e84a 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
fdb2704414a9ed92394ada0d1395e4db86889465 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution