public void DoNotCrashOnBadInput() { // For error recovery, do not throw exceptions on bad inputs. var ctors = new IValueSetFactory[] { ForByte, ForSByte, ForChar, ForShort, ForUShort, ForInt, ForUInt, ForLong, ForULong, ForBool, ForFloat, ForDouble, ForString, ForDecimal, ForNint, ForNuint }; ConstantValue badConstant = ConstantValue.Bad; foreach (IValueSetFactory fac in ctors) { foreach (BinaryOperatorKind relation in new[] { LessThan, Equal, NotEqual }) { IValueSet set = fac.Related(relation, badConstant); _ = set.All(relation, badConstant); _ = set.Any(relation, badConstant); } } }
public bool All(BinaryOperatorKind relation, TFloating value) { TFloatingTC tc = default; return ((!_hasNaN || tc.Related(relation, tc.NaN, value)) && _numbers.All(relation, value)); }