3 ms·
> once a program proved correct Now that's the incredibly difficult part, as bugs are no stranger to code, let alone code that tries to model the real world wi
by operator-name 4y ago
> once a program proved correct
Now that's the incredibly difficult part, as bugs are no stranger to code, let alone code that tries to model the real world with assumptions.
The sin function is actually incredibly incredibly complex (https://stackoverflow.com/questions/2284860/how-does-c-compute-sin-and-other-math-functions https://stackoverflow.com/questions/2284860/how-does-c-compu...) and implimentation are full of implicit and imperfect assumptions (like floating point). Under normal use these errors are silently propogated, and the floating point model well designed enough that for the majority it doesn't matter at all.
Being able to run a model whilst iterating is great, but at the end of the day it's still a model, and could break down.
- WalterBright 4y agoI'm painfully aware of that. My biggest enemy was accumulating roundoff error. I'd check the results by running the reverse algorithm to see if the outputs reproduced the inputs. For example, I'd check the matrix inversion by multiplying the input by the inverse and seeing how close it got to the identity matrix.