Skip to content

multipleOf is inconsistent, fails for negative numbers #315

Closed
@leongersen

Description

@leongersen

The specification doesn't say negative numbers should fail a multipleOf constraint, yet the current documentation fails -49.89 with a multipleOf value of 0.01.

Funnily enough, the implementation of this constraint has some edge cases where it lets negative numbers pass:

Calling the NumberConstraint::fmod function with the parameters:

Calling abs() on the first argument of NumberConstraint::fmod should both fix this inconsistency and bring multipleOf in line with the spec.

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