How can I write a program that indicates a number if it is integer or not?
Mostrar comentarios más antiguos
How can I write a program that indicates a number if it is integer or not?
Respuestas (3)
James Tursa
el 15 de Mzo. de 2018
doc floor
doc ceil
doc round
What happens if you use one of these functions and compare the result to the original value?
Roger Stafford
el 15 de Mzo. de 2018
Editada: Roger Stafford
el 15 de Mzo. de 2018
If n is your number, then
round(n)==n
is true if and only if n is an integer
Star Strider
el 15 de Mzo. de 2018
isint = @(x) rem(x,1) == 0;
It returns a logical result.
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!