# InexactError in learnxiny?

**URL:** <https://discourse.julialang.org/t/inexacterror-in-learnxiny/55967>\
**Category:** New to Julia\
**Tags:** inexacterror\
**Created:** [February 24, 2021, 10:15pm UTC](https://discourse.julialang.org/t/inexacterror-in-learnxiny/55967 "2021-02-24T22:15:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Albert\_Zevelev](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albert_zevelev/32/11844_2.png) [@Albert\_Zevelev](https://discourse.julialang.org/u/Albert_Zevelev)\
**Post date:** [February 24, 2021, 10:15pm UTC](https://discourse.julialang.org/t/inexacterror-in-learnxiny/55967/1 "2021-02-24T22:15:41Z")

</div>

The following issue might surprise newcomers to Julia

```julia
julia> y1 = [1:3;]
3-element Array{Int64,1}:
 1
 2
 3
julia> y1[3] = y1[3] + 5.0
8.0
julia> y1[3] = y1[3] + 4.99
ERROR: InexactError: Int64(12.99)
Stacktrace:
 [1] Int64 at ./float.jl:710 [inlined]
 [2] convert at ./number.jl:7 [inlined]
 [3] setindex!(::Array{Int64,1}, ::Float64, ::Int64) at ./array.jl:847
 [4] top-level scope at REPL[187]:1

```

whereas the following works

```julia
julia> y1 = [1.0:3.0;]
3-element Array{Float64,1}:
 1.0
 2.0
 3.0
julia> y1[3] = y1[3] + 5.0
8.0
julia> y1[3] = y1[3] + 4.99
12.99

```

Though I feel kinda like this really shouldn’t be an error in Julia…
