lua-users home
lua-l archive

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

Although Lua 5.3 strictly follows C89 and C99, many embedded environments come with crippled C libraries that make it impossible to use floating point operations. Changing the number type from double to "integer only" was easy in previous versions of Lua since only the configuration file needed to be changed. This no longer seems to be the case since the C code directly uses many floating point library functions and macro constants(C89/C99). We have tried to port Lua 5.3.1 to some of these embedded environments, and we have run into major issues that cannot be resolved without major changes to the C code. I therefore propose that you add an option (which can be set via the configuration file) that removes any use of floating point from Lua.


Compiling for Cortex M7 using the IAR compiler worked (C99 compatible floating point library).
Compiling for ColdFire using the CodeWarrior compiler failed (crippled C89 floating point library).

In addition to issues with exotic compilers/libraries, some Real Time Operating Systems do not save the floating point registers on context switches, which makes it impossible to use floating point with CPU's that include hardware floating point operations. In others, one must specifically enable it. For example, in VxWorks, floating point registers are not saved unless a specific option is set when the thread is created.