compCompass(magX, magY, magZ, -(accelX), -(accelY), -(accelZ))
Note that the "lower bounds" of either range may be larger or smaller than the "upper bounds" so the map() function may be used to reverse a range of numbers,
You have to convert the ADC output to signed values where 0 represents zero acceleration - this is fundamental to all such sensors.Normally sensors output V/2 for a zero value (if the sensor takes 3.3V then this is 1.65V, which will read as 338 on the analogRead() for a 5V Arduino. So you should subtract 338 from each of your readings.
The raw x/y/z readings from both the accelerometer & the magnetometer are correct (eg the accelerometer axes read 1g when the +ve direction is pointed down, -1g when +ve direction pointed up),