lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed 30 Apr, D Burgess wrote:
> 
> What is your platform? 

RiscPC RISC OS 4.02 (STRONGARM CPU) and
Iyonix RISC OS 5.02 (INTEL 80321 CPU)

with Norcroft C compiler.

> and what exception, SIGFPE?

Yes 


> I had a problem with OS400 throwing an exception on
> floating point to int assignment. 
> e.g. int n = (double)d;

> I think your change is wrong because there is no
> guarantee that you will have an integer value on
> the LHS of (n == -1).

It will not be an integer, it will be a double, (Lua_Number
is a double on my system), and the compiler will type -1 as a
double accordingly. Actually, I use 

 t = (time_t) fabs(n);
 
rather than t = (time_t) n; because I am worried that other
negative values might cause similar mayhem.

-- 
Gavin Wraith (gavin@wraith.u-net.com)
Home page: http://www.wraith.u-net.com/