New Reply

Error in binary arithmetics

 
Share Thread Thread Tools
Dec17-12, 02:03 PM   #1
 

Error in binary arithmetics


Hello everyone !
I got a problem, I can't figure out why when I compute [itex]A+B[/itex] and [itex]2\times (\frac{A}{2}+\frac{B}{2})[/itex] the result is sometimes different.
Can anyone explain why the results of the two operations are different ?

Edit : A and B are coded in binary of course and we compute a binary addition.
PhysOrg.com
PhysOrg
engineering news on PhysOrg.com

>> NASA: Austin, calling Austin. 3-D pizzas to go
>> Research suggests modular design competence can benefit new product development
>> Army ground combat systems adopts tool for choosing future warfighting vehicles
Dec17-12, 02:12 PM   #2

Engineering 2012
 
Recognitions:
Gold Membership Gold Member
Science Advisor Science Advisor
Are you using integer or floating point ?

My guess is former , and one of the numerators is an odd number.
Dec17-12, 02:14 PM   #3
 
Integers I forgot to mention sorry.
Dec17-12, 02:24 PM   #4

Engineering 2012
 
Recognitions:
Gold Membership Gold Member
Science Advisor Science Advisor

Error in binary arithmetics


Well there ya go.

Got Basic?

FOR I = 1 , 10 , 1
PRINT I, INT( I/2)
NEXT I
END
Dec17-12, 02:32 PM   #5
 
Quote by jim hardy View Post
Well there ya go.

Got Basic?

FOR I = 1 , 10 , 1
PRINT I, INT( I/2)
NEXT I
END
I see thank you :) .
Dec17-12, 09:38 PM   #6
 
Recognitions:
Science Advisor Science Advisor
Quote by megaflop View Post
Integers I forgot to mention sorry.
Does only "misbehave" if you're using one or more odd integers?
New Reply
Thread Tools


Similar Threads for: Error in binary arithmetics
Thread Forum Replies
arithmetics and algebra, what/ which is the main concept? Set Theory, Logic, Probability, Statistics 22
Arithmetics in Z Linear & Abstract Algebra 3
Binary Search Error Programming & Comp Sci 0
A question on modular arithmetics Precalculus Mathematics Homework 5
Tertiary Arithmetics General Math 1