Skip to content

Commit

Permalink
add docs for sign
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrodium committed Nov 25, 2023
1 parent 28be6d7 commit a41be79
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/src/examples/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ imag(q1) # Not supported.
imag_part(q1) # Use this instead.
```

Unit quaternions can be obtained with [`sign`](@ref).

```@repl intro
sign(q1)
sign(q2)
sign(q3)
sign(quat(0)) # Zero-quaternion will not be normalized.
```

## `Quaternion` vs `quat`
The general rule is that [`quat`](@ref) is to [`Quaternion`](@ref) as [`complex`](https://docs.julialang.org/en/v1/base/numbers/#Base.complex-Tuple{Complex}) is to [`Complex`](https://docs.julialang.org/en/v1/base/numbers/#Base.Complex).
`Complex` and `Quaternion` are both constructors so should return an object of the corresponding type, whereas `quat` and `complex` both can operate on types and arrays.
Expand Down

0 comments on commit a41be79

Please sign in to comment.