Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[doc] Improve operator page #4067

Merged
merged 5 commits into from
Jan 19, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions docs/lang/articles/basic/operator.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ default numerical types.
| `a << b` | left-shift `a` by `b` bits |
| `a >> b` | right-shift `a` by `b` bits |

:::note

The `>>` operation denotes the
[Shift Logical](https://en.wikipedia.org/wiki/Logical_shift) Right (SHR) operation. For the
qiao-bo marked this conversation as resolved.
Show resolved Hide resolved
[Shift Arithmetic](https://en.wikipedia.org/wiki/Arithmetic_shift) Right (SAR) operation,
consider using `ti.bit_shr()` or `ti.bit_shl()` for the left shift operation.
qiao-bo marked this conversation as resolved.
Show resolved Hide resolved

:::

### Trigonometric functions

```python
Expand Down Expand Up @@ -123,6 +132,14 @@ pow(x, y) # Same as `x ** y`.
ti.random(dtype=float)
```

:::note

The return number has a range that is type dependent. For example, floating
point type returns a number between 0 and 1, while integer type such as `ti.i32`
returns a number between -2147483648 and 2147483647.

:::

### Supported atomic operations

In Taichi, augmented assignments (e.g., `x[i] += 1`) are automatically
Expand Down