lights FAQ Forum github.com/luapower/ldecnumber
This package
ldecnumber

Math
amoeba
eq
ldecnumber

local decnumber = require'ldecnumber'

ldecnumber is a Lua binding for the decNumber Decimal Arithmetic package.

Two methods added: dn:frompacked() and dn:topacked() for working with tarantool.

ldecNumber docs here

decNumber docs here

Example

Single user billing system

local decnumber = require'ldecnumber'

local balance = decnumber.tonumber'0.00'

balance = balance + '0.01'
balance = balance + '1.25'
balance = balance - '1.12'

balance:isfinite() --> true
balance:isinfinite() --> false
balance:isnan() --> false

balance:tostring() --> '0.14'

Last updated: 9 months ago | Edit on GitHub

Package:ldecnumber
Pkg type:other
Version: 1.1.3-6-g5a977f9
Last commit:
License: Public Domain

Requires: none

Required by: none


Top