QUOTE (tycho @ Sep 7 2007, 02:27)

Actually, because the OP indicated that only a small set of files didn't match the originals, I think there is a different reason. When you apply replaygain without the wrap option, peak values that should be increased beyond 255, will stay at 255. When you undo these values, they will go below the original value.
You can use the wrap (/w) option to allow for lossless undoable gain change. However, the wrap options has the disadvantage that the mp3 may change high peak values to near silent ones when applying positive gains, and vise versa when applying negative gains.
edit: As "wrapping" (or overflow/underflow) only will occur quite seldom, it has been suggested that all the wrapped frames should be stored in a tag instead of actually being wrapped, which would allow for lossless undoable gain, without the disadvantage mentioned. Someone just have to implement it...
Thank you for the explanation on the w switch. Unfortunately it doesn't look to be the issue unless I'm using it wrong. I tried mp3gain -a -k -p -w on an mp3 that I knew would result in a mismatch with the original and after running that I ran mp3gain -u -p followed by mp3gain -s d -p. The file sizes remained the same as the original, however comparing it to the original failed.