[#BloombergLP-bdldfp-DecimalUtil-copySign-064]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdldfp.adoc[bdldfp]::xref:BloombergLP/bdldfp/DecimalUtil.adoc[DecimalUtil]::copySign
:relfileprefix: ../../../
:mrdocs:

Return a value with the magnitude of `x` and the sign of `y`&period;

== Synopsis

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

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

== Description

Return a decimal value with the magnitude of the specifed `x` and the sign of the specified `y`&period; If `x` is NaN, then NaN with the sign of `y` is returned&period;

Examples&colon; `copySign( 5&period;0, &hyphen;2&period;0)` &equals;&equals;&gt; &hyphen;5&period;0&semi; `copySign(&hyphen;5&period;0, &hyphen;2&period;0)` &equals;&equals;&gt; 5&period;0

== Return Value

value with the magnitude of `x` and the sign of `y`

== Parameters

[cols="1,4"]
|===
| Name| Description
| *x*
| value providing the magnitude
| *y*
| value providing the sign
|===


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