Float.FloatToFloat16(Single) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
{
[Android.Runtime.Register("floatToFloat16", "(F)S", "", ApiSince=36)]
public static short FloatToFloat16(float f);
[<Android.Runtime.Register("floatToFloat16", "(F)S", "", ApiSince=36)>]
static member FloatToFloat16 : single -> int16
Parameters
- f
- Single
the float
value to convert to binary16
Returns
the floating-point binary16 value, encoded in a short
, closest in value to the argument}
The conversion is computed under the java.math.RoundingMode#HALF_EVEN round to nearest even rounding
mode.
Special cases:
<ul>
<li> If the argument is zero, the result is a zero with the
same sign as the argument.
<li> If the argument is infinite, the result is an infinity
with the same sign as the argument.
<li> If the argument is a NaN, the result is a NaN.
</ul>
The binary16 format is discussed in
more detail in the <code data-dev-comment-type="c">#float16ToFloat</code> method.
- Attributes
Remarks
{
Added in 20.
Java documentation for java.lang.Float.floatToFloat16(float)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.