[PD] [expr] - fmod weirdness

oliver oliver at klingt.org
Tue Jun 23 01:07:57 CEST 2020


hi,

i just stumbled upon a problem when i tried to use [expr fmod] to 
produce a modified [wrap] object that should be able to produce a float 
wrapped around an arbitrary limit (not just 1 as in vanilla's [wrap])

i know that there are many ways to do this but i tried the [expr] way 
and noticed something weird (not sure if that's a bug, though):


i am getting "inconsistent" results from the [expr] object.
whereas if i'm cranking out a "handmade" version, the results are what 
they are supposed to be.

i attached the patch that shows the problem

is this a single / double precision case ?



best

oliver

-- 
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
/////////////// http://pendler.klingt.org //////////////
\\\\\\\\\\\\\\\ http://oliver.klingt.org  \\\\\\\\\\\\\\
////////////////////////////////////////////////////////
-------------- next part --------------
#N canvas 221 50 560 502 10;
#X obj 66 329 expr fmod($f1 \, $f2);
#X msg 66 259 4.001;
#X obj 177 278 loadbang;
#X msg 177 301 4;
#X msg 66 235 4.0001;
#X msg 66 281 4.01;
#X msg 66 214 4.00001;
#X obj 66 384 print console;
#X floatatom 80 359 10 0 0 0 - - -, f 10;
#X msg 66 170 4.1;
#X msg 326 257 4.001;
#X msg 326 233 4.0001;
#X msg 326 279 4.01;
#X msg 326 212 4.00001;
#X msg 326 166 4.1;
#X obj 326 350 %, f 17;
#X obj 425 213 loadbang;
#X msg 425 236 4;
#X obj 326 427 print console;
#X floatatom 340 402 10 0 0 0 - - -, f 10;
#X text 72 103 with expr:;
#X text 340 101 with vanilla objects:;
#X text 206 7 FLOAT MODULO:;
#X text 147 35 TASK: make float numbers wrap at 4;
#X text 191 55 compare the results:;
#X text 63 411 inconsistent results;
#X msg 66 142 4.5;
#X text 99 141 no problem with this one;
#X text 123 213 from here on it gets weird;
#X obj 326 326 * 100000;
#X obj 425 325 * 100000;
#X msg 326 141 4.5;
#X obj 326 373 / 100000;
#X text 324 449 expected results;
#X text 99 162 should produce 0.1 \, but doesn't, f 17;
#X connect 0 0 7 0;
#X connect 0 0 8 0;
#X connect 1 0 0 0;
#X connect 2 0 3 0;
#X connect 3 0 0 1;
#X connect 4 0 0 0;
#X connect 5 0 0 0;
#X connect 6 0 0 0;
#X connect 9 0 0 0;
#X connect 10 0 29 0;
#X connect 11 0 29 0;
#X connect 12 0 29 0;
#X connect 13 0 29 0;
#X connect 14 0 29 0;
#X connect 15 0 32 0;
#X connect 16 0 17 0;
#X connect 17 0 30 0;
#X connect 26 0 0 0;
#X connect 29 0 15 0;
#X connect 30 0 15 1;
#X connect 31 0 29 0;
#X connect 32 0 19 0;
#X connect 32 0 18 0;


More information about the Pd-list mailing list