Julien
Julien

Reputation: 781

Julia - significance of f0 after a number

What is the significance of f0 in the following:

julia> 1.25f3

1250.0f0

What is the difference with 1.25 e3 which means 1.25 * 10^3 ?

I looked for in the documentation, but I did not find it...

Upvotes: 3

Views: 1572

Answers (1)

fredrikekre
fredrikekre

Reputation: 10984

That is a very old manual you are reading, take a look at this section instead: https://docs.julialang.org/en/v1/manual/integers-and-floating-point-numbers/ . The TL;DR is that with f you get Float32 (single precision) and with e you get Float64 (double precision):

julia> typeof(1.25f3)
Float32

julia> typeof(1.25e3)
Float64

Upvotes: 9

Related Questions