Edit

Share via


MathF.Truncate(Single) Method

Definition

Calculates the integral part of a specified single-precision floating-point number.

C#
public static float Truncate(float x);

Parameters

x
Single

The number to truncate.

Returns

The truncated representation of x

Remarks

Truncate rounds x to the nearest integer towards zero.

Applies to

Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.0 (package-provided), 2.1

See also