fix decimal formatting to US convention (no commas) in offer book

This commit is contained in:
woodser 2023-10-11 16:33:44 -04:00
parent 9dd53cb892
commit d65f36f122
2 changed files with 2 additions and 2 deletions

View File

@ -63,7 +63,7 @@ import org.bitcoinj.core.Coin;
public class HavenoUtils { public class HavenoUtils {
// Use the US locale as a base for all DecimalFormats (commas should be omitted from number strings). // Use the US locale as a base for all DecimalFormats (commas should be omitted from number strings).
private static final DecimalFormatSymbols DECIMAL_FORMAT_SYMBOLS = DecimalFormatSymbols.getInstance(Locale.US); public static final DecimalFormatSymbols DECIMAL_FORMAT_SYMBOLS = DecimalFormatSymbols.getInstance(Locale.US);
public static int XMR_SMALLEST_UNIT_EXPONENT = 12; public static int XMR_SMALLEST_UNIT_EXPONENT = 12;
public static final String LOOPBACK_HOST = "127.0.0.1"; // local loopback address to host Monero node public static final String LOOPBACK_HOST = "127.0.0.1"; // local loopback address to host Monero node
public static final String LOCALHOST = "localhost"; public static final String LOCALHOST = "localhost";

View File

@ -65,7 +65,7 @@ public class VolumeUtil {
} }
public static Volume getRoundedVolumePrecise(Volume volumeByAmount) { public static Volume getRoundedVolumePrecise(Volume volumeByAmount) {
DecimalFormat decimalFormat = new DecimalFormat("#.####"); DecimalFormat decimalFormat = new DecimalFormat("#.####", HavenoUtils.DECIMAL_FORMAT_SYMBOLS);
double roundedVolume = Double.parseDouble(decimalFormat.format(Double.parseDouble(volumeByAmount.toString()))); double roundedVolume = Double.parseDouble(decimalFormat.format(Double.parseDouble(volumeByAmount.toString())));
return Volume.parse(String.valueOf(roundedVolume), volumeByAmount.getCurrencyCode()); return Volume.parse(String.valueOf(roundedVolume), volumeByAmount.getCurrencyCode());
} }