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

Float type does not follow IEEE 754 standard #27653

Closed
drewtownchi opened this issue Dec 4, 2017 · 5 comments
Closed

Float type does not follow IEEE 754 standard #27653

drewtownchi opened this issue Dec 4, 2017 · 5 comments
Labels
>docs General docs changes

Comments

@drewtownchi
Copy link

Elasticsearch version 6.0.0

Plugins installed: [x-pack]

JVM version (java -version): 1.8.0_60

OS version (uname -a if on a Unix-like system): Centos 7

Description of the problem including expected versus actual behavior:

https://www.elastic.co/guide/en/elasticsearch/reference/6.0/number.html
float | A single-precision 32-bit IEEE 754 floating point.

https://en.wikipedia.org/wiki/IEEE_754 "As with IEEE 754-1985, the biased-exponent field is filled with all 1 bits to indicate either infinity (trailing significand field = 0) or a NaN (trailing significand field ≠ 0)."

Elasticsearch is rejecting our infinity value floats. The Elasticsearch documentation claims to follow the IEEE 754 float spec but is rejecting infinity and NaN values.

Steps to reproduce:

  1. This is the commit that changed this behavior d8ff6e9
  2. Create an index
  3. Send a finite float to a field on the index
  4. Send an infinity value to the same field on the index

Provide logs (if relevant):
"caused_by"=>{"type"=>"illegal_argument_exception", "reason"=>"[float] supports only finite values, but got [Infinity]"}

@rjernst
Copy link
Member

rjernst commented Dec 4, 2017

This is by design. Json has no way to represent inifinity or NaN.
See the original issue: #25534

@rjernst rjernst closed this as completed Dec 4, 2017
@drewtownchi
Copy link
Author

@rjernst Should the documentation be updated to say it follows RFC 4627 or ECMA-262 instead of IEEE 754? The Elasticsearch docs don't accurately reflect the accepted values for float/half-float/double

NOTE 4: Finite numbers are stringified as if by calling ToString(number). NaN and Infinity regardless of sign are represented as the String null.

@rjernst
Copy link
Member

rjernst commented Dec 4, 2017

I'll reopen as a docs issue, but I'm not sure in what way we should change the docs. /cc @jpountz

@rjernst rjernst reopened this Dec 4, 2017
@rjernst rjernst added the >docs General docs changes label Dec 4, 2017
@jpountz
Copy link
Contributor

jpountz commented Dec 5, 2017

@drw112 would something like that work for you: A single-precision 32-bit IEEE 754 floating point, restricted to finite values.?

@drewtownchi
Copy link
Author

Yes, I think that is clear and concise. Thanks!

cbuescher pushed a commit to cbuescher/elasticsearch that referenced this issue Jan 16, 2018
Since elastic#25826 we reject infinite values for float, double and half_float
datatypes. This change adds this restriction to the documentation for the
supported datatypes.

Closes elastic#27653
cbuescher pushed a commit that referenced this issue Jan 16, 2018
Since #25826 we reject infinite values for float, double and half_float
datatypes. This change adds this restriction to the documentation for the
supported datatypes.

Closes #27653
cbuescher pushed a commit that referenced this issue Jan 16, 2018
Since #25826 we reject infinite values for float, double and half_float
datatypes. This change adds this restriction to the documentation for the
supported datatypes.

Closes #27653
cbuescher pushed a commit that referenced this issue Jan 16, 2018
Since #25826 we reject infinite values for float, double and half_float
datatypes. This change adds this restriction to the documentation for the
supported datatypes.

Closes #27653
cbuescher pushed a commit that referenced this issue Jan 16, 2018
Since #25826 we reject infinite values for float, double and half_float
datatypes. This change adds this restriction to the documentation for the
supported datatypes.

Closes #27653
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>docs General docs changes
Projects
None yet
Development

No branches or pull requests

3 participants