[#BloombergLP-bdldfp-DecimalConvertUtil_IntelDfp-decimalToDouble-08]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdldfp.adoc[bdldfp]::xref:BloombergLP/bdldfp/DecimalConvertUtil_IntelDfp.adoc[DecimalConvertUtil&lowbar;IntelDfp]::decimalToDouble
:relfileprefix: ../../../
:mrdocs:

Return a `double` closest to the value of the specified `decimal`&period;

== Synopsis

Declared in `&lt;bdldfp&lowbar;decimalconvertutil&lowbar;inteldfp&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
double
decimalToDouble(xref:BloombergLP/bdldfp/Decimal32.adoc[Decimal32] decimal);
----

== Description

Conversion follows the rules defined by IEEE&hyphen;754&colon;

&ast; If the `decimal` object is a NaN, return a NaN&period; &ast; Otherwise if `decimal` is positive or negative infinity, return infinity of the same sign&period; &ast; Otherwise if `decimal` is positive or negative zero, return zero of the same sign&period; &ast; Otherwise if `decimal` object has an absolute value that is larger than `std&colon;&colon;numeric&lowbar;limits&lt;double&gt;&colon;&colon;max()`, raise the &quot;overflow&quot; floating&hyphen;point exception and return infinity of the same sign as `decimal`&period; &ast; Otherwise if `decimal` has an absolute value that is smaller than `std&colon;&colon;numeric&lowbar;limits&lt;double&gt;&colon;&colon;min()`, raise the &quot;underflow&quot; floating&hyphen;point exception and return zero of the same sign as `decimal`&period; &ast; Otherwise if `decimal` has a value that has more significant base&hyphen;10 digits than `std&colon;&colon;numeric&lowbar;limits&lt;double&gt;&colon;&colon;digits10`, raise the &quot;inexact&quot; floating&hyphen;point exception, round that value according to the _binary_ rounding direction setting of the floating&hyphen;point environment, and return the result of that&period; &ast; Otherwise if `decimal` has a significand that cannot be exactly represented using binary floating&hyphen;point, raise the &quot;inexact&quot; floating&hyphen;point exception, roundthat value according to the _binary_ rounding direction setting of the environment, and return the result of that&period; &ast; Otherwise use the exact value of the `other` object for the initialization if this object&period;

== Return Value

closest `double` representation of `decimal`

== Parameters

[cols="1,4"]
|===
| Name| Description
| *decimal*
| value to convert
|===


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