# Board index » delphi » float to int

## float to int

How could I convert a float to an integer without using:
y:= strtoint ( floattostr ( int ( x ) ) )

Thanks.
Bye.
DJL.

## Re:float to int

##### Quote
DJL wrote:

> How could I convert a float to an integer without using:
> y:= strtoint ( floattostr ( int ( x ) ) )

> Thanks.
> Bye.
> DJL.

Hello,
what's wrong with round()?
Or wth a different rounding rule: trunc()?
--
Pierre Meyer????????????????????????
e-mail : me...@lps.u-psud.fr

## Re:float to int

y := round(x);

regards Sven

##### Quote
DJL <djelloul.be...@voila.fr> wrote in message

news:8giuau\$1u2\$2@wfn.emn.fr...
##### Quote
> How could I convert a float to an integer without using:
> y:= strtoint ( floattostr ( int ( x ) ) )

> Thanks.
> Bye.
> DJL.

## Re:float to int

Try y := Trunc(x); or y := Round(x);

Jake

##### Quote
"DJL" <djelloul.be...@voila.fr> wrote in message

news:8giuau\$1u2\$2@wfn.emn.fr...
##### Quote
> How could I convert a float to an integer without using:
> y:= strtoint ( floattostr ( int ( x ) ) )

> Thanks.
> Bye.
> DJL.