5 ms·
0x7FDE623822FC16E6: A magic constant for double float reciprocal (2011)
- pushedx 5y agoWhen someone asks you what software engineering is, this is software engineering.
- worewood 5y agoThis is programming/hacking. Software engineering is more related to the tools and processes an used to build and maintain software.
- gibolt 5y agoThis is very much engineering, discoving an extremely effective solution based on system knowledge.
- rfd4sgmk8u 5y agoEngineering 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.
- sennight 5y agoThe problem with that redefinition is that you spontaneously transform into an engineer when working on your own personal library, but as soon as you pull in a single dependency, or manually punch in some old school approximation algorithm, you are "just" some dirty good for nothing code janitor. Imagine somebody tasked with designing a bridge abandoning their engineering mindset because they used somebody else's drafting table. Also, that engineer better be "just" implementing other peoples algorithms on that bridge design - I'm not interested in driving across some 10Xer's suspension bridge.
- Quarrel 5y agoI really love the totally varied definitions in this thread. THIS pretty much sums up so much of CS.
- taneq 5y agoOne of the biggest eye-openers to me once I hit "the real world" was how many wildly different interpretations of the word "engineering" there are. At one end of the scale you have people who equate it entirely with methodology and process, and at the other you have people who equate it with building a high performance system.
- dahfizz 5y agoI 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 5y agoFWIW, I would probably call this "applied mathematics"; "software engineering" is a discipline that studies how to create software.
- jhgb 5y ago> FWIW, I would probably call this "applied mathematics" You mean the thing we call "computer science" (or "mathematical informatics" in some non-English-speaking countries)?
- deleted 5y ago[deleted]
- dang 5y agoJust one past thread with one past comment: 0x7FDE623822FC16E6 : a magic constant for double float reciprocal - https://news.ycombinator.com/item?id=2335025 https://news.ycombinator.com/item?id=2335025 - March 2011 (1 comment)
- madars 5y agocperciva'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 5y agohttps://github.com/search?q=0x7FDE623822FC16E6&type=code https://github.com/search?q=0x7FDE623822FC16E6&type=code
- aarchi 5y agoLooks 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.go https://github.com/gorgonia/gorgonia/blob/master/math_fast.g...
- 0xdeadb00f 5y agoSince when do I have to login to search GitHub code?
- tempodox 5y agoThe URL triggers an “advanced search” (“Code” only, instead of “All GitHub”). For that, they want your login.
- kevincox 5y agoNo long required and regex search (not that it is needed here). Plus it searches GitLab too. (I think there is a repo limit though based on popular repos) https://sourcegraph.com/search?q=context:global+7FDE623822FC16E6+&patternType=literal https://sourcegraph.com/search?q=context:global+7FDE623822FC...
- peterburkimsher 5y agoAs 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-square-root-e51fee3b49d9 https://medium.com/hard-mode/the-legendary-fast-inverse-squa... This is where I really see CS as being close to mathematics.
- marcellus23 5y agoAsk me how I know you didn’t read the article :)
- SolarNet 5y ago> As mentioned in the article
- peterburkimsher 5y agoTouché, 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.
- bertr4nd 5y agoIf your box has avx512, this paper has a neat vectorized double precision reciprocal: http://www.ecs.umass.edu/arith-2018/pdf/arith25_18.pdf http://www.ecs.umass.edu/arith-2018/pdf/arith25_18.pdf I’ve not tried it yet but I like all the new math instructions.
- longemen3000 5y agoi remembered when i wanted to implement sqrt(x) by myself. before concluding that the LLVM instruction was the fastest, i came with this: https://gist.github.com/longemen3000/72b2d18761d1a89fd31a7aaa468dc3e5 https://gist.github.com/longemen3000/72b2d18761d1a89fd31a7aa...
- kazinator 5y agoThat 6E6 on the end looks ironically like a floating-point exponent. :)