jdorn / json-editor

JSON Schema Based Editor
MIT License
5.8k stars 1.08k forks source link

multipleOf erroneous validation failure #388

Closed abloomston closed 8 years ago

abloomston commented 9 years ago

Entering a value of "1.15" for a field with the following schema

{
    "title": "multipleOf problem",
    "type": "number",
    "multipleOf": 0.01,
    "minimum": -10.00,
    "maximum": 10.00
}

produces the following validation error

Value must be a multiple of 0.01.

See http://jeremydorn.com/json-editor/?schema=N4IgLglmA2CmIC4QFsCu1IAc4HkBmABJgE4D2ARnMiADTgCem8SAdqsubMbSulrnkQAGAHRCAjHWQQWENNQQBacUKkBDAB5z2iFQF8gA&value=IwOmFYgA&theme=bootstrap2&iconlib=fontawesome4&object_layout=normal&show_errors=always

stevage commented 9 years ago

FWIW, looks like some kind of floating point bug - the values "0.15" and "2.15" validate fine. "1.11" to "1.19" fail, "4.14" and "4.18" fail, "2.22" fails...

abloomston commented 9 years ago

Note that I updated the ticket description for a typo: maximim -> maximum

abloomston commented 9 years ago

I've submitted two PRs for two separate proposed fixes for #388, see: #436 and #437.

Karthiccc commented 7 years ago

I can't able to use 1.11 in mutiple of 0.01 in latest version