Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Storing a floating-point number in C
#1
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.
Also follow me on Youtube for videos about video games:
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Storing short integers in C Qomplainerz 0 262 07-26-2023, 03:45 PM
Last Post: Qomplainerz
  Storing an integer in C Qomplainerz 0 277 07-26-2023, 08:17 AM
Last Post: Qomplainerz
  Storing a single character in C Qomplainerz 0 212 07-26-2023, 07:45 AM
Last Post: Qomplainerz

Forum Jump:


Users browsing this thread: 2 Guest(s)