apiref
bsearch@1.0.0

smallestFloatAsync()  Function

Returns the smallest floating-point value in range [min, max] that is accepted by the predicate.

Signature

export declare function smallestFloatAsync(min: number, max: number, predicate: (value: number) => PromiseLike<boolean>, maxIterations?: number): Promise<number | undefined>;

Parameters

ParameterTypeDescription
minnumber

The minimum value to search for.

maxnumber

The maximum value to search for.

predicate(value: number) => PromiseLike<boolean>

A predicate. There should exist some value X such that predicate(x) returns true for all x >= X and returns false otherwise.

maxIterationsnumber

Maximum number of iterations to perform. It can be reduced to speed up the search for less precise values.

(Returns)Promise<number | undefined>

A promise that resolves to the smallest floating-point value whose predicate returns true, or undefined if no such value exists.