|
I commonly see floating point numbers being used when bench-marking processors in common bench-marking software such as geekbench. I just wonder how are each handled by the processor/ memory? |
|
Integers are stored as a binary number. For example, the number 7 would be stored as 00000000000000000000000000000111 in a 32 bit computer. Floating point numbers are stored slightly differently. The following link will take you to a page which explains exactly how floating point numbers are stored - http://introcs.cs.princeton.edu/java/91float/ The instructions which the processor gets from the memory are also stored as binary numbers. Each instruction that the processor can do is given a binary number. The list of instructions and the binary numbers for the instructions is called the Instruction Set. The computer will read the instruction from memory, and then process the data appropriately. Hope this helps! :) Thanks for the help ;P but wouldn't the FPU and ALU be used in the processing ? FPU for floating point numbers and ALU for integer numbers Floating points are probably used as a simple way to generate a lot of work for even a strong CPU. I would assume that integers would occur periodically though unintended. Is that what you were asking? Im Asking how the processor/ memory handle integer and floating point numbers? Are they handled by using the ALU and the FPU? Thanks :P The ALU passes the binary through logic gates, (in the form of transistors) which will output the result. The logic gates it passes through will differ depending on the instruction. The FPU is a little bit more complicated. It also uses logic gates to process the operands, but it uses a more advanced algorithm to do so. As trueb said, if you want to know the process that the FPU uses, then look at the IEEE 754 standard, as that outlines it all. Hope this information helps! Considering the current ways of threading and caching that's probably quite a can of worms. Well over my head to say the least.
showing 5 of 6
show all
|
|
ok here is some background: an integer is nothing more then a binary number you have two flavors unsigned and signed, unsigned is pretty simple if you know binary. Signed, however, you have a sign bit and something called twos complement. being that this is not what you asked we will skip over this. a floating point number can represent really large number and really small number, it is very different a floating point number has three parts, the sign, the exponent, and fraction. The sign part is always one bit, and is the most significant bit in the number. The exponent is 8 bits in a single floating point and 11 in a double floating point number. The fraction represents the fractional part it is 23 bits in a single and 52 in a double. There are some special cases for example you have the number 0, infinity, negative infinity, and NaN (not a number) If the value is zero both the exponent and the fraction are both 0, sign bit does not matter. If the value is infinity the exponent is all ones, and fraction is all zeros, sign bit is zero If the value is negative infinity the exponent is all ones, the fraction is all zeros and the sign bit is 1. In this case for NaN the exponent is all ones, the fraction is a non zero number, and the sign does not matter. When you are adding to floating point numbers here are the steps:
This is a very detailed topic and i cannot get into all of it now. everything is detailed in the IEEE 754 standard. |
