Class NumberUtils

java.lang.Object
com.alibaba.fastjson2.util.NumberUtils

public final class NumberUtils extends Object
Author: wangy
  • Method Details

    • doubleToScientific

      public static Scientific doubleToScientific(double doubleValue)
      Conversion of ieee floating point numbers to Scientific notation

      Using 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

      public static Scientific floatToScientific(float floatValue)