double-double
Version:
Pure double-double precision functions *with strict error bounds*.
38 lines (26 loc) • 1.09 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>End to end test</title>
<meta name="description" content="End to end test for the `global var browser build`">
<!-- <script src="./browser/index.js"></script> -->
<script src="./browser/index.min.js"></script>
<script>
const { ddAddDd } = doubleDouble;
const dd1 = [-4.357806199228875e-10, 11638607.274152497]; // some double-double
const dd2 = [4.511949494578893e-11, -2797357.2918064594]; // another double-double
const r1 = ddAddDd(dd1,dd2); // sum the two double-doubles
const r2 = [-3.906611249770986e-10, 8841249.982346037]; // the correct result
if (r1[0] === r2[0] && r1[1] === r2[1]) {
console.log('success! 😁'); // we should get to here!
} else {
console.log('failure! 😥'); // ...and not here
}
</script>
</head>
<body>
Check the console.
</body>
</html>