struct BigDecimal

Overview

A BigDecimal can represent arbitrarily large precision decimals.

It is internally represented by a pair of BigInt and UInt64: value and scale. Value contains the actual value, and scale tells the decimal point place. E.g. when value is 1234 and scale 2, the result is 12.34.

The general idea and some of the arithmetic algorithms were adapted from the MIT/APACHE-licensed bigdecimal-rs.

Included Modules

Defined in:

clear/extensions/core_ext.cr

Instance Method Summary

Instance Method Detail

def to_json(json) #

[View source]