Float
The Float scalar type represents signed double‐precision fractional values as specified byIEEE 754. Response formats that support an appropriate double‐precision number type should use that type to represent this scalar.
Result Coercion
GraphQL servers should coerce non‐floating‐point raw values to Float when possible otherwise they must raise a field error. Examples of this may include returning1.0
for the integer number1
, or2.0
for the string"2"
.
Input Coercion
When expected as an input type, both integer and float input values are accepted. Integer input values are coerced to Float by adding an empty fractional part, for example1.0
for the integer input value1
. All other input values, including strings with numeric content, must raise a query error indicating an incorrect type. If the integer input value represents a value not representable by IEEE 754, a query error should be raised.