The length of intdec(intdec(x, r), 1/r) is often not the length(x)
Reported by Samuel GOUGEON (@sgougeon)
BUG DESCRIPTION:
----------------
The length of intdec(intdec(x, r), 1/r) is often not the length(x)
The resampling ratio should be considered more symetrically/reciprocally.
ERROR LOG:
----------
None.
HOW TO REPRODUCE THE BUG:
-------------------------
Fs1 = 10000; // initial sampling frequency
t1 = linspace(0, 5-1/Fs1, 5*Fs1)';
u1 = sin(2*%pi*F0*t1);
disp(length(u1));
for Fs2 = 6995:7005 // targeted resampling frequency
mprintf("%d ",length(intdec(intdec(u1, Fs2/Fs1), Fs1/Fs2)))
end
// Execution result:
--> exec tmp.sce
50000.
49998 49998 49998 49998 49998 50000 49999 49998 49998 49998 49998
OTHER INFORMATION:
------------------
When replacing int() with round() in the code, we get:
--> exec tmp.sce
50000.
50000 50000 50000 50000 50000 50000 50000 50000 50000 50000 50000
and the resampling error is unchanged (still residual)