Skip to content
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

Floating point comparisons should not be tested with the validator #735

Closed
ml-evs opened this issue Mar 8, 2021 · 0 comments · Fixed by #736
Closed

Floating point comparisons should not be tested with the validator #735

ml-evs opened this issue Mar 8, 2021 · 0 comments · Fixed by #736
Assignees
Labels
bug Something isn't working priority/medium Issue or PR with a consensus of medium priority validator Related to the OPTIMADE validator

Comments

@ml-evs
Copy link
Member

ml-evs commented Mar 8, 2021

During validation, we currently test that queries for e.g. _custom_float_field=3.5 returns at least one matching document to _custom_float_field>=3.5 and other inclusive operators. The OPTIMADE specification is quite flexible on floating point comparisons, so during validation we should be too:

While the filtering language supports tests for equality between properties of floating point type and decimal numbers given in the filter string, such comparisons come with the usual caveats for testing for equality of floating point numbers. Normally, a client cannot rely on that a floating point number stored in a database takes on a representation that exactly matches the one obtained for a number given in the filtering string as a decimal number or as an integer. However, testing for equality to zero MUST be supported.

This is a big problem when e.g. testing queries on elements_ratios with filters like elements_ratios HAS 0.299999999999999988897769753748434595763683319091796875, or whatever.

@ml-evs ml-evs added bug Something isn't working priority/medium Issue or PR with a consensus of medium priority validator Related to the OPTIMADE validator labels Mar 8, 2021
@ml-evs ml-evs self-assigned this Mar 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority/medium Issue or PR with a consensus of medium priority validator Related to the OPTIMADE validator
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant