Why do I get different results for this division?
Show older comments
Hello,
I have the following piece of code. I expect to get b = 0:
R1 = 1e3;
Cond = 2e-12;
b = 1/R1/Cond - 1/(R1*Cond); % The result is not zero
But if I try the following, the result is zero:
A = 4;
B = 2;
C = 1/A/B - 1/(A*B);
I thought that the operation 1/a/b was always equal to 1/(a*b). Maybe it's due to the fact that the variable Cond is small. I'd like to know why there are differences.
Thanks.
Accepted Answer
More Answers (0)
Categories
Find more on Linear Algebra in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!