Class AccurateFormatter

java.lang.Object
org.orekit.utils.AccurateFormatter
All Implemented Interfaces:
Formatter

public class AccurateFormatter extends Object implements Formatter
Formatter used to produce strings from data with high accuracy.

When producing test output from computed data, we want the shortest decimal representation of a floating point number that maintains round-trip safety. That is, a correct parser can recover the exact original number.

For efficiency, this class uses the Ryƫ algorithm for producing shortest string representation with round-trip safety.

Since:
11.0
Author:
Luc Maisonobe
  • Constructor Details

    • AccurateFormatter

      public AccurateFormatter()
      Public constructor.
  • Method Details

    • toString

      public String toString(double value)
      Formats to full accuracy. Format a double number.
      Specified by:
      toString in interface Formatter
      Parameters:
      value - number to format
      Returns:
      number formatted.
    • toString

      public String toString(int year, int month, int day, int hour, int minute, double seconds)
      Formats the seconds variable with maximum precision needed. Format a date. Does not check if date time is real or if it will meet formating requirements.
      Specified by:
      toString in interface Formatter
      Parameters:
      year - of date to be formatted
      month - of date to be formatted
      day - of month to be formatted
      hour - to be formatted
      minute - to be formatted
      seconds - and sub-seconds to be formatted
      Returns:
      date formatted to match the following format [yyyy-MM-ddTHH:mm:ss.S#]