Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dpsanders committed Nov 5, 2015
1 parent d667f03 commit d633afa
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 26 deletions.
31 changes: 16 additions & 15 deletions base/docs/helpdb.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1238,20 +1238,6 @@ For matrices or vectors $A$ and $B$, calculates $Aᴴ / B$
"""
Ac_rdiv_B

doc"""
```rst
.. setrounding(T, mode)
Set the rounding mode of floating point type ``T``, controlling the
rounding of basic arithmetic functions (:func:`+`, :func:`-`, :func:`*`,
:func:`/` and :func:`sqrt`) and type conversion.
Note that this may affect other types, for instance changing the rounding
mode of ``Float64`` will change the rounding mode of ``Float32``. See
``rounding`` for available modes
```
"""
setrounding

doc"""
linspace(start, stop, n=100)
Expand Down Expand Up @@ -6446,6 +6432,21 @@ Like `broadcast_function`, but for `broadcast!`.
"""
broadcast!_function

doc"""
```rst
.. setrounding(T, mode)
Set the rounding mode of floating point type ``T``, controlling the
rounding of basic arithmetic functions (:func:`+`, :func:`-`, :func:`*`,
:func:`/` and :func:`sqrt`) and type conversion.
Note that this may affect other types, for instance changing the rounding
mode of ``Float64`` will change the rounding mode of ``Float32``. See
``rounding`` for available modes
```
"""
setrounding(T, mode)

doc"""
setrounding(f::Function, T, mode)
Expand All @@ -6458,7 +6459,7 @@ Change the rounding mode of floating point type `T` for the duration of `f`. It
See `rounding` for available rounding modes.
"""
setrounding
setrounding(f::Function, T, mode)

doc"""
sleep(seconds)
Expand Down
1 change: 1 addition & 0 deletions base/mpfr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ end

rounding_raw(::Type{BigFloat}) = ROUNDING_MODE[end]
setrounding_raw(::Type{BigFloat},i::Integer) = ROUNDING_MODE[end] = i

rounding(::Type{BigFloat}) = from_mpfr(rounding_raw(BigFloat))
setrounding(::Type{BigFloat},r::RoundingMode) = setrounding_raw(BigFloat,to_mpfr(r))

Expand Down
5 changes: 0 additions & 5 deletions base/rounding.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,7 @@ rounding_raw{T<:Union{Float32,Float64}}(::Type{T}) = ccall(:fegetround, Int32, (
setrounding{T<:Union{Float32,Float64}}(::Type{T},r::RoundingMode) = setrounding_raw(T,to_fenv(r))
rounding{T<:Union{Float32,Float64}}(::Type{T}) = from_fenv(rounding_raw(T))

doc"""
setrounding(f::Function, T, mode)

Set the rounding mode of the type `T` only for the duration of the function
`f`. Often used as e.g. `setrounding(T, mode) do ... end`.
"""
function setrounding{T}(f::Function, ::Type{T}, rounding::RoundingMode)
old_rounding_raw = rounding_raw(T)
setrounding(T,rounding)
Expand Down
10 changes: 4 additions & 6 deletions doc/stdlib/numbers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,10 @@ General Number Functions and Constants
Valid modes are ``RoundNearest``, ``RoundToZero``, ``RoundUp``,
``RoundDown``, and ``RoundFromZero`` (``BigFloat`` only).

.. function:: setrounding(T, mode)

.. Docstring generated from Julia source
.. function:: setrounding(f::Function, T, mode)

.. Docstring generated from Julia source
Expand All @@ -370,12 +374,6 @@ General Number Functions and Constants
See ``rounding`` for available rounding modes.

.. function:: setrounding(T, mode)

.. Docstring generated from Julia source
Set the rounding mode of the type ``T`` only for the duration of the function ``f``\ . Often used as e.g. ``setrounding(T, mode) do ... end``\ .

.. function:: get_zero_subnormals() -> Bool

.. Docstring generated from Julia source
Expand Down

0 comments on commit d633afa

Please sign in to comment.