A library for big calculations.
Hecho en Puerto Rico por Radamés J. Valentín Reyes
Co-engineered by Copilot and Gemini
Note: This library uses high-performance Uint8List storage to handle arbitrary-precision calculations (defaulting to 200+ decimal places).
BigDec zero = BigDec.zero;
BigDec one = BigDec.one;BigDec bigDec = BigDec.fromInt(42, precision: 200);
BigDec bigDecStr = BigDec.fromString("1.2345");
BigDec bigDecRaw = BigDec(integer: BigInt.from(10), decimal: BigInt.from(5));Includes standard operators and named methods.
BigDec sum = a + b; // or a.add(b)
BigDec diff = a - b; // or a.subtract(b)
BigDec product = a * b; // or a.multiply(b)
BigDec quotient = a / b; // or a.divide(b)
BigDec remainder = a % b;
BigDec neg = -a;High-precision implementations for complex simulations.
BigDec power = a.pow(BigInt.from(10));
BigDec root = a.sqrt();
BigDec absolute = a.abs();
// Transcendental Functions
BigDec pi = BigDec.pi(200);
BigDec naturalLog = a.ln();
BigDec exponent = a.exp();
BigDec sine = a.sin();
BigDec cosine = a.cos();Support for sorting and numerical comparison logic.
if (a.greaterThan(b)) { ... }
if (a == b) { ... } // Also supports compareTo(other)BigDec val = BigDec.fromString("-123.456");
print(val.integer); // -123
print(val.decimal); // 456
print(val.isNegative); // true
print(val.isInteger); // false
print(val.signum); // -1BigDec rounded = val.round();
BigDec floored = val.floor();
BigDec ceiled = val.ceil();
BigDec truncated = val.truncate();
// Adjusting precision
BigDec highRes = val.withPrecision(500);String fixed = val.toStringAsFixed(2); // "-123.46"
String full = val.toString();
double approx = val.toDouble();