The Crystal Programming Language Forum

Int32 and Float64 why the defaults?

Related to https://github.com/crystal-lang/crystal/issues/8111
Why are Int32 and Float64 the default primitive types? Why not both 32, or vice versa?
Thanks!

1 Like

Because Int32 occupies less space and is faster. And because you get more precision with Float64 and the speed difference / memory space for float usually doesn’t matter. But I might be wrong. I think we copied that from somewhere else too, I’m not sure.

2 Likes

These are the usual sizes integers and floating point numbers in C when compiled for x64.