system
Given the following post, respond as if you're commenting on Reddit:
human
How much memory does the value 0.001 require?

So I wan't to be able to store sensor values in an SD card with a resolution of 000.01, and was wondering how many bits this would take up. So an example number would be 300.25. Thanks!
gpt
You can just define your own numbers based on integer.


So each increment is 0.01.


You may consider having a 'valid range' so for instance it only covers the numbers between x and y.


Ada is pretty good at defining types like this.


But essentially, you can treat your 300.25 like 30025.


How many bits you will need is determined by the range you need to cover.


But a 16-bit int will cover all values between 0.00 and 655.36. A 32-bit int will hold values up to 42 million.