integer - What exactly is a float? -
yeah, noob question of century... in seriousness, have no idea float value is... , more importantly, difference between float , integer.
thanks in advance!
see
basically, floating point data type way of storing numeric value in scientific notation. might write 2.3789 x 10^12, since computers work in binary, it's binary scientific notation.
floating point values, in software, trade magnitude absolute precision (you've got many bits spread around).
integers are...well..integers. rightmost (low-order bit) represents 2^0 (e.g., 1), next bit represents 2^1 (2s), next 2^2 (4) , forth. leftmost (high-order) bit represents sign (0 positive, 1 negative). brings negative values: represented in what's called two's-complement notation. two's complement of positive number:
- flip bits: zeros become ones , ones become zeros.
- add 1 result, doing usual carries.
so eight-bit positive 1 (in binary, 00000001) converted negative representation (11111111) by
00000001original value.11111110flip bits11111111add 1
the advantage of two's complement notation addition , subtraction use same circuitry: subtraction implemented via addition: using +1/-1 example above, yields zero: add rightmost bits giving binary 10 (decimal 2). carry next column, repeat addition. carry propagates out through sign bit giving final value of 00000000.
there used systems used other representations, (if not all) modern computers use two's-complement notation.
then, of course, there bit-order (big-endian v. little-endian) that's story.
Comments
Post a Comment