HMC5883L compass huge error [SOLVED]

I think this might be the problem:

  if(6<=Wire.available()){

The processor may not have read all 6 bytes when you get here but you don't stop and wait. You will go straight through and process the variable x, y and z as if you had read something.
Try changing this:

  if(6<=Wire.available()){
    x = Wire.receive()<<8; //X msb
    x |= Wire.receive(); //X lsb
    z = Wire.receive()<<8; //Z msb
    z |= Wire.receive(); //Z lsb
    y = Wire.receive()<<8; //Y msb
    y |= Wire.receive(); //Y lsb
  }

to this:

  while(Wire.available() < 6);
  x = Wire.receive()<<8; //X msb
  x |= Wire.receive(); //X lsb
  z = Wire.receive()<<8; //Z msb
  z |= Wire.receive(); //Z lsb
  y = Wire.receive()<<8; //Y msb
  y |= Wire.receive(); //Y lsb

Pete