Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "math/base/assert/is-probability/docs/types/index.d"

Index

Functions

Functions

isProbability

  • isProbability(x: number): boolean
  • Tests if a numeric value is a probability.

    Notes

    • A probability is defined as a numeric value on the closed interval [0,1].

    Parameters

    • x: number

      value to test

    Returns boolean

    boolean indicating whether the value is a probability

    Example

    var bool = isProbability( 0.5 );
    // returns true

    Example

    var bool = isProbability( 3.14 );
    // returns false

    Example

    var bool = isProbability( NaN );
    // returns false