MUD-Dev
mailing list archive

[ Other Periods  | Other mailing lists  | Search  ]

Date:  [ Previous  | Next  ]      Thread:  [ Previous  | Next  ]      Index:  [ Author  | Date  | Thread  ]

[MUD-Dev] Re: [CODE QUESTION] How to encode floats into bytes?



Adam Wiggins wrote:
> On Mon, 7 Sep 1998, Ben Greear wrote:

> > float f = 42.5;
> > char* bytes = (char*)(&f);

> Not only that, but if you decide to compile with -ffast-math one day, you
> may get some funny results.

Depending on the compiler the following should fix errors introduced by
optimization?

  volatile float f = 42.5f;

--
Ola Fosheim Groestad,Norway





[ Other Periods  | Other mailing lists  | Search  ]