mozilla
Your Search Results

    SIMD.float64x2

    This is an experimental technology, part of the Harmony (ECMAScript 7) proposal.
    Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future version of browsers as the spec changes.

    The SIMD.float64x2 data type is a 128-bit vector divided into 2 lanes storing double precision floating point values.

    SIMD.float64x2

    Figure 1: SIMD.float64x2 in a 128-bit SIMD register.

    Syntax

    SIMD.float64x2(x, y);

    Parameters

    x Optional
    An double specifying the value of the first lane. Defaults to NaN.
    y Optional
    An double specifying the value of the second lane. Defaults to NaN.

    Constructors

    In addition to the simple constructors, the SIMD API provides the following constructor. Note that you can also convert from another SIMD data type to float64x2.

    SIMD.float64x2.splat()
    Creates a float64x2 with all lanes set to a given value.

    Operations

    To actually do something with SIMD types, SIMD operations are needed that work on SIMD data types.

    Checking SIMD types

    SIMD.float64x2.check()
    Returns a new float64x2 if the parameter is a valid float64x2 data type. Throws a TypeError otherwise.

    Accessing and mutating lanes

    SIMD.float64x2.extractLane()
    Returns the value of the given lane.
    SIMD.float64x2.replaceLane()
    Returns a new float64x2 with the given lane value replaced.

    Loading from and storing into typed arrays

    SIMD.float64x2.load()
    Returns a new float64x2 with the lane values loaded from a typed array.
    SIMD.float64x2.store()
    Stores a float64x2 into a typed array.

    Arithmetic operations

    SIMD.float64x2.abs()
    Returns a new float64x2 with the absolute lane values.
    SIMD.float64x2.add()
    Returns a new float64x2 with the lane values added (a + b).
    SIMD.float64x2.div()
    Returns a new float64x2 with the lane values divided (a / b).
    SIMD.float64x2.mul()
    Returns a new float64x2 with the lane values multiplied (a * b).
    SIMD.float64x2.neg()
    Returns a new float64x2 with the negated lane values.
    SIMD.float64x2.reciprocalApproximation()
    Returns a new float64x2 with an approximation of the reciprocal lane values.
    SIMD.float64x2.reciprocalSqrtApproximation()
    Returns a new float64x2 with an approximation of the reciprocal square root lane values.
    SIMD.float64x2.sub()
    Returns a new float64x2 with the lane values subtracted (a - b).
    SIMD.float64x2.sqrt()
    Returns a new float64x2 with the square root of the lane values.

    Shuffling and swizzling

    SIMD.float64x2.shuffle()
    Returns a new float64x2 with the lane values shuffled.
    SIMD.float64x2.swizzle()
    Returns a new float64x2 with the lane values swizzled.

    Min/max and clamping

    SIMD.float64x2.clamp()
    Returns a new float64x2 with the lane values clamped between a lower limit and an upper limit.
    SIMD.float64x2.max()
    Returns a new float64x2 with the maximum of the lane values.
    SIMD.float64x2.maxNum()
    Returns a new float64x2 with the maximum of the lane values, preferring numbers over NaN.
    SIMD.float64x2.min()
    Returns a new float64x2 with the minimum of the lane values.
    SIMD.float64x2.minNum()
    Returns a new float64x2 with the minimum of the lane values, preferring numbers over NaN.

    Selections

    SIMD.float64x2.select()
    Returns a new float64x2 with the lane values being a mix of the lanes depending on the selector mask.
    SIMD.float64x2.selectBits()
    Returns a new float64x2 with the lane values being a mix of bits depending on the selector mask.

    Comparisons

    SIMD.float64x2.equal()
    Returns a selection mask depending on a == b.
    SIMD.float64x2.notEqual()
    Returns a selection mask depending on a != b.
    SIMD.float64x2.lessThan()
    Returns a selection mask depending on a < b.
    SIMD.float64x2.lessThanOrEqual()
    Returns a selection mask depending on a <= b.
    SIMD.float64x2.greaterThan()
    Returns a selection mask depending on a > b.
    SIMD.float64x2.greaterThanOrEqual()
    Returns a selection mask depending on a >= b.

    Data conversions (packing / unpacking)

    SIMD.float64x2.fromInt32x4()
    Creates a new float64x2 data type with a float conversion from an int32x4.
    SIMD.float64x2.fromInt32x4Bits()
    Creates a new float64x2 data type with a bit-wise copy from an int32x4.
    SIMD.float64x2.fromFloat32x4()
    Creates a new float64x2 data type with a float conversion from a float32x4.
    SIMD.float64x2.fromFloat32x4Bits()
    Creates a new float64x2 data type with a bit-wise copy from a float32x4.
    SIMD.float64x2.fromInt16x8Bits()
    Creates a new float64x2 data type with a bit-wise copy from an int16x8.
    SIMD.float64x2.fromInt8x16Bits()
    Creates a new float64x2 data type with a bit-wise copy from an int8x16.

    Examples

    Constructing an float64x2

    new SIMD.float64x2(1, 2); // float64x2[1, 2]
    new SIMD.float64x2(1);    // float64x2[1, NaN]
    new SIMD.float64x2();     // float64x2[NaN, NaN]
    

    Specifications

    SIMD is not yet part of an official standards document or draft. For standardization work and a Polyfill implementation based on typed arrays, see the ecmascript_simd GitHub repository.

    Browser compatibility

    Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
    Basic support Not supported Nightly build Not supported Not supported Not supported
    Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
    Basic support Not supported Not supported Nightly build Not supported Not supported Not supported

    See also

    Document Tags and Contributors

    Contributors to this page: fscholz
    Last updated by: fscholz,
    Hide Sidebar