Skip to content

Commit

Permalink
Xrefs and a few examples for math stuff (#29150)
Browse files Browse the repository at this point in the history
(cherry picked from commit 02aa9bb)
  • Loading branch information
kshyatt authored and KristofferC committed Sep 17, 2018
1 parent e174444 commit 499fb01
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions base/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,19 @@ atanh(x::Number)
Compute the natural logarithm of `x`. Throws [`DomainError`](@ref) for negative
[`Real`](@ref) arguments. Use complex negative arguments to obtain complex results.
# Examples
```jldoctest; filter = r"Stacktrace:(\\n \\[[0-9]+\\].*)*"
julia> log(2)
0.6931471805599453
julia> log(-3)
ERROR: DomainError with -3.0:
log will only return a complex result if called with a complex argument. Try log(Complex(x)).
Stacktrace:
[1] throw_complex_domainerror(::Symbol, ::Float64) at ./math.jl:31
[...]
```
"""
log(x::Number)

Expand Down Expand Up @@ -709,18 +722,18 @@ according to the rounding mode `r`. In other words, the quantity
without any intermediate rounding.
- if `r == RoundNearest`, then the result is exact, and in the interval
``[-|y|/2, |y|/2]``.
``[-|y|/2, |y|/2]``. See also [`RoundNearest`](@ref).
- if `r == RoundToZero` (default), then the result is exact, and in the interval
``[0, |y|)`` if `x` is positive, or ``(-|y|, 0]`` otherwise.
``[0, |y|)`` if `x` is positive, or ``(-|y|, 0]`` otherwise. See also [`RoundToZero`](@ref).
- if `r == RoundDown`, then the result is in the interval ``[0, y)`` if `y` is positive, or
``(y, 0]`` otherwise. The result may not be exact if `x` and `y` have different signs, and
`abs(x) < abs(y)`.
`abs(x) < abs(y)`. See also[`RoundDown`](@ref).
- if `r == RoundUp`, then the result is in the interval `(-y,0]` if `y` is positive, or
`[0,-y)` otherwise. The result may not be exact if `x` and `y` have the same sign, and
`abs(x) < abs(y)`.
`abs(x) < abs(y)`. See also [`RoundUp`](@ref).
"""
rem(x, y, ::RoundingMode{:ToZero}) = rem(x,y)
Expand Down Expand Up @@ -820,14 +833,15 @@ without any intermediate rounding. This internally uses a high precision approxi
2π, and so will give a more accurate result than `rem(x,2π,r)`
- if `r == RoundNearest`, then the result is in the interval ``[-π, π]``. This will generally
be the most accurate result.
be the most accurate result. See also [`RoundNearest`](@ref).
- if `r == RoundToZero`, then the result is in the interval ``[0, 2π]`` if `x` is positive,.
or ``[-2π, 0]`` otherwise.
or ``[-2π, 0]`` otherwise. See also [`RoundToZero`](@ref).
- if `r == RoundDown`, then the result is in the interval ``[0, 2π]``.
See also [`RoundDown`](@ref).
- if `r == RoundUp`, then the result is in the interval ``[-2π, 0]``.
See also [`RoundUp`](@ref).
# Examples
```jldoctest
Expand Down

0 comments on commit 499fb01

Please sign in to comment.