## digitalmars.D - Casting float to int and int to float

• Garett Bass (4/4) Dec 19 2005 In D, does a cast from float to int (and vice-versa) actually convert th...
• Jarrett Billingsley (3/5) Dec 19 2005 Right.
• Manfred Nowak (4/10) Dec 19 2005 What is the "equivalent integer value" of a float that is out of the
• Oskar Linde (6/8) Dec 19 2005 The smallest representable integer. For
• Manfred Nowak (4/8) Dec 20 2005 Sadly, it is neither documented nor implemented this way.
"Garett Bass" <gtbass studiotekne.com> writes:
```In D, does a cast from float to int (and vice-versa) actually convert the whole
part of the float to an equivalent integer value?
Or does the cast merely reinterpret the bits as the other type?

Thanks,
Garett
```
Dec 19 2005
"Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
```"Garett Bass" <gtbass studiotekne.com> wrote in message
news:do7jpf\$1up0\$1 digitaldaemon.com...
In D, does a cast from float to int (and vice-versa) actually convert the
whole part of the float to an equivalent integer value?

Right.
```
Dec 19 2005
Manfred Nowak <svv1999 hotmail.com> writes:
```Jarrett Billingsley wrote:

"Garett Bass" <gtbass studiotekne.com> wrote
In D, does a cast from float to int (and vice-versa) actually
convert the whole part of the float to an equivalent integer
value?

Right.

What is the "equivalent integer value" of a float that is out of the
range of the integer it is casted to?

-manfred
```
Dec 19 2005
Oskar Linde <oskar.lindeREM OVEgmail.com> writes:
```Manfred Nowak wrote:

What is the "equivalent integer value" of a float that is out of the
range of the integer it is casted to?

The smallest representable integer. For
long: (0x8000000000000000) -9223372036854775808
int: (0x80000000) -2147483648
etc...

/Oskar
```
Dec 19 2005
Manfred Nowak <svv1999 hotmail.com> writes:
```Oskar Linde wrote:
[...]
The smallest representable integer. For
long: (0x8000000000000000) -9223372036854775808
int: (0x80000000) -2147483648
etc...

Sadly, it is neither documented nor implemented this way.

-manfred
```
Dec 20 2005