I am beginner in Julia. I want to know when I give a multiple a large number with a decimal (or divide) suppose 45349632 * 0.4
, I get the answer as 1.81398528e7
which is correct but why is the value shown in this way when 45349632
can be displayed as such which is > answer itself. It seems to appear with computations… How can I get the value without decimal point and e. I tried multiplying the number with 10,100…but then that shows e8,9
…
This means 1.81398528 * 10^7
, the e
is not the mathematical constant, it denotes that the number following is the exponent with 10 as base.
Ok I know that. My issue was that I wanted to set an array by indexing another array
arr = features[i:0.4*n,1:8] where n = 45349632.
The error showed was ERROR: ArgumentError: invalid index: 1.0. I wanted to get rid of the e raise and display the full value as such…Luckily I could fix it myself
features[i:Int(0.4*n),1:8]
float times integer is a float and in Julia you can’t index with floats (into the standard arrays).
This works…
julia> Int(25000 * 0.4)
10000
julia> Int(45349632/4)
11337408
It is true when Int(45349632*0.4) is given
julia> Int(45349632 * 0.4)
ERROR: InexactError()
in convert(::Type{Int64}, ::Float64) at ./float.jl:656
in Int64(::Float64) at ./sysimg.jl:66
is shown…
You can round to the nearest integer with round(Int,x)
Or 45349632 ÷ 4
(typed as “45349632 \div tabulator 4”)