jit.op bug: 12 multiplied by 10 outputs 0
i think i found a jit.op bug
12 * 10 = 0;
12 * 10. = 11;
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 540.3oc0V9saaCBEF+ZWo9Nf3xorH.63+rq5dNlppv1rD5vPjMYMaU6ce.N1 MqIKkjUYxtvbjNbH7kelyG94auIBVp1x5ffOA9BHJ5YSlHWNalngDQvF51JA syUH7QtddESHJEppuAmsqD4lFtTvztZHCY40tknJe7iX7XsUJgqrj8VrZidX 0io+pRp63+jYSVLGMjtuT8OVy5ENTv6zvY.33C39gZWS0Uq3xkOzxpz8kma+ o.wEHafjmaCEj4nWVTq5oCEhj131O3ma4TAzMyut8FazDl4M9jrmL3XjEZ1V 8HVUqA2Yd9.3tuSE.LZ9YfWB73zjbtzzHjGZn5V9VuYYZODisi3r8Q4TPNMn DTdbRgOFoPuWjpjJWZYjKdRNQRcbB6.DBEFNITz5dI6KpJ9KjBeQjxCBgQSB gtPKr7qJGLRJ452Aye3lEN+KRBZJ7uJ2n0Jo+ceouU22E2lk1+2FMLBtepak RtpZkvwKBSqTCqqitjcXuTGSSElFHh+HM98xr9zDaQlkQYI1wE89zKl5axrG 55awAXP0JZKHAjbFeAPHrZFtfyYxjmcIVM80ZNgKO3a1canchWgyN0l1pA4t 6TBXuMsl0o4RplaLldoH7eVzJdcMyM+HJZ30qUbodmNNkAh2RC6izRBhzR+O mZYAQZY9Hs7fHsBudghByaTjOhKMbZC+VZK95sSvdiZHzFwKw8uagXSXB+1b 6.uu -----------end_max5_patcher-----------
You should do this with float32 matrix
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 591.3oc2V9sbiBBEF+Z8ofwK2IaF.M9m8ptOGc5jAUZJcQHiR1lsc569BnlM sM0PyZLc2KDGvC3m+N7cvm78BxkaoMAfuAtF348jummcHy.dc88BpHaK3jFa XA2yTyKnbdNWV7ifYsQH1TwDbpxFBtavZ4C19Qc8Yk1EPle+WQn8lobipep8 gdqTnDjJpcBeulQ38w2Fr5WqoshNfyZTAy.A6t.2zE5Zhp3NlX0xZZgpM5L3 b3LPXVr4FNM0bKCOGtaNlWbC6Q6hmoeZ2JoWAVCSJLCi5FrPxeolqkOREK0z aIQopY4aT8jc+E3FSzO66aZl4HyEzGzTqGAJ5V0tTgbM3J80W.W8SBGffyGL kreJ.e3T.9imBz5XYEQ+Iu8nIfzLaBHtk7glVTx6y+wiUJPNH+frAc.1.GM1 jSDqLTwdeHxfs6ICQVj.gSGY3RRYqJcCNYGlMnSjMGmIH34iIiR0rzKSwrVu DNF+eawLWqkkb4JkgifmsRYZnqzT1QeY7v9xS08E29YB6aOob9nXyhtj1LT3 h+srYUzlFxJ5a7YMTEgqMWXWMWgiV89Aw7hDCXShLsKZK0uXJN9yr0r0wCPf a0GFpBwfHPjy+qvkn1S+Ai1pNYIefZO1PzF.wq+qe6awL9KQXibScQuB69dA +4EURaTLAQ0sO+5cN08h4NVYI093duQEqbsjITcR3c1e6rhvNHIDZR0TnKRZ RUT7mNE4xNojOcJ5U61N6RR+SP5BSCqovoWRGCSwSpjxbIwAmTIk3fjR+KTj tyy9+FPCSKBC -----------end_max5_patcher-----------
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?
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
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.
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.
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, 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?
jit.expr is always float32 processing.
thanks for the explanations
Forums > MaxMSP