Skip to content

Commit c8ed17f

Browse files
adienesinkydragon
andauthored
Doc float complex (#49949)
Co-authored-by: inky <git@wo-class.cn>
1 parent 671c6a1 commit c8ed17f

File tree

3 files changed

+30
-10
lines changed

3 files changed

+30
-10
lines changed

base/complex.jl

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,6 @@ Convert real numbers or arrays to complex. `i` defaults to zero.
162162
```jldoctest
163163
julia> complex(7)
164164
7 + 0im
165-
166-
julia> complex([1, 2, 3])
167-
3-element Vector{Complex{Int64}}:
168-
1 + 0im
169-
2 + 0im
170-
3 + 0im
171165
```
172166
"""
173167
complex(z::Complex) = z
@@ -1122,7 +1116,23 @@ big(::Type{Complex{T}}) where {T<:Real} = Complex{big(T)}
11221116
big(z::Complex{T}) where {T<:Real} = Complex{big(T)}(z)
11231117

11241118
## Array operations on complex numbers ##
1119+
"""
1120+
complex(A::AbstractArray)
1121+
1122+
Return an array containing the complex analog of each entry in array `A`.
1123+
1124+
Equivalent to `complex.(A)`, except that the return value may share memory with all or
1125+
part of `A` in accordance with the behavior of `convert(T, A)` given output type `T`.
11251126
1127+
# Examples
1128+
```jldoctest
1129+
julia> complex([1, 2, 3])
1130+
3-element Vector{Complex{Int64}}:
1131+
1 + 0im
1132+
2 + 0im
1133+
3 + 0im
1134+
```
1135+
"""
11261136
complex(A::AbstractArray{<:Complex}) = A
11271137

11281138
function complex(A::AbstractArray{T}) where T

base/essentials.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ julia> convert(BigFloat, x)
437437
```
438438
439439
If `T` is a collection type and `x` a collection, the result of
440-
`convert(T, x)` may alias all or part of `x`.
440+
`convert(T, x)` may share memory with all or part of `x`.
441441
```jldoctest
442442
julia> x = Int[1, 2, 3];
443443

base/float.jl

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,6 @@ See also: [`complex`](@ref), [`oftype`](@ref), [`convert`](@ref).
368368
369369
# Examples
370370
```jldoctest
371-
julia> float(1:1000)
372-
1.0:1.0:1000.0
373-
374371
julia> float(typemax(Int32))
375372
2.147483647e9
376373
```
@@ -1207,7 +1204,20 @@ floattype(::Type{Int16}) = Float16
12071204

12081205

12091206
## Array operations on floating point numbers ##
1207+
"""
1208+
float(A::AbstractArray)
1209+
1210+
Return an array containing the floating-point analog of each entry in array `A`.
1211+
1212+
Equivalent to `float.(A)`, except that the return value may share memory with all or
1213+
part of `A` in accordance with the behavior of `convert(T, A)` given output type `T`.
12101214
1215+
# Examples
1216+
```jldoctest
1217+
julia> float(1:1000)
1218+
1.0:1.0:1000.0
1219+
```
1220+
"""
12111221
float(A::AbstractArray{<:AbstractFloat}) = A
12121222

12131223
function float(A::AbstractArray{T}) where T

0 commit comments

Comments
 (0)