For ENG-4454, fix bug pointed out by Ning handling ranges spanning Long.MIN to Long.MAX, and add a test for the condition