-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
18 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -359,20 +359,24 @@ for to in BitInteger_types, from in (BitInteger_types..., Bool) | |
end | ||
end | ||
|
||
""" | ||
rem(x::Integer, T::Type{<:Integer}) | ||
mod(x::Integer, T::Type{<:Integer}) | ||
%(x::Integer, T::Type{<:Integer}) | ||
Find `y::T` such that `x` ≡ `y` (mod n), where n is the number of integers representable | ||
in `T`, and `y` is an integer in `[typemin(T),typemax(T)]`. | ||
```jldoctest | ||
julia> 129 % Int8 | ||
-127 | ||
``` | ||
""" | ||
function rem(x::Integer, T::Type) end, function mod(x::Integer, T::Type) end | ||
# @doc isn't available when running in Core at this point. | ||
# Tuple syntax for documention two function signatures at the same time | ||
# doesn't work either at this point. | ||
isdefined(Main, :Base) && for fname in (:mod, :rem) | ||
@eval @doc """ | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
yuyichao
Author
Contributor
|
||
rem(x::Integer, T::Type{<:Integer}) | ||
mod(x::Integer, T::Type{<:Integer}) | ||
%(x::Integer, T::Type{<:Integer}) | ||
Find `y::T` such that `x` ≡ `y` (mod n), where n is the number of integers representable | ||
in `T`, and `y` is an integer in `[typemin(T),typemax(T)]`. | ||
```jldoctest | ||
julia> 129 % Int8 | ||
-127 | ||
``` | ||
""" -> $fname(x::Integer, T::Type{<:Integer}) | ||
end | ||
|
||
rem{T<:Integer}(x::T, ::Type{T}) = x | ||
rem(x::Integer, ::Type{Bool}) = ((x & 1) != 0) | ||
|
This breaks the ability to do
include("coreimg.jl")
(useful e.g. when hacking inference.jl). Would@eval Main.Base @doc ...
do?