lua-users home
lua-l archive

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

Glenn McAllister wrote:
> Linux kernel, custom built.  We don't use a packaged  
> distro, we build it all ourselves and have been for 9 years now. :)

The problem is very likely to be a bad interaction between floor()
and pow(). Looks like the FPU flags (rounding mode etc.) are not
properly restored.

Lacking details, this could be either a bug in the C library, the
cross-compiler or the kernel. Especially for soft-float targets
(or accidental mixing of soft-floats/hard-floats). You can
probably find the culprit by wading through the assembler code
with a debugger.

As to why you're seeing differences between script and interactive
execution: Lua folds constants while parsing and this indirectly
calls pow() for the ^ operator. A script is parsed in one go, but
the interactive prompt runs the parser for every line.

Calling floor() on behalf of the % operator apparently screws up
the FPU state. The non-constant folded ^ operator is thus always
affected, but the constant-folded one is only affected if the
parsing is done afterwards.