Prev: rgb2ycbcr
Next: rgb2hsv functions mathmatical formula
From: James Tursa on 28 Dec 2009 12:40 "Tamas " <t.jambor(a)ucl.ac.uk> wrote in message <hhakvg$5ei$1(a)fred.mathworks.com>... > sorry, my mistake. even if it dispalyed -0.0000 is in fact not a zero... FYI, even though it is not applicable in your case, MATLAB uses IEEE floating point formats which *do* have negative zero. -0 is the same bit pattern as 0 except the sign bit is set. In comparisons it is equal to zero, but the sign propagates in expressions. e.g., >> z = 0 z = 0 >> mz = -0 mz = 0 >> z == mz ans = 1 >> format hex >> z z = 0000000000000000 >> mz mz = 8000000000000000 >> z * 1 ans = 0000000000000000 >> mz * 1 ans = 8000000000000000 Unfortunately, as shown above, MATLAB does not display -0 as -0, but as 0. There is a related thread about this if you are interested: http://www.mathworks.com/matlabcentral/newsreader/view_thread/251089#649355 James Tursa |