Skip to content

rubypanther/dec_number

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DecNumber is a wrapper around ICU-decNumber (Copyright (c) IBM Corporation)
that subclasses Numeric.

The main benefit over BigDecimal and other things is that each instance carries it's own context around with it in a DecContext object. The context is what dertimines the precision and rounding behavior.

An example is a database with Decimal columns with differing precision and where you can't accept using Floats.

I don't expect to instantiate these object directly, instead I will bind them to SQL Decimal in an ORM, or using some sort of Money class.

If you'd like to help out, please write tests!

Currently they try to give you back DecNumber objects whenever used, including as the rval with another Numeric.

TODO: Most of the methods should accept a context as an argument. Currently the context is attached to the receiver.