#![allow(unused)]
fn main() {
use precision_core::Decimal;
// From integers
let a = Decimal::from(100i64);
// From mantissa and scale: value = mantissa * 10^(-scale)
let b = Decimal::new(12345, 2); // 123.45
// From strings
let c: Decimal = "99.99".parse().unwrap();
// Arithmetic with checked operations
let sum = a.try_add(b)?;
let product = a.try_mul(c)?;
let quotient = a.try_div(b)?;
}
#![allow(unused)]
fn main() {
use financial_calc::{compound_interest, future_value, Decimal};
let principal = Decimal::from(10000i64);
let rate = Decimal::new(5, 2); // 5%
// Compound interest: monthly for 5 years
let interest = compound_interest(principal, rate, 12, 5)?;
// Future value
let fv = future_value(principal, rate, 10)?;
}