Package com.alibaba.fastjson2.util
Class NumberUtils
java.lang.Object
com.alibaba.fastjson2.util.NumberUtils
Author: wangy
-
Method Summary
Modifier and TypeMethodDescriptionstatic ScientificdoubleToScientific(double doubleValue) Conversion of ieee floating point numbers to Scientific notationstatic ScientificfloatToScientific(float floatValue) static intwriteDouble(byte[] buf, int off, double doubleValue, boolean json) static intwriteDouble(char[] buf, int off, double doubleValue, boolean json) static intwriteFloat(byte[] buf, int off, float floatValue, boolean json) static intwriteFloat(char[] buf, int off, float floatValue, boolean json)
-
Method Details
-
doubleToScientific
Conversion of ieee floating point numbers to Scientific notationUsing the difference estimation method
The output may not be the shortest, but the general result is correct
- Parameters:
doubleValue- > 0
-
writeDouble
public static int writeDouble(byte[] buf, int off, double doubleValue, boolean json) -
writeDouble
public static int writeDouble(char[] buf, int off, double doubleValue, boolean json) -
writeFloat
public static int writeFloat(byte[] buf, int off, float floatValue, boolean json) -
writeFloat
public static int writeFloat(char[] buf, int off, float floatValue, boolean json) -
floatToScientific
-