[SDL] Floating data types...

MIGUEL ANGEL BLANCH LARDIN x5101920 at fedro.ugr.es
Wed Jan 24 08:50:38 PST 2001


Mensaje citado por: Mattias Engdegård <f91-men at nada.kth.se>:

> >   Are floating(double and long double too) data types the same on 
all
> >platforms? That is do they all have the same mantissa, exponent,
> >endianess... I noticed SDL_net doesn't have any conversion methods 
for
> >sending floats to machines of different endianess.
>
> 2 issues: byte order and fp format. Most contemporary machines use
> IEEE floats so you can safely spec that in a protocol. Use either 32
> or 64 bit floats; oddball ones like 80 (intel) or 128 (sun) are out,
> so are ancient stuff like ibm 360/VAX/Cray fp formats. You can
> probably use the ordinary byte order macros to convert endianness 
---
> this is not guaranteed but true in reality

I know that Age of Kings are having a lot of problems due to float 
point values, as not all the system ( and speaking on x86 system only 
:-> ) compute the number in the same way.

To compute the value and having the same result on both system you are 
going to need:
a) Same precision
b) Non buggy FPU 
c) Good luck

But for common things there shouldn't be many problems.



More information about the SDL mailing list