[HN Gopher] 0x7FDE623822FC16E6: A magic constant for double floa...
       ___________________________________________________________________
        
       0x7FDE623822FC16E6: A magic constant for double float reciprocal
       (2011)
        
       Author : signa11
       Score  : 83 points
       Date   : 2021-07-21 11:58 UTC (1 days ago)
        
 (HTM) web link (pvk.ca)
 (TXT) w3m dump (pvk.ca)
        
       | dang wrote:
       | Just one past thread with one past comment:
       | 
       |  _0x7FDE623822FC16E6 : a magic constant for double float
       | reciprocal_ - https://news.ycombinator.com/item?id=2335025 -
       | March 2011 (1 comment)
        
         | madars wrote:
         | cperciva's comment there also generalizes to cryptographic
         | protocols which sometimes require batch inversion (i.e. given
         | a1, ..., an \in F, find out all a1^{-1}, ..., an^{-1}; e.g.
         | when converting a bunch of EC points from projective to affine
         | coordinates), and is there known as "Montgomery's trick"
         | (separate from Montgomery modular multiplication). That is, you
         | trade n inversions for 3(n-1) multiplications and one
         | inversion.
        
       | pella wrote:
       | https://github.com/search?q=0x7FDE623822FC16E6&type=code
        
         | aarchi wrote:
         | Looks like the only use on GitHub so far is Gorgonia, a Go ML
         | library, along with a fast tanh function.
         | 
         | https://github.com/gorgonia/gorgonia/blob/master/math_fast.g...
        
       | peterburkimsher wrote:
       | As mentioned in the article, it reminds me of the 0x5f3759df fast
       | inverse square root used in Quake III Arena!
       | 
       | https://medium.com/hard-mode/the-legendary-fast-inverse-squa...
       | 
       | This is where I really see CS as being close to mathematics.
        
         | marcellus23 wrote:
         | Ask me how I know you didn't read the article :)
        
           | SolarNet wrote:
           | > As mentioned in the article
        
             | peterburkimsher wrote:
             | Touche, I edited it. I still thought it's worth keeping the
             | comment because people might not always realise how useful
             | these hacks can be when performance is important e.g.
             | games.
        
       | [deleted]
        
       | pushedx wrote:
       | When someone asks you what software engineering is, this is
       | software engineering.
        
         | worewood wrote:
         | This is programming/hacking. Software engineering is more
         | related to the tools and processes an used to build and
         | maintain software.
        
           | gibolt wrote:
           | This is very much engineering, discoving an extremely
           | effective solution based on system knowledge.
        
             | rfd4sgmk8u wrote:
             | Engineering would be how you test it, how you document it,
             | how you maintain it, how you deploy it. Implementing other
             | peoples algorithms is just programming/coding.
        
           | dahfizz wrote:
           | I consider tools and processes more like being a code
           | mechanic.
           | 
           | A construction worker is familiar with construction tools and
           | processes. A civil engineer does the math and design work to
           | "program" a building.
        
         | saurik wrote:
         | FWIW, I would probably call this "applied mathematics";
         | "software engineering" is a discipline that studies how to
         | create software.
        
       ___________________________________________________________________
       (page generated 2021-07-22 23:00 UTC)