]> gitweb.factorcode.org Git - factor.git/commit
vm: use the ``fmt`` library to fix shortest decimal representation issue.
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 7 Feb 2024 18:47:15 +0000 (10:47 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 7 Feb 2024 18:47:15 +0000 (10:47 -0800)
commit4a58c56e7eb9d056e986b0a783ae3d59830f6123
treea59450680f3185063761dd750eeaab257eb9bf07
parentc4b59678928938a93d854bd691f0f1df7e71dcc3
vm: use the ``fmt`` library to fix shortest decimal representation issue.

Before:

    IN: scratchpad 0x1.1ffffffffffffp7 .
    144.0

    IN: scratchpad 0x1.2p7 .
    144.0

    IN: scratchpad 0x1.2000000000001p7 .
    144.0

After:

    IN: scratchpad 0x1.1ffffffffffffp7 .
    143.99999999999997

    IN: scratchpad 0x1.2p7 .
    144.0

    IN: scratchpad 0x1.2000000000001p7 .
    144.00000000000003

Perhaps we should implement the Dragonbox algorithm ourselves at some point.
GNUmakefile
vm/fmt/core.h [new file with mode: 0644]
vm/fmt/format-inl.h [new file with mode: 0644]
vm/fmt/format.h [new file with mode: 0644]
vm/math.cpp