1BSON::Decimal128(3)   User Contributed Perl Documentation  BSON::Decimal128(3)
2
3
4

NAME

6       BSON::Decimal128 - BSON type wrapper for Decimal128
7

VERSION

9       version v1.12.2
10

SYNOPSIS

12           use BSON::Types ':all';
13
14           # string representation
15           $decimal = bson_decimal128( "1.23456789E+1000" );
16
17           # binary representation in BID format
18           $decimal = BSON::Decimal128->new( bytes => $bid )
19

DESCRIPTION

21       This module provides a BSON type wrapper for Decimal128 values.
22
23       It may be initialized with either a numeric value in string form, or
24       with a binary Decimal128 representation (16 bytes), but not both.
25
26       Initialization from a string will throw an error if the string cannot
27       be parsed as a Decimal128 or if the resulting number would not fit into
28       128 bits.  If required, clamping or exact rounding will be applied to
29       try to fit the value into 128 bits.
30

ATTRIBUTES

32   value
33       The Decimal128 value represented as string.  If not provided, it will
34       be generated from the "bytes" attribute on demand.
35
36   bytes
37       The Decimal128 value represented in Binary Integer Decimal
38       <https://en.wikipedia.org/wiki/Binary_Integer_Decimal> (BID) format.
39       If not provided, it will be generated from the "value" attribute on
40       demand.
41

METHODS

43   TO_JSON
44       Returns the value as a string.
45
46       If the "BSON_EXTJSON" option is true, it will instead be compatible
47       with MongoDB's extended JSON
48       <https://github.com/mongodb/specifications/blob/master/source/extended-
49       json.rst> format, which represents it as a document as follows:
50
51           {"$numberDecimal" : "2.23372036854775807E+57"}
52

OVERLOADING

54       The stringification operator ("") is overloaded to return a
55       (normalized) string representation. Fallback overloading is enabled.
56

AUTHORS

58       •   David Golden <david@mongodb.com>
59
60       •   Stefan G. <minimalist@lavabit.com>
61
63       This software is Copyright (c) 2020 by Stefan G. and MongoDB, Inc.
64
65       This is free software, licensed under:
66
67         The Apache License, Version 2.0, January 2004
68
69
70
71perl v5.36.0                      2022-07-22               BSON::Decimal128(3)
Impressum