Note: The Float64x2 type is currently not part of the SIMD specification draft.
The SIMD.Float64x2 data type is a 128-bit vector divided into 2 lanes storing double precision floating point values.
Figure 1: SIMD.Float64x2 in a 128-bit SIMD register.
SIMD.Float64x2(x, y);
x Optional
NaN.y Optional
NaN.In addition to the simple creator functions, the SIMD API provides the following constructor functions:
SIMD.Float64x2.splat()Note that you can also convert from another SIMD data type to Float64x2.
Note: SIMD types don't work with new, as SIMD values are no "boxed" objects (comparable to String(s) vs. new String(s), which creates a String object).
var v = new SIMD.Float64x2(1, 2); // TypeError: SIMD.Float64x2 is not a constructor var w = new SIMD.Float64x2.splat(3); // TypeError: SIMD.Float64x2.splat is not a constructor
Instead, you just write:
var v = SIMD.Float64x2(1, 2); var w = SIMD.Float64x2.splat(3);
To actually do something with SIMD types, SIMD operations are needed that work on SIMD data types.
SIMD.Float64x2.check()TypeError otherwise.SIMD.Float64x2.extractLane()SIMD.Float64x2.replaceLane()SIMD.Float64x2.load()SIMD.Float64x2.load1()SIMD.Float64x2.store()SIMD.Float64x2.store1()
SIMD.Float64x2.abs()SIMD.Float64x2.add()a + b).SIMD.Float64x2.div()a / b).SIMD.Float64x2.mul()a * b).SIMD.Float64x2.neg()SIMD.Float64x2.reciprocalApproximation()SIMD.Float64x2.reciprocalSqrtApproximation()SIMD.Float64x2.sub()a - b).SIMD.Float64x2.sqrt()SIMD.Float64x2.shuffle()SIMD.Float64x2.swizzle()SIMD.Float64x2.max()SIMD.Float64x2.maxNum()NaN.SIMD.Float64x2.min()SIMD.Float64x2.minNum()NaN.SIMD.Float64x2.select()SIMD.Float64x2.equal()a == b.SIMD.Float64x2.notEqual()a != b.SIMD.Float64x2.lessThan()a < b.SIMD.Float64x2.lessThanOrEqual()a <= b.SIMD.Float64x2.greaterThan()a > b.SIMD.Float64x2.greaterThanOrEqual()a >= b.SIMD.Float64x2.fromFloat32x4Bits()SIMD.Float64x2.fromInt32x4Bits()SIMD.Float64x2.fromInt16x8Bits()SIMD.Float64x2.fromInt8x16Bits()SIMD.Float64x2.fromUint32x4Bits()SIMD.Float64x2.fromUint16x8Bits()SIMD.Float64x2.fromUint8x16Bits()The following methods and properties are installed on the SIMD.Float64x2.prototype.
SIMD.Float64x2.prototype.constructorSIMD.Float64x2.prototype.toLocaleString()Object.prototype.toLocaleString() method.SIMD.Float64x2.prototype.toString()Object.prototype.toString() method.SIMD.Float64x2.prototype.valueOf()SIMD.Float64x2.prototype.toSource()
Object.prototype.toSource() method.SIMD.Float64x2(1, 2); // Float64x2[1, 2] SIMD.Float64x2(1); // Float64x2[1, NaN] SIMD.Float64x2(); // Float64x2[NaN, NaN]
The Float64x2 type is currently not part of the SIMD specification draft.
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | No support | Nightly build | No support | No support | No support |
| Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|
| Basic support | No support | No support | Nightly build | No support | No support | No support |
© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64x2