Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
7.39 not equal 7.39

Subject: 7.39 not equal 7.39

From: meng long

Date: 29 Nov, 2010 13:15:05

Message: 1 of 2

I get dBuyP transformed from C++, dBuyP = 7.39, as display is matlab.
I compute dUpP = round(100*6.72*1.1)/100 = 7.39 in matlab.

Then, I try (dBuyP==dUpP), false is resulted in matlab!!!!
         I try (dBuyP>=dUpP-0.0001), true is resulted in matlab!!!!

Why can I Know?

Subject: 7.39 not equal 7.39

From: Mark Shore

Date: 29 Nov, 2010 13:28:03

Message: 2 of 2

"meng long" <menglong6518@yeah.net> wrote in message <id090p$o5b$1@fred.mathworks.com>...
> I get dBuyP transformed from C++, dBuyP = 7.39, as display is matlab.
> I compute dUpP = round(100*6.72*1.1)/100 = 7.39 in matlab.
>
> Then, I try (dBuyP==dUpP), false is resulted in matlab!!!!
> I try (dBuyP>=dUpP-0.0001), true is resulted in matlab!!!!
>
> Why can I Know?

http://matlab.wikia.com/wiki/FAQ#Why_is_0.3_-_0.2_-_0.1_.28or_similar.29_not_equal_to_zero.3F

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us