[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: exponent and modulus operator oddities on ppc
- From: Mike Pall <mikelu-0903@...>
- Date: Mon, 2 Mar 2009 20:18:17 +0100
Glenn McAllister wrote:
> Linux kernel 126.96.36.199, 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
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.