[#BloombergLP-bdldfp-operator_d128-03]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdldfp.adoc[bdldfp]::operator&quot;&quot;&lowbar;d128
:relfileprefix: ../../
:mrdocs:

Parse the specified literal text into a decimal floating&hyphen;point value&period;

== Synopsis

Declared in `&lt;bdldfp&lowbar;decimal&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bdldfp/Decimal128.adoc[bdldfp::Decimal128]
operator&quot;&quot;&lowbar;d128(char const* str);
----

== Description

Produce an object of the indicated return type by parsing the specified `str` having the specified `len` excluding the terminating null character that represents a floating&hyphen;point number written in both fixed and scientific notations&period; These user&hyphen;defined literal suffixes can be applied to both numeric and string literals, (i&period;e&period;, 1&period;2&lowbar;d128, &quot;1&period;2&quot;&lowbar;d128 or &quot;inf&quot;&lowbar;d128)&period; The resulting decimal object is initialized as follows&colon;

&ast; If `str` does not represent a floating&hyphen;point value, then return a decimal object of the indicated return type initialized to a NaN&period; &ast; Otherwise if `str` represents infinity (positive or negative), then return a decimal object of the indicated return type initialized to infinity value with the same sign&period; &ast; Otherwise if `str` represents zero (positive or negative), then return a decimal object of the indicated return type initialized to zero with the same sign&period; &ast; Otherwise if `str` represents a value that has an absolute value that is larger than the maximum value supported by the indicated return type, then store the value of the macro `ERANGE` into `errno` and return a decimal object of the return type initialized to infinity with the same sign&period; &ast; Otherwise if `str` represents a value that has an absolute value that is smaller than min value of the indicated return type, then store the value of the macro `ERANGE` into `errno` and return a decimal object of the return type initialized to zero with the same sign&period; &ast; Otherwise if `str` has a value that is not exactly representable using the maximum digit number supported by the indicated return type, then return a decimal object of the return type initialized to the value represented by `str` rounded according to the rounding direction&period; &ast; Otherwise return a decimal object of the indicated return type initialized to the decimal value representation of `str`&period;

Note that the parsing follows the rules as specified for the `strtod128` function in section 9&period;6 of the ISO&sol;EIC TR 247128 C Decimal Floating&hyphen;Point Technical Report&period;

Also note that the numeric literal version omits the optional leading sign in `str`&period; For example, if the string is &hyphen;1&period;2&lowbar;d128 then the string &quot;1&period;2&quot; is passed to the one&hyphen;argument form, not &quot;&hyphen;1&period;2&quot;, because leading signs are operators, not parts of literals&period; On the other hand, the string literal version does not omit leading sign and if the string is &quot;&hyphen;1&period;2&quot;&lowbar;d128 then the string &quot;&hyphen;1&period;2&quot; is passed to the two&hyphen;argument form&period;

Also note that the quantum of the resultant value is affected by the number of decimal places in `str` string in both numeric and string literal formats starting with the most significand digit and cannot exceed the maximum number of digits necessary to differentiate all values of the indicated return type, for example&colon;

`0&period;015&lowbar;d128&semi; &equals;&gt; 15e&hyphen;3` `1&period;5&lowbar;d128&semi; &equals;&gt; 15e&hyphen;1` `1&period;500&lowbar;d128&semi; &equals;&gt; 1500e&hyphen;3` &apos;1&period;2345678901234567890123456789012349&lowbar;d128&semi; &equals;&gt; 1234567890123456789012345678901235e&hyphen;33&apos;

== Return Value

decimal object of the return type initialized to infinity with the same sign

== Parameters

[cols="1,4"]
|===
| Name| Description
| *str*
| character sequence to parse
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
