RFR: 8369312: Refactor Float.toHexString() to avoid use of regex
Shaojin Wen
swen at openjdk.org
Thu Oct 16 02:08:13 UTC 2025
On Tue, 14 Oct 2025 01:13:16 GMT, Joe Darcy <darcy at openjdk.org> wrote:
> Simple refactoring to avoid use the regular expressions. Existing tests in
>
> java/lang/Double/ToHexString.java
>
> cover the float conversions too.
The exponent -1022 is at the end, so the following implementation might be better.
return s.endsWith("-1022") ? s.substring(0, s.length() - 5).concat("-126") : s;
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27780#issuecomment-3408896057
More information about the core-libs-dev
mailing list