Skip to content

multipleOf does not work for floats #985

@Willem-J-an

Description

@Willem-J-an

Describe the bug

This code does not seem to accurately calculate if a number is a multipleOf in the case of float numbers. A value of 0.9 with a multipleOf is flagged, because 0.9 % 0.05 === 0.05 in javascript.

Expected Behavior

Value of 0.9 is not flagged.

Current Behavior

Value of 0.9 is flagged.

Steps to Reproduce

  1. Create schema with multipleOf 0.05
  2. Set value of 0.9
  3. The value is flagged as not being a multiple of 0.05

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions