Int to float?

Taylor Hillegeist via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Mar 5 12:06:53 PST 2015


On Thursday, 5 March 2015 at 20:03:09 UTC, Benjamin Thaut wrote:
> Am 05.03.2015 um 21:00 schrieb Taylor Hillegeist:
>> How to I cast a Int to float without changing its binary 
>> representation?
>
> int someValue = 5;
> float sameBinary = *(cast(float*)cast(void*)&someValue);

ahh of course! lol :)


More information about the Digitalmars-d-learn mailing list