locale - Investigating a Java bug regarding String.valueOf(float) -
in java possibility string.valueof(float) format float number differently based on operating system code run on, version of java and/or operating systems locale.
for example, float number 4.5 ever formatted "4,5" instead of "4.5"?
string.valueof(float) calls float.tostring().
float.tostring() calls intern sun.misc.floatingdecimal.tojavaformatstring(float)
the result string never contain sign , bacause of hard-coded '.' (ascii: 46) inside binarytoasciibuffer.getchars(chars[])
you can see if decompile sun.misc.floatingdecimal class (in case java 8 jdk) or see (similar) implementation in openjdk.
Comments
Post a Comment