Skip to content

Commit 18d7924

Browse files
committed
Update CompleteValue() to not return early for NaN
1 parent 64321d5 commit 18d7924

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

spec/Section 3 -- Type System.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -450,11 +450,10 @@ encoding integer numbers larger than 32-bit.
450450

451451
### Float
452452

453-
The Float scalar type represents signed double-precision finite (i.e., not {NaN}
454-
or {Infinity}) fractional values as specified by
455-
[IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point). Response formats
456-
that support an appropriate double-precision number type should use that type to
457-
represent this scalar.
453+
The Float scalar type represents signed double-precision finite values as
454+
specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).
455+
Response formats that support an appropriate double-precision number type should
456+
use that type to represent this scalar.
458457

459458
**Result Coercion**
460459

@@ -466,14 +465,18 @@ reasonable without losing information, otherwise they must raise a field error.
466465
Examples of this may include returning `1.0` for the integer number `1`, or
467466
`123.0` for the string `"123"`.
468467

468+
Non-finite floating-point internal values ({NaN} and {Infinity}) cannot be
469+
coerced to {Float} and must raise a field error.
470+
469471
**Input Coercion**
470472

471473
When expected as an input type, both integer and float input values are
472474
accepted. Integer input values are coerced to Float by adding an empty
473475
fractional part, for example `1.0` for the integer input value `1`. All
474476
other input values, including strings with numeric content, must raise a query
475-
error indicating an incorrect type. If the integer input value represents a
476-
value not representable by IEEE 754, a query error should be raised.
477+
error indicating an incorrect type. If the input value otherwise represents a
478+
value not representable by finite IEEE 754 (e.g. {NaN}, {Infinity}, or an
479+
integer above the precision of a float), a query error should be raised.
477480

478481

479482
### String

spec/Section 6 -- Execution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ CompleteValue(fieldType, fields, result, variableValues):
648648
* If {completedResult} is {null}, throw a field error.
649649
* Return {completedResult}.
650650
* If {result} is {null} (or another internal value similar to {null} such as
651-
{undefined} or {NaN}), return {null}.
651+
{undefined}), return {null}.
652652
* If {fieldType} is a List type:
653653
* If {result} is not a collection of values, throw a field error.
654654
* Let {innerType} be the inner type of {fieldType}.

0 commit comments

Comments
 (0)