decimal128
Version:
Partial implementation of IEEE 754 Decimal128 decimal floating-point numbers
7 lines (6 loc) • 330 B
JavaScript
import { Decimal128 } from "../src/Decimal128.mjs";
let exchangeRateEurToUsd = new Decimal128("1.09");
let amountInUsd = new Decimal128("450.27");
let exchangeRateUsdToEur = new Decimal128(1).divide(exchangeRateEurToUsd);
let amountInEur = exchangeRateUsdToEur.multiply(amountInUsd);
console.log(amountInEur.round(2).toString());