System.Convert.ToSingle Method

Converts the value of the specified double-precision floating-point number to an equivalent single-precision floating-point number.

Syntax

public static float ToSingle (double value)

Parameters

value
The double-precision floating-point number to convert.

Returns

A single-precision floating-point number that is equivalent to value.

value is rounded using rounding to nearest. For example, when rounded to two decimals, the value 2.345 becomes 2.34 and the value 2.355 becomes 2.36.

Exceptions

TypeReason
OverflowException value is greater than float.MaxValue or less than float.MinValue.

Remarks

Documentation for this section has not yet been entered.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0