File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
storage/ctab/src/main/java/org/openscience/cdk/io Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 5252import java .io .OutputStreamWriter ;
5353import java .io .Writer ;
5454import java .nio .charset .StandardCharsets ;
55+ import java .text .DecimalFormat ;
5556import java .text .SimpleDateFormat ;
5657import java .util .ArrayList ;
5758import java .util .Collection ;
@@ -775,8 +776,10 @@ public void close() throws IOException {
775776 * for Sgroups but all lines are handled.
776777 */
777778 private static final class V30LineWriter implements Closeable {
778- public static final String PREFIX = "M V30 " ;
779- public static final int LIMIT = 78 ; // -\n takes two chars (80 total)
779+ // note: non-static
780+ private final DecimalFormat decimalFmt = new DecimalFormat ("#.#####" );
781+ public static final String PREFIX = "M V30 " ;
782+ public static final int LIMIT = 78 ; // -\n takes two chars (80 total)
780783
781784 // the base writer instance
782785 private final Writer writer ;
@@ -854,7 +857,7 @@ private void writePrefixIfNeeded() throws IOException {
854857 * @throws IOException low-level IO error
855858 */
856859 V30LineWriter write (double num ) throws IOException {
857- return write (String .format (Locale . ROOT , "%.5f" , num ));
860+ return write (decimalFmt .format (num ));
858861 }
859862
860863 /**
You can’t perform that action at this time.
0 commit comments