# The elements in the uninitialised array / vector?

**URL:** <https://discourse.julialang.org/t/the-elements-in-the-uninitialised-array-vector/22864>\
**Category:** General Usage\
**Created:** [April 7, 2019, 7:40am UTC](https://discourse.julialang.org/t/the-elements-in-the-uninitialised-array-vector/22864 "2019-04-07T07:40:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bsnyh](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Post date:** [April 7, 2019, 7:40am UTC](https://discourse.julialang.org/t/the-elements-in-the-uninitialised-array-vector/22864/1 "2019-04-07T07:40:43Z")

</div>

This is probably a simple question. The code is this:  
`julia> Vector{Float64}(undef,3)`

The output:

```julia
3-element Array{Float64,1}:
6.92297776986275e-310
6.92297776986354e-310
6.92297776986433e-310

```

I do not know what is exactly the meaning of the elements in the output of the 3-element Array. Are they randomly given or? I thought the vector is uninitialized, right?

---

<div class="post-metadata">

**Author:** ![longemen3000](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/longemen3000/32/7298_2.png) [@longemen3000](https://discourse.julialang.org/u/longemen3000)\
**Post date:** [April 7, 2019, 7:52am UTC](https://discourse.julialang.org/t/the-elements-in-the-uninitialised-array-vector/22864/2 "2019-04-07T07:52:52Z")

</div>

I’m not in the computer right now, but I think that is the representation of a float64 of the bit value `0000000...000`, you can try with `println(bitstring(x[1]))` to see what’s happening. About why 64 zero bits have that representation… I don’t know, that’s how floating point works 🤷‍♂️

---

<div class="post-metadata">

**Author:** ![bsnyh](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Post date:** [April 7, 2019, 8:00am UTC](https://discourse.julialang.org/t/the-elements-in-the-uninitialised-array-vector/22864/3 "2019-04-07T08:00:13Z")

</div>

```julia
julia> a=Vector{Float64}(undef,3)
3-element Array{Float64,1}:
 2.219358699e-314
 2.21936164e-314
 2.2085939415e-314

julia> println(bitstring(a[1]))
0000000000000000000000000000000100001011101111101111100000010000

```

I changed to my MAC book pro and the above is the code. Does this seem reasonable?

---

<div class="post-metadata">

**Author:** ![longemen3000](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/longemen3000/32/7298_2.png) [@longemen3000](https://discourse.julialang.org/u/longemen3000)\
**Post date:** [April 7, 2019, 8:06am UTC](https://discourse.julialang.org/t/the-elements-in-the-uninitialised-array-vector/22864/4 "2019-04-07T08:06:13Z")

</div>

From [Wikipedia](https://en.m.wikipedia.org/wiki/Floating-point_arithmetic), the first bit is the sign, the bites 2-12 are the exponent, and the rest are significant digits, so it makes sense

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [April 7, 2019, 8:07am UTC](https://discourse.julialang.org/t/the-elements-in-the-uninitialised-array-vector/22864/5 "2019-04-07T08:07:14Z")

</div>

> [@bsnyh](#):
>
> I thought the vector is uninitialized, right?

That is correct and the numbers you see are what happened to be in the memory that got allocated.
