Constraints to be applied on float

Since 2.6.0

interface FloatConstraints {
    max?: number;
    maxExcluded?: boolean;
    min?: number;
    minExcluded?: boolean;
    noDefaultInfinity?: boolean;
    noInteger?: boolean;
    noNaN?: boolean;
}

Properties

max?: number

Upper bound for the generated 32-bit floats (included)

Number.POSITIVE_INFINITY, 3.4028234663852886e+38 when noDefaultInfinity is true

Since 2.8.0

maxExcluded?: boolean

Should the upper bound (aka max) be excluded? Note: Excluding max=Number.POSITIVE_INFINITY would result into having max set to 3.4028234663852886e+38.

false

Since 3.12.0

min?: number

Lower bound for the generated 32-bit floats (included)

Number.NEGATIVE_INFINITY, -3.4028234663852886e+38 when noDefaultInfinity is true

Since 2.8.0

minExcluded?: boolean

Should the lower bound (aka min) be excluded? Note: Excluding min=Number.NEGATIVE_INFINITY would result into having min set to -3.4028234663852886e+38.

false

Since 3.12.0

noDefaultInfinity?: boolean

By default, lower and upper bounds are -infinity and +infinity. By setting noDefaultInfinity to true, you move those defaults to minimal and maximal finite values.

false

Since 2.8.0

noInteger?: boolean

When set to true, Number.isInteger(value) will be false for any generated value. Note: -infinity and +infinity, or NaN can stil be generated except if you rejected them via another constraint.

false

Since 3.18.0

noNaN?: boolean

When set to true, no more Number.NaN can be generated.

false

Since 2.8.0