Floating-point number: What is it?
The floating-point number in computer science is often in the case of measuring devices, which are intended to work with a certain accuracy, use.
- A floating-point number (or "floating point number") is a representation of a number using exponential notation. In exceptions, this only works as an approximation. The number 1230000 can represent you with the number of 1,23 ⋅ 10⁶.
- The of 1.23 is called here, "mantissa". The 10 is the "base" and the 6 is the Exponent. The mantissa, a sign could attach. The Whole you can apply also to the dual system. The number 10101100, you can represent with the number of 1,0101100 ⋅ 2⁷. The Computer stores only the sign, mantissa and Exponent.
- Computer slide usually the comma as long as the back-and-forth, until there is only a 1 before the decimal point is. Then the PC needs to store only the fractional part of the mantissa, and the exponent.
- Thus, the Exponent can be stored as a positive number, is added to a fixed number, the so-called Bias. The smallest possible Exponent of the place before the decimal point (Bias) is stored as 0.
- In contrast to the fixed-point number is the decimal point in a floating-point number to a fixed point.

Floating-point number: What is it?
Half, Float, & Double - Common encodings of floating-point numbers
These three terms are certainly, in particular when programming with the Arduino, once stumbled. It is normalized representations.
- The data type of "half" is a 16-Bit number. The leftmost Bit is for the sign of the charge. The Exponent has 5 Bits, and the mantissa is 10. As a Bias of 15 is used. Since the first Bit of the mantissa is (almost) always 1, is not stored.
- The data type "float" (or "single") is a 32-Bit number. Also here is used a Bit for the sign. The Exponent has 8 Bits available (that is, Bias = 127) and the mantissa is 23.
- Also, the data type "double" is used a Bit for the sign. In this case, the Exponent has 11 Bits available (that is, Bias = 1023), and the mantissa even 52 Bits. A total of 64 Bits, i.e. 8 bytes.
- In addition to these three common data types, there are also many more. However, these are not usually used, since the accuracy of half, float and double is good enough.

Floating-Point Numbers: Half, Float, & Double
Decimal numbers to convert numbers in floating point - so it goes
Finally, we would like to show you how you can convert a normal decimal number in a floating-point number.
- In this example, we use the decimal number to 18.4. This is first of all the number before the comma in the dual system to transfer. As a result, you should get (10010)₂.
- Then, you need to convert the 0.4. You multiply first, which is 0.4 with 2. As a result, you get a 0.8. Make a note of the number before the decimal point. In this case, the is a 0. Then multiply the 0.8 with 2. This Time you will receive as a result of 1.6. Make a note of the 1 and expect to 0.6. After some time, you will notice that the pattern (repeated in this example). Make a note of finally, all the Numbers from top to bottom: 011001100110...
- Together then add the Numbers:. Supplement also (⋅ 2⁰), so you 10010,01100110... ⋅ 2⁰ get. Then, move the decimal point until only one 1 before the decimal point is, and you also change to match the potency. As a result, you should get 1,001001100110... ⋅ 2⁴, since you have moved the decimal point 4 Places to the left. This step is also called "Normalize".
- In this example, the data type "float" use. So add to your exponent the appropriate Bias value. The result of the calculation 4 + 127 = 131 you need to convert back into a binary number. The number 131 is in the dual system, the number 10000011.
- Now you can write down the ready-to-floating-point number. You write as the First Bit for the sign. Since it is a positive number, the first Bit is a 0. After that, you need to write the 131. The Whole thing fits in this case perfectly, because this number requires 8 Bits and a float is also 8 Bit are available. Finally, you need to write down the first 23 Bits of the mantissa, as in the case of a float, the mantissa has 23 Bits available.
- Your finished floating-point number should be the number 01000001100100110011001100110011. A bit clearer is shown that the number 0/10000011/00100110011001100110011.

Floating point numbers will convert exchange rate (source:Pixabay)
Floating-point number in decimal number to convert - so it goes
To conclude, we would like to show you how you can convert a floating point number back into a decimal number. For this, we take the number 1000001100100110011001100110011.
- You must fill out the first number (in front) with zeros until you get a 16 -, 32 -, or 64-Bit number. In this case, the 01000001100100110011001100110011 is.
- The first digit stands for the sign. Our number is positive.
- Then write down the next (in this case) 8 digits, and subtract the Bias. (10000011)₂ = 131 → 131 - 127 = 4 → Rear is so "⋅ 2⁴".
- Write a "1," and then all the remaining Numbers, as well as the "⋅ 2⁴": 1,00100110011001100110011 ⋅ 2⁴
- Move the comma, then 4 spaces to the right, so you can omit the "⋅ 2⁴": 10010,0110011001100110011
- You are to expect next, the 10010 as usual in an integer. You get 18.
- Now you need to convert the Digits after the decimal point. The first digit after the decimal point has the value of 1 : 21, the second 1 : 22, and so on. You add the values, and the number before the comma you will get the number 18,3999996185302734375.
In the next practical tip we show you how to ASCII characters to binary numbers, convert can.
