# Find all functions/methods that take two numbers as arguments

I’m implementing a new subtype of `Integer` (should be a PR to Julia’s `Base`), so I want a list of all functions that have a type signature like `(::Int16, ::Int16)`, so I could implement the operation for the new type.

I remember there was a feature kind of like what I’m asking for in the help REPL. But I can’t find the exact syntax for the feature.

Regarding the specific question of finding math ops, there’s plenty in the manual. Ought to keep me busy for some time:

https://docs.julialang.org/en/v1.12-dev/manual/mathematical-operations/

https://docs.julialang.org/en/v1.12-dev/base/math/

You were probably looking for this:

``````help?> ?(Int16(0), Int16(1))
last(itr, n::Integer) @ Base abstractarray.jl:552
complex(x::Real, y::Real) @ Base complex.jl:175
hypot(x::Number, y::Number) @ Base.Math math.jl:776
<=(x::T, y::T) where T<:Union{Int128, Int16, Int32, Int64, Int8} @ Base int.jl:514
in(x::Number, y::Number) @ Base number.jl:282
size(x::Number, d::Integer) @ Base number.jl:81
atan(y::Real, x::Real) @ Base.Math math.jl:874
/(x::Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}, y::Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}) @ Base int.jl:97
gcd(a::T, b::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} @ Base intfuncs.jl:50
first(itr, n::Integer) @ Base abstractarray.jl:502
Complex(re::T, im::T) where T<:Real @ Base complex.jl:14
>>(x::Integer, c::Integer) @ Base operators.jl:696
^(x::T, p::T) where T<:Integer @ Base intfuncs.jl:310
hcat(X::T...) where T<:Number @ Base abstractarray.jl:1616
bitrotate(x::T, k::Integer) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} @ Base int.jl:587
min(x::T, y::T) where T<:Real @ Base promotion.jl:533
isless(x::Real, y::Real) @ Base operators.jl:430
mod(x::T, y::T) where T<:Integer @ Base int.jl:285
rem(x::T, y::T) where T<:Union{Int16, Int32, Int64, Int8} @ Base int.jl:296
rand(dims::Integer...) @ Random ~/.julia/juliaup/julia-1.10.4+0.x64.linux.gnu/share/julia/stdlib/v1.10/Random/src/Random.jl:279
VersionNumber(major::Integer, minor::Integer) @ Base version.jl:77
log(b::T, x::T) where T<:Number @ Base.Math math.jl:352
vcat(X::T...) where T<:Number @ Base abstractarray.jl:1614
mapreduce(f, op, A::Union{Base.AbstractBroadcasted, AbstractArray}...; kw...) @ Base reducedim.jl:359
iterate(x::Number, ::Any) @ Base number.jl:280
<<(x::Integer, c::Integer) @ Base operators.jl:651
fill(v, dims::Union{Integer, AbstractUnitRange}...) @ Base array.jl:582
+(x::T, y::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} @ Base int.jl:87
*(x::T, y::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} @ Base int.jl:88
minmax(x::T, y::T) where T<:Real @ Base promotion.jl:534
falses(dims::Union{Integer, AbstractUnitRange}...) @ Base bitarray.jl:403
|(x::T, y::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} @ Base int.jl:372
>>>(x::Integer, c::Integer) @ Base operators.jl:734
isapprox(x::Integer, y::Integer; atol, rtol, nans, norm) @ Base floatfuncs.jl:313
flipsign(x::T, y::T) where T<:Union{Int128, Int16, Int32, Int64, Int8} @ Base int.jl:142
map(f, x::Number, ys::Number...) @ Base number.jl:284
less(file, line::Integer) @ InteractiveUtils ~/.julia/juliaup/julia-1.10.4+0.x64.linux.gnu/share/julia/stdlib/v1.10/InteractiveUtils/src/editless.jl:311
gcdx(a::Integer, b::Integer) @ Base intfuncs.jl:199
cld(a::T, b::T) where T<:Union{AbstractFloat, Integer} @ Base div.jl:320
max(x::T, y::T) where T<:Real @ Base promotion.jl:532
getindex(x::Number, i::Integer) @ Base number.jl:96
//(n::Integer, d::Integer) @ Base rational.jl:62
widemul(x::Number, y::Number) @ Base number.jl:277
mod1(x::T, y::T) where T<:Real @ Base operators.jl:830
timedwait(testcb, timeout::Real; pollint) @ Base asyncevent.jl:336
Rational(n::T, d::T) where T<:Integer @ Base rational.jl:39
edit(f, idx::Integer) @ InteractiveUtils ~/.julia/juliaup/julia-1.10.4+0.x64.linux.gnu/share/julia/stdlib/v1.10/InteractiveUtils/src/editless.jl:268
axes(x::Number, d::Integer) @ Base number.jl:83
promote(x::T, y::T, zs::T...) where T @ Base promotion.jl:409
lcm(a::T, b::T) where T<:Integer @ Base intfuncs.jl:130
ntuple(f::F, n::Integer) where F @ Base ntuple.jl:17
copysign(x::Signed, y::Signed) @ Base int.jl:150
kron(a::Number, b::Union{Number, AbstractVecOrMat}) @ LinearAlgebra ~/.julia/juliaup/julia-1.10.4+0.x64.linux.gnu/share/julia/stdlib/v1.10/LinearAlgebra/src/dense.jl:473
trues(dims::Union{Integer, AbstractUnitRange}...) @ Base bitarray.jl:421
cmp(x::Integer, y::Integer) @ Base operators.jl:462
error(s::Vararg{Any, N}) where N @ Base error.jl:42
&(x::T, y::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} @ Base int.jl:347
==(x::T, y::T) where T<:Number @ Base promotion.jl:521
zeros(dims::Union{Integer, AbstractUnitRange}...) @ Base array.jl:631
fld(a::T, b::T) where T<:Union{AbstractFloat, Integer} @ Base div.jl:319
div(x::T, y::T) where T<:Union{Int16, Int32, Int64, Int8} @ Base int.jl:295
(::Colon)(start::T, stop::T) where T<:Real @ Base range.jl:5
-(x::T, y::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} @ Base int.jl:86
xor(x::T, y::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} @ Base int.jl:373
reduce(op, a::Number) @ Base reduce.jl:492
CartesianIndex(index::Integer...) @ Base.IteratorsMD multidimensional.jl:79
binomial(n::T, k::T) where T<:Integer @ Base intfuncs.jl:1140
fld1(x::T, y::T) where T<:Integer @ Base operators.jl:855
prevpow(a::T, x::Real) where T<:Real @ Base intfuncs.jl:524
invmod(n::Integer, m::Integer) @ Base intfuncs.jl:239
randn(dims::Integer...) @ Random ~/.julia/juliaup/julia-1.10.4+0.x64.linux.gnu/share/julia/stdlib/v1.10/Random/src/normal.jl:258
UnitRange(start::T, stop::T) where T<:Real @ Base range.jl:406
ones(dims::Union{Integer, AbstractUnitRange}...) @ Base array.jl:631
nextpow(a::Real, x::Real) @ Base intfuncs.jl:480
<(x::T, y::T) where T<:Union{Int128, Int16, Int32, Int64, Int8} @ Base int.jl:83
``````

Which I actually never used before and so had to look up how it works in the PR.

There is also `methodswith` if you don’t want to search for an exact signature:

``````julia> methodswith(Int16)
[1] AbstractFloat(x::Int16) @ Base float.jl:266
[2] Float16(x::Int16) @ Base float.jl:159
[3] Float32(x::Int16) @ Base float.jl:159
[4] Float64(x::Int16) @ Base float.jl:159
[5] Int64(x::Union{Bool, Int32, Int64, UInt16, UInt32, UInt64, UInt8, Int128, Int16, Int8, UInt128}) @ Core boot.jl:784
[6] Int128(x::Union{Bool, Int32, Int64, UInt16, UInt32, UInt64, UInt8, Int128, Int16, Int8, UInt128}) @ Core boot.jl:785
[7] Int16(x::Union{Bool, Int32, Int64, UInt16, UInt32, UInt64, UInt8, Int128, Int16, Int8, UInt128}) @ Core boot.jl:782
[8] Int32(x::Union{Bool, Int32, Int64, UInt16, UInt32, UInt64, UInt8, Int128, Int16, Int8, UInt128}) @ Core boot.jl:783
[9] Int8(x::Union{Bool, Int32, Int64, UInt16, UInt32, UInt64, UInt8, Int128, Int16, Int8, UInt128}) @ Core boot.jl:781
[10] UInt64(x::Union{Bool, Int32, Int64, UInt16, UInt32, UInt64, UInt8, Int128, Int16, Int8, UInt128}) @ Core boot.jl:789
[11] UInt128(x::Union{Bool, Int32, Int64, UInt16, UInt32, UInt64, UInt8, Int128, Int16, Int8, UInt128}) @ Core boot.jl:790
[12] UInt16(x::Union{Bool, Int32, Int64, UInt16, UInt32, UInt64, UInt8, Int128, Int16, Int8, UInt128}) @ Core boot.jl:787
[13] UInt32(x::Union{Bool, Int32, Int64, UInt16, UInt32, UInt64, UInt8, Int128, Int16, Int8, UInt128}) @ Core boot.jl:788
[14] UInt8(x::Union{Bool, Int32, Int64, UInt16, UInt32, UInt64, UInt8, Int128, Int16, Int8, UInt128}) @ Core boot.jl:786
[15] Unsigned(x::Int16) @ Core boot.jl:806
[16] rem(x::Int16, ::Type{UInt32}) @ Base int.jl:549
[17] rem(x::Int16, ::Type{UInt16}) @ Base int.jl:554
[18] rem(x::Int16, ::Type{UInt8}) @ Base int.jl:544
[19] rem(x::Int16, ::Type{Int32}) @ Base int.jl:549
[20] rem(x::Int16, ::Type{UInt64}) @ Base int.jl:549
[21] rem(x::Int16, ::Type{Int128}) @ Base int.jl:549
[22] rem(x::Int16, ::Type{Int8}) @ Base int.jl:544
[23] rem(x::Int16, ::Type{Int64}) @ Base int.jl:549
[24] rem(x::Int16, ::Type{UInt128}) @ Base int.jl:549
[25] rem(x::Unsigned, y::Union{Int128, Int16, Int32, Int64, Int8}) @ Base int.jl:233
[26] rem(x::T, y::T) where T<:Union{Int16, Int32, Int64, Int8} @ Base int.jl:296
[27] rem(x::Union{Int128, Int16, Int32, Int64, Int8}, y::Unsigned) @ Base int.jl:232
[28] &(x::T, y::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} @ Base int.jl:347
[29] *(x::BigInt, c::Union{Int16, Int32, Int64, Int8}) @ Base.GMP gmp.jl:562
[30] *(x::BigFloat, c::Union{Int16, Int32, Int64, Int8}) @ Base.MPFR mpfr.jl:447
[31] *(c::Union{Int16, Int32, Int64, Int8}, x::BigInt) @ Base.GMP gmp.jl:563
[32] *(x::T, y::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} @ Base int.jl:88
[33] *(c::Union{Int16, Int32, Int64, Int8}, x::BigFloat) @ Base.MPFR mpfr.jl:452
[34] +(x::BigInt, c::Union{Int16, Int32, Int64, Int8}) @ Base.GMP gmp.jl:555
[35] +(x::BigFloat, c::Union{Int16, Int32, Int64, Int8}) @ Base.MPFR mpfr.jl:447
[36] +(c::Union{Int16, Int32, Int64, Int8}, x::BigInt) @ Base.GMP gmp.jl:556
[37] +(x::T, y::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} @ Base int.jl:87
[38] +(c::Union{Int16, Int32, Int64, Int8}, x::BigFloat) @ Base.MPFR mpfr.jl:452
[39] -(x::BigInt, c::Union{Int16, Int32, Int64, Int8}) @ Base.GMP gmp.jl:557
[40] -(x::BigFloat, c::Union{Int16, Int32, Int64, Int8}) @ Base.MPFR mpfr.jl:494
[41] -(c::Union{Int16, Int32, Int64, Int8}, x::BigInt) @ Base.GMP gmp.jl:558
[42] -(x::T, y::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} @ Base int.jl:86
[43] -(c::Union{Int16, Int32, Int64, Int8}, x::BigFloat) @ Base.MPFR mpfr.jl:499
[44] -(x::Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}) @ Base int.jl:85
[45] /(x::BigFloat, c::Union{Int16, Int32, Int64, Int8}) @ Base.MPFR mpfr.jl:494
[46] /(x::BigInt, y::Union{Int16, Int32, Int64, Int8, UInt16, UInt32, UInt64, UInt8}) @ Base.GMP gmp.jl:565
[47] /(x::Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}, y::Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}) @ Base int.jl:97
[48] /(c::Union{Int16, Int32, Int64, Int8}, x::BigFloat) @ Base.MPFR mpfr.jl:499
[49] /(x::Union{Int16, Int32, Int64, Int8, UInt16, UInt32, UInt64, UInt8}, y::BigInt) @ Base.GMP gmp.jl:566
[50] <(x::Float16, y::Union{Int16, UInt16}) @ Base float.jl:604
[51] <(x::T, y::T) where T<:Union{Int128, Int16, Int32, Int64, Int8} @ Base int.jl:83
[52] <(x::Union{Int16, UInt16}, y::Float16) @ Base float.jl:605
[53] <(x::Union{UInt128, UInt16, UInt32, UInt64, UInt8}, y::Union{Int128, Int16, Int32, Int64, Int8}) @ Base int.jl:520
[54] <(x::Union{Int128, Int16, Int32, Int64, Int8}, y::Union{UInt128, UInt16, UInt32, UInt64, UInt8}) @ Base int.jl:519
[55] <<(x::Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}, y::Union{UInt128, UInt16, UInt32, UInt64, UInt8}) @ Base int.jl:529
[56] <<(x::Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}, y::Int64) @ Base int.jl:536
[57] <=(x::Float16, y::Union{Int16, UInt16}) @ Base float.jl:604
[58] <=(x::T, y::T) where T<:Union{Int128, Int16, Int32, Int64, Int8} @ Base int.jl:514
[59] <=(x::Union{Int16, UInt16}, y::Float16) @ Base float.jl:605
[60] <=(x::Union{Int128, Int16, Int32, Int64, Int8}, y::Union{UInt128, UInt16, UInt32, UInt64, UInt8}) @ Base int.jl:521
[61] <=(x::Union{UInt128, UInt16, UInt32, UInt64, UInt8}, y::Union{Int128, Int16, Int32, Int64, Int8}) @ Base int.jl:522
[62] ==(x::Float16, y::Union{Int16, UInt16}) @ Base float.jl:604
[63] ==(x::Union{Int16, UInt16}, y::Float16) @ Base float.jl:605
[64] ==(x::Union{UInt128, UInt16, UInt32, UInt64, UInt8}, y::Union{Int128, Int16, Int32, Int64, Int8}) @ Base int.jl:518
[65] ==(x::Union{Int128, Int16, Int32, Int64, Int8}, y::Union{UInt128, UInt16, UInt32, UInt64, UInt8}) @ Base int.jl:517
[66] >>(x::Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}, y::Int64) @ Base int.jl:534
[67] >>(x::Union{Int128, Int16, Int32, Int64, Int8}, y::Union{UInt128, UInt16, UInt32, UInt64, UInt8}) @ Base int.jl:527
[68] >>>(x::Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}, y::Union{UInt128, UInt16, UInt32, UInt64, UInt8}) @ Base int.jl:530
[69] >>>(x::Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}, y::Int64) @ Base int.jl:538
[70] BigFloat(x::Union{Bool, Int16, Int32, Int8}, r::Base.MPFR.MPFRRoundingMode; precision) @ Base.MPFR mpfr.jl:277
[71] BigFloat(x::Union{Bool, Int16, Int32, Int8}; ...) @ Base.MPFR mpfr.jl:277
[72] ^(x::BigFloat, y::Union{Int16, Int32, Int64, Int8}) @ Base.MPFR mpfr.jl:658
[73] bitreverse(x::Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}) @ Base int.jl:1094
[74] bitrotate(x::T, k::Integer) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} @ Base int.jl:587
[75] bswap(x::Union{Int128, Int16, Int32, Int64, UInt128, UInt16, UInt32, UInt64}) @ Base int.jl:398
[76] checkindex(::Type{Bool}, inds::Base.OneTo{T}, i::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} @ Base abstractarray.jl:763
[77] cmp(x::BigInt, y::Union{Int16, Int32, Int64, Int8}) @ Base.GMP gmp.jl:618
[78] cmp(x::BigFloat, y::Union{Int16, Int32, Int64, Int8}) @ Base.MPFR mpfr.jl:855
[79] count_ones(x::Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}) @ Base int.jl:415
[80] div(x::BigFloat, c::Union{Int16, Int32, Int64, Int8}) @ Base.MPFR mpfr.jl:567
[81] div(x::Unsigned, y::Union{Int128, Int16, Int32, Int64, Int8}) @ Base int.jl:230
[82] div(a::T, b::T, ::RoundingMode{:ToZero}) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt16, UInt32, UInt64, UInt8} @ Base div.jl:308
[83] div(c::Union{Int16, Int32, Int64, Int8}, x::BigFloat) @ Base.MPFR mpfr.jl:573
[84] div(x::Union{Int128, Int16, Int32, Int64, Int8}, y::Unsigned) @ Base int.jl:229
[85] div(x::T, y::T) where T<:Union{Int16, Int32, Int64, Int8} @ Base int.jl:295
[86] divrem(x::Unsigned, y::Union{Int128, Int16, Int32, Int64, Int8}) @ Base int.jl:240
[87] divrem(x::Union{Int128, Int16, Int32, Int64, Int8}, y::Unsigned) @ Base int.jl:235
[88] exp2(x::Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}) @ Base.Math special/exp.jl:387
[89] factorial(n::Union{Int16, Int32, Int8, UInt16, UInt32, UInt8}) @ Base combinatorics.jl:33
[90] flipsign(x::T, y::T) where T<:Union{Int128, Int16, Int32, Int64, Int8} @ Base int.jl:142
[91] flipsign(x::Union{Int128, Int16, Int32, Int64, Int8}, y::Union{Int128, Int16, Int32, Int64, Int8}) @ Base int.jl:143
[92] gcd(a::T, b::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} @ Base intfuncs.jl:50
[93] hash(x::Union{Bool, Int16, Int32, Int8, UInt16, UInt32, UInt8}, h::UInt64) @ Base hashing.jl:88
[94] ldexp(x::BigFloat, n::Union{Int16, Int32, Int64, Int8}) @ Base.MPFR mpfr.jl:706
[95] leading_zeros(x::Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}) @ Base int.jl:428
[96] mod(x::Union{Int128, Int16, Int32, Int64, Int8}, y::Unsigned) @ Base int.jl:289
[97] repeat(s::String, r::Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}) @ Base strings/substring.jl:260
[98] repeat(c::Char, r::Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}) @ Base strings/string.jl:526