diff --git a/JSTests/stress/dataview-get-cse.js b/JSTests/stress/dataview-get-cse.js
index e3d47a938e..2cb8e36b2c 100644
--- a/JSTests/stress/dataview-get-cse.js
+++ b/JSTests/stress/dataview-get-cse.js
@@ -5,6 +5,26 @@ function assert(b) {
         throw new Error;
 }
 
+function getIsLittleEndian() {
+    let ab = new ArrayBuffer(2);
+    let ta = new Int16Array(ab);
+    ta[0] = 0x0102;
+    let dv = new DataView(ab);
+    return dv.getInt16(0, true) === 0x0102;
+}
+
+let isLittleEndian = getIsLittleEndian();
+
+function adjustForEndianess(value) {
+    if (isLittleEndian)
+        return value;
+
+    let ab = new ArrayBuffer(8);
+    let ta = new Float64Array(ab);
+    ta[0] = value;
+    let dv = new DataView(ab);
+    return dv.getFloat64(0, true);
+}
 
 function test1() {
     function foo(dv) {
@@ -41,7 +61,7 @@ test2();
 function test3() {
     function foo(dv, ta) {
         let a = dv.getFloat64(0, true);
-        ta[0] = Math.PI;
+        ta[0] = adjustForEndianess(Math.PI);
         let b = dv.getFloat64(0, true);
         return [a, b];
     }
diff --git a/JSTests/stress/dataview-jit-get.js b/JSTests/stress/dataview-jit-get.js
index e0665af20c..1d1ed06ca8 100644
--- a/JSTests/stress/dataview-jit-get.js
+++ b/JSTests/stress/dataview-jit-get.js
@@ -5,6 +5,16 @@ function assert(b) {
         throw new Error("Bad!");
 }
 
+function getIsLittleEndian() {
+    let ab = new ArrayBuffer(2);
+    let ta = new Int16Array(ab);
+    ta[0] = 0x0102;
+    let dv = new DataView(ab);
+    return dv.getInt16(0, true) === 0x0102;
+}
+
+let isLittleEndian = getIsLittleEndian();
+
 function test1() {
     function bigEndian(o, i) {
         return o.getInt32(i, false);
@@ -18,10 +28,20 @@ function test1() {
         return o.getInt32(i, b);
     }
     noInline(biEndian);
+    function adjustForEndianess(value) {
+        if (isLittleEndian)
+            return value;
+
+        let ab = new ArrayBuffer(4);
+        let ta = new Int32Array(ab);
+        ta[0] = value;
+        let dv = new DataView(ab);
+        return dv.getInt32(0, true);
+    }
 
     let ab = new ArrayBuffer(4);
     let ta = new Int32Array(ab);
-    ta[0] = 0x01020304;
+    ta[0] = adjustForEndianess(0x01020304);
     let dv = new DataView(ab);
 
     for (let i = 0; i < 10000; ++i) {
@@ -43,7 +63,7 @@ function test1() {
     }
 
     // Make sure we get the right sign.
-    ta[0] = -32361386; // 0xfe123456
+    ta[0] = adjustForEndianess(-32361386); // 0xfe123456
     for (let i = 0; i < 10000; ++i) {
         assert(bigEndian(dv, 0) === 0x563412fe);
         assert(littleEndian(dv, 0) === -32361386);
@@ -54,7 +74,7 @@ function test1() {
     }
 
     // -2146290602 == (int)0x80123456
-    ta[0] = 0x56341280;
+    ta[0] = adjustForEndianess(0x56341280);
     for (let i = 0; i < 10000; ++i) {
         assert(bigEndian(dv, 0) === -2146290602);
         assert(littleEndian(dv, 0) === 0x56341280);
@@ -79,10 +99,20 @@ function test2() {
         return o.getInt16(i, b);
     }
     noInline(biEndian);
+    function adjustForEndianess(value) {
+        if (isLittleEndian)
+            return value;
+
+        let ab = new ArrayBuffer(2);
+        let ta = new Int16Array(ab);
+        ta[0] = value;
+        let dv = new DataView(ab);
+        return dv.getInt16(0, true);
+    }
 
     let ab = new ArrayBuffer(2);
     let ta = new Int16Array(ab);
-    ta[0] = 0x0102;
+    ta[0] = adjustForEndianess(0x0102);
     let dv = new DataView(ab);
 
     for (let i = 0; i < 10000; ++i) {
@@ -95,7 +125,7 @@ function test2() {
     }
 
     // Check sign.
-    ta[0] = -512; // 0xfe00
+    ta[0] = adjustForEndianess(-512); // 0xfe00
     for (let i = 0; i < 10000; ++i) {
         assert(bigEndian(dv, 0) === 0x00fe);
         assert(littleEndian(dv, 0) === -512);
@@ -106,7 +136,7 @@ function test2() {
     }
 
     // Check sign extension.
-    ta[0] = 0x00fe;
+    ta[0] = adjustForEndianess(0x00fe);
     for (let i = 0; i < 10000; ++i) {
         assert(bigEndian(dv, 0) === -512);
         assert(littleEndian(dv, 0) === 0x00fe);
@@ -131,6 +161,16 @@ function test3() {
         return o.getFloat32(i, b);
     }
     noInline(biEndian);
+    function adjustForEndianess(value) {
+        if (isLittleEndian)
+            return value;
+
+        let ab = new ArrayBuffer(4);
+        let ta = new Float32Array(ab);
+        ta[0] = value;
+        let dv = new DataView(ab);
+        return dv.getFloat32(0, true);
+    }
 
     let ab = new ArrayBuffer(4);
     let ta = new Float32Array(ab);
@@ -138,7 +178,7 @@ function test3() {
     const normalAsDouble = 12912.403320312500;
 
     const flipped = -5.1162437589918884e-21;
-    ta[0] = normal;
+    ta[0] = adjustForEndianess(normal);
 
     let dv = new DataView(ab);
     for (let i = 0; i < 10000; ++i) {
@@ -152,6 +192,17 @@ function test3() {
 }
 test3();
 
+function adjustForEndianessUint32(value) {
+    if (isLittleEndian)
+        return value;
+
+    let ab = new ArrayBuffer(4);
+    let ta = new Uint32Array(ab);
+    ta[0] = value;
+    let dv = new DataView(ab);
+    return dv.getUint32(0, true);
+}
+
 function test4() {
     function bigEndian(o, i) {
         return o.getUint32(i, false);
@@ -168,7 +219,7 @@ function test4() {
 
     let ab = new ArrayBuffer(4);
     let ta = new Uint32Array(ab);
-    ta[0] = 0xa0b0d0f0;
+    ta[0] = adjustForEndianessUint32(0xa0b0d0f0);
 
     let dv = new DataView(ab);
     for (let i = 0; i < 10000; ++i) {
@@ -198,7 +249,7 @@ function test5() {
 
     let ab = new ArrayBuffer(4);
     let ta = new Uint32Array(ab);
-    ta[0] = 0xa0b0d0f0;
+    ta[0] = adjustForEndianessUint32(0xa0b0d0f0);
 
     let dv = new DataView(ab);
     for (let i = 0; i < 10000; ++i) {
@@ -239,7 +290,7 @@ function test6() {
 
     let ab = new ArrayBuffer(4);
     let ta = new Uint32Array(ab);
-    ta[0] = 0xa070fa01;
+    ta[0] = adjustForEndianessUint32(0xa070fa01);
 
     let dv = new DataView(ab);
     for (let i = 0; i < 10000; ++i) {
@@ -272,7 +323,7 @@ function test7() {
 
     let ab = new ArrayBuffer(4);
     let ta = new Uint32Array(ab);
-    ta[0] = 0xa070fa01;
+    ta[0] = adjustForEndianessUint32(0xa070fa01);
 
     let dv = new DataView(ab);
     for (let i = 0; i < 10000; ++i) {
@@ -292,7 +343,7 @@ function test8() {
 
     let ab = new ArrayBuffer(4);
     let ta = new Uint32Array(ab);
-    ta[0] = 0xa070fa01;
+    ta[0] = adjustForEndianessUint32(0xa070fa01);
 
     let dv = new DataView(ab);
     for (let i = 0; i < 10000; ++i) {
diff --git a/JSTests/stress/dataview-jit-neuter.js b/JSTests/stress/dataview-jit-neuter.js
index 635fc4c712..ff8caa1a29 100644
--- a/JSTests/stress/dataview-jit-neuter.js
+++ b/JSTests/stress/dataview-jit-neuter.js
@@ -5,6 +5,27 @@ function assert(b) {
         throw new Error("Bad!");
 }
 
+function getIsLittleEndian() {
+    let ab = new ArrayBuffer(2);
+    let ta = new Int16Array(ab);
+    ta[0] = 0x0102;
+    let dv = new DataView(ab);
+    return dv.getInt16(0, true) === 0x0102;
+}
+
+let isLittleEndian = getIsLittleEndian();
+
+function adjustForEndianess(value) {
+    if (isLittleEndian)
+        return value;
+
+    let ab = new ArrayBuffer(4);
+    let ta = new Uint32Array(ab);
+    ta[0] = value;
+    let dv = new DataView(ab);
+    return dv.getUint32(0, true);
+}
+
 function test() {
     function load(o, i) {
         return o.getUint8(i);
@@ -13,7 +34,7 @@ function test() {
 
     let ab = new ArrayBuffer(4);
     let ta = new Uint32Array(ab);
-    ta[0] = 0xa070fa01;
+    ta[0] = adjustForEndianess(0xa070fa01);
     let dv = new DataView(ab);
 
     for (let i = 0; i < 1000; ++i) {
@@ -40,7 +61,7 @@ function test2() {
 
     let ab = new ArrayBuffer(4);
     let ta = new Uint32Array(ab);
-    ta[0] = 0xa070fa01;
+    ta[0] = adjustForEndianess(0xa070fa01);
     let dv = new DataView(ab);
 
     for (let i = 0; i < 10000; ++i) {
diff --git a/JSTests/stress/dataview-jit-set-nan.js b/JSTests/stress/dataview-jit-set-nan.js
index cbd1cdb3af..bc3e9af465 100644
--- a/JSTests/stress/dataview-jit-set-nan.js
+++ b/JSTests/stress/dataview-jit-set-nan.js
@@ -7,6 +7,27 @@ function assert(b) {
         throw new Error;
 }
 
+function getIsLittleEndian() {
+    let ab = new ArrayBuffer(2);
+    let ta = new Int16Array(ab);
+    ta[0] = 0x0102;
+    let dv = new DataView(ab);
+    return dv.getInt16(0, true) === 0x0102;
+}
+
+let isLittleEndian = getIsLittleEndian();
+
+function adjustForEndianessFloat32(value) {
+    if (isLittleEndian)
+        return value;
+
+    let ab = new ArrayBuffer(4);
+    let ta = new Float32Array(ab);
+    ta[0] = value;
+    let dv = new DataView(ab);
+    return dv.getFloat32(0, true);
+}
+
 function test() {
     function storeLittleEndian(dv, index, value) {
         dv.setFloat32(index, value, true);
@@ -29,24 +50,25 @@ function test() {
     let dv = new DataView(buffer);
 
     for (let i = 0; i < 10000; ++i) {
-        storeLittleEndian(dv, 0, 1.5);
+        storeLittleEndian(dv, 0, adjustForEndianessFloat32(1.5));
         assert(arr[0] === 1.5);
 
-        storeLittleEndian(dv, 0, 12912.124123215122);
+        store(dv, 0, 12912.124123215122, isLittleEndian);
+        //storeLittleEndian(dv, 0, adjustForEndianessFloat32(12912.124123215122));
         assert(arr[0] === 12912.1240234375);
         assert(bits[0] === 0x4649c07f);
 
-        storeLittleEndian(dv, 0, NaN);
+        storeLittleEndian(dv, 0, adjustForEndianessFloat32(NaN));
         assert(isNaN(arr[0]));
         assert(bits[0] === 0x7FC00000);
 
-        storeLittleEndian(dv, 0, 2.3879393e-38);
+        storeLittleEndian(dv, 0, adjustForEndianessFloat32(2.3879393e-38));
         assert(arr[0] === 2.387939260590663e-38);
         assert(bits[0] === 0x01020304);
 
-        storeBigEndian(dv, 0, 2.3879393e-38);
+        storeBigEndian(dv, 0, adjustForEndianessFloat32(2.3879393e-38));
         assert(arr[0] === 1.539989614439558e-36);
         assert(bits[0] === 0x04030201);
     }
 }
-test();
\ No newline at end of file
+test();
diff --git a/JSTests/stress/dataview-jit-set.js b/JSTests/stress/dataview-jit-set.js
index 9238eb73f9..cb22891e68 100644
--- a/JSTests/stress/dataview-jit-set.js
+++ b/JSTests/stress/dataview-jit-set.js
@@ -5,13 +5,17 @@ function assert(b) {
         throw new Error;
 }
 
+function getIsLittleEndian() {
+    let ab = new ArrayBuffer(2);
+    let ta = new Int16Array(ab);
+    ta[0] = 0x0102;
+    let dv = new DataView(ab);
+    return dv.getInt16(0, true) === 0x0102;
+}
+
+let isLittleEndian = getIsLittleEndian();
+
 function readHex(dv, bytes) {
-    function isLittleEndian() { 
-        let b = new ArrayBuffer(4);
-        let dv = new DataView(b);
-        dv.setInt32(0, 0x00112233, true);
-        return dv.getUint8(0) === 0x33;
-    }
     let str = "";
     function readByte(i) {
         let b = dv.getUint8(i).toString(16);
@@ -21,7 +25,7 @@ function readHex(dv, bytes) {
             assert(b.length === 2)
         return b;
     }
-    if (isLittleEndian()) {
+    if (isLittleEndian) {
         for (let i = bytes; i--;)
             str = str + readByte(i);
     } else {
@@ -35,10 +39,21 @@ function readHex(dv, bytes) {
 {
     let b = new ArrayBuffer(4);
     let dv = new DataView(b);
-    dv.setInt32(0, 0x00112233, true);
+    dv.setInt32(0, 0x00112233, isLittleEndian);
     assert(readHex(dv, 4) === "0x00112233");
 }
 
+function adjustForEndianessUint16(value) {
+    if (isLittleEndian)
+        return value;
+
+    let ab = new ArrayBuffer(4);
+    let ta = new Uint16Array(ab);
+    ta[0] = value;
+    let dv = new DataView(ab);
+    return dv.getUint16(0, true);
+}
+
 function test() {
     function storeLittleEndian(dv, index, value) {
         dv.setInt16(index, value, true);
@@ -60,52 +75,52 @@ function test() {
     let dv = new DataView(buffer);
 
     for (let i = 0; i < 10000; ++i) {
-        storeLittleEndian(dv, 0, 0xfaba);
+        storeLittleEndian(dv, 0, adjustForEndianessUint16(0xfaba));
         assert(arr[0] === 0xfaba);
 
-        store(dv, 0, 0xabcd, true);
+        store(dv, 0, adjustForEndianessUint16(0xabcd), true);
         assert(arr[0] === 0xabcd);
 
-        store(dv, 0, 0xbadbeef, true);
+        store(dv, 0, adjustForEndianessUint16(0xbadbeef), true);
         assert(arr[0] === 0xbeef);
 
-        storeLittleEndian(dv, 0, 0xbb4db33f, true);
+        storeLittleEndian(dv, 0, adjustForEndianessUint16(0xbb4db33f), true);
         assert(arr[0] === 0xb33f);
 
-        storeBigEndian(dv, 0, 0xfada);
+        storeBigEndian(dv, 0, adjustForEndianessUint16(0xfada));
         assert(arr[0] === 0xdafa);
 
-        storeBigEndian(dv, 0, 0x12ab);
+        storeBigEndian(dv, 0, adjustForEndianessUint16(0x12ab));
         assert(arr[0] === 0xab12);
 
-        store(dv, 0, 0x1234, false);
+        store(dv, 0, adjustForEndianessUint16(0x1234), false);
         assert(arr[0] === 0x3412);
 
-        store(dv, 0, 0x0102, false);
+        store(dv, 0, adjustForEndianessUint16(0x0102), false);
         assert(arr[0] === 0x0201);
 
-        store(dv, 0, -1, false);
+        store(dv, 0, adjustForEndianessUint16(-1), false);
         assert(arr[0] === 0xffff);
 
-        store(dv, 0, -2, false);
+        store(dv, 0, adjustForEndianessUint16(-2), false);
         assert(arr[0] === 0xfeff);
 
-        storeBigEndian(dv, 0, -1);
+        storeBigEndian(dv, 0, adjustForEndianessUint16(-1));
         assert(arr[0] === 0xffff);
 
-        storeBigEndian(dv, 0, -2);
+        storeBigEndian(dv, 0, adjustForEndianessUint16(-2));
         assert(arr[0] === 0xfeff);
 
-        storeBigEndian(dv, 0, -2147483648); 
+        storeBigEndian(dv, 0, adjustForEndianessUint16(-2147483648));
         assert(arr[0] === 0x0000);
 
-        storeLittleEndian(dv, 0, -2147483648); 
+        storeLittleEndian(dv, 0, adjustForEndianessUint16(-2147483648));
         assert(arr[0] === 0x0000);
 
-        storeLittleEndian(dv, 0, -2147478988); 
+        storeLittleEndian(dv, 0, adjustForEndianessUint16(-2147478988));
         assert(arr[0] === 0x1234);
 
-        storeBigEndian(dv, 0, -2147478988); 
+        storeBigEndian(dv, 0, adjustForEndianessUint16(-2147478988));
         assert(arr[0] === 0x3412);
     }
 }
@@ -132,57 +147,68 @@ function test2() {
     let dv = new DataView(buffer);
 
     for (let i = 0; i < 10000; ++i) {
-        storeLittleEndian(dv, 0, 0xfaba);
+        storeLittleEndian(dv, 0, adjustForEndianessUint16(0xfaba));
         assert(arr[0] === 0xfaba);
 
-        store(dv, 0, 0xabcd, true);
+        store(dv, 0, adjustForEndianessUint16(0xabcd), true);
         assert(arr[0] === 0xabcd);
 
-        store(dv, 0, 0xbadbeef, true);
+        store(dv, 0, adjustForEndianessUint16(0xbadbeef), true);
         assert(arr[0] === 0xbeef);
 
-        storeLittleEndian(dv, 0, 0xbb4db33f, true);
+        storeLittleEndian(dv, 0, adjustForEndianessUint16(0xbb4db33f), true);
         assert(arr[0] === 0xb33f);
 
-        storeBigEndian(dv, 0, 0xfada);
+        storeBigEndian(dv, 0, adjustForEndianessUint16(0xfada));
         assert(arr[0] === 0xdafa);
 
-        storeBigEndian(dv, 0, 0x12ab);
+        storeBigEndian(dv, 0, adjustForEndianessUint16(0x12ab));
         assert(arr[0] === 0xab12);
 
-        store(dv, 0, 0x1234, false);
+        store(dv, 0, adjustForEndianessUint16(0x1234), false);
         assert(arr[0] === 0x3412);
 
-        store(dv, 0, 0x0102, false);
+        store(dv, 0, adjustForEndianessUint16(0x0102), false);
         assert(arr[0] === 0x0201);
 
-        store(dv, 0, -1, false);
+        store(dv, 0, adjustForEndianessUint16(-1), false);
         assert(arr[0] === 0xffff);
 
-        store(dv, 0, -2, false);
+        store(dv, 0, adjustForEndianessUint16(-2), false);
         assert(arr[0] === 0xfeff);
 
-        storeBigEndian(dv, 0, -1);
+        storeBigEndian(dv, 0, adjustForEndianessUint16(-1));
         assert(arr[0] === 0xffff);
 
-        storeBigEndian(dv, 0, -2);
+        storeBigEndian(dv, 0, adjustForEndianessUint16(-2));
         assert(arr[0] === 0xfeff);
 
-        storeBigEndian(dv, 0, -2147483648); 
+        storeBigEndian(dv, 0, adjustForEndianessUint16(-2147483648));
         assert(arr[0] === 0x0000);
 
-        storeLittleEndian(dv, 0, -2147483648); 
+        storeLittleEndian(dv, 0, adjustForEndianessUint16(-2147483648));
         assert(arr[0] === 0x0000);
 
-        storeLittleEndian(dv, 0, -2147478988); 
+        storeLittleEndian(dv, 0, adjustForEndianessUint16(-2147478988));
         assert(arr[0] === 0x1234);
 
-        storeBigEndian(dv, 0, -2147478988); 
+        storeBigEndian(dv, 0, adjustForEndianessUint16(-2147478988));
         assert(arr[0] === 0x3412);
     }
 }
 test2();
 
+function adjustForEndianessUint32(value) {
+    if (isLittleEndian)
+        return value;
+
+    let ab = new ArrayBuffer(4);
+    let ta = new Uint32Array(ab);
+    ta[0] = value;
+    let dv = new DataView(ab);
+    return dv.getUint32(0, true);
+}
+
 function test3() {
     function storeLittleEndian(dv, index, value) {
         dv.setUint32(index, value, true);
@@ -205,29 +231,29 @@ function test3() {
     let dv = new DataView(buffer);
 
     for (let i = 0; i < 10000; ++i) {
-        storeLittleEndian(dv, 0, 0xffffffff);
+        storeLittleEndian(dv, 0, adjustForEndianessUint32(0xffffffff));
         assert(arr[0] === 0xffffffff);
         assert(arr2[0] === -1);
 
-        storeLittleEndian(dv, 0, 0xffaabbcc);
+        storeLittleEndian(dv, 0, adjustForEndianessUint32(0xffaabbcc));
         assert(arr[0] === 0xffaabbcc);
 
-        storeBigEndian(dv, 0, 0x12345678);
+        storeBigEndian(dv, 0, adjustForEndianessUint32(0x12345678));
         assert(arr[0] === 0x78563412);
 
-        storeBigEndian(dv, 0, 0xffaabbcc);
+        storeBigEndian(dv, 0, adjustForEndianessUint32(0xffaabbcc));
         assert(arr[0] === 0xccbbaaff);
 
-        store(dv, 0, 0xfaeadaca, false);
+        store(dv, 0, adjustForEndianessUint32(0xfaeadaca), false);
         assert(arr[0] === 0xcadaeafa);
 
-        store(dv, 0, 0xcadaeafa, false);
+        store(dv, 0, adjustForEndianessUint32(0xcadaeafa), false);
         assert(arr2[0] === -85271862);
 
-        store(dv, 0, 0x12345678, false);
+        store(dv, 0, adjustForEndianessUint32(0x12345678), false);
         assert(arr[0] === 0x78563412);
 
-        storeBigEndian(dv, 0, 0xbeeffeeb);
+        storeBigEndian(dv, 0, adjustForEndianessUint32(0xbeeffeeb));
         assert(arr2[0] === -335614018);
     }
 }
@@ -255,34 +281,45 @@ function test4() {
     let dv = new DataView(buffer);
 
     for (let i = 0; i < 10000; ++i) {
-        storeLittleEndian(dv, 0, 0xffffffff);
+        storeLittleEndian(dv, 0, adjustForEndianessUint32(0xffffffff));
         assert(arr[0] === 0xffffffff);
         assert(arr2[0] === -1);
 
-        storeLittleEndian(dv, 0, 0xffaabbcc);
+        storeLittleEndian(dv, 0, adjustForEndianessUint32(0xffaabbcc));
         assert(arr[0] === 0xffaabbcc);
 
-        storeBigEndian(dv, 0, 0x12345678);
+        storeBigEndian(dv, 0, adjustForEndianessUint32(0x12345678));
         assert(arr[0] === 0x78563412);
 
-        storeBigEndian(dv, 0, 0xffaabbcc);
+        storeBigEndian(dv, 0, adjustForEndianessUint32(0xffaabbcc));
         assert(arr[0] === 0xccbbaaff);
 
-        store(dv, 0, 0xfaeadaca, false);
+        store(dv, 0, adjustForEndianessUint32(0xfaeadaca), false);
         assert(arr[0] === 0xcadaeafa);
 
-        store(dv, 0, 0xcadaeafa, false);
+        store(dv, 0, adjustForEndianessUint32(0xcadaeafa), false);
         assert(arr2[0] === -85271862);
 
-        store(dv, 0, 0x12345678, false);
+        store(dv, 0, adjustForEndianessUint32(0x12345678), false);
         assert(arr[0] === 0x78563412);
 
-        storeBigEndian(dv, 0, 0xbeeffeeb);
+        storeBigEndian(dv, 0, adjustForEndianessUint32(0xbeeffeeb));
         assert(arr2[0] === -335614018);
     }
 }
 test4();
 
+function adjustForEndianessFloat32(value) {
+    if (isLittleEndian)
+        return value;
+
+    let ab = new ArrayBuffer(4);
+    let ta = new Float32Array(ab);
+    ta[0] = value;
+    let dv = new DataView(ab);
+    return dv.getFloat32(0, true);
+}
+
 function test5() {
     function storeLittleEndian(dv, index, value) {
         dv.setFloat32(index, value, true);
@@ -305,27 +342,38 @@ function test5() {
     let dv = new DataView(buffer);
 
     for (let i = 0; i < 10000; ++i) {
-        storeLittleEndian(dv, 0, 1.5);
+        storeLittleEndian(dv, 0, adjustForEndianessFloat32(1.5));
         assert(arr[0] === 1.5);
 
-        storeLittleEndian(dv, 0, 12912.124123215122);
-        assert(arr[0] === 12912.1240234375);
+        store(dv, 0, 12912.124123215122, isLittleEndian);
         assert(bits[0] === 0x4649c07f);
+        assert(arr[0] === 12912.1240234375);
 
-        storeLittleEndian(dv, 0, NaN);
+        storeLittleEndian(dv, 0, adjustForEndianessFloat32(NaN));
         assert(isNaN(arr[0]));
 
-        storeLittleEndian(dv, 0, 2.3879393e-38);
+        storeLittleEndian(dv, 0, adjustForEndianessFloat32(2.3879393e-38));
         assert(arr[0] === 2.387939260590663e-38);
         assert(bits[0] === 0x01020304);
 
-        storeBigEndian(dv, 0, 2.3879393e-38);
+        storeBigEndian(dv, 0, adjustForEndianessFloat32(2.3879393e-38));
         assert(arr[0] === 1.539989614439558e-36);
         assert(bits[0] === 0x04030201);
     }
 }
 test5();
 
+function adjustForEndianessFloat64(value) {
+    if (isLittleEndian)
+        return value;
+
+    let ab = new ArrayBuffer(8);
+    let ta = new Float64Array(ab);
+    ta[0] = value;
+    let dv = new DataView(ab);
+    return dv.getFloat64(0, true);
+}
+
 function test6() {
     function storeLittleEndian(dv, index, value) {
         dv.setFloat64(index, value, true);
@@ -347,30 +395,30 @@ function test6() {
     let dv = new DataView(buffer);
 
     for (let i = 0; i < 10000; ++i) {
-        storeLittleEndian(dv, 0, NaN);
+        storeLittleEndian(dv, 0, adjustForEndianessFloat64(NaN));
         assert(isNaN(arr[0]));
 
-        storeLittleEndian(dv, 0, -2.5075187084135162e+284);
+        storeLittleEndian(dv, 0, adjustForEndianessFloat64(-2.5075187084135162e+284));
         assert(arr[0] === -2.5075187084135162e+284);
         assert(readHex(dv, 8) === "0xfafafafafafafafa");
 
-        store(dv, 0, 124.553, true);
+        store(dv, 0, adjustForEndianessFloat64(124.553), true);
         assert(readHex(dv, 8) === "0x405f23645a1cac08");
 
-        store(dv, 0, Infinity, true);
+        store(dv, 0, adjustForEndianessFloat64(Infinity), true);
         assert(readHex(dv, 8) === "0x7ff0000000000000");
 
-        store(dv, 0, Infinity, false);
+        store(dv, 0, adjustForEndianessFloat64(Infinity), false);
         assert(readHex(dv, 8) === "0x000000000000f07f");
 
-        store(dv, 0, -Infinity, true);
+        store(dv, 0, adjustForEndianessFloat64(-Infinity), true);
         assert(readHex(dv, 8) === "0xfff0000000000000");
 
-        storeBigEndian(dv, 0, -2.5075187084135162e+284);
+        storeBigEndian(dv, 0, adjustForEndianessFloat64(-2.5075187084135162e+284));
         assert(arr[0] === -2.5075187084135162e+284);
         assert(readHex(dv, 8) === "0xfafafafafafafafa");
 
-        storeBigEndian(dv, 0, 124.553);
+        storeBigEndian(dv, 0, adjustForEndianessFloat64(124.553));
         assert(readHex(dv, 8) === "0x08ac1c5a64235f40");
     }
 }
