<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>bnprks</author><text>Sadly even SSE vs. AVX is enough to often give different results, as SSE doesn&amp;#x27;t have support for fused multiply-add instructions which allow calculation of a*b + c with guaranteed correct rounding. Even though this should allow CPUs from 2013 and later to all use FMA, gcc&amp;#x2F;clang don&amp;#x27;t enable AVX by default for the x86-64 targets. And even if they did, results are only guaranteed identical if implementations have chosen the exact same polynomial approximation method and no compiler optimizations alter the instruction sequence.&lt;p&gt;Unfortunately, floating point results will probably continue to differ across platforms for the foreseeable future.</text><parent_chain><item><author>cogman10</author><text>Well, what&amp;#x27;s fun is that (AFAIK) trigonometric functions tend not to be implemented in the newer floating point instructions, such as AVX or SSE.&lt;p&gt;So while what you say is true about the x87 implementation of those functions, for anything targeting a machine built in the last 20 years it&amp;#x27;s likely the code will run consistently regardless the architecture (barring architecture floating point bugs, which aren&amp;#x27;t terribly uncommon in the less significant bits and when overclocking comes into play).&lt;p&gt;x86 compilers won&amp;#x27;t use x87 instructions when SSE2 and later are available.  x87 is just a really weird and funky instruction set that&amp;#x27;s best left in the gutter of history.</text></item><item><author>warpech</author><text>This made me realize that trigonometric functions are not deterministic across different CPU architectures, OS, and programming languages (floating point precision aside).&lt;p&gt;E.g. I would assume that Math.sin(x) returns the same thing in NodeJS on Windows and Mac&amp;#x2F;M1, but it turns out it is necessarily so. 
 &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;stackoverflow.com&amp;#x2F;questions&amp;#x2F;74074312&amp;#x2F;standard-math-functions-reproducibility-on-different-cpus&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;stackoverflow.com&amp;#x2F;questions&amp;#x2F;74074312&amp;#x2F;standard-math-f...&lt;/a&gt;</text></item></parent_chain></comment><story><title>How do computers calculate sine?</title><url>https://androidcalculator.com/how-do-calculators-compute-sine/</url></story>
<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>enriquto</author><text>&amp;gt; x87 is just a really weird and funky instruction set that&amp;#x27;s best left in the gutter of history&lt;p&gt;hmmm, can you use the long doubles in sse or avx?  They are glorious, and as far as I see from playing with godbolt, they still require dirtying your hands with the x87 stack.</text><parent_chain><item><author>cogman10</author><text>Well, what&amp;#x27;s fun is that (AFAIK) trigonometric functions tend not to be implemented in the newer floating point instructions, such as AVX or SSE.&lt;p&gt;So while what you say is true about the x87 implementation of those functions, for anything targeting a machine built in the last 20 years it&amp;#x27;s likely the code will run consistently regardless the architecture (barring architecture floating point bugs, which aren&amp;#x27;t terribly uncommon in the less significant bits and when overclocking comes into play).&lt;p&gt;x86 compilers won&amp;#x27;t use x87 instructions when SSE2 and later are available.  x87 is just a really weird and funky instruction set that&amp;#x27;s best left in the gutter of history.</text></item><item><author>warpech</author><text>This made me realize that trigonometric functions are not deterministic across different CPU architectures, OS, and programming languages (floating point precision aside).&lt;p&gt;E.g. I would assume that Math.sin(x) returns the same thing in NodeJS on Windows and Mac&amp;#x2F;M1, but it turns out it is necessarily so. 
 &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;stackoverflow.com&amp;#x2F;questions&amp;#x2F;74074312&amp;#x2F;standard-math-functions-reproducibility-on-different-cpus&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;stackoverflow.com&amp;#x2F;questions&amp;#x2F;74074312&amp;#x2F;standard-math-f...&lt;/a&gt;</text></item></parent_chain></comment><story><title>How do computers calculate sine?</title><url>https://androidcalculator.com/how-do-calculators-compute-sine/</url></story>