[#mp_units-scale-05]
= xref:mp_units.adoc[mp&lowbar;units]::scale
:relfileprefix: ../
:mrdocs:

`scale` overloads

== Synopses

Declared in `&lt;mp&hyphen;units&sol;framework&sol;scaling&period;h&gt;`

Scale `value` by the unit magnitude passed as `m,` converting to type `To&period;`


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename To,
    xref:mp_units/UnitMagnitude.adoc[UnitMagnitude] M,
    typename From&gt;
requires detail&colon;&colon;UnitMagnitudeScalable&lt;From&gt;
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
constexpr
auto
xref:mp_units/scale-0e.adoc[scale](
    M m,
    From const& value);
----

[.small]#xref:mp_units/scale-0e.adoc[_» more&period;&period;&period;_]#

Scale `value` by the unit magnitude passed as `m,` converting to type `To,` with the result rounded according to `policy&period;`


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename To,
    xref:mp_units/UnitMagnitude.adoc[UnitMagnitude] M,
    typename From,
    xref:mp_units/RoundingPolicy.adoc[RoundingPolicy] Policy&gt;
requires detail&colon;&colon;UnitMagnitudeScalable&lt;From&gt;
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
constexpr
auto
xref:mp_units/scale-00.adoc[scale](
    M m,
    From const& value,
    Policy policy);
----

[.small]#xref:mp_units/scale-00.adoc[_» more&period;&period;&period;_]#

== Return Value

* `value` scaled by `m,` truncated to type `To`
* `value` scaled by `m,` rounded to type `To` according to `policy`

[NOTE]
====
The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^].
====
== Parameters

[cols="1,4"]
|===
| Name| Description
| *m*
| unit magnitude to scale `value` by
| *value*
| value being scaled
| *policy*
| rounding policy tag selecting how the scaled result is rounded
|===


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