From 429e0c8670fd92364f6f22eb1478936c93597510 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 18 Mar 2024 16:17:30 -0700 Subject: [PATCH] Rename `float32`/`float64` to `f32`/`f64`. (#117) * Rename `float32`/`float64` to `f32`/`f64`. The `float32` and `float64` types are being [renamed to `f32` and `f64`]. All the main tools have been updated to accept both old and new names for now, so there's no urgeny to change anything, but users who wish to can now start switching to the new `f32`/`f64` names. While here, also add some brief documentation mentioning the handling of NaNs in `f32`/`f64`. [renamed to `f32` and `f64`]: https://github.com/WebAssembly/component-model/issues/277 * Update component-model/src/design/wit.md Co-authored-by: itowlson --------- Co-authored-by: itowlson --- component-model/src/design/wit.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/component-model/src/design/wit.md b/component-model/src/design/wit.md index d670818..2f2e49c 100644 --- a/component-model/src/design/wit.md +++ b/component-model/src/design/wit.md @@ -93,10 +93,12 @@ WIT defines the following primitive types: | `bool` | Boolean value - true or false. | | `s8`, `s16`, `s32`, `s64` | Signed integers of the appropriate width. For example, `s32` is a 32-bit integer. | | `u8`, `u16`, `u32`, `u64` | Unsigned integers of the appropriate width. For example, `u32` is a 32-bit integer. | -| `float32`, `float64` | Floating-point numbers of the appropriate width. For example, `float64` is a 64-bit (double precision) floating-point number. | +| `f32`, `f64` | Floating-point numbers of the appropriate width. For example, `f64` is a 64-bit (double precision) floating-point number. See the note on NaNs below. | | `char` | Unicode character. (Specifically, a [Unicode scalar value](https://unicode.org/glossary/#unicode_scalar_value).) | | `string` | A Unicode string - that is, a finite sequence of characters. | +The `f32` and `f64` types support the usual set of IEEE 754 single and double-precision values, except that they logically only have a single NaN value. The exact bit-level representation of a NaN is not guaranteed to be preserved when values pass through WIT interfaces. + ### Lists `list` for any type T denotes an ordered sequence of values of type T. T can be any type, built-in or user-defined: