[#BloombergLP-bdldfp-DecimalImpUtil-subtract-02]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdldfp.adoc[bdldfp]::xref:BloombergLP/bdldfp/DecimalImpUtil.adoc[DecimalImpUtil]::subtract
:relfileprefix: ../../../
:mrdocs:

Subtract the value of the specified `rhs` from the value of the specified `lhs` as described by IEEE&hyphen;754 and return the result&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
xref:BloombergLP/bdldfp/DecimalImpUtil/ValueType32.adoc[DecimalImpUtil::ValueType32]
subtract(
    xref:BloombergLP/bdldfp/DecimalImpUtil/ValueType32.adoc[ValueType32] lhs,
    xref:BloombergLP/bdldfp/DecimalImpUtil/ValueType32.adoc[ValueType32] rhs);
----

== Description

&ast; If either of `lhs` or `rhs` is signaling NaN, then store the value of the macro `EDOM` into `errno` and return a NaN&period; &ast; Otherwise if either of `lhs` or `rhs` is NaN, return a NaN&period; &ast; Otherwise if `lhs` and the `rhs` have infinity values of the same sign, store the value of the macro `EDOM` into `errno` and return a NaN&period; &ast; Otherwise if `lhs` and the `rhs` have infinity values of differing signs, then return `lhs`&period; &ast; Otherwise if `rhs` has a zero value (positive or negative), then return `lhs`&period; &ast; Otherwise if the subtracting of `lhs` and `rhs` has an absolute value that is larger than the maximum value supported by the indicated result type then store the value of the macro `ERANGE` into `errno` and return infinity with the same sign as that result&period; &ast; Otherwise return the result of subtracting the value of `rhs` from the value of `lhs`&period; Return the difference of the specified decimal values&period;


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