added machine tolerance to max principle check