Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
doc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Build Status

Intro

ldecnumber -- a tarantool (luajit, Lua 5.1) wrapper for the decNumber Decimal Arithmetic package.

The wrapper and decNumber library are built as a monolithic Lua module.

Installing

tarantoolctl rocks install https://raw.githubusercontent.com/tarantool/ldecnumber/master/ldecnumber-scm-1.rockspec

Example

Single user billing system

decnumber = require('ldecnumber')

local balance = decnumber.tonumber("0.00")

-- put some money
balance = balance + "0.01"

-- once again a little bit more
balance = balance + "1.25"


-- take some money
balance = balance - "1.12"

-- check balance value is valid
balance:isfinite() --> true
balance:isinfinite() --> false
balance:isnan() --> false

-- send balance to report system
balance:tostring() --> '0.14'

Documentation

Links

Copyrights

The Lua wrapper is Copyright (c) 2006-7 Doug Currie, Londonderry, NH All rights reserved.

The decNumber C library is Copyright (c) 1995-2005 International Business Machines Corporation and others All rights reserved.

The software and documentation is made available under the terms of the ICU License (ICU 1.8.1 and later) included in the package as decNumber/ICU-license.html.

About

Lua decnumber bindings

Resources

License

Packages

No packages published

Languages

You can’t perform that action at this time.