diff --git a/specification/hugr.md b/specification/hugr.md index a0a639e95..86fece3d1 100644 --- a/specification/hugr.md +++ b/specification/hugr.md @@ -1576,10 +1576,11 @@ The following operations are defined: Note that an `and<0>` operation produces the constant value "true" and an `or<0>` operation produces the constant value "false". -### Arithmetic Extension +### Arithmetic Extensions -The Arithmetic Extension provides types and operations for integer and -floating-point operations. +Types and operations for integer and +floating-point operations are provided by a collection of extensions under the +namespace `arithmetic`. We largely adopt (a subset of) the definitions of [WebAssembly 2.0](https://webassembly.github.io/spec/core/index.html), @@ -1591,6 +1592,8 @@ A few additonal operations not included in WebAssembly are also specified, and there are some other small differences (highlighted below). +### `arithmetic.int.types` + The `int` type is parametrized by its width `N`, which is a positive integer. @@ -1610,6 +1613,9 @@ either differs from or is not part of the [WebAssembly](https://webassembly.github.io/spec/core/exec/numerics.html) specification. +### `arithmetic.int` + +This extension defines operations on the integer types. Casts: @@ -1671,9 +1677,15 @@ Other operations: | `irotl`( \* ) | `int`, `int` | `int` | rotate first input left by k bits where k is unsigned interpretation of second input (leftmost bits replace rightmost bits) | | `irotr`( \* ) | `int`, `int` | `int` | rotate first input right by k bits where k is unsigned interpretation of second input (rightmost bits replace leftmost bits) | + +### `arithmetic.float.types` + The `float64` type represents IEEE 754-2019 floating-point data of 64 bits. + +### `arithmetic.float` + Floating-point operations are defined as follows. All operations below follow [WebAssembly](https://webassembly.github.io/spec/core/exec/numerics.html#floating-point-operations) @@ -1698,6 +1710,9 @@ except where stated. | `ffloor` | `float64` | `float64` | floor | | `fceil` | `float64` | `float64` | ceiling | +### `arithmetic.conversions` + + Conversions between integers and floats: | Name | Inputs | Outputs | Meaning |