float overview

float represents valid javascript floating point numbers within (and tagged with) a certain range

Added in v2.0.0


Table of contents


Model

Float (type alias)

Floating point branded newtype. Parameters: min, max are inclusive.

Represents floating point numbers:

 { f | f ∈ ℝ, f >= -Number.MAX_VALUE, f <= Number.MAX_VALUE }

Signature

export type Float<Min extends number = MaxNegativeFloat, Max extends number = MaxPositiveFloat> = Branded<
  number,
  FloatBrand<Min, Max>
>

Added in v1.0.0

MaxNegativeFloat (type alias)

The largest negative float in JavaScript.

Signature

export type MaxNegativeFloat = -1.7976931348623157e308

Added in v2.0.0

MaxPositiveFloat (type alias)

The largest positive float in JavaScript.

Signature

export type MaxPositiveFloat = 1.7976931348623157e308

Added in v2.0.0

MinNegativeFloat (type alias)

The smallest negative float in JavaScript.

Signature

export type MinNegativeFloat = -5e-324

Added in v2.0.0

MinPositiveFloat (type alias)

The smallest positive float in JavaScript.

Signature

export type MinPositiveFloat = 5e-324

Added in v2.0.0

utils

FloatBrand (interface)

A brand for bounded floats.

Signature

export interface FloatBrand<Min extends number, Max extends number> {
  readonly Float: unique symbol
  readonly Min: Min
  readonly Max: Max
}

Added in v2.2.1

maxNegativeFloat

The largest negative float in JavaScript.

Signature

export declare const maxNegativeFloat: -1.7976931348623157e308

Added in v2.0.0

maxPositiveFloat

The largest positive float in JavaScript.

Signature

export declare const maxPositiveFloat: 1.7976931348623157e308

Added in v2.0.0

minNegativeFloat

The smallest negative float in JavaScript.

Signature

export declare const minNegativeFloat: -5e-324

Added in v2.0.0

minPositiveFloat

The smallest positive float in JavaScript.

Signature

export declare const minPositiveFloat: 5e-324

Added in v2.0.0