MatLab single precision epsilon versus double precision epsilon
Show older comments
when I solve for the epsilon of one, using a basic method. I get the following values for single and double precision.
double precision: 2.2204e-16
single precision: 1.1921e-07
why is that? I am 99% sure matlab's machine epsilon is correct for double precision. can somebody inform me if I am correct or incorrect? I will attach code later on.
1 Comment
eps(double(1))
eps(single(1))
Accepted Answer
More Answers (1)
KSSV
on 14 Jan 2022
For single precision epsilon is:
2^-23
For double precision epslon is:
2^-52
6 Comments
Aarav Shah
on 14 Jan 2022
Edited: KSSV
on 14 Jan 2022
epsilon = single(1);
while 1. + (epsilon/2) > 1.
epsilon = epsilon / 2;
end
epsilon
Aarav Shah
on 14 Jan 2022
2^-23
Aarav Shah
on 14 Jan 2022
John D'Errico
on 14 Jan 2022
How is the code that @KSSV shows different from what was said? What needs to be clarified in your mind?
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!