Class FastScientificFormatter


  • public class FastScientificFormatter
    extends FastDoubleFormatter
    Formatter for double numbers in scientific format with low overhead.

    This class is intended to be used when formatting large amounts of data with fixed scientific formats like, for example, large ephemeris or measurement files.

    Building the formatter is done once, and the formatter FastDoubleFormatter.appendTo(Appendable, double) or FastDoubleFormatter.toString(double) methods can be called hundreds of thousands of times, without incurring the overhead that would occur with String.format(). Some tests showed this formatter is about 6-7 times faster than String.format() with %{width}.{%precision}e format.

    Instances of this class are immutable

    Since:
    14.0
    Author:
    Luc Maisonobe
    • Constructor Detail

      • FastScientificFormatter

        public FastScientificFormatter​(int width)
        Simple constructor.

        This constructor is equivalent to Formatter float format %{width}.{width-7}e

        Parameters:
        width - number of characters to output