Skip to content

Commit aaaadbe

Browse files
authored
Define IEEE 764-2019 floating point schemas (#36)
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent ee831f9 commit aaaadbe

19 files changed

Lines changed: 788 additions & 15 deletions

README.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ expressed as JSON Schema definitions.
5050

5151
| Organisation | Standard | Title |
5252
|--------------|----------|-------|
53+
| IEEE | [IEEE Std 754-2019](https://ieeexplore.ieee.org/document/8766229) | IEEE Standard for Floating-Point Arithmetic |
5354
| 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 |
5455
| IETF | [RFC 3986](https://www.rfc-editor.org/rfc/rfc3986) | Uniform Resource Identifier (URI): Generic Syntax |
5556
| IETF | [RFC 4918](https://www.rfc-editor.org/rfc/rfc4918) | HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV) |
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "IEEE 754-2019 Half Precision Binary Floating-Point with Special Values (binary16)",
4+
"description": "A 16-bit binary floating-point format, extended to accept special values as strings",
5+
"examples": [
6+
0.0,
7+
1.0,
8+
-1.0,
9+
3.14,
10+
65504.0,
11+
-65504.0,
12+
"NaN",
13+
"+Inf",
14+
"-Inf",
15+
"qNaN"
16+
],
17+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
18+
"x-links": [ "https://ieeexplore.ieee.org/document/8766229" ],
19+
"anyOf": [
20+
{
21+
"$ref": "./binary16.json"
22+
},
23+
{
24+
"$ref": "./special.json"
25+
}
26+
]
27+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "IEEE 754-2019 Half Precision Binary Floating-Point (binary16)",
4+
"description": "A 16-bit binary floating-point format. Also known as half precision",
5+
"examples": [ 0.0, 1.0, -1.0, 3.14, 65504.0, -65504.0, 6.10352e-05 ],
6+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
7+
"x-links": [ "https://ieeexplore.ieee.org/document/8766229" ],
8+
"type": "number",
9+
"maximum": 65504.0,
10+
"minimum": -65504.0
11+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "IEEE 754-2019 Single Precision Binary Floating-Point with Special Values (binary32)",
4+
"description": "A 32-bit binary floating-point format, extended to accept special values as strings",
5+
"examples": [
6+
0.0,
7+
1.5,
8+
-3.14,
9+
340282346638528859811704183484516925440.0,
10+
-340282346638528859811704183484516925440.0,
11+
"NaN",
12+
"+Inf",
13+
"-Inf",
14+
"sNaN"
15+
],
16+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
17+
"x-links": [ "https://ieeexplore.ieee.org/document/8766229" ],
18+
"anyOf": [
19+
{
20+
"$ref": "./binary32.json"
21+
},
22+
{
23+
"$ref": "./special.json"
24+
}
25+
]
26+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "IEEE 754-2019 Single Precision Binary Floating-Point (binary32)",
4+
"description": "A 32-bit binary floating-point format",
5+
"examples": [
6+
0.0,
7+
1.5,
8+
-3.14,
9+
340282346638528859811704183484516925440.0,
10+
-340282346638528859811704183484516925440.0,
11+
1.4013e-45
12+
],
13+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
14+
"x-links": [ "https://ieeexplore.ieee.org/document/8766229" ],
15+
"type": "number",
16+
"maximum": 340282346638528859811704183484516925440.0,
17+
"minimum": -340282346638528859811704183484516925440.0
18+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "IEEE 754-2019 Double Precision Binary Floating-Point with Special Values (binary64)",
4+
"description": "A 64-bit binary floating-point format",
5+
"examples": [
6+
0.0,
7+
1.5,
8+
-3.14159,
9+
299800000.0,
10+
179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0,
11+
-179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0,
12+
"NaN",
13+
"+Inf",
14+
"-Inf",
15+
"qNaN"
16+
],
17+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
18+
"x-links": [ "https://ieeexplore.ieee.org/document/8766229" ],
19+
"anyOf": [
20+
{
21+
"$ref": "./binary64.json"
22+
},
23+
{
24+
"$ref": "./special.json"
25+
}
26+
]
27+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "IEEE 754-2019 Double Precision Binary Floating-Point (binary64)",
4+
"description": "A 64-bit binary floating-point format",
5+
"examples": [
6+
0.0,
7+
1.5,
8+
-3.14159,
9+
299800000.0,
10+
179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0,
11+
-179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0
12+
],
13+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
14+
"x-links": [ "https://ieeexplore.ieee.org/document/8766229" ],
15+
"type": "number",
16+
"maximum": 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0,
17+
"minimum": -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0
18+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "IEEE 754-2019 Special Floating-Point Values",
4+
"description": "Special floating-point values: NaN (Not-a-Number) with quiet and signaling variants, and positive/negative infinities",
5+
"examples": [ "NaN", "qNaN", "sNaN", "+Inf", "-Inf" ],
6+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
7+
"x-links": [ "https://ieeexplore.ieee.org/document/8766229" ],
8+
"enum": [ "NaN", "qNaN", "sNaN", "+Inf", "-Inf" ]
9+
}

schemas/iso/c/2024/double.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"title": "ISO/IEC 9899:2024 Double Precision Floating Point (double)",
4-
"description": "A double precision (64-bit) floating point type conforming to IEC 60559 (IEEE 754)",
5-
"$comment": "The minimum and maximum represent `DBL_MAX` and `-DBL_MAX`. Special floating-point values are defined in a separate schema",
4+
"description": "A double precision (64-bit) floating point type",
65
"examples": [
76
0.0,
87
1.5,
@@ -18,9 +17,7 @@
1817
"x-links": [ "https://www.iso.org/standard/82075.html" ],
1918
"anyOf": [
2019
{
21-
"type": "number",
22-
"maximum": 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0,
23-
"minimum": -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0
20+
"$ref": "../../../ieee/floating-point/2019/binary64.json"
2421
},
2522
{
2623
"$ref": "./float-special.json"

schemas/iso/c/2024/float-special.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"title": "ISO/IEC 9899:2024 Special Floating-Point Values",
4-
"description": "Special floating-point values as defined in `<math.h>`. These are represented as strings since JSON numbers cannot express these values",
4+
"description": "Special floating-point values as defined in `<math.h>`",
55
"examples": [ "NAN", "INFINITY", "-INFINITY" ],
66
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
77
"x-links": [ "https://www.iso.org/standard/82075.html" ],

0 commit comments

Comments
 (0)