Skip to content

Instantly share code, notes, and snippets.

@andrewhummus
Created October 18, 2021 22:39
Show Gist options
  • Save andrewhummus/50d5e2c859970ffff3bd5532492b1cb8 to your computer and use it in GitHub Desktop.
Save andrewhummus/50d5e2c859970ffff3bd5532492b1cb8 to your computer and use it in GitHub Desktop.
float 64 vs float 32

float32 is a 32 bit number - float64 uses 64 bits.

That means that float64’s take up twice as much memory - and doing operations on them may be a lot slower in some machine architectures.

However, float64’s can represent numbers much more accurately than 32 bit floats.

They also allow much larger numbers to be stored.

For your Python-Numpy project I'm sure you know the input variables and their nature.

To make a decision we as programmers need to ask ourselves

What kind of precision does my output need? Is speed not an issue at all? what precision is needed in parts per million? A naive example would be if I store weather data of my city as [12.3, 14.5, 11.1, 9.9, 12.2, 8.2]

Next day Predicted Output could be of 11.5 or 11.5164374

do your think storing float 32 or float 64 would be necessary?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment