Exception when casting doubles to ints
John.Tytgat at aaug.net
Thu Jan 6 14:41:14 PST 2005
In message <BAY101-F254E3ED3F8DDFE11900C51F0930 at phx.gbl> you wrote:
> It appears that when a double that is larger than the maximum
> int is cast to an int a floating point exception occurs. On cygwin
> you do not get an exception, and as the code where I found the
> problem was in lua I suspect other linux/unix variations also do not
> raise an exception. Can anyone confirm the unix behaviour?
> If this is the case should the RISC OS gcc match what unix does?
Actually I don't mind this being the default behaviour because it is
something pretty undefined what int value you would have if no exception
would be raised.
But I think your question is around the header fenv.h (cfr.
for more info). I understand from it that the default floating point
exception behaviour is not specified but that you can change it with
limitations using the fe*() functions. If your lua program is using
those fe*() and you think UnixLib is not behaving like the above mentioned
specification, feel free to let us know the details.
John Tytgat, in his comfy chair at home BASS
John.Tytgat at aaug.net ARM powered, RISC OS driven
More information about the gcc