# \`Float\` type like \`Int\` type

**URL:** <https://discourse.julialang.org/t/float-type-like-int-type/1164>\
**Category:** General Usage\
**Tags:** proposal, faq\
**Created:** [December 27, 2016, 4:10pm UTC](https://discourse.julialang.org/t/float-type-like-int-type/1164 "2016-12-27T16:10:52Z")\
**Posts on this page:** 10\
**Page:** 2

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [March 13, 2017, 4:10pm UTC](https://discourse.julialang.org/t/float-type-like-int-type/1164/21 "2017-03-13T16:10:55Z")

</div>

@GunnarFarneback can you exemplify your usage of `Float32`? How having `Float` always point to `Float64` impact your workflow? I am doing image processing all the time too, but working with arrays instead of RGB, HSV, …

Again, the proposal doesn’t change the meaning nor the existence of `Float64` and `Float32`. It just saves us from typing these suffix numbers all the time, which makes code look more complicated than it is.

`Int` does the job for `Int32` and `Int64` and no one complains, even though it is more subtle and a function of the host machine. `Float` would do the job for `Float32`, `Float64`, etc. but always point to `Float64`, which is the most portable of all.

---

<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:** [March 13, 2017, 4:16pm UTC](https://discourse.julialang.org/t/float-type-like-int-type/1164/22 "2017-03-13T16:16:24Z")

</div>

How about having an alias, `Double`, for `Float64`? Matlab, too, uses that.

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [March 13, 2017, 4:18pm UTC](https://discourse.julialang.org/t/float-type-like-int-type/1164/23 "2017-03-13T16:18:38Z")

</div>

That would also be welcome! Something without bits on it.

---

<div class="post-metadata">

**Author:** ![vchuravy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vchuravy/32/8_2.png) [@vchuravy](https://discourse.julialang.org/u/vchuravy)\
**Post date:** [March 13, 2017, 4:38pm UTC](https://discourse.julialang.org/t/float-type-like-int-type/1164/24 "2017-03-13T16:38:44Z")

</div>

For me the explicitness that Julia carries with it is very welcome. The notion that `Float32` or `Float64` is non-julian seems odd to me since being explicit is normally preferred in Julia. I have a slight distaste for `Int` and prefer using `Int32` and `Int64`, while using `Int` only when interfacing with C code that is platform dependent. For me code should always be written in a way that makes _reading_ it easier than _writing_ it, so I prefer being explicit event though I have to type more.

Again there is no natural Float type and you might want to choose `Float32`, `Float16`, `Float64`, `Float128` depending on your algorithmic needs. In a loot of use-cases the using the extended precision provided by `Float64` is not necessary and you can use Float32 and have correct results.

As a side note, please don’t make sweeping general statements. Instead make statements about your personal experience.

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [March 13, 2017, 4:39pm UTC](https://discourse.julialang.org/t/float-type-like-int-type/1164/25 "2017-03-13T16:39:25Z")

</div>

This is an amazingly tedious thread. It’s been pointed out that this has been discussed at least half a dozen times previously. The reasons for the status quo have been given – yet again. None of those reasons have really been refuted, and the only counter-argument boils down to “I don’t want to write digits”. You don’t have to – just define `const Float = Float64` in your own code.

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [March 13, 2017, 4:44pm UTC](https://discourse.julialang.org/t/float-type-like-int-type/1164/26 "2017-03-13T16:44:36Z")

</div>

Thanks for joining the discussion, I consider this thread closed.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [March 13, 2017, 4:44pm UTC](https://discourse.julialang.org/t/float-type-like-int-type/1164/27 "2017-03-13T16:44:42Z")

</div>

> [@vchuravy](#):
>
> For me the explicitness that Julia carries with it is very welcome. The notion that Float32 or Float64 is non-julian seems odd to me since being explicit is normally preferred in Julia. I have a slight distaste for Int and prefer using Int32 and Int64, while using Int only when interfacing with C code that is platform dependent.

This can cause some problems though. Sometimes if your dispatches require Int64 (admittedly too strict), then your code will fail on 32-bit machines if someone tries to pass something like `1` since that will be an `Int32`. Using `Int` stops a lot of these problems.

And this isn’t just theoretical. I changed a bunch of `Int64`’s to `Int` to fix Windows 32-bit tests for Optim.jl not too long ago. So `Int` is very practical.

`Float` on the other hand, can always be replaced by `Float64`. So there is no true analogue to `Int` in the floating point domain. Instead, it would be weird if `Float64` didn’t have the bits, because then it would be the only fixed-length numbers which don’t mention their bit length. All of the signed + unsigned integers do it, every other float does it, just `Float` would be the odd man out.

---

<div class="post-metadata">

**Author:** ![simonbyrne](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simonbyrne/32/19_2.png) [@simonbyrne](https://discourse.julialang.org/u/simonbyrne)\
**Post date:** [March 13, 2017, 4:46pm UTC](https://discourse.julialang.org/t/float-type-like-int-type/1164/28 "2017-03-13T16:46:29Z")

</div>

`float` and `double` are a hangover from the days when floating point formats differed between computers (essentially the only requirement of the C is that `float` is a subset of `double`). Fortunately, these things are now standardised (as IEEE754 `binary32` and `binary64`) so it makes sense to give them names that reflect this.

Also, `double` is simply a terrible name (“double” of what?). At least Fortran (where I assume it originates) was more descriptive, calling it `double precision`.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 13, 2017, 4:48pm UTC](https://discourse.julialang.org/t/float-type-like-int-type/1164/29 "2017-03-13T16:48:21Z")

</div>

I am not in favor of aliases (I consider `Int` more of a necessity than a feature). I prefer the approach @vchuravy outlines below.

---

<div class="post-metadata">

**Author:** ![dysonance](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dysonance/32/148_2.png) [@dysonance](https://discourse.julialang.org/u/dysonance)\
**Post date:** [March 14, 2017, 12:32am UTC](https://discourse.julialang.org/t/float-type-like-int-type/1164/30 "2017-03-14T00:32:13Z")

</div>

My apologies, I must admit I definitely had not intended to restart an old argument and beat what I honestly had no idea was a long-dead horse. Thanks for your patience and effort explaining 🙂

Honestly, it just seemed odd to me that `Int` and `Float` didn’t have parallel meanings and as I’ve been using Julia for a while now without understanding the difference (or reason) I just wanted to bring it up as either (a) a potential future change if many agreed, or (b) an addition to some FAQ section like @stevengj suggested to prevent any confusion especially for Julia newcomers.

[Previous page](https://discourse.julialang.org/t/float-type-like-int-type/1164.md?page=1)
