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.

NOTE To use BigDecimal, you must explicitly import it with require "big"

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

Included Modules

Defined in:

big/nason.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from struct Value

==(other : NASON::Any) ==

Instance methods inherited from class Object

===(other : NASON::Any) ===, nil_or_null? nil_or_null?, not_null! not_null!, null? null?, to_nason(io : IO) : Nil
to_nason : String
to_nason
, to_pretty_json(indent : String = " ") : String
to_pretty_json(io : IO, indent : String = " ") : Nil
to_pretty_json

Class methods inherited from class Object

from_nason(string_or_io, root : String)
from_nason(string_or_io)
from_nason

Constructor Detail

def self.new(pull : NASON::PullParser) #

[View source]

Class Method Detail

def self.from_json_object_key?(key : String) : BigDecimal | Nil #

[View source]

Instance Method Detail

def to_json_object_key #

[View source]
def to_nason(json : NASON::Builder) : Nil #

[View source]