프로그래밍 언어/Delphi

[Reference] System.Trunc

얗마 2017. 4. 11. 22:01

Delphi

function Trunc(X: Real): Int64;

Properties

Type

Visibility

Source

Unit

Parent

function

public

System.pas

System

System

Description

Truncates a real number to an integer.

In Delphi code, the Trunc function truncates a real-type value to an integer-type value.

X is a real-type expression. 

Trunc returns an Int64 value that is the value of X rounded toward zero.

If the truncated value of X is not within the Int64 range, an EInvalidOp exception is raised.

 

실수를 정수로 자릅니다.

Delphi 코드에서 Trunc 함수는 실수형 값을 정수형 값으로 자릅니다.

X는 실수형 표현입니다.

TruncX 값을 0으로 반올림 한 Int64 값을 반환합니다.

X의 잘린 값이 Int64 범위 내에 있지 않으면, EInvalidOp 예외가 발생합니다.

 

Example

var

  Num: Single;

begin

  Num := 3.14;

 

  // 결과: 3

  Writeln(Trunc(Num));

  Readln;

end.

 

truncate 미국식 [|trʌŋkeɪt]   영국식 [trʌŋ|keɪt]

(아래나 위를 잘라서) 길이를 줄이다

within 미국·영국 [wɪ|ðɪn]   영국식   중요

1. (특정한 기간) 이내에
2. (
특정한 거리) 이내에
3. (
범위한계) 내에

 

출처: http://docwiki.embarcadero.com/Libraries/XE2/en/System.Trunc