Integer Operations
Basic operations
Module
Functions
Reduce functions
Module
UTCGP.number_arithmetic — Module
Simple arithmetic functions
The default is int for the fallback. To cast to other types, use update_caster! and update_fallback! Exports :
- bundle_number_arithmetic :
number_sumnumber_minusnumber_multnumber_divsafe_divpower_of
Functions
UTCGP.number_arithmetic.number_sum — Function
number_sum(a::Number, b::Number, args...)Returns a+b
julia> number_sum(0,1)
1UTCGP.number_arithmetic.number_minus — Function
number_minus(a::Number, b::Number, args...)Returns a-b
julia> number_minus(0,1)
-1UTCGP.number_arithmetic.number_mult — Function
number_mult(a::Number, b::Number, args...)Returns a*b
julia> number_mult(3,3)
9UTCGP.number_arithmetic.number_div — Function
number_div(a::Number, b::Number, args...)Throws DivideError if the divisor is equal to 0.
Returns a/b
julia> number_div(3,3)
1.0UTCGP.number_arithmetic.safe_div — Function
safe_div(a::Number, b::Number, args...)If the divisor is equal (==) to 0, then the function returns 0 and does not raise an Error.
Else, the division works as expected.
julia> safe_div(3,0)
0Reduce functions
Module
UTCGP.number_reduce — Module
REDUCE Functions : from vector of number to number
Exports :
- bundle_number_reduce :
reduce_sumreduce_minreduce_maxreduce_argminreduce_argmaxreduce_length
Functions
UTCGP.number_reduce.reduce_sum — Function
reduce_sum(from :: Vector{<:Number}, args...)Returns the sum of the vector
julia> reduce_sum([1,2,3])
6UTCGP.number_reduce.reduce_min — Function
reduce_min(from::Vector{<:Number}, args...)Returns the minimum in the vector.
julia> reduce_min([1,2,3])
1UTCGP.number_reduce.reduce_max — Function
reduce_max(from::Vector{<:Number}, args...)Returns the maximum in the vector.
julia> reduce_max([1,2,3])
3UTCGP.number_reduce.reduce_argmin — Function
reduce_argmin(from::Vector{<:Number}, args...)Returns the argmin of the vector.
julia> reduce_argmin([1,2,3])
1UTCGP.number_reduce.reduce_argmax — Function
reduce_argmax(from::Vector{<:Number}, args...)Returns the argmax of the vector.
julia> reduce_argmax([1,2,3])
3UTCGP.number_reduce.reduce_length — Function
reduce_length(from::Vector{<:Any}, args...)Returns the length of the vector
reduce_length(from::String, args...)Return the length of the string.
julia> reduce_length(collect(1:10))
10