Skip to content

Commit

Permalink
docs: Clarify in spec that the arithmetic extension is a collection
Browse files Browse the repository at this point in the history
Closes #747
  • Loading branch information
ss2165 committed Jan 9, 2024
1 parent c844a2d commit 87933ab
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions specification/hugr.md
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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<N>` type is parametrized by its width `N`, which is a positive
integer.

Expand All @@ -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:

Expand Down Expand Up @@ -1671,9 +1677,15 @@ Other operations:
| `irotl<N,M>`( \* ) | `int<N>`, `int<M>` | `int<N>` | rotate first input left by k bits where k is unsigned interpretation of second input (leftmost bits replace rightmost bits) |
| `irotr<N,M>`( \* ) | `int<N>`, `int<M>` | `int<N>` | 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)
Expand All @@ -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 |
Expand Down

0 comments on commit 87933ab

Please sign in to comment.