File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -24,8 +24,8 @@ For example,
2424| ` Dual{Complex{Float32}} ` | ` Float32 ` |
2525
2626The 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
3030Packages should write a custom method for ` base_numeric_type `
3131if this behavior is incompatible with their type.
Original file line number Diff line number Diff line change @@ -12,13 +12,19 @@ as a measurement or a quantity.
1212For 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,
You can’t perform that action at this time.
0 commit comments