Note: The Float64x2 type is currently not part of the SIMD specification draft.
The static SIMD.%type%.fromFloat64x2() method creates a new SIMD data type with a float conversion from a Float64x2.
Syntax
SIMD.Float32x4.fromFloat64x2(t) SIMD.Int32x4.fromFloat64x2(t)
Parameters
t- A Float64x2 SIMD type to convert from.
Errors thrown
- A
RangeError, if the conversion from floating-point to integer loses precision (if the lane values are smaller than -2147483649.0 or larger than 2147483648.0, orNaN, orInfinity).
Examples
SIMD.Float32x2.fromFloat64x2
See also the Math.fround() method for rounding from double precision float64 to single precision float32.
var t = SIMD.Float64x2(1.0, 2.7); SIMD.Float32x4.fromFloat64x2(t); // Float64x2[1.0, 2.700000047683716]
SIMD.Int32x4.fromFloat32x4
A floating-point to integer conversion of t is performed and a RangeError might be thrown if losing precision.
var t = SIMD.Float64x2(1.3, 2.7); SIMD.Int32x4.fromFloat64x2(t); // Int32x4[1, 2, 0, 0] var t = SIMD.Float64x2(NaN, 2147483650.0); SIMD.Int32x4.fromFloat64x2(t); // RangeError: SIMD conversion loses precision
Specifications
The Float64x2 type is currently not part of the SIMD specification draft.
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 |