char matrix multiplied by 1, wrong result?


    Sep 09 2008 | 3:09 pm
    hi there!
    can anyone enlighten me, why a char matrix multiplied with either 1. or 255 is resulting in y=x-1?
    so let's assume we've got a matrix containing only the value 255, if i multiply this matrix via jit.op with a value of 1. or 255, i get as a result 254.
    i guess this has something todo with truncating/rounding the char value, but why?
    here is the example:
    run on xp sp3, max 4.6.3
    thanks for any information,
    micha

    • Sep 09 2008 | 10:16 pm
      jitter matrices are zero based so thats ok.
      On Tue, Sep 9, 2008 at 6:10 PM, micha wrote:
      >
      > hi there!
      >
      > can anyone enlighten me, why a char matrix multiplied with either 1. or 255
      > is resulting in y=x-1?
      >
      > so let's assume we've got a matrix containing only the value 255, if i
      > multiply this matrix via jit.op with a value of 1. or 255, i get as a result
      > 254.
      >
      > i guess this has something todo with truncating/rounding the char value,
      > but why?
      >
      > here is the example:
      >
      >
      > #P window setfont "Sans Serif" 9.;
      > #P window linecount 1;
      > #P comment 169 251 27 9109513 huh?;
      > #P user jit.cellblock 39 109 85 129 139 9 1 1 45 17 0 1 1 0 0 0 0 0 1 0 0 0
      > 255 255 255 0 0 0 0 0 0 191 191 191 0 0 0 215 215 240 1 1 1 0 4 0 0 0;
      > #P user jit.cellblock 91 250 137 270 139 9 1 1 45 17 0 1 1 0 0 0 0 0 1 0 0
      > 0 255 255 255 0 0 0 0 0 0 191 191 191 0 0 0 215 215 240 1 1 1 0 4 0 0 0;
      > #P user jit.cellblock 241 252 287 272 139 9 1 1 45 17 0 1 1 0 0 0 0 0 1 0 0
      > 0 255 255 255 0 0 0 0 0 0 191 191 191 0 0 0 215 215 240 1 1 1 0 4 0 0 0;
      > #P newex 241 229 100 9109513 jit.op @op * @val 255;
      > #P newex 91 227 93 9109513 jit.op @op * @val 1.;
      > #P message 91 52 46 9109513 255 , bang;
      > #P newex 91 76 81 9109513 jit.matrix 1 char 1;
      > #P window setfont "Sans Serif" 12.;
      > #P comment 82 30 68 9109516 press here;
      > #P window setfont "Sans Serif" 9.;
      > #P comment 10 112 27 9109513 yes!;
      > #P fasten 2 0 8 0 96 102 44 102;
      > #P connect 3 0 2 0;
      > #P connect 2 0 4 0;
      > #P connect 4 0 7 0;
      > #P fasten 2 0 5 0 96 125 246 125;
      > #P fasten 5 0 6 0 246 250 246 250;
      > #P window clipboard copycount 10;
      >
      >
      > run on xp sp3, max 4.6.3
      >
      > thanks for any information,
      >
      > micha
      >
      >
    • Sep 10 2008 | 8:47 am
      hello yair,
      thanks for the answer, but i still don't get it. i mean, it's clear that chars start at zero and go up to 255, that's a byte. yes. but if i multiply some byte with 1, i exspect the value to be the same?
      micha
    • Sep 10 2008 | 12:46 pm
      sorry for misleading, that is strange and i cant explain
      On Wed, Sep 10, 2008 at 10:47 AM, micha wrote:
      >
      > hello yair,
      >
      > thanks for the answer, but i still don't get it. i mean, it's clear that
      > chars start at zero and go up to 255, that's a byte. yes. but if i multiply
      > some byte with 1, i exspect the value to be the same?
      >
      > micha
      >
      >
      >
      >
    • Sep 10 2008 | 3:05 pm
      yepp, that's really strange. and if this is a real bug, i can't belive that noone stumbled upon this before?
    • Sep 10 2008 | 8:29 pm
      ah yes, some additional information: jit.expr, with an expression of "expr in[0]*1" works correct.
      so what is wrong with jit.op?
    • Sep 12 2008 | 1:26 pm
      hi,
      yes, i found in the same situation time ago, dosent seems the right behavior of @op * ... :-?
      i bypass the problem converting the matrix to long and then i get the right values with op mult.
      bye
      o