News for hackers. Stuff that matters.

nonsequitur

Re:Show HN: HyperLogLog in Zig on Wednesday January 11, 2023 @02:41PM (#34343459)
Re:We want to make Nix better on Friday September 02, 2022 @04:20PM (#32695314)
Nix is turing complete (it can implement the Lambda Calculus), even conveniently so.
Re:Looking at Zig Programming Language on Tuesday April 05, 2022 @12:55PM (#30921499)
Hint: It's `catch {}` instead of `catch { ... }`.
This doesn't work because you're not left-shifting (doubling) the carry. But when adding the shifted carry to (x ^ y) we're back to potentially overflowing the highest bits. The solution is to add the highest and the lower bits separately:

  lower = 0x7f7f7f7f;
  highest = ~lower;
  z = ((x & lower) + (y & lower)) ^ ((x ^ y) & highest);
Note this only improves performance for larger container integers.
Re:How to use dig on Saturday December 04, 2021 @12:55PM (#29442677)
You can directly query `getaddrinfo` with

  getent ahosts myhost
Re:NSA's Puzzle Periodical on Monday August 22, 2016 @07:20AM (#12335478)
There's no assignment to the „m“ variables that would make your algorithm work in the general case.

im4w1l's strategy is just:

Player i returns (i - [Sum of the other players' suits]) % 4

(With i ranging from 0 to 3)

Re:How to multiply polynomials in Θ(n log n) time on Tuesday September 08, 2015 @04:46AM (#10184632)
Thanks! That paper is available on the author's website: http://gi.cebitec.uni-bielefeld.de/people/zsuzsa/papers/Algo...
Re:How to multiply polynomials in Θ(n log n) time on Monday September 07, 2015 @08:27PM (#10183641)
Can anybody guess in which way he used convolution for solving what is generally known as the change-making problem? Wikipedia [1] mentions a "probabilistic convolution tree", but that seems much more involved.

Edit: Solved. I've missed that the problem only deals with change amounts that can be reached with one or two coins. So a single convolution is sufficient in this specific case.

https://en.wikipedia.org/wiki/Change-making_problem

Re:The C++ Programming Language (4th Edition) on Sunday May 12, 2013 @05:44AM (#5693744)
I was dissappointed with the quality of the code and the final demo game. Also, it uses DirectX.

Here's an alternative: Dive into the GamePlay engine (https://github.com/blackberry/GamePlay/) and go through all the samples (https://github.com/blackberry/GamePlay/tree/master/samples), especially this collection of small feature demos (https://github.com/blackberry/GamePlay/tree/master/samples/b...). You'll get exposed to core concepts like Lighting, Terrain, Particles, 2D GUIs and Lua Scripting, all implemented from the ground up in C++ and OpenGL.

Re:Google Blockly - a visual programming language on Friday June 01, 2012 @03:46AM (#4052414)
Take some of that time to figure out the math and the code becomes trivial:

  for (n = 1; n <= 20; n++) {
    window.alert(n << (n-1))
  }
A short explanation: http://mathbin.net/98435
Re:9 reasons to start using C++11 on Friday May 11, 2012 @03:21AM (#3958119)
C++11 support in common compilers: http://wiki.apache.org/stdcxx/C++0xCompilerSupport
The complete "Force Concept Inventory" test (PDF): http://shs.westport.k12.ct.us/physics/2007-2008/FCI-rv95.pdf http://bit.ly/8YeiOZ (mirror)