MatLab single precision epsilon versus double precision epsilon
Afficher commentaires plus anciens
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 commentaire
eps(double(1))
eps(single(1))
Réponse acceptée
Plus de réponses (1)
KSSV
le 14 Jan 2022
For single precision epsilon is:
2^-23
For double precision epslon is:
2^-52
6 commentaires
Aarav Shah
le 14 Jan 2022
Modifié(e) : KSSV
le 14 Jan 2022
epsilon = single(1);
while 1. + (epsilon/2) > 1.
epsilon = epsilon / 2;
end
epsilon
Aarav Shah
le 14 Jan 2022
2^-23
Aarav Shah
le 14 Jan 2022
John D'Errico
le 14 Jan 2022
How is the code that @KSSV shows different from what was said? What needs to be clarified in your mind?
Catégories
En savoir plus sur Mathematics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!