public class AccurateFormatter extends Object
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.
Modifier and Type | Field and Description |
---|---|
static Locale |
STANDARDIZED_LOCALE
Standardized locale to use, to ensure files can be exchanged without
internationalization issues.
|
Modifier and Type | Method and Description |
---|---|
static String |
format(double value)
Format a double number.
|
static String |
format(int year,
int month,
int day,
int hour,
int minute,
double seconds)
Format a date.
|
public static final Locale STANDARDIZED_LOCALE
public static String format(double value)
value
- number to formatpublic static String format(int year, int month, int day, int hour, int minute, double seconds)
year
- yearmonth
- monthday
- dayhour
- hourminute
- minuteseconds
- secondsCopyright © 2002-2021 CS GROUP. All rights reserved.