how are float values exactly represented in memory......

Recommended Answers

All 5 Replies

Floats in C are usually stored as 32-bit (i.e. single precision) IEEE floating point numbers.

I want to know how is a floating point no. stored in memory i.e. if I enter a no. 1.2 ....how exactly would it be stored in memory in form of bits....where would the mantissa get stored..

The how is already sufficiently answered in the article linked in my first post. As to where: If it's a local variable, it will be stored on the stack - same as ints or any other type of value.

Its not that simple

What was that in reply to? What's not how simple? You're not saying, that floats are not stored on the stack, are you (nothing in the linked article would support that of course, but since your post came directly after mine, it kinda sounds like that might be what you're saying)?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.