Skip to content

LiveUser/big_dec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BigDec

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).

Constants

BigDec zero = BigDec.zero;
BigDec one = BigDec.one;

Constructors

BigDec bigDec = BigDec.fromInt(42, precision: 200);
BigDec bigDecStr = BigDec.fromString("1.2345");
BigDec bigDecRaw = BigDec(integer: BigInt.from(10), decimal: BigInt.from(5));

Arithmetic Operations

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;

Advanced Math & Transcendentals

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();

Equality & Comparison

Support for sorting and numerical comparison logic.

if (a.greaterThan(b)) { ... }
if (a == b) { ... } // Also supports compareTo(other)

Component Getters & Predicates

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);     // -1

Rounding & Precision

BigDec rounded = val.round();
BigDec floored = val.floor();
BigDec ceiled = val.ceil();
BigDec truncated = val.truncate();

// Adjusting precision
BigDec highRes = val.withPrecision(500);

Utility & Output

String fixed = val.toStringAsFixed(2); // "-123.46"
String full = val.toString();
double approx = val.toDouble();

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages