|
On Sat, Jul 4, 2020 at 3:01 PM Long Z <zandzx02cn@gmail.com> wrote:
>
> HW: STM32F107RCT6 (ARM Cortex M3)
> OS: MadOS
> I port lua to a RTOS, and then found a strange error :
> * math.pow(2, 2) result 4.0 BUT 2^2 result 2.
> * After some test, I found x^y result x always.
> * I used v5.4.0, v5.3.5 and v5.1.5 for testing, and got the same result.
> Here is my luaconfig.h used in v5.4.0.
>
Here's some troubleshooting ideas/questions:
* Are you running the Lua source code on the STM32, or are you
compiling it somewhere else and just running the bytecode there? If
the latter, does the former work any better?
* If you stub out the whole constfolding function in src/lcode.c,
replacing the entire body with "return 0;", does anything change?
* If you do "function mypow(x, y) return x ^ y end" and then call
"mypow(2, 2)", what does it return?
* If you get the numbers at runtime instead of hardcoding them in the
Lua source, does anything change?
Joseph C. Sible