I don't actually understand what the old or new versions of this code are doing.  I think that if you use beta and gamma like this, you don't need the rawZ > 9.2 check above, however, since those are built in here.

If this code matches an algorithm used in gecko somewhere, then that is a strong argument in favor of keeping the code just like this.  If so, maybe you can add a comment linking to the gecko code that uses the same test.

On the other hand, if this is just something that Dale made up, then there is no need to retain this particular code.

Also note that the device orientation spec (http://www.w3.org/TR/orientation-event/#deviceorientation) seems to indicate that the gamma angle is always between -90 and +90. That makes me a little suspicious of the original code. Perhaps the way gamma is calculated here it is possible to get values > 90 or < -90.