dashu-macros
Utility macros to create mathematical number literals. See Docs.rs for the full documentation.
Features
- Support creating big integers with literals using
ubig!andibig!. - Support creating big floats with literals using
fbig!anddbig!. - Support creating big rationals with literals using
rbig!. - Support creating big complex numbers with literals using
cbig!. - All macros can be used to create const numbers if they are small enough.
Quick example
One macro per number domain — all compile-time, with zero precision loss:
use ;
use UBig;
let a = ubig!; // integer, any base
let b = ibig!; // signed integer
let c = fbig!; // binary float (hex float syntax)
let d = dbig!; // decimal float
let e = rbig!; // rational
let f = cbig!; // complex
// const-capable when the value fits in a DoubleWord
const C: UBig = ubig!;
// explicit radix, and static_ variants for large const values
let g = ubig!;
static BIG: &UBig = static_ubig!;
// the `_` escape for literals the tokenizer rejects (hex floats)
let _h = fbig!;
License
See the top-level readme.