3 ms·
> Exactly how? Are you being sarcastic? EDIT: Assuming you aren't being sarcastic, you clearly aren't thinking like an engineer. As the OP points out, there a
by 0xff00ffee 7y ago
> Exactly how?
Are you being sarcastic?
EDIT: Assuming you aren't being sarcastic, you clearly aren't thinking like an engineer. As the OP points out, there are many ways to compute sine. And they all have tradeoffs. So you need to decide what tradeoffs describe your constraints. Otherwise you can simply use an infinite series. See, you didn't define what you meant by "exactly". Exactly to infinite precision? Or exactly in 100 clock cycles?
- soVeryTired 7y agoThe point of the article is that the fine details of the calculation of transcendetal functions often change between javascript versions. The standards committee -- possibly deliberately -- didn't pin them down tightly.
- 0xff00ffee 7y agoI'll repeat once again: do your engineering homework and decide if you can live with a spec that changes the Nth digit of precision, or if you need more precision roll your own. If you're just making an SVG rotate, then why are you arguing?
- zamadatix 7y agoThe Nth digit in this case is digit 0, as the article points out. You're interpreting it as the usual "floating point is inaccurate" article/conversation instead of what it actually is - a surprising detail in the ECMAScript standard.
- edflsafoiewq 7y agoIs it surprising? What languages specify the exact result of mathematical functions?
- zamadatix 7y agoE.g. java.lang.Math spends a lot of time defining the required accuracy of functions https://docs.oracle.com/javase/7/docs/api/java/lang/Math.html https://docs.oracle.com/javase/7/docs/api/java/lang/Math.htm...
- 0xff00ffee 7y agoIt absolutely is filed under "FP is inaccurate". If you need increased precision beyond a few digits, you must approach the problem armed with numerical computation knowledge and not rely on libraries or generic implementations: even between versions. It's not a surprise, its why the Numerical Recipes books are so famous. (Heck it's even discussed in Abrash's Graphics Programming Book!) I guess this article is more valuable that I expected: it is exposing some really glaring flaws in what people expect from their underlying language. Kinda scary, but I guess it is better late then never to learn the basics.
- zamadatix 7y agoHow is it filed under "FP is inaccurate" if it can be fixed by choice of algorithm and is about algorithms changing? Would be true of fixed point as well. Also it's generally considered poor form to continually talk about people needing to learn the basics/go to school/think like an engineer on HN - generally the focus here is on the content not on how you view the author/readers.