How to subtract two close numbers?

2 views (last 30 days)
Hi!
I've compiled the code below and i don't know why it doesn't give exact zero.
I'll appreciate if someone helps me.
format long
x=5.4;
y=x-5;
z=y-0.4;
disp(z)

Accepted Answer

Stephen23
Stephen23 on 16 Oct 2019
Edited: Stephen23 on 16 Oct 2019

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices 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!