@OP
1. In human vocabulary, the integer number refers to a number with no decimal point and fractional part; it has only integer part. For example: 1234.
2. In human vocabulary, the decimal number refers to a number with integer part, decimal point, and fractional part. For example: 12.37. In programming language, it is known as floating point number or simply float.
3. How to store a integer number like 1234 into computer memory?
We simply execute the following instruction; as a result, the given number is automatically saved into two consecutive memory locations. The given integer number is always saved as binary bits in the computer memory. This is to say that the given integer number of base 10 is converted into binary number of base 2 (123410 ---->00000100110100102 ---->04D216) and then it is saved into computer memory. As one memory location can hold 8-bit data, we need two memory locations to hold the given data.
unsigned int x = 1234;
===> unsigned int x = 0x04D2;
4. How to store a floating point number like 12.37 into computer memory?
(1) According to IEEE-754 Standard (aka binary32 format), a float number (+ve or -ve) will be coded into 32-bit data as per following template in order to store it into computer memory. This is what we call '32-bit representation of a float number'.
Figure-1: 32-bit representation of a float number (for example: 0.15625)
(2) Manual procedure to obtain binary32 formatted value for the float number 0.15625.
(a) Calculating binary bits of 0.15625
0.15625x2 = 0.3125
0.3125x2 = 0.625
0.625x2 = 1.25
1.25x2 = 0.50
0.50x2 = 1.00
... continue until the residual is exhausted to 0 or 23 fractional bits are accumulated
(b) 0.1562510 = 0.001012
==>0x20+0x2-1+0x2-2+1x2-3+0x2-4+1x2-5
==> 0 + 0 + 0 + 0.125 + 0 + 0.03125
==> 0.15625
(c) 0.001012
==> 1.012*2-3
(d) binary32 format value of 0.15625 as per Fig-1.
Sign (1-bit: b31: 0 (the given number is +ve)
Biased exponent (8-bit : b30 - b23): -3 (from Step-4c) + 127 (fixed bias) = 124 = 7Ch
fraction (23-bit: b22 - b0) 01000000000000000000000 (from Step-4c)
(e) binray32 value: 0(sign) 01111100(biased exponent) 01000000000000000000000(fraction)
(f) Arranging as nibbles: 0011 1110 0010 0000 0000 0000 0000 0000
(g) Presenting in hex: 3E200000 (4-byte = 4x8 = 32-bit)
5. Programming codes to generate binary32 formatted value for a float number (say: 0.15625)
(1) When we make the following declaration using the keyword float, the binary32 formatted 32-bit (4-byte) value is automatically saved into 4 consecutive memory locations. The low order memory location holds the lower byte of the data.
float x = 0.15625;
(2) We may execute the following codes to collect the 32-bit data from the unseen memory locations and show it in the Serial Monitor.
float x = 0.15625;
unsigned long *ptr;
ptr = (unsigned long*) &x;
unsigned long m = *ptr;
Serial.println(m, HEX); //shows: 3E200000
6. Precision of a binary32 formatted float number
Precision refers to the number of digits after the decimal point that we can present. For the binary32 formatted float number, the precision is 23 digits.
7. Accuracy of a binary32 formatted float result
Accuracy refers to 'how many' digits are coming out exactly in the result during the processing of two/more float numbers. For example:
float x1 = 12.12345678;
float x2 = 23.12345678;
----------------------------------------------
Sum on manual calculation: 35.24691356
Sum using program codes:
float x = x1 + x2;
Serial.print(x, 23); //shows: 35.246913 90991210937500000
The accuracy is 6-digit; whereas, in manual calculation we have 8-digit accuracy.
8. double type floating point number.
This is a 64-bit representation of a floating point number. In this representation, there are 53 fraction bits after the decimal point in addition to a very large integer part. The result of the processing of double type float numbers gives about 15-digit accuracy. The encoding format (known as binary64) is:
Figure-2: 64-bit (binary64 formatted) representation of a float number
9. Arduino UNO, NANO, and MEGA (all 8-bit AVR) supports only 32-bit representation of float number. In these Arduinos, the keywords float and double mean the same thing -- the binary32 format.
10. Arduino DUE supports both 32-bit and 64-bit representation of decimal numbers via the keywords float and double respectively.
I apologize and seek correction if any misconception is being carried by this post.