Skip to content

Commit 46ac6d9

Browse files
xorJanetkelman
authored andcommitted
Move docstrings inline from helpdb to base/trig.jl, base/number.jl, and `base/parse.jl (JuliaLang#22618)
1 parent 88e7fbc commit 46ac6d9

File tree

4 files changed

+48
-97
lines changed

4 files changed

+48
-97
lines changed

base/docs/helpdb/Base.jl

-93
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,6 @@ Also available as the macro `@assert expr`.
133133
"""
134134
assert
135135

136-
"""
137-
sech(x)
138-
139-
Compute the hyperbolic secant of `x`
140-
"""
141-
sech
142-
143136
"""
144137
unsafe_copy!(dest::Ptr{T}, src::Ptr{T}, N)
145138
@@ -1271,13 +1264,6 @@ Compile the given function `f` for the argument tuple (of types) `args`, but do
12711264
"""
12721265
precompile
12731266

1274-
"""
1275-
cot(x)
1276-
1277-
Compute the cotangent of `x`, where `x` is in radians.
1278-
"""
1279-
cot
1280-
12811267
"""
12821268
get(collection, key, default)
12831269
@@ -1322,13 +1308,6 @@ Forces synchronization between the in-memory version of a memory-mapped `Array`
13221308
"""
13231309
Mmap.sync!
13241310

1325-
"""
1326-
csc(x)
1327-
1328-
Compute the cosecant of `x`, where `x` is in radians.
1329-
"""
1330-
csc
1331-
13321311
"""
13331312
hash(x[, h::UInt])
13341313
@@ -1396,13 +1375,6 @@ or a composite object and field name (as a symbol) or index.
13961375
"""
13971376
isdefined
13981377

1399-
"""
1400-
cotd(x)
1401-
1402-
Compute the cotangent of `x`, where `x` is in degrees.
1403-
"""
1404-
cotd
1405-
14061378
"""
14071379
wait([x])
14081380
@@ -1681,13 +1653,6 @@ used only with extreme caution, as it can cause memory use to grow without bound
16811653
"""
16821654
gc_enable
16831655

1684-
"""
1685-
secd(x)
1686-
1687-
Compute the secant of `x`, where `x` is in degrees.
1688-
"""
1689-
secd
1690-
16911656
"""
16921657
OverflowError()
16931658
@@ -1754,20 +1719,6 @@ unpredictable.
17541719
"""
17551720
finalizer
17561721

1757-
"""
1758-
csch(x)
1759-
1760-
Compute the hyperbolic cosecant of `x`.
1761-
"""
1762-
csch
1763-
1764-
"""
1765-
sec(x)
1766-
1767-
Compute the secant of `x`, where `x` is in radians.
1768-
"""
1769-
sec
1770-
17711722
"""
17721723
TypeError(func::Symbol, context::AbstractString, expected::Type, got)
17731724
@@ -1986,13 +1937,6 @@ retrieved by accessing `m.match` and the captured sequences can be retrieved by
19861937
"""
19871938
match
19881939

1989-
"""
1990-
coth(x)
1991-
1992-
Compute the hyperbolic cotangent of `x`.
1993-
"""
1994-
coth
1995-
19961940
"""
19971941
start(iter) -> state
19981942
@@ -2308,43 +2252,6 @@ Unicode string.)
23082252
"""
23092253
reverseind
23102254

2311-
"""
2312-
signbit(x)
2313-
2314-
Returns `true` if the value of the sign of `x` is negative, otherwise `false`.
2315-
2316-
# Examples
2317-
```jldoctest
2318-
julia> signbit(-4)
2319-
true
2320-
2321-
julia> signbit(5)
2322-
false
2323-
2324-
julia> signbit(5.5)
2325-
false
2326-
2327-
julia> signbit(-4.1)
2328-
true
2329-
```
2330-
"""
2331-
signbit
2332-
2333-
"""
2334-
cscd(x)
2335-
2336-
Compute the cosecant of `x`, where `x` is in degrees.
2337-
"""
2338-
cscd
2339-
2340-
"""
2341-
tryparse(type, str, [base])
2342-
2343-
Like [`parse`](@ref), but returns a [`Nullable`](@ref) of the requested type. The result will be null if the
2344-
string does not contain a valid number.
2345-
"""
2346-
tryparse
2347-
23482255
"""
23492256
exit([code])
23502257

base/number.jl

+21
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,27 @@ divrem(x,y) = (div(x,y),rem(x,y))
6969
The floored quotient and modulus after division. Equivalent to `(fld(x,y), mod(x,y))`.
7070
"""
7171
fldmod(x,y) = (fld(x,y),mod(x,y))
72+
73+
"""
74+
signbit(x)
75+
76+
Returns `true` if the value of the sign of `x` is negative, otherwise `false`.
77+
78+
# Examples
79+
```jldoctest
80+
julia> signbit(-4)
81+
true
82+
83+
julia> signbit(5)
84+
false
85+
86+
julia> signbit(5.5)
87+
false
88+
89+
julia> signbit(-4.1)
90+
true
91+
```
92+
"""
7293
signbit(x::Real) = x < 0
7394

7495
"""

base/parse.jl

+6
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,12 @@ end
171171
throw(ArgumentError("invalid base: base must be 2 ≤ base ≤ 62, got $base"))
172172
end
173173

174+
"""
175+
tryparse(type, str, [base])
176+
177+
Like [`parse`](@ref), but returns a [`Nullable`](@ref) of the requested type. The result
178+
will be null if the string does not contain a valid number.
179+
"""
174180
tryparse(::Type{T}, s::AbstractString, base::Integer) where {T<:Integer} =
175181
tryparse_internal(T, s, start(s), endof(s), check_valid_base(base), false)
176182
tryparse(::Type{T}, s::AbstractString) where {T<:Integer} =

base/special/trig.jl

+21-4
Original file line numberDiff line numberDiff line change
@@ -310,11 +310,28 @@ cosc(x::Complex{<:AbstractFloat}) = x==0 ? zero(x) : oftype(x,(cospi(x)-sinpi(x)
310310
cosc(x::Complex) = cosc(float(x))
311311
cosc(x::Real) = x==0 || isinf(x) ? zero(x) : (cospi(x)-sinpi(x)/(pi*x))/x
312312

313-
for (finv, f) in ((:sec, :cos), (:csc, :sin), (:cot, :tan),
314-
(:sech, :cosh), (:csch, :sinh), (:coth, :tanh),
315-
(:secd, :cosd), (:cscd, :sind), (:cotd, :tand))
313+
for (finv, f, finvh, fh, finvd, fd, fn) in ((:sec, :cos, :sech, :cosh, :secd, :cosd, "secant"),
314+
(:csc, :sin, :csch, :sinh, :cscd, :sind, "cosecant"),
315+
(:cot, :tan, :coth, :tanh, :cotd, :tand, "cotangent"))
316+
name = string(finv)
317+
hname = string(finvh)
318+
dname = string(finvd)
316319
@eval begin
317-
($finv)(z::T) where {T<:Number} = one(T) / (($f)(z))
320+
@doc """
321+
$($name)(x)
322+
323+
Compute the $($fn) of `x`, where `x` is in radians.
324+
""" ($finv)(z::T) where {T<:Number} = one(T) / (($f)(z))
325+
@doc """
326+
$($hname)(x)
327+
328+
Compute the hyperbolic $($fn) of `x`.
329+
""" ($finvh)(z::T) where {T<:Number} = one(T) / (($fh)(z))
330+
@doc """
331+
$($dname)(x)
332+
333+
Compute the $($fn) of `x`, where `x` is in degrees.
334+
""" ($finvd)(z::T) where {T<:Number} = one(T) / (($fd)(z))
318335
end
319336
end
320337

0 commit comments

Comments
 (0)