vscode_erlang
vscode_erlang copied to clipboard
Float literals are replaced with approximation
3.3 becomes 3.2999999999999998 3.4 becomes 3.3999999999999999
Is there a way to disable this?
Hi,
Thanks for your report could you shared logs ? you can activate it in settings (set erlang.verbose to true)
https://gist.github.com/dpavsrtrl/b4c4ff3780ebfdcc9920230dbfc1efc6
Hi @dpavsrtrl,
I found the origin of this issue : B = 3.1 + 3.2 + 3.3 + 3.4 + 3.5 + 3.6 + 3.7 + 3.8 + 3.9.
after formating document it becomes : B = 3.1 + 3.2 + 3.29999999999999982236 + 3.39999999999999991118 + 3.5 + 3.6 + 3.7 + 3.79999999999999982236 + 3.89999999999999991118.
I use erlang to format document (erl_tidy). Then, I would like to use 'erl_prettypr:format', but there is the same issue... after digging, it come from 'erl_syntax:float_literal({float, 7, 3.4}), which use float_to_list() that returns '3.39999999999999991118e+00', So, unfortunately I didn't found a quick workaround for this problem.
Fixed by #224