contents   index   previous   next



You can completely redefine all of the floating-point types and operations by compiling with JSE_FP_EMULATOR defined. If this flag is defined, then you must implement, through macros or function calls, all of the basic and extended math operations. Even such a simple operations as adding two numbers or converting a number to an integer must be defined by your macros and functions. Those macros and functions are all defined in the file src/include/sefp.h.


One example has been provided for using JSE_FP_EMULATOR. If the tester (tests/testers/config/fpemul.h) header file is used, it defines JSE_FP_EMULATOR and includes a sample implementation of all the math routines as found in src/app/fpemul.*. This example is built for systems that need floating-point support but which have very slow FP emulation. The goal is to make numbers be kept as integers as long as possible and only converted to floats when they cannot be represented accurately as integers—the resulting code matches the ECMAScript specification but with optimal speed on a slow-FP system. Note that this is just one sample implementation; different platforms will have different schemes for FP emulation.