mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[emscripten] Fix float rouding errors when computing grid axis labels
Emscripten converts C++ floats to doubles, which produces rounding errors. In the Graph application, when displaying y=sin(x), the ordinate '1' displayed "10" instead, because the exponent of 1000f was wrongly computed. To prevent this, we add the -s PRECISE_F32=1 flag, which uses 32-bits floating point values for floats. See https://kripken.github.io/emscripten-site/docs/getting_started/FAQ.html#why-do-i-get-odd-rounding-errors-when-using-float-variables
This commit is contained in:
@@ -71,7 +71,7 @@ _mp_import_name \
|
||||
_mp_parse_compile_execute
|
||||
|
||||
EMTERPRETIFY_WHITELIST = $(foreach sym,$(EMSCRIPTEN_ASYNC_SYMBOLS),"$(sym)",)END
|
||||
EMFLAGS = -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1 -s EMTERPRETIFY_WHITELIST='[$(EMTERPRETIFY_WHITELIST:,END=)]'
|
||||
EMFLAGS = -s PRECISE_F32=1 -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1 -s EMTERPRETIFY_WHITELIST='[$(EMTERPRETIFY_WHITELIST:,END=)]'
|
||||
|
||||
ifeq ($(DEBUG),1)
|
||||
EMFLAGS += --profiling-funcs
|
||||
|
||||
Reference in New Issue
Block a user