Created
October 10, 2022 15:05
-
-
Save joewagner/85d12f6df995111c672f0c868408af9a to your computer and use it in GitHub Desktop.
Javascript Muller Kahan
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a test designed by muller and kahan that demonstrates how | |
// the calculation of a known convergence returns incorrectly because | |
// of the mathematics of floating point numbers | |
const max = 21 | |
let u = 2.0; | |
let v = -4.0; | |
let w; | |
for (let i = 3; i < max; i++) { | |
w = 111.0 - 1130.0/v + 3000.0/(v*u); | |
u = v; | |
v = w; | |
} | |
console.log(v); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment