I understand you exactly when you say two folded - I also had same experience - but luckily solved with help of that forum.
I originaly interfaced HMC5883L with plain C from beaglebone embbeded linux platform.
I was getting strange values if I turned device for around 90 degrees - values were like 65231, etc, but originaly when device was on desk they were like normall (around 0 to 10) - I am talking about raw data obtained by:
x=outputData[0] << 8 | outputData[1]; //Combine MSB and LSB of X Data output register
z=outputData[2] << 8 | outputData[3]; //Combine MSB and LSB of Z Data output register
y=outputData[4] << 8 | outputData[5]; //Combine MSB and LSB of Y Data output register
I resolved issue properly declaring x, y and z variables with:
short x,y,z=0;
instead of:
int x,y,z=0;
maybe that's also true for rest of you that you have similar problems.
I am attaching working code in plain C.