Floating Point Addition - hardware/software

In summary, when adding floating point numbers on a x86 processor, the fractional part of the number with the lower exponent is shifted to the right and added to the other number, resulting in a truncation error. This method favors the larger exponent, which is why it is better to add numbers from smaller to larger rather than the other way around.
  • #1
coolul007
Gold Member
271
8
Can someone explain to me how floating point addition is implemented on a x86 in hardware or software. I would like to find out what method is used to add varying number size. if I have a 1 X 10^-100 + 2 X 10^50. are the exponents average for a common ground or does the large one rule etc. or is it something else?
 
Technology news on Phys.org
  • #2
The fractional (mantissa) part of the number with the lower exponent is shifted to the right before addition is performed. This results in truncation error.
 
  • #3
rcgldr said:
The fractional (mantissa) part of the number with the lower exponent is shifted to the right before addition is performed. This results in truncation error.

Thanx, for the answer, this came up in a question in the math section "is it better to add an array of numbers from smaller to larger or larger to smaller". Everyone answered small to large, which got to me to thinking about what really goes on...Therefore the larger exponent rules.
 

Related to Floating Point Addition - hardware/software

1. What is floating point addition?

Floating point addition is a mathematical operation used in computing, specifically for performing calculations with numbers that have a fractional component. It is commonly used in scientific and engineering applications where precision is important.

2. How does floating point addition work?

Floating point addition works by converting numbers into a standardized format, where the fractional portion is represented by a binary number and the whole number portion is represented separately. The numbers are then added together using a predetermined algorithm, taking into account the exponents and rounding to maintain accuracy.

3. What is the difference between floating point addition in hardware and software?

Floating point addition in hardware is typically performed by specialized processors, known as floating point units (FPUs), which are designed specifically for this task. In contrast, floating point addition in software is performed by the computer's central processing unit (CPU), which is a more general-purpose processor. This can result in differences in speed and accuracy.

4. What are some common issues with floating point addition?

One common issue with floating point addition is the limited precision of floating point numbers, which can result in rounding errors and inaccuracies. Another issue is the potential for overflow or underflow, which occurs when the result of an addition operation is too large or too small to be represented accurately.

5. How can floating point addition be optimized for speed?

Floating point addition can be optimized for speed by using specialized hardware, such as FPUs, which are designed to perform these operations quickly and efficiently. Additionally, algorithms and programming techniques can be used to minimize the number of operations needed and reduce the likelihood of overflow or underflow.

Similar threads

  • Computing and Technology
Replies
4
Views
833
Replies
4
Views
1K
  • Programming and Computer Science
Replies
1
Views
2K
  • Programming and Computer Science
Replies
1
Views
2K
  • Programming and Computer Science
Replies
2
Views
2K
  • General Discussion
Replies
14
Views
2K
  • General Discussion
Replies
15
Views
1K
  • General Math
Replies
1
Views
2K
  • Linear and Abstract Algebra
Replies
2
Views
2K
Back
Top