Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc float complex #49949

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions base/complex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,6 @@ Convert real numbers or arrays to complex. `i` defaults to zero.
```jldoctest
julia> complex(7)
7 + 0im

julia> complex([1, 2, 3])
3-element Vector{Complex{Int64}}:
1 + 0im
2 + 0im
3 + 0im
```
"""
complex(z::Complex) = z
Expand Down Expand Up @@ -1125,7 +1119,23 @@ big(::Type{Complex{T}}) where {T<:Real} = Complex{big(T)}
big(z::Complex{T}) where {T<:Real} = Complex{big(T)}(z)

## Array operations on complex numbers ##
"""
complex(A::AbstractArray)

Return an array containing the complex analog of each entry in array `A`.

Equivalent to `complex.(A)`, except that the return value may share memory with all or
part of `A` in accordance with the behavior of `convert(T, A)` given output type `T`.

# Examples
```jldoctest
julia> complex([1, 2, 3])
adienes marked this conversation as resolved.
Show resolved Hide resolved
3-element Vector{Complex{Int64}}:
1 + 0im
2 + 0im
3 + 0im
```
"""
complex(A::AbstractArray{<:Complex}) = A

function complex(A::AbstractArray{T}) where T
Expand Down
2 changes: 1 addition & 1 deletion base/essentials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ julia> convert(BigFloat, x)
```

If `T` is a collection type and `x` a collection, the result of
`convert(T, x)` may alias all or part of `x`.
`convert(T, x)` may share memory with all or part of `x`.
```jldoctest
julia> x = Int[1, 2, 3];

Expand Down
16 changes: 13 additions & 3 deletions base/float.jl
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,6 @@ See also: [`complex`](@ref), [`oftype`](@ref), [`convert`](@ref).

# Examples
```jldoctest
julia> float(1:1000)
1.0:1.0:1000.0

julia> float(typemax(Int32))
2.147483647e9
```
Expand Down Expand Up @@ -1190,7 +1187,20 @@ floattype(::Type{Int16}) = Float16


## Array operations on floating point numbers ##
"""
float(A::AbstractArray)

Return an array containing the floating-point analog of each entry in array `A`.

Equivalent to `float.(A)`, except that the return value may share memory with all or
part of `A` in accordance with the behavior of `convert(T, A)` given output type `T`.

# Examples
```jldoctest
julia> float(1:1000)
1.0:1.0:1000.0
```
adienes marked this conversation as resolved.
Show resolved Hide resolved
"""
float(A::AbstractArray{<:AbstractFloat}) = A

function float(A::AbstractArray{T}) where T
Expand Down