Skip to content

Commit 60869a8

Browse files
committed
Update docstring to README
1 parent e3db74b commit 60869a8

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ For example,
2424
| `Dual{Complex{Float32}}` | `Float32` |
2525

2626
The standard behavior is to return the *first* type parameter,
27-
or, if that type has parameters of its own, to recursively
28-
take the first type parameter until a non-parameterized type is found.
27+
or, if that type has parameters of its own (such as `Dual{Complex{Float32}}`),
28+
to recursively take the first type parameter until a non-parameterized type is found.
2929

3030
Packages should write a custom method for `base_numeric_type`
3131
if this behavior is incompatible with their type.

src/BaseType.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,19 @@ as a measurement or a quantity.
1212
For example,
1313
1414
| Input Type | Output Type |
15-
|---|---|
15+
|:-:|---|
1616
| `Float32` | `Float32` |
1717
| `ComplexF32` | `Float32` |
1818
| `Measurement{Float32}` | `Float32` |
19-
| `Rational{Int8}` | `Int8` |
2019
| `Dual{BigFloat}` | `BigFloat` |
21-
| `Quantity{Float32,Dimensions}` | `Float32` |
20+
| `Rational{Int8}` | `Int8` |
21+
| `Quantity{Float32, ...}` | `Float32` |
22+
| `Quantity{Measurement{Float32}, ...}` | `Float32` |
23+
| `Dual{Complex{Float32}}` | `Float32` |
24+
25+
The standard behavior is to return the *first* type parameter,
26+
or, if that type has parameters of its own (such as `Dual{Complex{Float32}}`),
27+
to recursively take the first type parameter until a non-parameterized type is found.
2228
"""
2329
@generated function base_numeric_type(::Type{T}) where {T}
2430
# This uses a generated function for type stability in Julia <=1.9,

0 commit comments

Comments
 (0)