[#BloombergLP-bdldfp-DecimalImpUtil-add-0a] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdldfp.adoc[bdldfp]::xref:BloombergLP/bdldfp/DecimalImpUtil.adoc[DecimalImpUtil]::add :relfileprefix: ../../../ :mrdocs: Add the value of the specified `rhs` to the value of the specified `lhs` as described by IEEE‐754 and return the result. == Synopsis Declared in `<bdldfp_decimalimputil.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static xref:BloombergLP/bdldfp/DecimalImpUtil/ValueType32.adoc[DecimalImpUtil::ValueType32] add( xref:BloombergLP/bdldfp/DecimalImpUtil/ValueType32.adoc[ValueType32] lhs, xref:BloombergLP/bdldfp/DecimalImpUtil/ValueType32.adoc[ValueType32] rhs); ---- == Description * If either of `lhs` or `rhs` is signaling NaN, then store the value of the macro `EDOM` into `errno` and return a NaN. * Otherwise if either of `lhs` or `rhs` is NaN, return a NaN. * Otherwise if `lhs` and `rhs` are infinities of differing signs, store the value of the macro `EDOM` into `errno` and return a NaN. * Otherwise if `lhs` and `rhs` are infinities of the same sign then return infinity of that sign. * Otherwise if `rhs` is zero (positive or negative), return `lhs`. * Otherwise if the sum 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. * Otherwise return the sum of the number represented by `lhs` and the number represented by `rhs`. Return the sum of the specified decimal values. [.small]#Created with https://www.mrdocs.com[MrDocs]#