A rational
can be written as a ration (Simple fraction), Operator // is used to find exact
ratio of integers.
julia> 10//15 2//3 julia> 20//60 1//3 julia> -4//-24 1//6 julia> -15//5 -3//1 julia> 5//-15 -1//3
Get
numerator and denominator of rational value
num() and den() functions are used to get numerator and denominator of rational value.
num() and den() functions are used to get numerator and denominator of rational value.
julia> num(4//24) 1 julia> den(4//24) 6 julia> num(6//32) 3 julia> den(6//32) 16
Convert
rational value to float
It is very simple, pass the rational value to float() function.
It is very simple, pass the rational value to float() function.
julia> 6//32 3//16 julia> float(6//32) 0.1875
No comments:
Post a Comment