use std::concat; use std::str::FromStr; use criterion::{BenchmarkId, Criterion}; use radix_common::math::*; use crate::macros::QUICK; use crate::{bench_ops, ops_fn, ops_root_fn, process_op}; /* "57896044618658097711785492504343953926634.992332820282019728792003956564819967" */ const ADD_OPERANDS: [(&str, &str); 4] = [ ( "578960446186580977117854925043439539266.992332820282019728792003956564819967", "578960446186580977117854925043439539266.992332820282019728792003956564819967", ), ( "-578960446186580977117854925043439539266.992332820282019728792003956564819967", "578960446186580977117854925043439539266.992332820282019728792003956564819967", ), ("1", "-1"), ( "-578960446186580977117854925043439539266.992332820282019728792003956564819967", "-578960446186580977117854925043439539266.992332820282019728792003956564819967", ), ]; const SUB_OPERANDS: [(&str, &str); 4] = [ ( "578960446186580977117854925043439539266.992332820282019728792003956564819967", "578960446186580977117854925043439539266.992332820282019728792003956564819967", ), ( "-578960446186580977117854925043439539266.992332820282019728792003956564819967", "578960446186580977117854925043439539266.992332820282019728792003956564819967", ), ("1", "-1"), ( "-578960446186580977117854925043439539266.992332820282019728792003956564819967", "-578960446186580977117854925043439539266.992332820282019728792003956564819967", ), ]; const MUL_OPERANDS: [(&str, &str); 4] = [ ( "60446580977117854925.992332820282019728792003956564819967", "61869771178549250434.992332820282019728792003956564819967", ), ( "-6046580977117854925.992332820282019728792003956564819967", "61869771178549250434.992332820282019728792003956564819967", ), ( "27896044618658097717.854925043439539", "27896044618658097717.8549250434395392", ), ("-123123123123", "-1"), ]; const DIV_OPERANDS: [(&str, &str); 4] = [ ( "57896044618658097711785492504343953926634.992332820282019728792003956564819967", "9872304819812379812371928371237972.123123123123123870923809238", ), ( "-57896044618658097711785492504343953926634.992332820282019728792003956564819968", "9872304819812379812371928371237972.123123123123123870923809238", ), ( "57896044618658097711785492504343953926634992332820282019728.792003956564819967", "278960446186580977117.8549250434395392", ), ("-123123123123", "-1"), ]; const ROOT_OPERANDS: [(&str, &str); 4] = [ ( "57896044618658097711785492504343953926634.992332820282019728792003956564819967", "30", ), ( "57896044618658097711785492504343953926634.992332820282019728792003956564819967", "17", ), ("12379879872423987.123123123", "13"), ("9", "2"), ]; const POW_OPERANDS: [(&str, &str); 4] = [ ("12.123123123123123123", "15"), ("1.123123123", "13"), ("4", "5"), ("9", "2"), ]; const TO_STRING_OPERANDS: [&str; 4] = [ "57896044618658097711785492504343953926634.992332820282019728792003956564819967", "578918658097711785492504343953926634.792003956564817", "-11237987890123090890328.1928379813", "9", ]; const FROM_STRING_OPERANDS: [&str; 4] = [ "57896044618658097711785492504343953926634.992332820282019728792003956564819967", "578918658097711785492504343953926634.792003956564817", "-11237987890123090890328.1928379813", "9", ]; ops_fn!(PreciseDecimal, checked_powi, i64, "clone"); ops_root_fn!(PreciseDecimal, checked_nth_root, "clone"); bench_ops!(PreciseDecimal, "add"); bench_ops!(PreciseDecimal, "sub"); bench_ops!(PreciseDecimal, "mul"); bench_ops!(PreciseDecimal, "div"); bench_ops!(PreciseDecimal, "root", u32); bench_ops!(PreciseDecimal, "pow", i64); bench_ops!(PreciseDecimal, "to_string"); bench_ops!(PreciseDecimal, "from_string");