[#BloombergLP-bdldfp-DecimalImpUtil-parse128-07]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdldfp.adoc[bdldfp]::xref:BloombergLP/bdldfp/DecimalImpUtil.adoc[DecimalImpUtil]::parse128
:relfileprefix: ../../../
:mrdocs:

Produce an object of the indicated return type by parsing the specified `input` string that represents a floating&hyphen;point number (written in either fixed or scientific notation)&period; Optionally specify `status` in which to load a bit mask of additional status information&period; The resulting decimal object is initialized as follows&colon;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
xref:BloombergLP/bdldfp/DecimalImpUtil/ValueType128.adoc[DecimalImpUtil::ValueType128]
parse128(
    char const* input,
    unsigned int* status);
----

== Description

&ast; If `input` 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 `input` represents infinity (positive or negative), as case&hyphen;insensitive &quot;Inf&quot; or &quot;Infinity&quot; string, then return a decimal object of the indicated return type initialized to infinity value with the same sign&period; &ast; Otherwise if `input` 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 `std&colon;&colon;numeric&lowbar;limits&lt;Decimal32&gt;&colon;&colon;max()` then store the value of the macro `ERANGE` into `errno` and return a decimal object of the indicated return type initialized to infinity with the same sign&period; &ast; Otherwise if `input` represents a value that has an absolute value that is smaller than `std&colon;&colon;numeric&lowbar;limits&lt;Decimal32&gt;&colon;&colon;min()`, then store the value of the macro `ERANGE` into `errno` and return a decimal object of the indicated return type initialized to zero with the same sign&period; &ast; Otherwise if `input` has a value that is not exactly representable using `std&colon;&colon;numeric&lowbar;limits&lt;Decimal32&gt;&colon;&colon;max&lowbar;digit` decimal digits then return a decimal object of the indicated return type initialized to the value represented by `input` 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 `input`&period;

The `&ast;status`, if supplied, mest be 0, and may be loaded with a bit mask of `k&lowbar;STATUS&lowbar;INEXACT`, `k&lowbar;STATUS&lowbar;UNDERFLOW`, and `k&lowbar;STATUS&lowbar;OVERFLOW` indicating wether the conversion from text was inexact, underflowed, or overflowed (or some combination) respectively&period; The behavior is undefined unless `&ast;status` (if supplied) is 0&period;

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

Also note that the quanta of the resultant value is determined by the number of decimal places starting with the most significand digit in `input` string and cannot exceed the maximum number of digits necessary to differentiate all values of the indicated return type, for example&colon;

&grave; &apos;parse32(&quot;0&period;015&quot;) &equals;&gt; 15e&hyphen;3&apos; &apos;parse32(&quot;1&period;5&quot;) &equals;&gt; 15e&hyphen;1&apos; &apos;parse32(&quot;1&period;500&quot;) &equals;&gt; 1500e&hyphen;3&apos; &apos;parse32(&quot;1&period;2345678) &equals;&gt; 1234568e&hyphen;6&apos; &grave; Parse a 128&hyphen;bit decimal value from the specified `input` string&period;


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