Skip to content
This repository was archived by the owner on Jul 24, 2019. It is now read-only.
This repository was archived by the owner on Jul 24, 2019. It is now read-only.

multipleOf fails with some floats #12

Description

@seagreen

Specifically it fails this test:

jsonschema_test.go:56: schema.Validate failed to validate good data.
  file: JSON-Schema-Test-Suite/tests/draft4/multipleOf.json
  test case description: by small number
  schema: {"multipleOf": 0.0001}
  test instance description: 0.0075 is multiple of 0.0001
  test data: 0.0075
  result of schema.Validate:
      expected: true
      actual: false
      actual validation errors: [{Value must be a multiple of 0.0001.}]

One thing I could do is multiple both the operator and the operand by some factor of 10 and then turn them both into integers before making the calculation. No idea if that's a good approach or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions