MATLAB: How to round number up to a specific number of decimal places
ceildecimalfix?floorMATLABround
Suppose I have a variable x=0.34; is there a function (or how would one look like) to round this number up to, say 0.4 (next highest number with one decimal place)?
We can tell from the number of decimal places that you show that you must be using symbolic numbers, so you can use vpa() to evaluate to a specific number of decimal places.
There is no way to round double precision numbers to a particular number of decimal places, because 0.1 is not exactly representable as a finite binary floating point number, for the same reasons that 1/7 is not exactly representable as a finite decimal number.
Best Answer