[quake3] bspc on MacOSX

Mike Davis only_mortal at mac.com
Wed Feb 22 19:16:27 EST 2006


I don't profess to understand your specific problem but floating  
point calculations will be different between PPC and Intel, writing  
from personal experience (NeXTStep 3.1 to be specific).

As a rule, under Intel architectures I don't do, "x == y" with floats  
as the accuracy is higher (Intel P60 HP Vectra with NS3.1 versus  
68040 pizza box). You usually have to do a tolerance such as:

if( absf( x - y ) < 0.01f ) {
}

Instead of:

if( x == y ) {
}

Naturally, the less civilized people will write some inline C++  
function junk (requires -O3 on the Mac):

inline bool IsEqual( float a, float b )
{
   return ( absf( a - b ) < 0.01 ? true : false );
}

Even worse the C++ guys will stick it in a header file... /me shudders

On 23 Feb 2006, at 00:32, Vincent Morénas wrote:

> Hi everyone,
>
> I don't know if it is the right place to ask but here is my  
> problem: I compiled the bspc program (from the svn revision 200 of  
> the Q3 source code, the last revision before the bspc folder  
> disappeared) on MacOSX (ppc). The compiling went fine but when run,  
> the executable generates wrong numbers (I compiled the same source  
> on a pentium linux box and everything works as expected there).
> I first thought it was a big<->little endian issue but I checked  
> and the byte swapping is done correctly.... so I am a little lost  
> here.... Can the same floating point calculations give different  
> results on different architecture ? Have you been faced with this  
> kind of problem before ?
>
> Thanks for your suggestions,
>
> Vincent.




More information about the quake3 mailing list