Storing a floating-point number in C - Printable Version +- QP School (https://qomplainerzschool.lima-city.de) +-- Forum: Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=3) +--- Forum: C 18 Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=32) +--- Thread: Storing a floating-point number in C (/showthread.php?tid=5143) |
Storing a floating-point number in C - Qomplainerz - 07-26-2023 Description: The float data type in C is used to store single-precision floating-point numbers. It typically occupies 4 bytes of memory and can represent a wide range of real numbers. However, it has limited precision, so it may not be suitable for applications requiring high accuracy. Example: float pi = 3.14159; Explanation: In this example, we declare a variable pi of type float. We initialize it with the value 3.14159. The float data type can represent real numbers with a range of approximately ±3.4E+38 and typically has 6 to 9 significant decimal digits of precision. |