http://xhip.cjb.net/temp/public/difference_signal.wav
this is (float - int). float and double produce bit-for-bit matching results in the 'short' output.
what this seems to show is that there isnt really much difference in this case and probably many other cases between single and double. there is a major difference in many cases between float and int, though.
either way, discounting a difference because you do not notice it or because it does not influence you does not prove that it is not important
sam; i noticed last night my version was still not working. i could make it give error in the lsb, or the 16th bit by changing things around, then i gave up on it again. yours seems to still give an error in the lsb (of -1) compared to the x86 instruction for negative values. this is pretty tricky stuff, and it definitely will not help anybody to write faster code. it is interesting however because we could use the same technique to scale up to as many bits as we like. the fastest method would be to use the x86 32x32 instruction to get 64x64 results, and then that function could be used to get 128x128 results, and so on. so it could potentially be worth the effort, if not just fun to mess with since it makes you feel like a binary wizard.
i think the error in your version may be due to the fact -n = ~n+1. so you can fix it by simply adding the line:
acc -= (~acc >> 31) & 1 & acc;
...i think.
there should be a more simple way to do this.
...nope, rofl.
a good test function for this:
Code: Select all
long n = 1;
while (n != 0)
{
long reference = m32x(0x7FFFFFFF, n);
long result = m32l(0x7FFFFFFF, n);
long delta = reference - result;
if (delta) { printf("err %i != %i\n", reference, result); break; }
n++;
}


