Skip to content

Fix: floating point precision #6

@sitch

Description

@sitch

Currently this uses floats to perform arithmetic, which leads to unexpected evals over certain numerical intersections

This test currently passes, but most people's general conceptions would expect this to fail

    test "floating point arithmetic" do
      refute JsonLogic.apply(%{"+" => [0.1, 0.2]}) == 0.3
      assert JsonLogic.apply(%{"+" => [0.1, 0.2]}) == 0.30000000000000004
    end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions