Skip to content

Commit

Permalink
Merge pull request #604 from openwdl/296-exponentiation
Browse files Browse the repository at this point in the history
add exponentiation operator (#296)
  • Loading branch information
wleepang committed Mar 27, 2024
2 parents 346cca3 + 33d9482 commit adc5716
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ version 1.2.0

+ Added `contains_key` function to standard library. [PR 603](https://github.com/openwdl/wdl/pull/603)

+ Added exponentiation operator (`**`).


version 1.1.1
---------------------------
Expand Down
15 changes: 10 additions & 5 deletions SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -1971,6 +1971,7 @@ In operations on mismatched numeric types (e.g., `Int` + `Float`), the `Int` is
| `Int` | `-` | `Int` | `Int` | |
| `Int` | `*` | `Int` | `Int` | |
| `Int` | `/` | `Int` | `Int` | Integer division |
| `Int` | `**` | `Int` | `Int` | Integer exponentiation |
| `Int` | `%` | `Int` | `Int` | Integer division, return remainder |
| `Int` | `==` | `Int` | `Boolean` | |
| `Int` | `!=` | `Int` | `Boolean` | |
Expand All @@ -1983,6 +1984,7 @@ In operations on mismatched numeric types (e.g., `Int` + `Float`), the `Int` is
| `Int` | `-` | `Float` | `Float` | |
| `Int` | `*` | `Float` | `Float` | |
| `Int` | `/` | `Float` | `Float` | |
| `Int` | `**` | `Float` | `Float` | |
| `Int` | `==` | `Float` | `Boolean` | |
| `Int` | `!=` | `Float` | `Boolean` | |
| `Int` | `>` | `Float` | `Boolean` | |
Expand All @@ -1993,6 +1995,7 @@ In operations on mismatched numeric types (e.g., `Int` + `Float`), the `Int` is
| `Float` | `-` | `Float` | `Float` | |
| `Float` | `*` | `Float` | `Float` | |
| `Float` | `/` | `Float` | `Float` | |
| `Float` | `**` | `Float` | `Float` | |
| `Float` | `%` | `Float` | `Float` | |
| `Float` | `==` | `Float` | `Boolean` | |
| `Float` | `!=` | `Float` | `Boolean` | |
Expand All @@ -2005,6 +2008,7 @@ In operations on mismatched numeric types (e.g., `Int` + `Float`), the `Int` is
| `Float` | `-` | `Int` | `Float` | |
| `Float` | `*` | `Int` | `Float` | |
| `Float` | `/` | `Int` | `Float` | |
| `Float` | `**` | `Int` | `Float` | |
| `Float` | `%` | `Int` | `Float` | |
| `Float` | `==` | `Int` | `Boolean` | |
| `Float` | `!=` | `Int` | `Boolean` | |
Expand Down Expand Up @@ -2186,12 +2190,13 @@ Example output:

| Precedence | Operator type | Associativity | Example |
| ---------- | --------------------- | ------------- | ------------ |
| 11 | Grouping | n/a | `(x)` |
| 10 | Member Access | left-to-right | `x.y` |
| 9 | Index | left-to-right | `x[y]` |
| 8 | Function Call | left-to-right | `x(y,z,...)` |
| 7 | Logical NOT | right-to-left | `!x` |
| 12 | Grouping | n/a | `(x)` |
| 11 | Member Access | left-to-right | `x.y` |
| 10 | Index | left-to-right | `x[y]` |
| 9 | Function Call | left-to-right | `x(y,z,...)` |
| 8 | Logical NOT | right-to-left | `!x` |
| | Unary Negation | right-to-left | `-x` |
| 7 | Exponentiation | left-to-right | `x**y` |
| 6 | Multiplication | left-to-right | `x*y` |
| | Division | left-to-right | `x/y` |
| | Remainder | left-to-right | `x%y` |
Expand Down

0 comments on commit adc5716

Please sign in to comment.