Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


Curious
Posts:
1,978
Registered:
12/6/04


Re: precision of fractional numbers
Posted:
Oct 8, 2013 10:16 AM


"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <l30tbi$jau$1@newscl01ah.mathworks.com>... > Sorry should read > > > > round(x*100)/100 > >
Consider the OPs original request: More specifically, I would like Matlab to consider 3.257 as 3.26. It is feasible for a single number, but I am looking for a command to use in the first line of the script and that applies same format to all the numbers along the calculations.
First, the above would apply "for a single number" but not for every number in the entire script.
Second, although 3.257 would APPEAR to be 3.26 (to two decimal digits), I don't believe it would necessarrily be EXACTLY 3.26 due to the way MATLAB (or a computer, in general) stores floating point numbers. (I don't have MATLAB installed on this computer, so I can't give an example using the short and long formats.)



