diff --git a/README.markdown b/README.markdown index ac415d3..eec3394 100644 --- a/README.markdown +++ b/README.markdown @@ -50,6 +50,7 @@ expressed as JSON Schema definitions. | Organisation | Standard | Title | |--------------|----------|-------| +| IEEE | [IEEE Std 754-2019](https://ieeexplore.ieee.org/document/8766229) | IEEE Standard for Floating-Point Arithmetic | | IEEE | [IEEE Std 1003.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/) | IEEE Standard for Information Technology—Portable Operating System Interface (POSIX) Base Specifications, Issue 7 | | IETF | [RFC 3986](https://www.rfc-editor.org/rfc/rfc3986) | Uniform Resource Identifier (URI): Generic Syntax | | IETF | [RFC 4918](https://www.rfc-editor.org/rfc/rfc4918) | HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV) | diff --git a/schemas/ieee/floating-point/2019/binary16-special.json b/schemas/ieee/floating-point/2019/binary16-special.json new file mode 100644 index 0000000..e267136 --- /dev/null +++ b/schemas/ieee/floating-point/2019/binary16-special.json @@ -0,0 +1,27 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "IEEE 754-2019 Half Precision Binary Floating-Point with Special Values (binary16)", + "description": "A 16-bit binary floating-point format, extended to accept special values as strings", + "examples": [ + 0.0, + 1.0, + -1.0, + 3.14, + 65504.0, + -65504.0, + "NaN", + "+Inf", + "-Inf", + "qNaN" + ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://ieeexplore.ieee.org/document/8766229" ], + "anyOf": [ + { + "$ref": "./binary16.json" + }, + { + "$ref": "./special.json" + } + ] +} diff --git a/schemas/ieee/floating-point/2019/binary16.json b/schemas/ieee/floating-point/2019/binary16.json new file mode 100644 index 0000000..436b9ce --- /dev/null +++ b/schemas/ieee/floating-point/2019/binary16.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "IEEE 754-2019 Half Precision Binary Floating-Point (binary16)", + "description": "A 16-bit binary floating-point format. Also known as half precision", + "examples": [ 0.0, 1.0, -1.0, 3.14, 65504.0, -65504.0, 6.10352e-05 ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://ieeexplore.ieee.org/document/8766229" ], + "type": "number", + "maximum": 65504.0, + "minimum": -65504.0 +} diff --git a/schemas/ieee/floating-point/2019/binary32-special.json b/schemas/ieee/floating-point/2019/binary32-special.json new file mode 100644 index 0000000..cd06026 --- /dev/null +++ b/schemas/ieee/floating-point/2019/binary32-special.json @@ -0,0 +1,26 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "IEEE 754-2019 Single Precision Binary Floating-Point with Special Values (binary32)", + "description": "A 32-bit binary floating-point format, extended to accept special values as strings", + "examples": [ + 0.0, + 1.5, + -3.14, + 340282346638528859811704183484516925440.0, + -340282346638528859811704183484516925440.0, + "NaN", + "+Inf", + "-Inf", + "sNaN" + ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://ieeexplore.ieee.org/document/8766229" ], + "anyOf": [ + { + "$ref": "./binary32.json" + }, + { + "$ref": "./special.json" + } + ] +} diff --git a/schemas/ieee/floating-point/2019/binary32.json b/schemas/ieee/floating-point/2019/binary32.json new file mode 100644 index 0000000..f58c20f --- /dev/null +++ b/schemas/ieee/floating-point/2019/binary32.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "IEEE 754-2019 Single Precision Binary Floating-Point (binary32)", + "description": "A 32-bit binary floating-point format", + "examples": [ + 0.0, + 1.5, + -3.14, + 340282346638528859811704183484516925440.0, + -340282346638528859811704183484516925440.0, + 1.4013e-45 + ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://ieeexplore.ieee.org/document/8766229" ], + "type": "number", + "maximum": 340282346638528859811704183484516925440.0, + "minimum": -340282346638528859811704183484516925440.0 +} diff --git a/schemas/ieee/floating-point/2019/binary64-special.json b/schemas/ieee/floating-point/2019/binary64-special.json new file mode 100644 index 0000000..f4072fc --- /dev/null +++ b/schemas/ieee/floating-point/2019/binary64-special.json @@ -0,0 +1,27 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "IEEE 754-2019 Double Precision Binary Floating-Point with Special Values (binary64)", + "description": "A 64-bit binary floating-point format", + "examples": [ + 0.0, + 1.5, + -3.14159, + 299800000.0, + 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0, + -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0, + "NaN", + "+Inf", + "-Inf", + "qNaN" + ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://ieeexplore.ieee.org/document/8766229" ], + "anyOf": [ + { + "$ref": "./binary64.json" + }, + { + "$ref": "./special.json" + } + ] +} diff --git a/schemas/ieee/floating-point/2019/binary64.json b/schemas/ieee/floating-point/2019/binary64.json new file mode 100644 index 0000000..4de8ddd --- /dev/null +++ b/schemas/ieee/floating-point/2019/binary64.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "IEEE 754-2019 Double Precision Binary Floating-Point (binary64)", + "description": "A 64-bit binary floating-point format", + "examples": [ + 0.0, + 1.5, + -3.14159, + 299800000.0, + 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0, + -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0 + ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://ieeexplore.ieee.org/document/8766229" ], + "type": "number", + "maximum": 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0, + "minimum": -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0 +} diff --git a/schemas/ieee/floating-point/2019/special.json b/schemas/ieee/floating-point/2019/special.json new file mode 100644 index 0000000..3a6ad01 --- /dev/null +++ b/schemas/ieee/floating-point/2019/special.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "IEEE 754-2019 Special Floating-Point Values", + "description": "Special floating-point values: NaN (Not-a-Number) with quiet and signaling variants, and positive/negative infinities", + "examples": [ "NaN", "qNaN", "sNaN", "+Inf", "-Inf" ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://ieeexplore.ieee.org/document/8766229" ], + "enum": [ "NaN", "qNaN", "sNaN", "+Inf", "-Inf" ] +} diff --git a/schemas/iso/c/2024/double.json b/schemas/iso/c/2024/double.json index 0404662..d14d939 100644 --- a/schemas/iso/c/2024/double.json +++ b/schemas/iso/c/2024/double.json @@ -1,8 +1,7 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "ISO/IEC 9899:2024 Double Precision Floating Point (double)", - "description": "A double precision (64-bit) floating point type conforming to IEC 60559 (IEEE 754)", - "$comment": "The minimum and maximum represent `DBL_MAX` and `-DBL_MAX`. Special floating-point values are defined in a separate schema", + "description": "A double precision (64-bit) floating point type", "examples": [ 0.0, 1.5, @@ -18,9 +17,7 @@ "x-links": [ "https://www.iso.org/standard/82075.html" ], "anyOf": [ { - "type": "number", - "maximum": 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0, - "minimum": -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0 + "$ref": "../../../ieee/floating-point/2019/binary64.json" }, { "$ref": "./float-special.json" diff --git a/schemas/iso/c/2024/float-special.json b/schemas/iso/c/2024/float-special.json index 0f731e1..9d854be 100644 --- a/schemas/iso/c/2024/float-special.json +++ b/schemas/iso/c/2024/float-special.json @@ -1,7 +1,7 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "ISO/IEC 9899:2024 Special Floating-Point Values", - "description": "Special floating-point values as defined in ``. These are represented as strings since JSON numbers cannot express these values", + "description": "Special floating-point values as defined in ``", "examples": [ "NAN", "INFINITY", "-INFINITY" ], "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", "x-links": [ "https://www.iso.org/standard/82075.html" ], diff --git a/schemas/iso/c/2024/float.json b/schemas/iso/c/2024/float.json index 2789f12..d3e3ebb 100644 --- a/schemas/iso/c/2024/float.json +++ b/schemas/iso/c/2024/float.json @@ -1,14 +1,13 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "ISO/IEC 9899:2024 Single Precision Floating Point (float)", - "description": "A single precision (32-bit) floating point type conforming to IEC 60559 (IEEE 754)", - "$comment": "The minimum and maximum represent `FLT_MAX` and `-FLT_MAX`. Special floating-point values are defined in a separate schema", + "description": "A single precision (32-bit) floating point type", "examples": [ 0.0, 1.5, -3.14, - 340282346600000016151267322115014000640.0, - -340282346600000016151267322115014000640.0, + 340282346638528859811704183484516925440.0, + -340282346638528859811704183484516925440.0, "NAN", "INFINITY", "-INFINITY" @@ -17,9 +16,7 @@ "x-links": [ "https://www.iso.org/standard/82075.html" ], "anyOf": [ { - "type": "number", - "maximum": 340282346600000016151267322115014000640.0, - "minimum": -340282346600000016151267322115014000640.0 + "$ref": "../../../ieee/floating-point/2019/binary32.json" }, { "$ref": "./float-special.json" diff --git a/test/ieee/floating-point/2019/binary16-special.test.json b/test/ieee/floating-point/2019/binary16-special.test.json new file mode 100644 index 0000000..576148d --- /dev/null +++ b/test/ieee/floating-point/2019/binary16-special.test.json @@ -0,0 +1,101 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/ieee/floating-point/2019/binary16-special.json", + "tests": [ + { + "description": "Valid - zero", + "data": 0.0, + "valid": true + }, + { + "description": "Valid - positive value", + "data": 1.0, + "valid": true + }, + { + "description": "Valid - negative value", + "data": -1.0, + "valid": true + }, + { + "description": "Valid - maximum value", + "data": 65504.0, + "valid": true + }, + { + "description": "Valid - minimum value", + "data": -65504.0, + "valid": true + }, + { + "description": "Valid - NaN", + "data": "NaN", + "valid": true + }, + { + "description": "Valid - qNaN", + "data": "qNaN", + "valid": true + }, + { + "description": "Valid - sNaN", + "data": "sNaN", + "valid": true + }, + { + "description": "Valid - +Inf", + "data": "+Inf", + "valid": true + }, + { + "description": "Valid - -Inf", + "data": "-Inf", + "valid": true + }, + { + "description": "Invalid - above maximum", + "data": 70000.0, + "valid": false + }, + { + "description": "Invalid - below minimum", + "data": -70000.0, + "valid": false + }, + { + "description": "Invalid - lowercase nan", + "data": "nan", + "valid": false + }, + { + "description": "Invalid - C23 style NAN", + "data": "NAN", + "valid": false + }, + { + "description": "Invalid - C23 style INFINITY", + "data": "INFINITY", + "valid": false + }, + { + "description": "Invalid type - boolean", + "data": false, + "valid": false + }, + { + "description": "Invalid type - null", + "data": null, + "valid": false + }, + { + "description": "Invalid type - array", + "data": [], + "valid": false + }, + { + "description": "Invalid type - object", + "data": {}, + "valid": false + } + ] +} diff --git a/test/ieee/floating-point/2019/binary16.test.json b/test/ieee/floating-point/2019/binary16.test.json new file mode 100644 index 0000000..6e70658 --- /dev/null +++ b/test/ieee/floating-point/2019/binary16.test.json @@ -0,0 +1,81 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/ieee/floating-point/2019/binary16.json", + "tests": [ + { + "description": "Valid - zero", + "data": 0.0, + "valid": true + }, + { + "description": "Valid - positive value", + "data": 1.0, + "valid": true + }, + { + "description": "Valid - negative value", + "data": -1.0, + "valid": true + }, + { + "description": "Valid - pi approximation", + "data": 3.14, + "valid": true + }, + { + "description": "Valid - maximum value", + "data": 65504.0, + "valid": true + }, + { + "description": "Valid - minimum value", + "data": -65504.0, + "valid": true + }, + { + "description": "Valid - small positive value", + "data": 6.10352e-05, + "valid": true + }, + { + "description": "Valid - small negative value", + "data": -6.10352e-05, + "valid": true + }, + { + "description": "Invalid - above maximum", + "data": 70000.0, + "valid": false + }, + { + "description": "Invalid - below minimum", + "data": -70000.0, + "valid": false + }, + { + "description": "Invalid type - boolean", + "data": false, + "valid": false + }, + { + "description": "Invalid type - null", + "data": null, + "valid": false + }, + { + "description": "Invalid type - string", + "data": "1.0", + "valid": false + }, + { + "description": "Invalid type - array", + "data": [], + "valid": false + }, + { + "description": "Invalid type - object", + "data": {}, + "valid": false + } + ] +} diff --git a/test/ieee/floating-point/2019/binary32-special.test.json b/test/ieee/floating-point/2019/binary32-special.test.json new file mode 100644 index 0000000..ed413af --- /dev/null +++ b/test/ieee/floating-point/2019/binary32-special.test.json @@ -0,0 +1,106 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/ieee/floating-point/2019/binary32-special.json", + "tests": [ + { + "description": "Valid - zero", + "data": 0.0, + "valid": true + }, + { + "description": "Valid - positive value", + "data": 1.5, + "valid": true + }, + { + "description": "Valid - negative value", + "data": -3.14, + "valid": true + }, + { + "description": "Valid - maximum value", + "data": 340282346638528859811704183484516925440.0, + "valid": true + }, + { + "description": "Valid - minimum value", + "data": -340282346638528859811704183484516925440.0, + "valid": true + }, + { + "description": "Valid - NaN", + "data": "NaN", + "valid": true + }, + { + "description": "Valid - qNaN", + "data": "qNaN", + "valid": true + }, + { + "description": "Valid - sNaN", + "data": "sNaN", + "valid": true + }, + { + "description": "Valid - +Inf", + "data": "+Inf", + "valid": true + }, + { + "description": "Valid - -Inf", + "data": "-Inf", + "valid": true + }, + { + "description": "Invalid - above maximum", + "data": 350000000000000001565567347835409530880.0, + "valid": false + }, + { + "description": "Invalid - below minimum", + "data": -350000000000000001565567347835409530880.0, + "valid": false + }, + { + "description": "Invalid - lowercase nan", + "data": "nan", + "valid": false + }, + { + "description": "Invalid - C23 style NAN", + "data": "NAN", + "valid": false + }, + { + "description": "Invalid - C23 style INFINITY", + "data": "INFINITY", + "valid": false + }, + { + "description": "Invalid - JavaScript style Infinity", + "data": "Infinity", + "valid": false + }, + { + "description": "Invalid type - boolean", + "data": false, + "valid": false + }, + { + "description": "Invalid type - null", + "data": null, + "valid": false + }, + { + "description": "Invalid type - array", + "data": [], + "valid": false + }, + { + "description": "Invalid type - object", + "data": {}, + "valid": false + } + ] +} diff --git a/test/ieee/floating-point/2019/binary32.test.json b/test/ieee/floating-point/2019/binary32.test.json new file mode 100644 index 0000000..e84932d --- /dev/null +++ b/test/ieee/floating-point/2019/binary32.test.json @@ -0,0 +1,76 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/ieee/floating-point/2019/binary32.json", + "tests": [ + { + "description": "Valid - zero", + "data": 0.0, + "valid": true + }, + { + "description": "Valid - positive value", + "data": 1.5, + "valid": true + }, + { + "description": "Valid - negative value", + "data": -3.14, + "valid": true + }, + { + "description": "Valid - maximum value", + "data": 340282346638528859811704183484516925440.0, + "valid": true + }, + { + "description": "Valid - minimum value", + "data": -340282346638528859811704183484516925440.0, + "valid": true + }, + { + "description": "Valid - small positive", + "data": 1.4013e-45, + "valid": true + }, + { + "description": "Valid - integer", + "data": 42, + "valid": true + }, + { + "description": "Invalid - above maximum", + "data": 350000000000000001565567347835409530880.0, + "valid": false + }, + { + "description": "Invalid - below minimum", + "data": -350000000000000001565567347835409530880.0, + "valid": false + }, + { + "description": "Invalid type - boolean", + "data": false, + "valid": false + }, + { + "description": "Invalid type - null", + "data": null, + "valid": false + }, + { + "description": "Invalid type - string", + "data": "1.5", + "valid": false + }, + { + "description": "Invalid type - array", + "data": [], + "valid": false + }, + { + "description": "Invalid type - object", + "data": {}, + "valid": false + } + ] +} diff --git a/test/ieee/floating-point/2019/binary64-special.test.json b/test/ieee/floating-point/2019/binary64-special.test.json new file mode 100644 index 0000000..bbdfcce --- /dev/null +++ b/test/ieee/floating-point/2019/binary64-special.test.json @@ -0,0 +1,96 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/ieee/floating-point/2019/binary64-special.json", + "tests": [ + { + "description": "Valid - zero", + "data": 0.0, + "valid": true + }, + { + "description": "Valid - positive value", + "data": 1.5, + "valid": true + }, + { + "description": "Valid - negative value", + "data": -3.14159, + "valid": true + }, + { + "description": "Valid - maximum value", + "data": 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0, + "valid": true + }, + { + "description": "Valid - minimum value", + "data": -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0, + "valid": true + }, + { + "description": "Valid - NaN", + "data": "NaN", + "valid": true + }, + { + "description": "Valid - qNaN", + "data": "qNaN", + "valid": true + }, + { + "description": "Valid - sNaN", + "data": "sNaN", + "valid": true + }, + { + "description": "Valid - +Inf", + "data": "+Inf", + "valid": true + }, + { + "description": "Valid - -Inf", + "data": "-Inf", + "valid": true + }, + { + "description": "Invalid - lowercase nan", + "data": "nan", + "valid": false + }, + { + "description": "Invalid - C23 style NAN", + "data": "NAN", + "valid": false + }, + { + "description": "Invalid - C23 style INFINITY", + "data": "INFINITY", + "valid": false + }, + { + "description": "Invalid - JavaScript style Infinity", + "data": "Infinity", + "valid": false + }, + { + "description": "Invalid type - boolean", + "data": false, + "valid": false + }, + { + "description": "Invalid type - null", + "data": null, + "valid": false + }, + { + "description": "Invalid type - array", + "data": [], + "valid": false + }, + { + "description": "Invalid type - object", + "data": {}, + "valid": false + } + ] +} diff --git a/test/ieee/floating-point/2019/binary64.test.json b/test/ieee/floating-point/2019/binary64.test.json new file mode 100644 index 0000000..6142277 --- /dev/null +++ b/test/ieee/floating-point/2019/binary64.test.json @@ -0,0 +1,81 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/ieee/floating-point/2019/binary64.json", + "tests": [ + { + "description": "Valid - zero", + "data": 0.0, + "valid": true + }, + { + "description": "Valid - positive value", + "data": 1.5, + "valid": true + }, + { + "description": "Valid - negative value", + "data": -3.14159, + "valid": true + }, + { + "description": "Valid - scientific notation", + "data": 299800000.0, + "valid": true + }, + { + "description": "Valid - maximum value", + "data": 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0, + "valid": true + }, + { + "description": "Valid - minimum value", + "data": -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0, + "valid": true + }, + { + "description": "Valid - integer value", + "data": 42, + "valid": true + }, + { + "description": "Valid - negative integer value", + "data": -100, + "valid": true + }, + { + "description": "Valid - large value within range", + "data": 10000000000000000159028911097599180468360808563945281389781327557747838772170381060813469985856815104.0, + "valid": true + }, + { + "description": "Valid - small negative value within range", + "data": -10000000000000000159028911097599180468360808563945281389781327557747838772170381060813469985856815104.0, + "valid": true + }, + { + "description": "Invalid type - boolean", + "data": false, + "valid": false + }, + { + "description": "Invalid type - null", + "data": null, + "valid": false + }, + { + "description": "Invalid type - string", + "data": "1.5", + "valid": false + }, + { + "description": "Invalid type - array", + "data": [], + "valid": false + }, + { + "description": "Invalid type - object", + "data": {}, + "valid": false + } + ] +} diff --git a/test/ieee/floating-point/2019/special.test.json b/test/ieee/floating-point/2019/special.test.json new file mode 100644 index 0000000..fb56c15 --- /dev/null +++ b/test/ieee/floating-point/2019/special.test.json @@ -0,0 +1,101 @@ +{ + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "target": "../../../../schemas/ieee/floating-point/2019/special.json", + "tests": [ + { + "description": "Valid - NaN", + "data": "NaN", + "valid": true + }, + { + "description": "Valid - qNaN", + "data": "qNaN", + "valid": true + }, + { + "description": "Valid - sNaN", + "data": "sNaN", + "valid": true + }, + { + "description": "Valid - +Inf", + "data": "+Inf", + "valid": true + }, + { + "description": "Valid - -Inf", + "data": "-Inf", + "valid": true + }, + { + "description": "Invalid - lowercase nan", + "data": "nan", + "valid": false + }, + { + "description": "Invalid - lowercase inf", + "data": "inf", + "valid": false + }, + { + "description": "Invalid - +inf lowercase", + "data": "+inf", + "valid": false + }, + { + "description": "Invalid - C23 style NAN", + "data": "NAN", + "valid": false + }, + { + "description": "Invalid - C23 style INFINITY", + "data": "INFINITY", + "valid": false + }, + { + "description": "Invalid - C23 style -INFINITY", + "data": "-INFINITY", + "valid": false + }, + { + "description": "Invalid - JavaScript style Infinity", + "data": "Infinity", + "valid": false + }, + { + "description": "Invalid - INF uppercase", + "data": "INF", + "valid": false + }, + { + "description": "Invalid - arbitrary string", + "data": "not-a-number", + "valid": false + }, + { + "description": "Invalid type - number", + "data": 0, + "valid": false + }, + { + "description": "Invalid type - boolean", + "data": true, + "valid": false + }, + { + "description": "Invalid type - null", + "data": null, + "valid": false + }, + { + "description": "Invalid type - array", + "data": [], + "valid": false + }, + { + "description": "Invalid type - object", + "data": {}, + "valid": false + } + ] +} diff --git a/test/iso/c/2024/float.test.json b/test/iso/c/2024/float.test.json index 037d8c5..2a17fda 100644 --- a/test/iso/c/2024/float.test.json +++ b/test/iso/c/2024/float.test.json @@ -19,12 +19,12 @@ }, { "description": "Valid - maximum value", - "data": 340282346600000016151267322115014000640.0, + "data": 340282346638528859811704183484516925440.0, "valid": true }, { "description": "Valid - minimum value", - "data": -340282346600000016151267322115014000640.0, + "data": -340282346638528859811704183484516925440.0, "valid": true }, {