[#BloombergLP-bdldfp-DecimalImpUtil_IntelDfp-binaryToDecimal32-00] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdldfp.adoc[bdldfp]::xref:BloombergLP/bdldfp/DecimalImpUtil_IntelDfp.adoc[DecimalImpUtil_IntelDfp]::binaryToDecimal32 :relfileprefix: ../../../ :mrdocs: Create a `Decimal32` object having the value closest to the specified `value` following the conversion rules as defined by IEEE‐754: == Synopsis Declared in `<bdldfp_decimalimputil_inteldfp.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static xref:BloombergLP/bdldfp/DecimalImpUtil_IntelDfp/ValueType32.adoc[DecimalImpUtil_IntelDfp::ValueType32] binaryToDecimal32(float value); ---- == Description * If `value` is signaling NaN, store the value of the macro `EDOM` into `errno` and return signaling NaN value. * If `value` is NaN, return a NaN. * Otherwise if `value` is infinity (positive or negative), then return an object equal to infinity with the same sign. * Otherwise if `value` is a zero value, then return an object equal to zero with the same sign. * Otherwise if `value` has an absolute value that is larger than `std::numeric_limits<Decimal32>::max()` then store the value of the macro `ERANGE` into `errno` and return infinity with the same sign as `value`. * Otherwise if `value` has an absolute value that is smaller than `std::numeric_limits<Decimal32>::min()` then store the value of the macro `ERANGE` into `errno` and return a zero with the same sign as `value`. * Otherwise if `value` needs more than `std::numeric_limits<Decimal32>::max_digit` significant decimal digits to represent then return the `value` rounded according to the rounding direction. * Otherwise return a `Decimal32` object representing `value`. [.small]#Created with https://www.mrdocs.com[MrDocs]#