GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
BSON::Decimal128(3) User Contributed Perl Documentation BSON::Decimal128(3)

BSON::Decimal128 - BSON type wrapper for Decimal128

version v1.12.2

    use BSON::Types ':all';

    # string representation
    $decimal = bson_decimal128( "1.23456789E+1000" );

    # binary representation in BID format
    $decimal = BSON::Decimal128->new( bytes => $bid )

This module provides a BSON type wrapper for Decimal128 values.

It may be initialized with either a numeric value in string form, or with a binary Decimal128 representation (16 bytes), but not both.

Initialization from a string will throw an error if the string cannot be parsed as a Decimal128 or if the resulting number would not fit into 128 bits. If required, clamping or exact rounding will be applied to try to fit the value into 128 bits.

The Decimal128 value represented as string. If not provided, it will be generated from the "bytes" attribute on demand.

The Decimal128 value represented in Binary Integer Decimal <https://en.wikipedia.org/wiki/Binary_Integer_Decimal> (BID) format. If not provided, it will be generated from the "value" attribute on demand.

Returns the value as a string.

If the "BSON_EXTJSON" option is true, it will instead be compatible with MongoDB's extended JSON <https://github.com/mongodb/specifications/blob/master/source/extended-json.rst> format, which represents it as a document as follows:

    {"$numberDecimal" : "2.23372036854775807E+57"}

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

  • David Golden <david@mongodb.com>
  • Stefan G. <minimalist@lavabit.com>

This software is Copyright (c) 2020 by Stefan G. and MongoDB, Inc.

This is free software, licensed under:

  The Apache License, Version 2.0, January 2004
2020-08-13 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.