Skip to content

Commit

Permalink
Update index.md
Browse files Browse the repository at this point in the history
  • Loading branch information
putianyi889 committed Mar 13, 2024
1 parent 1fd7dfe commit 0dc8e83
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ EltypeExtensions.jl is a mini toolbox for eltype-related conversions. The motiva

We note that this package has some overlap with [TypeUtils.jl](https://github.com/emmt/TypeUtils.jl) and [Unitless.jl](https://github.com/emmt/Unitless.jl).

## Guides
## Introduction

### `elconvert`
`elconvert(T, x)` works like `convert(T, x)`, except that `T` refers to the eltype of the result. This can be useful for generic codes.

### `basetype` and `precisiontype`
The `basetype` is used for nested collections, where `eltype` is repeatedly applied until the bottom. `precisiontype` has a similar idea, but goes deeper when possible. `precisiontype` is used to manipulate the accuracy of (nested) collections.
Expand All @@ -30,7 +33,7 @@ where `some` can be `el`, `base` and `precision`.
- When `T` has dynamic precision, `prec` specifies the precision of conversion. When `prec` is not provided, the precision is decided by the external setup from `T`. The difference is significant when `precisionconvert` is called by another function:
```@repl 1
precision(BigFloat)
f(x) = precisionconvert(BigFloat, x, precision(BigFloat))
f(x) = precisionconvert(BigFloat, x, 256)
g(x) = precisionconvert(BigFloat, x)
setprecision(128)
f(π) # static precision
Expand Down

0 comments on commit 0dc8e83

Please sign in to comment.