Abstract base class for all floating-point traits

Hierarchy

  • FPTraits

Properties

Methods

Properties

absInterval: ((n) => FPInterval)

Type declaration

absoluteErrorInterval: ((n, error_range) => FPInterval)

Type declaration

    • (n, error_range): FPInterval
    • Parameters

      • n: number
      • error_range: number

      Returns FPInterval

      an interval of the absolute error around the point

acosInterval: ((n) => FPInterval)

Type declaration

acoshAlternativeInterval: ((x) => FPInterval)

Type declaration

    • (x): FPInterval
    • Calculate an acceptance interval of acosh(x) using log(x + sqrt((x + 1.0f) * (x - 1.0)))

      Parameters

      Returns FPInterval

acoshIntervals: ScalarToInterval[]

All acceptance interval functions for acosh(x)

additionInterval: ((x, y) => FPInterval)

Type declaration

additionMatrixMatrixInterval: ((x, y) => FPMatrix)

Type declaration

    • (x, y): FPMatrix
    • Calculate an acceptance interval of x + y, when x and y are matrices

      Parameters

      • x: Array2D<number>
      • y: Array2D<number>

      Returns FPMatrix

asinInterval: ((n) => FPInterval)

Type declaration

asinhInterval: ((n) => FPInterval)

Type declaration

atan2Interval: ((y, x) => FPInterval)

Type declaration

atanInterval: ((n) => FPInterval)

Type declaration

atanhInterval: ((n) => FPInterval)

Type declaration

ceilInterval: ((n) => FPInterval)

Type declaration

clampIntervals: ScalarTripleToInterval[]

All acceptance interval functions for clamp(x, y, z)

clampMedianInterval: ((x, y, z) => FPInterval)

Type declaration

clampMinMaxInterval: ((x, low, high) => FPInterval)

Type declaration

correctlyRounded: ((n) => readonly number[])

Type declaration

    • (n): readonly number[]
    • Parameters

      • n: number

      Returns readonly number[]

      all valid roundings of input

correctlyRoundedInterval: ((n) => FPInterval)

Type declaration

correctlyRoundedMatrix: ((m) => FPMatrix)

Type declaration

    • (m): FPMatrix
    • Parameters

      • m: Array2D<number>

      Returns FPMatrix

      a matrix of correctly rounded intervals for the provided matrix

cosInterval: ((n) => FPInterval)

Type declaration

coshInterval: ((n) => FPInterval)

Type declaration

crossInterval: ((x, y) => FPVector)

Type declaration

    • (x, y): FPVector
    • Calculate a vector of acceptance intervals for cross(x, y)

      Parameters

      • x: readonly number[]
      • y: readonly number[]

      Returns FPVector

degreesInterval: ((n) => FPInterval)

Type declaration

determinantInterval: ((x) => FPInterval)

Type declaration

    • (x): FPInterval
    • Calculate an acceptance interval for determinant(x)

      Parameters

      • x: Array2D<number>

      Returns FPInterval

distanceInterval: ((x, y) => FPInterval)

Type declaration

    • (x, y): FPInterval
    • Calculate an acceptance interval of distance(x, y)

      Parameters

      • x: number | readonly number[]
      • y: number | readonly number[]

      Returns FPInterval

divisionInterval: ((x, y) => FPInterval)

Type declaration

dotInterval: ((x, y) => FPInterval)

Type declaration

exp2Interval: ((x) => FPInterval)

Type declaration

expInterval: ((x) => FPInterval)

Type declaration

faceForwardIntervals: ((x, y, z) => (undefined | FPVector)[])

Type declaration

    • (x, y, z): (undefined | FPVector)[]
    • Calculate the acceptance intervals for faceForward(x, y, z)

      Parameters

      • x: readonly number[]
      • y: readonly number[]
      • z: readonly number[]

      Returns (undefined | FPVector)[]

floorInterval: ((n) => FPInterval)

Type declaration

flushSubnormal: ((n) => number)

Type declaration

    • (n): number
    • Parameters

      • n: number

      Returns number

      0 if the provided number is subnormal, otherwise returns the proved number

fmaInterval: ((x, y, z) => FPInterval)

Type declaration

    • (x, y, z): FPInterval
    • Calculate an acceptance interval for fma(x, y, z)

      Parameters

      • x: number
      • y: number
      • z: number

      Returns FPInterval

fractInterval: ((n) => FPInterval)

Type declaration

inverseSqrtInterval: ((n) => FPInterval)

Type declaration

isFinite: ((n) => boolean)

Type declaration

    • (n): boolean
    • Parameters

      • n: number

      Returns boolean

      true if input is considered finite, otherwise false

isSubnormal: ((n) => boolean)

Type declaration

    • (n): boolean
    • Parameters

      • n: number

      Returns boolean

      true if input is considered subnormal, otherwise false

kind: FPKind
ldexpInterval: ((e1, e2) => FPInterval)

Type declaration

    • (e1, e2): FPInterval
    • Calculate an acceptance interval of ldexp(e1, e2), where e2 is integer

      Spec indicate that the result may be zero if e2 + bias <= 0, no matter how large was e1 * 2 ** e2, i.e. the actual valid result is correctlyRounded(e1 * 2 ** e2) or 0.0, if e2 + bias <= 0. Such discontinious flush-to-zero behavior is hard to be expressed using FPInterval, therefore in the situation of e2 + bias <= 0 the returned interval would be just correctlyRounded(e1 * 2 ** e2), and special examination should be taken when using the result.

      Parameters

      • e1: number
      • e2: number

      Returns FPInterval

lengthInterval: ((n) => FPInterval)

Type declaration

log2Interval: ((x) => FPInterval)

Type declaration

logInterval: ((x) => FPInterval)

Type declaration

maxInterval: ((x, y) => FPInterval)

Type declaration

minInterval: ((x, y) => FPInterval)

Type declaration

mixImpreciseInterval: ((x, y, z) => FPInterval)

Type declaration

    • (x, y, z): FPInterval
    • Calculate an acceptance interval of mix(x, y, z) using x + (y - x) * z

      Parameters

      • x: number
      • y: number
      • z: number

      Returns FPInterval

mixIntervals: ScalarTripleToInterval[]

All acceptance interval functions for mix(x, y, z)

mixPreciseInterval: ((x, y, z) => FPInterval)

Type declaration

    • (x, y, z): FPInterval
    • Calculate an acceptance interval of mix(x, y, z) using x * (1.0 - z) + y * z

      Parameters

      • x: number
      • y: number
      • z: number

      Returns FPInterval

modfInterval: ((n) => {
    fract: FPInterval;
    whole: FPInterval;
})

Type declaration

multiplicationInterval: ((x, y) => FPInterval)

Type declaration

multiplicationMatrixMatrixInterval: ((mat_x, mat_y) => FPMatrix)

Type declaration

    • (mat_x, mat_y): FPMatrix
    • Calculate an acceptance interval of x * y, when x is a matrix and y is a matrix

      Parameters

      • mat_x: Array2D<number>
      • mat_y: Array2D<number>

      Returns FPMatrix

multiplicationMatrixScalarInterval: ((mat, scalar) => FPMatrix)

Type declaration

    • (mat, scalar): FPMatrix
    • Calculate an acceptance interval of x * y, when x is a matrix and y is a scalar

      Parameters

      • mat: Array2D<number>
      • scalar: number

      Returns FPMatrix

multiplicationMatrixVectorInterval: ((x, y) => FPVector)

Type declaration

    • (x, y): FPVector
    • Calculate an acceptance interval of x * y, when x is a matrix and y is a vector

      Parameters

      • x: Array2D<number>
      • y: readonly number[]

      Returns FPVector

multiplicationScalarMatrixInterval: ((scalar, mat) => FPMatrix)

Type declaration

    • (scalar, mat): FPMatrix
    • Calculate an acceptance interval of x * y, when x is a scalar and y is a matrix

      Parameters

      • scalar: number
      • mat: Array2D<number>

      Returns FPMatrix

multiplicationVectorMatrixInterval: ((x, y) => FPVector)

Type declaration

    • (x, y): FPVector
    • Calculate an acceptance interval of x * y, when x is a vector and y is a matrix

      Parameters

      • x: readonly number[]
      • y: Array2D<number>

      Returns FPVector

negationInterval: ((n) => FPInterval)

Type declaration

normalizeInterval: ((n) => FPVector)

Type declaration

oneULP: ((target, mode?) => number)

Type declaration

    • (target, mode?): number
    • Parameters

      Returns number

      1 * ULP: (number)

powInterval: ((x, y) => FPInterval)

Type declaration

quantize: ((n) => number)

Type declaration

    • (n): number
    • Parameters

      • n: number

      Returns number

      the nearest precise value to the input. Rounding should be IEEE 'roundTiesToEven'.

radiansInterval: ((n) => FPInterval)

Type declaration

reflectInterval: ((x, y) => FPVector)

Type declaration

    • (x, y): FPVector
    • Calculate an acceptance interval of reflect(x, y)

      Parameters

      • x: readonly number[]
      • y: readonly number[]

      Returns FPVector

refractInterval: ((i, s, r) => FPVector)

Type declaration

    • (i, s, r): FPVector
    • Calculate acceptance interval vectors of reflect(i, s, r)

      Parameters

      • i: readonly number[]
      • s: readonly number[]
      • r: number

      Returns FPVector

remainderInterval: ((x, y) => FPInterval)

Type declaration

    • (x, y): FPInterval
    • Calculate an acceptance interval for x % y

      Parameters

      • x: number
      • y: number

      Returns FPInterval

roundInterval: ((n) => FPInterval)

Type declaration

saturateInterval: ((n) => FPInterval)

Type declaration

    • (n): FPInterval
      • Calculate an acceptance interval of saturate(n) as clamp(n, 0.0, 1.0)

      Parameters

      • n: number

      Returns FPInterval

scalarBuilder: ((n) => ScalarValue)

Type declaration

signInterval: ((n) => FPInterval)

Type declaration

sinInterval: ((n) => FPInterval)

Type declaration

sinhInterval: ((n) => FPInterval)

Type declaration

smoothStepInterval: ((low, high, x) => FPInterval)

Type declaration

    • (low, high, x): FPInterval
    • Calculate an acceptance interval of smoothStep(low, high, x)

      Parameters

      • low: number
      • high: number
      • x: number

      Returns FPInterval

sqrtInterval: ((n) => FPInterval)

Type declaration

stepInterval: ((edge, x) => FPInterval)

Type declaration

    • (edge, x): FPInterval
    • Calculate an acceptance 'interval' for step(edge, x)

      step only returns two possible values, so its interval requires special interpretation in CTS tests. This interval will be one of four values: [0, 0], [0, 1], [1, 1] & [-∞, +∞]. [0, 0] and [1, 1] indicate that the correct answer in point they encapsulate. [0, 1] should not be treated as a span, i.e. 0.1 is acceptable, but instead indicate either 0.0 or 1.0 are acceptable answers. [-∞, +∞] is treated as unbounded interval, since an unbounded or infinite value was passed in.

      Parameters

      • edge: number
      • x: number

      Returns FPInterval

subtractionInterval: ((x, y) => FPInterval)

Type declaration

subtractionMatrixMatrixInterval: ((x, y) => FPMatrix)

Type declaration

    • (x, y): FPMatrix
    • Calculate an acceptance interval of x - y, when x and y are matrices

      Parameters

      • x: Array2D<number>
      • y: Array2D<number>

      Returns FPMatrix

tanInterval: ((n) => FPInterval)

Type declaration

tanhInterval: ((n) => FPInterval)

Type declaration

transposeInterval: ((m) => FPMatrix)

Type declaration

    • (m): FPMatrix
    • Calculate an acceptance interval of transpose(m)

      Parameters

      • m: Array2D<number>

      Returns FPMatrix

truncInterval: ((n) => FPInterval)

Type declaration

ulpInterval: ((n, numULP) => FPInterval)

Type declaration

    • (n, numULP): FPInterval
    • Parameters

      • n: number
      • numULP: number

      Returns FPInterval

      an interval of N * ULP around the point

Methods

  • Parameters

    • values: readonly number[]

    Returns readonly number[]

    input with an appended 0, if inputs contains non-zero subnormals

  • WGSL specifies unbounded precision: https://www.w3.org/TR/WGSL/#floating-point-accuracy In most computations doubles (number in js) are equivalent to correctly rounded intervals. However in some cases (addition/subtraction) doubles do not provide enough numeric precision.

    These cases are whenever a small magnitude number, y (e.g. smallest positive normal) is added (or subtracted) from a much larger magnitude number x (1.0), such that the difference between them is smaller then ULP(x). When working in JS numbers the result will, incorrectly, simply be x, since it will get rounded. JS rounds to even but WGSL allows for rounding up and down (which in our context will be an interval). We must detect these cases where double precision does not represent infinitely accurate computations accurately then we must manually create the interval.

    Parameters

    • val: number
    • large_val: number
    • small_val: number

    Returns FPInterval

    an interval containing the correctly rounded val with respect to unbounded precision

  • Parameters

    • mats: ROArrayArrayArray<number>

      array of inputs to try for the matrix input

    • scalars: readonly number[]

      array of inputs to try for the scalar input

    • filter: IntervalFilter

      what interval filtering to apply

    • Rest ...ops: MatrixScalarToMatrix[]

      callbacks that implement generating a matrix of acceptance intervals

    Returns Case[]

    an array of Cases for operations over a range of inputs

  • Parameters

    • scalars: readonly number[]

      array of inputs to try for the scalar input

    • mats: ROArrayArrayArray<number>

      array of inputs to try for the matrix input

    • filter: IntervalFilter

      what interval filtering to apply

    • Rest ...ops: ScalarMatrixToMatrix[]

      callbacks that implement generating a matrix of acceptance intervals

    Returns Case[]

    an array of Cases for operations over a range of inputs

  • Parameters

    • param0s: readonly number[]

      array of inputs to try for the first input

    • param1s: readonly number[]

      array of inputs to try for the second input

    • filter: IntervalFilter

      what interval filtering to apply

    • Rest ...ops: ScalarPairToInterval[]

      callbacks that implement generating an acceptance interval

    Returns Case[]

    an array of Cases for operations over a range of inputs

  • Parameters

    • params: readonly number[]

      array of inputs to try

    • filter: IntervalFilter

      what interval filtering to apply

    • Rest ...ops: ScalarToInterval[]

      callbacks that implement generating an acceptance interval

    Returns Case[]

    an array of Cases for operations over a range of inputs

  • Parameters

    • param0s: readonly number[]

      array of inputs to try for the first input

    • param1s: readonly number[]

      array of inputs to try for the second input

    • param2s: readonly number[]

      array of inputs to try for the third input

    • filter: IntervalFilter

      what interval filtering to apply

    • Rest ...ops: ScalarTripleToInterval[]

      callbacks that implement generating an acceptance interval

    Returns Case[]

    an array of Cases for operations over a range of inputs

  • Parameters

    • scalars: readonly number[]

      array of scalar inputs to try

    • vectors: ROArrayArray<number>

      array of vector inputs to try

    • filter: IntervalFilter

      what interval filtering to apply

    • Rest ...ops: ScalarVectorToVector[]

      callbacks that implement generating a vector of acceptance intervals

    Returns Case[]

    an array of Cases for operations over a range of inputs

  • Parameters

    Returns Case[]

    an array of Cases for operations over a range of inputs

  • Parameters

    • vectors: ROArrayArray<number>

      array of vector inputs to try

    • scalars: readonly number[]

      array of scalar inputs to try

    • filter: IntervalFilter

      what interval filtering to apply

    • Rest ...ops: VectorScalarToVector[]

      callbacks that implement generating a vector of acceptance intervals

    Returns Case[]

    an array of Cases for operations over a range of inputs

  • Parameters

    • param0: number

      the first param to pass in

    • param1: number

      the second param to pass in

    • param2: number

      the third param to pass in

    • filter: IntervalFilter

      what interval filtering to apply

    • Rest ...ops: ScalarTripleToInterval[]

      callbacks that implement generating an acceptance interval

    Returns undefined | Case

    a Case for the params and the interval generator provided. The Case will use an interval comparator for matching results.

Generated using TypeDoc