Skip to main content

Function: float()

float(constraints?): Arbitrary<number>

Defined in: packages/fast-check/src/arbitrary/float.ts:154

For 32-bit floating point numbers:

  • sign: 1 bit
  • significand: 23 bits
  • exponent: 8 bits

The smallest non-zero value (in absolute value) that can be represented by such float is: 2 ** -126 * 2 ** -23. And the largest one is: 2 ** 127 * (1 + (2 ** 23 - 1) / 2 ** 23).

Parameters

ParameterTypeDescription
constraintsFloatConstraintsConstraints to apply when building instances (since 2.8.0)

Returns

Arbitrary<number>

Remarks

Since 0.0.6