Perl Diver 2.33
Main Environment Variables Perl Default Values Perl Config - Summary Perl Config - Full Installed Modules List Directory uptime Docs

Module Documentation
Details and documentation about a specific module, including version and documentation (if available). Note that while links to perldoc.com and search.cpan.org are provided, the module may be part of a larger distribution. If you reach a File Not Found page on either site, please try the parent module.

BSON::Decimal128

Name BSON::Decimal128
Version v1.12.2
Located at /usr/share/perl5
File /usr/share/perl5/BSON/Decimal128.pm
Is Core No
Search CPAN for this module BSON::Decimal128
Documentation BSON::Decimal128
Module Details BSON::Decimal128


NAME

BSON::Decimal128 - BSON type wrapper for Decimal128


VERSION

version v1.12.2


SYNOPSIS

    use BSON::Types ':all';
    # string representation
    $decimal = bson_decimal128( "1.23456789E+1000" );
    # binary representation in BID format
    $decimal = BSON::Decimal128->new( bytes => $bid )


DESCRIPTION

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.


ATTRIBUTES

value

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

bytes

The Decimal128 value represented in Binary Integer Decimal (BID) format. If not provided, it will be generated from the value attribute on demand.


METHODS

TO_JSON

Returns the value as a string.

If the BSON_EXTJSON option is true, it will instead be compatible with MongoDB's extended JSON format, which represents it as a document as follows:

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


OVERLOADING

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


AUTHORS


COPYRIGHT AND LICENSE

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

Perl Diver brought to you by ScriptSolutions.com © 1997- 2026