Re: Slightly different numerical results with 32-bit and 64-bit fpc

Martin Guy via fpc-pascal <[email protected]>
Newsgroups gmane.comp.compilers.free-pascal.general
Message-ID <[email protected]>
Sorry about that. Thunderbird seems to have sent the Draft last night 
before it was ready.

On 20/03/25 19:55, Martin Guy wrote:

> I'm resurrecting a software to do DolbyB encoding and decoding in software

 >but I'm finding that the resulting wave files, when it's compiled and 
run > on 32-bit and on 64-bit Debian x86 are very slightly different.

It's now public in case anyone has access to 32-bit and 64-bit plaforms
and cares to verify this. I've fixed the C version on 32-bit platforms
and it gives exact the same output as the Pascal version on 32-bit platforms
so it looks like some imprecision (or extra precision!) in the fpc 
64-bit math.
I've tried it with fpc on ARM aarch64 as well, and the results are the same
as on x86.

You'll need a wav file

On a 32-bit platform:

git clone https://codeberg.org/martinwguy/libdolbyb
cd libdolbyb
fpc DolbyBi64.PP
./DolbyBi64 in.wav out32.wav

On a 64-bit platform:

git clone https://codeberg.org/martinwguy/libdolbyb
cd libdolbyb
fpc DolbyBi64.PP
./DolbyBi64 in.wav out64.wav

and to subtract one wav from the other (assuming it's stereo)

sox --combine merge out32.wav out64.wav diffs.wav remix 1,3i 2,4i

(if it's mono, "remix 1,2i" is the magic)

then look at diffs.wav in your favorite sound editor.

Attached is the view in ReZound at maximum zoom where one vertical pixel
represents a difference of one bit value, or you can see it on
https://codeberg.org/martinwguy/libdolbyb/wiki/Status

Thanks and keep up the good work

    M

_______________________________________________
fpc-pascal maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
DolbyBi64-32-64-diffs-for-Cucurucucu-Paloma.png (image/png, 905 B) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.