Forums > Jitter

@expr "(cell[0]%4.>0.)*(cell[0]%4.<3.)*0.2-0.1"

September 8, 2008 | 9:27 am

Hello,

I don’t understand how *0.2-0.1 can set the cell to -0.10 if it is 0.
For me *0.2-0.1=0.1, so I suppose I don’t correctly read the expression.
Could someone lend a hand?

thank you.

max v2;
#N vpatcher 20 74 835 510;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 330 238 52 196617 *0.2;
#P comment 72 254 14 196617 0;
#P comment 422 254 14 196617 1;
#P comment 386 254 14 196617 0;
#P comment 345 254 14 196617 3;
#P comment 304 254 14 196617 2;
#P comment 265 254 14 196617 1;
#P comment 224 254 14 196617 0;
#P comment 146 254 14 196617 2;
#P comment 109 254 14 196617 1;
#P user jit.cellblock 54 266 451 291 3 9 10 1 39 20 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 2 0 0 0;
#P newex 54 237 259 196617 jit.expr @expr "(cell[0]%4.>0.)*(cell[0]%4.<3.)*0.2";
#P comment 183 254 14 196617 3;
#P newex 28 48 48 196617 loadbang;
#P toggle 513 40 15 0;
#P newex 513 57 58 196617 metro 100;
#N counter 1 100;
#X flags 0 0;
#P newobj 513 77 74 196617 counter 1 100;
#P number 513 118 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 513 97 27 196617 % 4;
#P comment 340 319 52 196617 *0.2-0.1;
#P comment 73 335 14 196617 0;
#P comment 423 335 14 196617 1;
#P comment 387 335 14 196617 0;
#P comment 346 335 14 196617 3;
#P comment 305 335 14 196617 2;
#P comment 266 335 14 196617 1;
#P comment 225 335 14 196617 0;
#P comment 147 335 14 196617 2;
#P comment 110 335 14 196617 1;
#P user jit.cellblock 55 347 452 372 3 9 10 1 39 20 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 2 0 0 0;
#P newex 55 318 279 196617 jit.expr @expr "(cell[0]%4.>0.)*(cell[0]%4.<3.)*0.2-0.1";
#P comment 184 335 14 196617 3;
#P comment 66 179 14 196617 0;
#P comment 416 179 14 196617 1;
#P comment 380 179 14 196617 0;
#P comment 339 179 14 196617 3;
#P comment 298 179 14 196617 2;
#P comment 259 179 14 196617 1;
#P comment 218 179 14 196617 0;
#P comment 140 179 14 196617 2;
#P comment 103 179 14 196617 1;
#P comment 296 163 128 196617 if 1 or 2 set 1. , otherw 0.;
#P user jit.cellblock 53 191 450 216 3 9 10 1 39 20 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 2 0 0 0;
#P newex 53 162 237 196617 jit.expr @expr "(cell[0]%4.>0.)*(cell[0]%4.<3.)";
#P button 28 76 15 0;
#P newex 28 95 115 196617 jit.matrix 1 float32 10;
#P comment 177 179 14 196617 3;
#P connect 33 0 2 0;
#P connect 2 0 1 0;
#P fasten 1 0 3 0 33 129 58 129;
#P connect 3 0 4 0;
#P fasten 1 0 35 0 33 226 59 226;
#P connect 35 0 36 0;
#P fasten 1 0 16 0 33 303 60 303;
#P connect 16 0 17 0;
#P connect 32 0 31 0;
#P connect 31 0 30 0;
#P connect 30 0 28 0;
#P connect 28 0 29 0;
#P pop;


September 8, 2008 | 9:45 am

On 8 sept. 08, at 11:27, Derrick Giscloux wrote:

> Hello,
>
> I don’t understand how *0.2-0.1 can set the cell to -0.10 if it is 0.
> For me *0.2-0.1=0.1, so I suppose I don’t correctly read the
> expression.
> Could someone lend a hand?

multiplication have higher precedence over the addition:

0 * 0.2 = 0. right ?

then

0 (the result of 0 * 0.2) minus 0.1 gives -0.1

unless I’m misreading you.
ej


September 8, 2008 | 10:57 am

clever,
thx ej.


September 21, 2008 | 4:19 pm

Hello,

I’m trying now to set a value in cells 1&2 and the inverse of this value in cells 0&3.

Unsuccessful.
How can I do this?

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 459 501 47 196617 plane -1;
#P flonum 442 429 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 442 455 109 196617 jit.matrix 1 float32 4;
#P user jit.cellblock 442 520 816 544 3 9 4 1 98 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 2 0 0 0;
#P newex 442 479 322 196617 jit.expr @inputs 1 @expr "((cell[0]%4.>0.)*(cell[0]%4.<3.))-in[0] ";
#P connect 2 0 0 0;
#P connect 0 0 1 0;
#P connect 3 0 2 0;
#P connect 4 0 1 0;
#P window clipboard copycount 5;


September 21, 2008 | 10:48 pm

Is this what you’re looking for?

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 233 342 47 196617 plane -1;
#P flonum 216 270 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 216 296 109 196617 jit.matrix 1 float32 4;
#P user jit.cellblock 216 361 590 385 3 9 4 1 98 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 2 0 0 0;
#P newex 216 320 304 196617 jit.expr @inputs 1 @expr "2.*(((cell[0]+1)%4)>1.)*in[0]-in[0]";
#P connect 2 0 0 0;
#P connect 0 0 1 0;
#P connect 4 0 1 0;
#P connect 3 0 2 0;
#P window clipboard copycount 5;

Andrew B.


September 22, 2008 | 9:36 am

Bright! thank you Andrew.

Below reversed cells values …

#P user jit.cellblock 137 134 295 155 3 9 4 1 39 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 2 0 0 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 137 107 322 196617 jit.expr @expr "2*((cell[0]%4.!=1.)*(cell[0]%4.!=2.))*in[0]-in[0]";
#P newex 137 84 109 196617 jit.matrix 1 float32 4;
#P user jit.cellblock 123 503 281 524 3 9 4 1 39 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 2 0 0 0;
#P newex 348 269 30 196617 !- 0.;
#P newex 348 385 30 196617 t b s;
#P newex 314 431 64 196617 jit.op @op +;
#P newex 348 332 266 196617 jit.expr @expr "(cell[0]%4.>0.)*(cell[0]%4.<3.)*in[0]";
#P flonum 348 290 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 348 309 109 196617 jit.matrix 1 float32 4;
#P newex 50 335 274 196617 jit.expr @expr "(cell[0]%4.!=1.)*(cell[0]%4.!=2.)*in[0]";
#P window setfont "Sans Serif" 14.;
#P flonum 50 50 50 14 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont "Sans Serif" 9.;
#P newex 50 312 109 196617 jit.matrix 1 float32 4;
#P newex 123 479 66 196617 jit.pack 3;
#P fasten 8 0 1 0 353 418 340 418 340 307 55 307;
#P connect 2 0 1 0;
#P connect 1 0 3 0;
#P fasten 7 0 0 0 319 463 128 463;
#P connect 0 0 10 0;
#P fasten 2 0 11 0 55 78 142 78;
#P connect 11 0 12 0;
#P connect 12 0 13 0;
#P fasten 3 0 7 0 55 413 319 413;
#P fasten 2 0 9 0 55 261 353 261;
#P connect 9 0 5 0;
#P connect 5 0 4 0;
#P connect 4 0 6 0;
#P connect 6 0 8 0;
#P connect 8 1 7 1;
#P window clipboard copycount 14;


Viewing 6 posts - 1 through 6 (of 6 total)