New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multipleOf erroneous validation failure #388

Closed
abloomston opened this Issue May 12, 2015 · 4 comments

Comments

Projects
None yet
3 participants
@abloomston

abloomston commented May 12, 2015

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

This comment has been minimized.

Show comment
Hide comment
@stevage

stevage May 18, 2015

Contributor

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...

Contributor

stevage commented May 18, 2015

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

This comment has been minimized.

Show comment
Hide comment
@abloomston

abloomston Jun 16, 2015

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

abloomston commented Jun 16, 2015

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

abloomston pushed a commit to abloomston/json-editor that referenced this issue Jun 16, 2015

Adam Bloomston
proposed fix for #388 using math.js
* bower and grunt-bower-concat are now required for building json-editor
* math.js is now required for running json-editor, but is not checked by jshint
* grunt no longer runs jshint on the output dist file, as it may contain
  external libaries
* float comparisons for multipleOf, divisibleBy, maximum, minimum use
  math.js

abloomston pushed a commit to abloomston/json-editor that referenced this issue Jun 16, 2015

Adam Bloomston
proposed fix for #388 using math.js
* bower and grunt-bower-concat are now required for building json-editor
* math.js is now required for running json-editor, but is not checked by jshint
* grunt no longer runs jshint on the output dist file, as it may contain
  external libaries
* float comparisons for multipleOf, divisibleBy, maximum, minimum use
  math.js

abloomston pushed a commit to abloomston/json-editor that referenced this issue Jun 16, 2015

Adam Bloomston
proposed fix for #388 using math.js
* bower and grunt-bower-concat are now required for building json-editor
* math.js is now required for running json-editor, but is not checked by jshint
* grunt no longer runs jshint on the output dist file, as it may contain
  external libaries
* float comparisons for multipleOf, divisibleBy, maximum, minimum use
  math.js

abloomston pushed a commit to abloomston/json-editor that referenced this issue Jun 16, 2015

Adam Bloomston
proposed fix for #388 using math.js
* stripped minimal logic from math.js fp arithmetic for fixing #388

This was referenced Jun 16, 2015

@abloomston

This comment has been minimized.

Show comment
Hide comment
@abloomston

abloomston Jun 16, 2015

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

abloomston commented Jun 16, 2015

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

abloomston pushed a commit to abloomston/json-editor that referenced this issue Jul 3, 2015

jdorn added a commit that referenced this issue Feb 11, 2016

proposed fix for #388 using math.js
Make math.js an optional dependency. Also add support for decimal.js

@jdorn jdorn closed this in b019e3b Feb 11, 2016

jdorn added a commit that referenced this issue Feb 11, 2016

Version bump to 0.7.24
Closes #526 Closes #533 Closes #436 Fixes #388
@Karthiccc

This comment has been minimized.

Show comment
Hide comment
@Karthiccc

Karthiccc Aug 2, 2017

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

Karthiccc commented Aug 2, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment