View Full Version : integers in matlab
Does anyone have an idea why this expression in Matlab with integers does not give zero as an answer:
>> 1019 / 250 * 250 - 1019
ans = -1.1369e-013
AFAIK, matlab doesn't specifically store an integer variable type.
If you need to be sure you have an integer output, use either:
fix(input)
or
floor(input)
to round it to the nearest or down to the next lowest integer.
Functions such as int2str automatically have a fix() in the command definition.
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.