UNPKG

2.3 kBTypeScriptView Raw
1import type { Arbitrary } from '../check/arbitrary/definition/Arbitrary.js';
2/**
3 * Constraints to be applied on {@link double}
4 * @remarks Since 2.6.0
5 * @public
6 */
7export interface DoubleConstraints {
8 /**
9 * Lower bound for the generated 64-bit floats (included, see minExcluded to exclude it)
10 * @defaultValue Number.NEGATIVE_INFINITY, -1.7976931348623157e+308 when noDefaultInfinity is true
11 * @remarks Since 2.8.0
12 */
13 min?: number;
14 /**
15 * Should the lower bound (aka min) be excluded?
16 * Note: Excluding min=Number.NEGATIVE_INFINITY would result into having min set to -Number.MAX_VALUE.
17 * @defaultValue false
18 * @remarks Since 3.12.0
19 */
20 minExcluded?: boolean;
21 /**
22 * Upper bound for the generated 64-bit floats (included, see maxExcluded to exclude it)
23 * @defaultValue Number.POSITIVE_INFINITY, 1.7976931348623157e+308 when noDefaultInfinity is true
24 * @remarks Since 2.8.0
25 */
26 max?: number;
27 /**
28 * Should the upper bound (aka max) be excluded?
29 * Note: Excluding max=Number.POSITIVE_INFINITY would result into having max set to Number.MAX_VALUE.
30 * @defaultValue false
31 * @remarks Since 3.12.0
32 */
33 maxExcluded?: boolean;
34 /**
35 * By default, lower and upper bounds are -infinity and +infinity.
36 * By setting noDefaultInfinity to true, you move those defaults to minimal and maximal finite values.
37 * @defaultValue false
38 * @remarks Since 2.8.0
39 */
40 noDefaultInfinity?: boolean;
41 /**
42 * When set to true, no more Number.NaN can be generated.
43 * @defaultValue false
44 * @remarks Since 2.8.0
45 */
46 noNaN?: boolean;
47 /**
48 * When set to true, Number.isInteger(value) will be false for any generated value.
49 * Note: -infinity and +infinity, or NaN can stil be generated except if you rejected them via another constraint.
50 * @defaultValue false
51 * @remarks Since 3.18.0
52 */
53 noInteger?: boolean;
54}
55/**
56 * For 64-bit floating point numbers:
57 * - sign: 1 bit
58 * - significand: 52 bits
59 * - exponent: 11 bits
60 *
61 * @param constraints - Constraints to apply when building instances (since 2.8.0)
62 *
63 * @remarks Since 0.0.6
64 * @public
65 */
66export declare function double(constraints?: DoubleConstraints): Arbitrary<number>;