Prev: Arithmetic operations for a combined number of floating values andintegers
Next: motor speed measurement
From: James Tursa on 24 Feb 2010 03:21 enviro <farhadnejadkoorki(a)yahoo.co.uk> wrote in message <1418213150.260148.1266998701372.JavaMail.root(a)gallium.mathforum.org>... > Dear all, > > It maybe simple but sometimes we need sum integer values and floating values (decimals) to get a floating results. However, it seems is not that easy like other operations in MATLAB. > > 1000 + 0.0001 should be 1000.0001 but in MATLAB it is just a n integer value of 1000. Likewise for summing two matrices with integer values and floating ones. Do you have any idea to find a simple way to get a floating result for arithmatic operations in this case. > > Many thanks Probably just a display issue. e.g., >> 1000 + 0.0001 ans = 1.0000e+003 >> format long >> 1000 + 0.0001 ans = 1.000000100000000e+003 Both give exactly the same result, but one prints more digits. James Tursa |