# What's the difference between Float64 and Real? And what is the Real type for?

**URL:** <https://discourse.julialang.org/t/whats-the-difference-between-float64-and-real-and-what-is-the-real-type-for/62971>\
**Category:** New to Julia\
**Tags:** array, type, float\
**Created:** [June 15, 2021, 8:46pm UTC](https://discourse.julialang.org/t/whats-the-difference-between-float64-and-real-and-what-is-the-real-type-for/62971 "2021-06-15T20:46:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Barmann](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/michael_barmann/32/20389_2.png) [@Michael\_Barmann](https://discourse.julialang.org/u/Michael_Barmann)\
**Post date:** [June 15, 2021, 8:46pm UTC](https://discourse.julialang.org/t/whats-the-difference-between-float64-and-real-and-what-is-the-real-type-for/62971/1 "2021-06-15T20:46:52Z")

</div>

Pardon this naive question but: what exactly is the difference between `Float64` and `Real`? For example, say we have:

```julia
a = [1.0, 2.0, 3.0] 
b = Array{Real,1}(a)

```

When I call `typeof()` on each, it reports the types as `Vector{Float64}` and `Vector{Real}`, respectively. But how are `a` and `b` different, and in what ways do they _behave_ differently? It seems to me that applying arithmetic operations to `b` (e.g. `b.^2`, `b .+ b`, etc.) just gives back an object of type `Vector{Float64}`…So what is the point of Real numbers?

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [June 15, 2021, 8:51pm UTC](https://discourse.julialang.org/t/whats-the-difference-between-float64-and-real-and-what-is-the-real-type-for/62971/2 "2021-06-15T20:51:06Z")

</div>

`Real` is an abstract type, while `Float64` is a concrete type.

`Int64 <: Real` and `Float64 <: Real`

Abstract types don’t carry any information on memory layout. They are used to organize methods and organize types. See the docs [here](https://docs.julialang.org/en/v1/manual/types/#man-abstract-types).

---

<div class="post-metadata">

**Author:** ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)\
**Post date:** [June 15, 2021, 8:51pm UTC](https://discourse.julialang.org/t/whats-the-difference-between-float64-and-real-and-what-is-the-real-type-for/62971/3 "2021-06-15T20:51:46Z")

</div>

```julia
julia> Int64 isa Real
false

```

I think you meant

```julia
julia> Int64 <: Real
true

```

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [June 15, 2021, 9:00pm UTC](https://discourse.julialang.org/t/whats-the-difference-between-float64-and-real-and-what-is-the-real-type-for/62971/4 "2021-06-15T21:00:31Z")

</div>

If you want to write a function that accepts `Float32` and `Float64` and `Int64` and `Rational` etc. But _not_ complex numbers. Then `Real` is there for you.

And `Vector{Real}` is a container that accepts all those different number types that are subtypes of `Real`.
