You have to handle such cases. You can set one of them to zero with some logic. If the value is negative then max will be zero, otherwise min will be zero.