This was discussed with @Afforess and @RoyAwesome 

An improvement would be something like
    
    float lengthSquared = x*x + y*z + z*z;
    if (minLength > lengthSquared || lengthSquared > maxLength) {
        q = Math.sin(halfAngle) / Math.sqrt(lengthSquared);
    } else {
        q = Math.sin(halfAngle);
    }

.. with the min/max thresholds being set as 1.0 + delta and 1.0 - delta