Hey all

I finally figured out some bug in netpd that looked platform dependent.
It turns out it actually is platform dependent. I do something that
only creates rounding errors on Windows (or Wine), but not on Linux or
macOS. 

Attached patch illustrates the issue. It pre-calculates a look-up
table. The resulting values in the table are slightly different between
platforms. On Linux, I get only integer values between 0 and 255, while
on Windows get some values like 8.99996 or 256. 

Assuming, that the code for [*~ ], [/~ ] and [phasor~ ] is the same on
all platforms, I wonder where the difference is coming from. Is Windows
simply less smart? Can this be fixed? Is there a cleaner way to do what
I want?

Roman
#N canvas 341 70 488 360 10;
#N canvas 539 296 450 300 pre-calcuate-LSB 0;
#X obj 11 12 inlet;
#X obj 11 65 switch~ 65536 1 1;
#X obj 38 90 samplerate~;
#X obj 38 136 phasor~;
#X obj 38 156 *~ 256;
#X obj 11 32 t b b;
#X obj 38 110 / 256;
#X obj 38 176 tabsend~ LSB;
#X connect 0 0 5 0;
#X connect 2 0 6 0;
#X connect 3 0 4 0;
#X connect 4 0 7 0;
#X connect 5 0 1 0;
#X connect 5 1 2 0;
#X connect 6 0 3 0;
#X restore 24 133 pd pre-calcuate-LSB;
#X obj 24 153 table LSB 65536;
#X text 26 11 1 Turn DSP on;
#X obj 26 54 s pd;
#X text 24 89 2 Calculate table;
#X obj 24 111 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 22 257 tabread LSB;
#X floatatom 22 279 10 0 0 0 - - -, f 10;
#X text 19 203 3 Check table content;
#X msg 22 230 24073;
#X msg 26 34 dsp 1;
#X text 20 302 Linux: 9;
#X text 20 316 Windows: 8.99956;
#X obj 162 257 tabread LSB;
#X floatatom 162 279 10 0 0 0 - - -, f 10;
#X msg 162 231 24064;
#X text 160 302 Linux: 0;
#X text 160 316 Windows: 256;
#X obj 274 258 tabread LSB;
#X floatatom 274 280 10 0 0 0 - - -, f 10;
#X msg 274 232 24063;
#X text 272 303 Linux: 255;
#X text 272 317 Windows: 255;
#X connect 5 0 0 0;
#X connect 6 0 7 0;
#X connect 9 0 6 0;
#X connect 10 0 3 0;
#X connect 13 0 14 0;
#X connect 15 0 13 0;
#X connect 18 0 19 0;
#X connect 20 0 18 0;

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list

Reply via email to