truncate

Summary

Removes decimal digits and returns the integral part of a number.

Usage

public static double truncate(double x)

Returns

An integral number representing the specified value with its decimal digits removed.

Parameters

x

The value to truncate.

Description

Removes decimal digits and returns the integral part of a number.

Examples

Basic Usage
1
2
3
4
import System;
 
Console.log(Math.truncate(2.2d)); // 2
Console.log(Math.truncate(3.3d)); // 3

Share

HTML | BBCode | Direct Link