[MUD-Dev] Re: [CODE QUESTION] How to encode floats into bytes?
Ola Fosheim Grøstad <olag@ifi.uio.no>
Ola Fosheim Grøstad <olag@ifi.uio.no>
Wed Sep 9 18:47:47 CEST 1998
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
More information about the mud-dev-archive
mailing list