Yeah, the noob question of the century... But in all seriousness, I actually have no idea what a float value actually is... And more importantly, the difference between a float and an integer.

Thanks in advance!

In basic terms:

Floating point value is a real number which is allowed to have decimal points.

Integer value has no decimal points (a whole number if you like)

In this case, Wikipedia is your best friend:

Though you should probably start just on the data types overview

Also, implementations of data types vary by language and processor architectures (e.g. integers are different numbers of bits on different architectures), but if using C as canon (C is the de-facto standard for system programming and is considered "just-above" assembly language in terms of abstraction) then these resources should be further enlightening:

Let me google this for you!

http://en.wikipedia.org/wiki/Primitive_data_type#Floating-point_numbers

Pretty interesting read for pros and beginners! Enjoy.

What every computer scientist should know about floating-point arithmetic http://download.oracle.com/docs/cd/E19957-01/806-3568/ncg_goldberg.html

Numerical Computing with IEEE Floating-Point Arithmetic http://www.amazon.com/Numerical-Computing-Floating-Point-Arithmetic/dp/0898714826/ref=wl_it_dp_o?ie=UTF8&coliid=IUNMIY7UE6ZS2&colid=2UDAD4OEO371J

IEEE 754-1985 http://en.wikipedia.org/wiki/IEEE_754-1985

See

Basically, the floating point data type is a way of storing a numeric value in scientific notation. You might write 2.3789 x 10^12, but since computers work in binary, it's a binary scientific notation.

Floating point values, in software, trade magnitude for absolute precision (you've only got so many bits to spread around).

Integers are...well..integers. The rightmost (low-order bit) represents 2^0 (e.g., 1), the next bit represents 2^1 (2s), the next 2^2 (4) and so forth. The leftmost (high-order) bit represents the sign (0 is positive, 1 is negative). Which brings us to negative values: they are represented in what's called two's-complement notation. To get the two's complement of a positive number:

- flip all the bits: zeros become ones and ones become zeros.
- add 1 to the result, doing all the usual carries.

So an eight-bit positive 1 (in binary, 00000001) get converted to its negative representation (11111111) by

`00000001`

The original value.`11111110`

Flip its bits`11111111`

Add 1

The advantage of two's complement notation is that addition and subtraction use the same circuitry: subtraction is implemented via addition: Using are +1/-1 example above, yields zero: add the rightmost bits giving you a binary 10 (decimal 2). Carry that to the next column, repeat the addition. The carry propagates out through the sign bit giving you the final value of 00000000.

There used to be systems that used other representations, but most (if not all) modern computers use two's-complement notation.

Then, of course, there is bit-order (big-endian v. little-endian) but that's another story.

float is a datatype.

I want to expand on something that Nicholas Carey mentioned in his answer:

Floating point values, in software, trade magnitude for absolute precision (you've only got so many bits to spread around).

This is the reason why we call them "floating point numbers" - we allow the decimal point to "float" depending on how big the number that we want to write is.

Let's give an example in decimal notation. Suppose that you are given 5 cells to write down a number: _ _ _ _ _ . If you don't use decimal points, then you can represent numbers from 0 to 99999. However, the smallest difference that you can represent is 1.

Now you decide that you need to write down dollar amounts so you add a decimal point two digits from the left: _ _ _ . _ _ This is called fixed point arithmetic. Now you can only write numbers from 0 to 999.99, but you can now represent a difference of one cent or 0.01

What if you wanted to use this program for both small day-to-day expenses and for your income tax? You can allow the decimal point to 'float' and represent it's position using one of the digits: [_] _ _ _ _

For example, your bank interest may be [3] 4 7 6 5 representing 4.765, your grocery bill may be [2] 5 9 8 2 (59.82), your rent payment 1 8 7 5 9 ( 875.9 ) and your income tax return [0] 2 3 8 9 (2389). You may even allow the decimal point to venture outside the digits like this: [-1] 4 5 9 8 represents 4598x10 = 45,980.

Note that you can now represent both very small and very big numbers, but you cannot represent all numbers exactly. For example, in writing [0]2389 we loose the cents.

It is more conventional to always think of floating point numbers in scientific notation like 4.598x10^4 where '4.598' is called the significand, '4' is the exponent, and '10' is the radix. The links mentioned by others have more detail on the actual storage format.

Similar Questions

What does a rack handler do exactly, i.e. can someone explain in pseudo-code the steps that a rack handler takes to deliver a result for a request?

What exactly does mqtt depend on tcp for? As in can it survive without TCP?? I get the connection oriented protocol and stuff but is there more to the relation between MQTT and TCP??

I hear a lot about spring, people are saying all over the web that Spring is a good framework for web development. But what exactly is it for? How can I use it for my Web-Java application development?

This is an expansion of the scope of a previous question of mine. What exactly is static, how is it used, and what is the purpose of using static when dealing with C++? Thanks.

What is exactly is a content level merge? I've heard this term used a couple times in git discussions.

What is Container.DataItem exactly?

I'm looking at this example of how to drag things around the screen and my only point of confusion is what exactly IS the Canvas c object being passed in? Is this View occupying the entire screen? Wha

For some reason it is almost impossible to search for '=>' Can anyone explain exactly what it means and when it is used? Thank you!

Based on this answer - http://stackoverflow.com/questions/3778647/how-to-change-classes-on-click can somebody explain me what exactly the code below is doing? $(a).click(function() { var $this = $(t

I am just starting to learn MPI. The implementation is MPICH2. The first thing I encountered is SMPD i.e Simple Multi-Purpose Daemon. I want to know what exactly it is and how it is related to MPI M

According to the docs you always use a doxygen tagfile pointing at a set of HTML files. So what exactly does the tagfile itself do? For a moderately sized project that generates 700 HTML files my tagf

How I can discover, what means all bits in binary representation of float-pointing type? If I have a double, or float, or long double, every type take some bytes. For example, double in Visual C++ tak

what this exactly do : <xsl:if test=./employee/first-name[@id='14'] > I mean, when will this case be true, if ./employee/first-name[@id] != null or , or what exactly? EDIT: I have edited t

When doing a XMLHttpRequest and using POST as the form method, what exactly am I sending? I know it should be like send(parameters), parameters = variable1=Hello, for example. But what if I want to

I came across several references to the concept of a dual issue processor (I hope this even makes sense in a sentence). I can't find any explanation of what exactly dual issue is. Google gives me link

What exactly does the word patch mean when refering to 'submitting a patch'? I've seen this used a lot, especially in the open source world. What what does it mean and what exactly is involved in subm

I looked into some TypeScript source code lately and came across a property typed like this: private _properties: {[name:string]: string}; I asked myself what this type refers to? What is it exactly?

I have been scouring the CVS man page for a while now, but am not able to follow what this CVS command is meant to do exactly. There appears to be multiple listings for -F in the man page, Im not sure

When someone is calling a function by SOME or ANY makes me unsure about this. Can I think about SOME as OneOf or OneFrom? Like an array (table) searching function? If yes, then what's the di

Of the possible DEFLATE compression levels [0 .. 9], which one exactly Java's Deflater.DEFAULT_COMPRESSION correspond to? In the Java source code, I see it as public static final int DEFAULT_COMPRESSI

Alright, my friend gave me this code for requesting headers and comparing them to what the header should be. It works perfectly, but I'm not sure why. Here is the code: $headers = apache_request_head

As the title says, What exactly is the as-if rule? An typical answer one would get is: The rule that allows any and all code transformations that do not change the observable behavior of the p

I've almost completed my C Primer Plus book and I'm about to hit Structures and Unions, etc... etc..., but I still don't have a full grasp of what exactly the keyword void is. What does void do? How d

What does a Web service really mean ? I am not looking for a theoretical explanation, I am looking for something practical. I was thinking that anything I can call from an external client is a Web ser

Does Listening a port means a continuous polling to that port or a discrete polling or an interrupt driven process. What exactly is going on in Listening to a Port?

In a C function declaration, I have seen this parameter definition: void *userData so, what exactly is that? My guess: the void says it can be anything arbitrary, or even nothing. Almost similar to i

I encountered the following in Scala code: class MyClass { ... val a = new A; import a._ } What does exactly val a = new A; import a._ mean ?

I understand that a git server hosts the master copy of a git repository. But what technically constitutes one? If I am in Eclipse, for example, and configure a remote in my repository is there anythi

In Mysql Administrator, when doing backups, what exactly is Compatibility Mode? I'm trying to bridge backups generated by webmin with the upload tool available inside mysql administrator. My data a

What exactly is RESTful programming?

Some say, it's making web content more personalize. Others say it's about sharing documents in a better way. What is it really? Exact Duplicate: http://stackoverflow.com/questions/32315/what-is-web-

So what gets stored in MongoDB logs? I checked out MongoDB documentation and wasn't able to find anything concrete on the subject, so I figured I would ask here. I had to peek into the logs to attempt

I'm reading Professional Assembly Language by Richard Blum,and I am confusing about a Inconsistency in the book and I wondering what exactly is program stack's growth direction? This is the picture fr

I use delegates (Actions, WaitCallbacks, Funcs) quite often but I am trying to get a better understanding of exactly 'what' they are. I have a fairly good understanding of objects vs reference types,

I always see people mention that Python binding and C Sharp binding etc. when I am actually using their C++ libraries. What does binding mean? If the library is written in C, and does Python bindi

As sou can see from the screenshot most of the time spent is waiting for a server response (thats the purple coloured area). What exactly is that server response time? Is the server too slow? Is my co

Rollback is used to reach the previous commit, but what will it do exactly?

I've read that setjmp saves the program state in the passed-in jmp_buf variable, but I haven't found any description of exactly what that entails. Does it make a copy of all the application's memory

Like almost anyone who's been programming for a while, I'm familiar with the term production code and have a vague sense of what it means. However, can someone offer a semi-rigorous definition, sinc

GCC has C extension which allows using nested functions. Actually, I don't understand what exactly can higher order functions in Haskell do (or other pure functional language) that C (function pointer

In Maya, when using the setAttr() command, we can use float and double as a variable type. What is the difference? The example in the documentation is the same one. -type float3 Array of three floats

There's setDoOutput() in URLConnection. According to documentation I should Set the DoOutput flag to true if you intend to use the URL connection for output, false if not. Now I'm facing exactly th

I'm confused on the concept of being immutable. Our professor is saying ints are immutable! Strings are immutable everyday, what does he mean by that exactly? A more general question, how do we kn

On MSDN I can read what it does, but I would like to know what it does technically (tells compiler where to look for types..)? I mean using as a directive.

For Acid to store values of type T, one must write $(deriveSafeCopy 0 'base ''T) after the definition of T. But what exactly does this command do?

dateadd(D, 1, getdate()), dateadd(Y, 1, getdate()) What is the difference between these two? Can anyone explain why they are giving same result? I am trying to get training completed date should be

What exactly is going on inside this Win32 messaging loop? I understand that TranslateMessage is converting keycodes to UTF char codes and sending the WM_CHAR event, but what is the call to PeekMessag

It's hard for me to grasp what exactly a return statement is doing. For instance, in this method... public int GivePoints(int amount) { Points -= amount; return amount; } Even if I place any random

What is the purpose and function of roles in a Capistrano recipe? When I look at sample recipes, I often see something like this: role :app, 'somedomain.com' role :web, 'somedomain.com' role :db, 's

Now, bear with me, I'm new to c++. While following an online tutorial for c++, it mentioned that all #define is used for is to define a constant, like this. #define RANDOM_CONSTANT 288 What I'm confu