![]() |
|
|
|
#1
|
||||
|
||||
|
I implemented Lua into my app and discovered that the use of big numbers will cause an FPU exception when the program is run or even compiled, depending how they're used. The exception is the same every time:
Code:
Exception - FPU Exception (V) Thread ID - 0x0435861B Th Name - user_main Module ID - 0x0437DD0F Mod Name - shell EPC - 0x0881FB8C Cause - 0x1000003C BadVAddr - 0x04405470 Status - 0x20088613 zr:0x00000000 at:0x08870000 v0:0x00000003 v1:0x00000003 a0:0x0887C070 a1:0x0BBBEF08 a2:0x0887C070 a3:0x00000001 t0:0x00000005 t1:0xFFFFFFFF t2:0x08867090 t3:0xFFFFFFFC t4:0x088670C8 t5:0xFFFFFFF8 t6:0x00000000 t7:0xDEADBEEF s0:0x0887C070 s1:0x0BBBEF08 s2:0x08875BD0 s3:0x0BBBEF08 s4:0x08875BD0 s5:0x0BBBF2A8 s6:0x0BBBEF78 s7:0x0000000C t8:0xDEADBEEF t9:0xDEADBEEF k0:0x0BBBFF00 k1:0x00000000 gp:0x0886F750 sp:0x0BBBEEC8 fp:0x00000000 ra:0x0881FC00 0x0881FB8C: 0x4600100D '...F' - trunc.w.s $fpr00, $fpr02 Code:
function FrameBegin() print(tostring(0x7FFFFFFF)) end Code:
function FrameBegin() print(tostring(0x7FFFFF00 + 0xC0)) end Adding at runtime has interesting side effects. If I do this (where foo() is a C function): Code:
x = 1 function FrameBegin() foo(0x7FFFFF00 + x) x = x + 1 end Code:
x = 1
function FrameBegin()
print("X = ", string.format("%X", (0x7FFFFF00 + x)))
x = x + 1
end
I suspect the addition problem is simply floating point precision loss, but when merely having these constants in your script crashes Lua before it's even executed, that's a bigger problem. :-/
__________________
>> PSP-2001 running 5.00m33-6, 4GB Lexar memory stick Luna is not dead, it just has a todo list a mile long. My website is, though. But it will return, someday... >_> |
![]() |
| Tags |
| bug, compiler, crash, float, lua |
|
|
|||
|
|||
|
|
| Thread Tools | |
| Display Modes | |
|
|