BTC — ETH — ICP — SOL — LIVE · updates every 60s
LedgerLifeICP · BITCOIN · DEFI · WEB3
← LedgerLife ICP

New Decimal Library Brings Fixed-Point Arithmetic to Motoko

By Maria Irene · 24 Sept 2025

A new fixed-point decimal type and arithmetic library for Motoko, called Decimal, has been announced and released on MOPS. The library, created by developer DATHKA, is designed to help Motoko developers handle precise calculations, particularly for cross-chain DeFi projects.

Decimal allows for conversion between Text, Float, Int, and Nat types with rounding, and includes basic arithmetic operations such as addition, subtraction, multiplication, division, and power. It also provides several utility functions to support predictable and reproducible handling of currency values with differing decimal places, such as satoshis, wei, or USD cents.

The library was developed as part of the daemoney project, a cross-chain DeFi initiative, where the ability to accurately parse, represent, and manipulate values across tokens with different decimal conventions was essential. DATHKA explained that no existing fixed-point decimal type was available for Motoko, prompting the creation of this open-source solution.

By sharing Decimal on MOPS, the developer hopes to provide a practical tool for the wider Motoko community. Feedback from early users will help refine the library, and DATHKA encourages developers to experiment with it and share their experiences. The release marks a useful addition to the Motoko ecosystem, especially for projects that require precision in financial computations.