commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From NickManley <>
Subject [GitHub] commons-lang pull request: LANG-1018: Fix precision loss on Number...
Date Tue, 24 May 2016 09:29:10 GMT
GitHub user NickManley opened a pull request:

    LANG-1018: Fix precision loss on NumberUtils.createNumber(String)

    **Warning: This patch will break backwards compatibility.**
    This patch is designed to fix the loss of precision when using NumberUtils.createNumber(String).
However, the fix is not 100% backwards compatible with the currently released commons-lang
3.4. To fix the loss of precision, values that were previously returning Floats are now returning
Doubles. Some explicit casts may break as a result.
    // Works in 3.4, but causes ClassCastException in patch.
    Float f = (Float) NumberUtils.createNumber("-160952.54");
    System.out.println(f); // prints "-160952.55"
    // Works with patch.
    Double d = (Double) NumberUtils.createNumber("-160952.54");
    System.out.println(d); // prints "-160952.54"

You can merge this pull request into a Git repository by running:

    $ git pull LANG-1018

Alternatively you can review and apply these changes as the patch at:

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #156
commit b77db22614da6f0c674b57cd0086048b58b30135
Author: Nick Manley <>
Date:   2016-05-24T09:10:29Z

    LANG-1018: Fix precision loss on NumberUtils.createNumber(String)


If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

View raw message