That way you can increase the precision where it matters more, at the cost of lower precision where it matters less. In a floating point representation, the values are not evenly spread: they are more densely packed closer to zero. The name comes from there being a fixed number of digits after the decimal point, which is the same for every number: if you can represent 1000.334 but not 1000.3344, then you can also represent 0.456 but not 0.7896. There are as many different values between 0 and 1 as there are between 1 000 000 and 1 000 001. In a fixed point representation, the values are all spread out evenly. This means two things: you have to pick minimum and maximum values that that type can represent, and you have to decide how to distribute the values in this interval between the two extreme values. Since each bit can have two different values, and there are 32 of them, that means there are 232 (or 4 294 967 296) different combinations, which means that this datatype can only represent that many different values. Now, you can make more complicated datastructures that have variable size, but for your basic datatype, that you would use to represent most numbers, it’s going to be of a fixed size.įor example, let’s say a number is represented by a sequence of 32 units that can have the value 0 or 1 (binary units, or bits). Well, numbers in a computer are all represented as a sequences of ones and zeroes (because everything in a computer is represented like that).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |