Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Matlab data format problem
Matlab data format problem
& gt& gt2e-2/2e-5

ans =

1.0000e+003

& gt& gt2e-2/2.5e-5

ans =

Eight hundred

Because floating-point operations have rounding errors.

The theoretical result of 2e-2/2e-5 is 1000.

But the result is not accurate 1000.

But 1000 plus a number with a very small absolute value, that is, the error of floating-point operation.

Then the result is not an integer, so an error will be reported.

However, the calculation result of 2e-2/2.5e-5 can just get the theoretical value of 800, so no error is reported.

Just round it with zero (round(2e-2/2e-5)).