cubit 1.3.1
Math library in Cairo using a 64.64 fixed point representation
A fixed point math library in 64.64 and 32.32 representation built for Cairo & Starknet. Successor to influenceth/cairo-math-64x61
Cubit is currently a WORK IN PROGRESS and should not be used in production (yet). Contributions are welcomed.
Cubit was built with auditless/cairo-template, reference its installation guide to install dependencies.
A signed 64.64-bit fixed point number is a fraction in which the numerator is a signed 128-bit integer and the denominator is 2^64. Since the denominator stays the same there is no need to store it (as in a floating point value).
64.64 (f128) values can represent values in the range of -2^64 to 2^64 with precision to 1e-20.
32.32 (f64) values can represent vlaues in the range of -2^32 to 2^32 with precision to 1e-9.
All libraries in Cubit are referenced via the core type first, either cubit::f64 or cubit::f128.
Within each library, the following functions are available:
core includes the following implementations for the Fixed type:
Add (+)AddEq (+=)Sub (-)SubEq (-=)Mul (*)MulEq (*=)Div (/)DivEq (/=)PartialEq (==, !=)PartialOrd (>, >=, <, <=)fixed.ceilfixed.expfixed.floorfixed.lnfixed.log2fixed.log10fixed.powfixed.roundfixed.sqrttrig includes precise and fast versions of the following trigonometric functions:
fixed.cosfixed.cos_fastfixed.sinfixed.sin_fastfixed.tanfixed.tan_fastfixed.acosfixed.acos_fastfixed.asinfixed.asin_fastfixed.atanfixed.atan_fastVersion 1.3.1
Uploaded 11 months ago
Cairo version >=2.4.0
Size 68.5 KB
Run the following command in your project dir
scarb add cubit@1.3.1
Or add the following line to your Scarb.toml
cubit = "1.3.1"