From c7fc048c8ccf40112d386b8f133663cfa7a444de Mon Sep 17 00:00:00 2001 From: kshyatt Date: Sat, 6 Aug 2016 10:16:39 -0700 Subject: [PATCH 1/3] More trig docstring cleanout --- base/docs/helpdb/Base.jl | 42 ---------------------------------------- base/special/trig.jl | 9 ++++++--- 2 files changed, 6 insertions(+), 45 deletions(-) diff --git a/base/docs/helpdb/Base.jl b/base/docs/helpdb/Base.jl index 82604311cd1cc..463fac30e923e 100644 --- a/base/docs/helpdb/Base.jl +++ b/base/docs/helpdb/Base.jl @@ -976,13 +976,6 @@ seeding. """ srand -""" - acot(x) - -Compute the inverse cotangent of `x`, where the output is in radians. -""" -acot - """ oftype(x, y) @@ -2640,13 +2633,6 @@ Get the concrete type of `x`. """ typeof -""" - acsc(x) - -Compute the inverse cosecant of `x`, where the output is in radians -""" -acsc - """ log(x) @@ -3059,13 +3045,6 @@ Element-wise less-than-or-equals comparison operator. """ Base.:(.<=) -""" - asec(x) - -Compute the inverse secant of `x`, where the output is in radians. -""" -asec - """ rank(M) @@ -4925,13 +4904,6 @@ recurses infinitely. """ StackOverflowError -""" - acsch(x) - -Compute the inverse hyperbolic cosecant of `x`. -""" -acsch - """ process_running(p::Process) @@ -5689,13 +5661,6 @@ Read a UDP packet from the specified socket, and return the bytes received. This """ recv -""" - acoth(x) - -Compute the inverse hyperbolic cotangent of `x`. -""" -acoth - """ det(M) @@ -6038,13 +6003,6 @@ the integrity and correctness of data read from `stream`. """ deserialize -""" - asech(x) - -Compute the inverse hyperbolic secant of `x`. -""" -asech - """ ismarked(s) diff --git a/base/special/trig.jl b/base/special/trig.jl index 087f2ad0338e6..fa4c33717f784 100644 --- a/base/special/trig.jl +++ b/base/special/trig.jl @@ -319,10 +319,13 @@ for (finv, f) in ((:sec, :cos), (:csc, :sin), (:cot, :tan), end end -for (fa, fainv) in ((:asec, :acos), (:acsc, :asin), (:acot, :atan), - (:asech, :acosh), (:acsch, :asinh), (:acoth, :atanh)) +for (fa, fainv, fn) in ((:asec, :acos, "secant"), (:acsc, :asin, "cosecant"), (:acot, :atan, "cotangent"), + (:asech, :acosh, "hyperbolic secant"), (:acsch, :asinh, "hyperbolic cosecant"), (:acoth, :atanh, "hyperbolic cotangent")) + name = string(fa) @eval begin - ($fa){T<:Number}(y::T) = ($fainv)(one(T) / y) + @doc """ + $($name)(x) + Compute the $($fn) of `x`, where the output is in radians. """ ($fa){T<:Number}(y::T) = ($fainv)(one(T) / y) ($fa){T<:Number}(y::AbstractArray{T}) = ($fainv)(one(T) ./ y) end end From 79a2e013a28029ab624c8271282e5a13f4d8fdad Mon Sep 17 00:00:00 2001 From: kshyatt Date: Sat, 6 Aug 2016 19:26:25 -0700 Subject: [PATCH 2/3] Fix a failing doctest --- doc/manual/integers-and-floating-point-numbers.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/manual/integers-and-floating-point-numbers.rst b/doc/manual/integers-and-floating-point-numbers.rst index 9b37bff26eb08..0e79f2feb4952 100644 --- a/doc/manual/integers-and-floating-point-numbers.rst +++ b/doc/manual/integers-and-floating-point-numbers.rst @@ -317,7 +317,7 @@ only as a storage format. In calculations they'll be converted to ``Float32``: 2 julia> 2*Float16(4.) - 8.0f0 + Float16(8.0) The underscore ``_`` can be used as digit separator: From 2912c9e2adb05258793d8b25931fa0b87720a4c5 Mon Sep 17 00:00:00 2001 From: kshyatt Date: Sun, 7 Aug 2016 16:35:56 -0700 Subject: [PATCH 3/3] Remove dupe digamma, fix docstrings --- base/docs/helpdb/Base.jl | 7 ------- base/special/trig.jl | 18 ++++++++++++------ doc/stdlib/math.rst | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/base/docs/helpdb/Base.jl b/base/docs/helpdb/Base.jl index 463fac30e923e..e84547a23a682 100644 --- a/base/docs/helpdb/Base.jl +++ b/base/docs/helpdb/Base.jl @@ -9,13 +9,6 @@ Raises a `SystemError` for `errno` with the descriptive string `sysfunc` if `ift """ systemerror -""" - digamma(x) - -Compute the digamma function of `x` (the logarithmic derivative of `gamma(x)`) -""" -digamma - """ fill!(A, x) diff --git a/base/special/trig.jl b/base/special/trig.jl index fa4c33717f784..2ad94211c590f 100644 --- a/base/special/trig.jl +++ b/base/special/trig.jl @@ -319,14 +319,20 @@ for (finv, f) in ((:sec, :cos), (:csc, :sin), (:cot, :tan), end end -for (fa, fainv, fn) in ((:asec, :acos, "secant"), (:acsc, :asin, "cosecant"), (:acot, :atan, "cotangent"), - (:asech, :acosh, "hyperbolic secant"), (:acsch, :asinh, "hyperbolic cosecant"), (:acoth, :atanh, "hyperbolic cotangent")) - name = string(fa) +for (tfa, tfainv, hfa, hfainv, fn) in ((:asec, :acos, :asech, :acosh, "secant"), + (:acsc, :asin, :acsch, :asinh, "cosecant"), + (:acot, :atan, :acoth, :atahn, "cotangent")) + tname = string(tfa) + hname = string(hfa) @eval begin @doc """ - $($name)(x) - Compute the $($fn) of `x`, where the output is in radians. """ ($fa){T<:Number}(y::T) = ($fainv)(one(T) / y) - ($fa){T<:Number}(y::AbstractArray{T}) = ($fainv)(one(T) ./ y) + $($tname)(x) + Compute the inverse $($fn) of `x`, where the output is in radians. """ ($tfa){T<:Number}(y::T) = ($tfainv)(one(T) / y) + ($tfa){T<:Number}(y::AbstractArray{T}) = ($tfainv)(one(T) ./ y) + @doc """ + $($hname)(x) + Compute the inverse hyperbolic $($fn) of `x`. """ ($hfa){T<:Number}(y::T) = ($hfainv)(one(T) / y) + ($hfa){T<:Number}(y::AbstractArray{T}) = ($hfainv)(one(T) ./ y) end end diff --git a/doc/stdlib/math.rst b/doc/stdlib/math.rst index 7c9a7c653e808..91b6c7d926867 100644 --- a/doc/stdlib/math.rst +++ b/doc/stdlib/math.rst @@ -664,7 +664,7 @@ Mathematical Functions .. Docstring generated from Julia source - Compute the inverse cosecant of ``x``\ , where the output is in radians + Compute the inverse cosecant of ``x``\ , where the output is in radians. .. function:: acot(x)