improved intersection testing arithmetic safety #50