Smallest positive number in MATLAB

165 visualizaciones (últimos 30 días)
Dyuman Joshi
Dyuman Joshi el 27 de Abr. de 2021
Comentada: Dyuman Joshi el 30 de Abr. de 2021
I recently stumbled upon a question on Cody (#1874), which asked the user to input the smallest in MATLAB.
As per my knowledge, realmin was supposed to return the smallest number in MATLAB, however that number is the smallest normalized floating point number. According to this thread of Stack overflow, it says eps(0) returns the smallest denormal number available in MATLAB.
However, my question is how eps(0) is denormal?
> realmin returns 2.2251e-308, where as eps(0) returns 4.9407e-324

Respuesta aceptada

Stephen23
Stephen23 el 27 de Abr. de 2021
Editada: Stephen23 el 27 de Abr. de 2021
eps(0) returns the smallest positive non-zero floating point number, which is denormal:
format hex
eps(0)
ans =
0000000000000001
Normal and denormal floating point numbers are explained here:
From the main architect of IEEE 754 (the term "gradual underflow" refers to denormal numbers):
  2 comentarios
Dyuman Joshi
Dyuman Joshi el 27 de Abr. de 2021
Thanks for all the resources, @Stephen Cobeldick. I'll try to go through them all.
Dyuman Joshi
Dyuman Joshi el 30 de Abr. de 2021
Apparently I misunderstood the definition of a denormal (base 10 instead of base 2). Thank you for your answer and the links!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by