Hi guys,
Pick any Erlang version and type the following:
$ erl Erlang/OTP 25 [erts-13.1.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns] [systemtap] Eshell V13.1.1 (abort with ^G) 1> 9999999999999999.0-9999999999999998.0 . 2.0
Weird, isn’t it?
This is very normal behaviour for float variables You can try it with python too, you will get the same result.
https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
Here are three more resources on floating‐point arithmetic which you may find useful if you want to learn more about the subject. Most of them are citing David Goldberg’s work.