[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Warning on floor and ceil on latest OS X devtools
- From: Asko Kauppi <askok@...>
- Date: Wed, 8 Jun 2005 11:39:52 +0300
I was struck by this, it's still partly a mystery but hardly my
If you use Lua mathlib with -ffast-math, this shall effect you.
Lua 5.1 (work4) Copyright (C) 1994-2004 Tecgraf, PUC-Rio
> print( math.floor(0.5) )
> print( math.ceil(0.7) )
Edelleenlähetetty viesti alkaa:
Lähettäjä: Asko Kauppi <firstname.lastname@example.org>
Päiväys: 8. kesäkuuta 2005 11.32.02 GMT+03:00
Aihe: XCode 2.1 and -ffast-math
Has anyone else experienced this weird bug, occurring after upgrade
to the new XCode 2.1:
OS X Tiger (10.4.1)
iMac G4 700MHz
XCode 2.1 (actually, using gcc from command line, but.. does it
If -ffast-math is given to gcc, it #defines floor[f] and ceil[f] to
__fastmath_floor[f] and so. These are inline functions that treat
-0.0 in a non-standard way. So what..
For me, in some places, floorf(0.7)==0.7 ! That's no use. Weird
thing is, that this is not consistent, some places work, others
don't. Possibly some variable assignment/code generation/whatever
Anyway, I did not have this (same code) before running XCode 2.1,
so clearly there's something wrong.
If some of you would have XCode 2.0, please send /usr/include/
architecture/ppc/math.h so I can compare them. It may be the
function hasn't changed, but gcc code generation has, though.
First aid: just stop using '-ffast-math' or #undef the macros it
defines. Regular libm functions will be used, and they work. :)