-2
$\begingroup$

Can anyone tell the meaning of the bold portion?

Float: It is used to store decimal numbers (numbers with floating point value) with single precision.

$\endgroup$
  • 2
    $\begingroup$ Any decent textbook on C (and even related languages) covers this. $\endgroup$ – dkaeae Mar 14 at 7:58
  • 2
    $\begingroup$ Also, if you are quoting something in a question, please at least surround it with quotation marks. It took me a minute to make sense of what you were really asking. $\endgroup$ – dkaeae Mar 14 at 8:00
1
$\begingroup$

You seem to be asking about some text on this page: https://www.geeksforgeeks.org/data-types-in-c/

The text about the float type is intended to say that float stores a single precision floating point value. The "single precision" refers to a specific well-known format for storing floating point values in computers; single precision values are 32 bits in size.

Floating point values are values represented internally in a fashion somewhat similar to scientific notation but using 2 instead of 10 as the number raised to a power. The 32 bits are separated in a sign, exponent, and mantissa, and the value stored by a floating point variable is:

$$ (-1)^\mathit{sign} \times 2^\mathit{exponent} \times (1.\mathit{mantissa}) $$

(Technically here, I'm talking about binary floating point, but that's what C's float type is.)

In a single precision float, the exponent is eight bits wide and the mantissa is twenty-three bits. (the sign is always one bit in any size floating point value)

The practical upshot of this is that you can use float variables to store real values that aren't integers; for example 1.5 or 3.14159. You should be aware that the way binary floating point numbers work is sometimes confusing and frustrating to new programmers; a basic guide to those issues can be found at https://floating-point-gui.de/.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.