jit.op bug: 12 multiplied by 10 outputs 0

zerox_'s icon
Max Patch
Copy patch and select New From Clipboard in Max.

i think i found a jit.op bug
12 * 10 = 0;
12 * 10. = 11;

Dg's icon
Max Patch
Copy patch and select New From Clipboard in Max.

You should do this with float32 matrix

micha's icon

hm, i had a similar problem like this:

solution was to switch to a long matrix. but nevertheless i do not understand why jit.op is so buggy with char matrices.

and: i do not understand why nobody from cycling comments on such a blatant bug.

and: this was with max 4, in max 5 this bug is still existing!

somehow i get a feeling that this forum has changed?

micha

zerox_'s icon

thanks kyred and micha for the quick reply
converting each matrix from char to float32 is for sure a very performative workaround ;-)

actually i am trying to apply jit.op * to a char matrix in java
now i converted it with mymatrix.setType("float32")

and i still cant multiply my by 10. !!!!!!!!!!!! ;-(

well. never mind. multiplications are probably not so important for programming

micha's icon

yeah, they are not so important and way overrated. additionally you can fake them using additions.

i still don't understand why nobody from cycling comments on this? there were times, when communication to the company (esp. joshua, ben and topher) was really easy and quick via the mailinglist.

Ben Bracken's icon

After a conversation with JKC regarding this whole deal and the float value 10., I think I understand what is going on here.

Culling from our conversation, float 10. is actually 1., as char data is mapped to 0-1. However, 1. (char 255) is not really 1. (which isn't representable in 8 bit fixed point, since it would be 256). So floating point greater than 1. becomes 1.-1/256., i.e. 0.996.

This all boils down to a more simple explanation that float maps to the range 0-0.996 char 0-255.

-Ben

Ben Bracken's icon

Also, there is no modulo arithmetic going on as it says in the jit.op ref regarding char data. I'll make sure that our documentation is updated.

-Ben

micha's icon

ben, thanks for the detailed explanation, these are the kind of answers and interna i want to hear ;-). only question open is why jit.expr works correctly, while jit.op does not?

Joshua Kit Clayton's icon

jit.expr is always float32 processing.

zerox_'s icon

thanks for the explanations