HNHacker News
TopNewBestAskShowJobs

martincmartin

7,330 karma · joined May 12, 2008

Enjoying life.
submissionscomments
martincmartin··on How much your computer can do in a second (2015)
Thanks. On godbolt, I see clang do it at -O3. But gcc still has a loop, where the body has add but no mul, although I don't fully understand the body. Where do you see it in gcc?

https://godbolt.org/z/sP194Y

martincmartin··on How much your computer can do in a second (2015)
They used -O2, which produces the straight forward loop. [0]

But with -O3, for NUMBER > 51, is uses some other odd loop. [1]

Seems to be O(n) no matter what though.

[0]: https://godbolt.org/z/czcaYf [1]: https://godbolt.org/z/sP194Y

martincmartin··on How much your computer can do in a second (2015)

  for (s = i = 0; i < NUMBER; ++i) {
      s += 1;
  }
I'm surprised gcc can't figure out that this is NUMBER*(NUMBER-1) and eliminate the loop entirely.
martincmartin··on Intuitive Guide to Maxwell's Equations
It's by Gabriel Weinreich.
martincmartin··on Intuitive Guide to Maxwell's Equations
The book Geometrical Vectors does exactly that. In fact, it considers the gradient vector to be a different kind of vector than a normal distance vector. If I have a vector between two points, and I compress space so that the points move closer together, then the distance vector gets smaller. However, the gradient vector gets bigger. The gradient is basically a density, it's units are units-of-whatever-your-taking-the-gradient-of / meters.

And, or course, the vector you get from a cross product only has 3 degrees of freedom because we live in a 3D world. The cross product of two 2D vectors is a scalar, the cross product of two 4D vectors needs 6 numbers to describe it. Even in 3D, if you reflect the original vectors in a mirror, the cross product now points the opposite direction, i.e. it depends on the handednes of the coordinate system.

martincmartin··on MIT 6.001 Structure and Interpretation (1986) [video]
Lisps have a uniform syntax in S-expressions. This makes it unfamiliar to new users, but it means syntax just melts away, and you're expressing the abstract syntax tree of your program directly.

So writing code to manipulate abstract syntax trees becomes easy, since you're using to writing & thinking about programs in that form, and it's just manipulating lists, which is easy. For example, it becomes easy to write a program to symbolically differentiate an input expression.

You also think about functions as something easy and natural to pass around.

They also encourage pure functions, which allow lazy evaluation, easy memoization, and other fun things.

martincmartin··on Announce bad news without lying to your team
"Tell the truth, the whole truth, and nothing but the truth."

Only the 3rd one is lying. You can still leave a completely misleading impression by telling partial truths.

martincmartin··on Gravity Is Not Like the Other Forces
"In theories of quantum gravity, the graviton is the hypothetical quantum of gravity, an elementary particle that mediates the force of gravity."

https://en.wikipedia.org/wiki/Graviton

martincmartin··on An understanding of AI’s limitations is starting to sink in
The next article in the series, see the menu on the left, describes Donald Knuth as "a programming guru." :)
martincmartin··on From scratch: reverse-mode automatic differentiation (in Python)
There's a straight forward algorithm for automatic differentiation. You can think of it like long division: tedious to do, but you can easily program a computer to do it.

Integration is a whole different ball game. It's essentially a puzzle: what function, when differentiated, produces this result? There are various heuristics you can apply, e.g. integration by parts. And there are some databases of common integrals. But in the end, there's no algorithm, integration requires ingenuity to solve.

martincmartin··on Disney claims anyone using a Twitter hashtag is agreeing to their terms of use
You could use the algorithms, just not their implementation of the algorithms. If you rewrote it from scratch, following their text (not their source code), you were fully allowed to use it.
martincmartin··on Full Circle: The complicated history of why there are 360 degrees in a circle
Radians are useful because the derivative of sin is cos, derivative of cos is - sin, limit (sin(h)/h) as h -> 0 is 1, etc.
martincmartin··on Full Circle: The complicated history of why there are 360 degrees in a circle
I think OP is suggesting that we change the definition of radian, not Pi.
martincmartin··on Stocks Halt; Oil and Bonds Drop in Sync
With lots of companies struggling or going under, the demand for commercial real estate should be lower. Supply roughly constant, demand significantly down.
martincmartin··on Differential Equations with Transformers: Deep Learning for Symbolic Math
Yes, but symbolic differentiation is straight forward. There are simple rules to apply to differentiate any expression: the chain rule, the product rule, the quotient rule, derivatives of known single argument functions, etc.

Integration is a completely different ball game. Given an arbitrary expression, most likely it's not symbolically integrable, i.e. it's integral can't be expressed as a combination of known functions. That's why there are lots of functions defined as "the integral of blah."

Even given an expression that's known to be symbolically integrable, it's quite the puzzle to figure out what the integral is. There's no straight forward algorithm, as with differentiation. It boils down to "try integration by parts; try this; try that; maybe do some clever algebraic manipulation to get it into a form where you can try one of those things; look it up in a book of integrals to see if it's there, or something similar is there; if all else fails, guess and check."

martincmartin··on Differential Equations with Transformers: Deep Learning for Symbolic Math
This is also required to get the answer exactly right. It's just that the problem domains they chose -- symbolic integration and differential equations -- can be checked easily. That is, if I have a guess F for the integral of f, I just need to symbolically differentiate F and see whether I get f.*

So the paper does "guess and check," and only returns answers that pass the check, i.e. are exactly right.

There are some problems where all the checks fail, i.e. the paper can't generate an answer. And there are also questions where Matlab / Maple can't find an answer either.

* It's a little more complicated; e.g. if f = cos^2, and the derivative of F is 1 - sin^2, I need to recognize they're the same. But it's safe, in the sense that if I can't determine whether they're the same, I can reject the solution and move on to the next one.

martincmartin··on Betelgeuse Remains Steadfast in the Infrared
For those of us who aren't astronomers, what does "episodic mass loss" mean?
martincmartin··on How Big Technical Changes Happen at Slack
> we are ruthless in killing experiments early that do not prove valuable.

Ed Catmull of Pixar calls new ideas "ugly babies." Ugly because they're covered in warts -- aspects that are easy to change, but that doubters seize on because they destroy value. For example, the script for the first Bond film, Dr. No, had an intelligent monkey for a villain. Babies because they don't have value in their current form, they need more work and iteration before they have value.

How does slack identify technologies that don't have value now, but whose problems are superficial and fixable?

martincmartin··on Elon Musk: Tons of C++/C engineers needed
I've always wanted to interview someone by giving them some code, and saying "please add such-and-such a feature."

I've had interviews before where people have given me code on paper and asked me to critique it; also gave me a program where they'd introduced a bug, and asked me to find the bug.

It's a shame these things haven't caught on. Developing green field code is only a tiny fraction of what we do.

martincmartin··on Ask HN: What were the things you did that made the biggest impact at your work?
Suppose you were to come upon someone in the woods working feverishly to saw down a tree.

“What are you doing?” you ask.

“Can’t you see?” comes the impatient reply. “I’m sawing down this tree.”

“You look exhausted!” you exclaim. “How long have you been at it?”

“Over five hours,” he returns, “and I’m beat! This is hard work.”

“Well, why don’t you take a break for a few minutes and sharpen that saw?” you inquire. “I’m sure it would go a lot faster.”

“I don’t have time to sharpen the saw,” the man says emphatically. “I’m too busy sawing!”

-- The 7th habit of "The 7 Habits of Highly Effective People."

martincmartin··on Ask HN: What were the things you did that made the biggest impact at your work?
Related question: What did you do that had the biggest impact, but wasn't recognized by such by the organization?

For example, speed up the build might make people more productive, but in a way that's not obvious to management, or even to the people working on it. It might be seen as a nice thing, but relatively minor. The knock on effects -- releasing more often, which leads to being able to try more experiments in production -- might not be noticed.

martincmartin··on 1195725856 and other mysterious numbers
Maybe we should start printing ASCII in future in some of the error paths...

I work on image processing; when we get an image we don't recognize, we print out the first few bytes in hex & ascii. Often, it's an error message or HTML error page. The user's code takes the results of an HTTP fetch and sends it to us, forgetting to check for errors.

martincmartin··on Evaluating State and Local Business Tax Incentives [pdf]
"Absence of evidence is not evidence of absence."

https://en.wikipedia.org/wiki/Evidence_of_absence

martincmartin··on Ask HN: A New Decade. Any Predictions? (2010)
For those who don't recognize the reference, it's the chorus of a song made famous by Chuck Berry:

https://genius.com/Chuck-berry-you-never-can-tell-lyrics

martincmartin··on Generating a Java program with 90% less code
For example, what if an IDE could read Java, but display it in a form that looks a lot like Kotlin? (Or Groovy, or your favourite high level language.) The file would still be Java underneath, so you don't need to convince your colleagues to adpot Kotlin. You can be in a happy Kotlin-esq world while working with their Java code, and they don't need to know or care.
martincmartin··on Generating a Java program with 90% less code
I've always wanted an IDE that would transform Java into a higher level language by "collapsing" the boiler plate. Just like we can collapse comments, I'd like to "collapse types" if I already know the types and just want to look at the logic. Or "collapse exception handling" if my current task involves changing the happy path and the exception stuff is just clutter.
martincmartin··on The Value in Go’s Simplicity
In woodworking, the only tool you need is a hammer and chisel. With enough effort, you can make a decent table leg, you don't need a lathe.

But if you do it several times, you think "if I just invest time into learning the lathe, I can save a lot more time when making table legs. In fact, I might be able to make a more complicated table, since the time and effort saved when making the legs can now be spent on other things."

martincmartin··on Floating point oddity
isn't this just a problem with numerical instability?

Yes, but many developers aren't aware of numeric instability. Or, maybe they've heard the term, but not how it applies in practice.

People seem to go through stages when learning about floating point:

1. "When you need fractions, use floating point." At this stage, they expect "x / 3 * 3 == x" to always be true, and are surprised when things like that fail.

2. "Floating point is just approximate. So always use double, which is accurate to 15 decimal places." So this explains why you don't get exact answers, but of course doesn't explain the numerical instability in the OP's post.

3. "Cancellation can cause results to be arbitrarily far off! We need to analyze the error propagation of every expression!" This is impractical, and developers in stage 2 look at you like you're over engineering the system.

4. "In practice, using doubles 'just works' in almost all situations." If you're lucky, you can recognize when it might not work, and do error analysis only in those cases. If not, you just don't sleep well at night, wondering whether or where your code will break down. Probably some of both.

martincmartin··on Military Has Been Researching "Anti-Gravity" For Nearly 70 Years
They're assuming that the readers will infer, from the name "quantum gravity", that it has to do with gravity. From just the name, "general relativity," people who don't know what it is probably wouldn't guess it's a theory of gravity.
martincmartin··on Google T5 scores 88.9 on SuperGLUE Benchmark, approaching human baseline
"The General Language Understanding Evaluation (GLUE) benchmark is a collection of resources for training, evaluating, and analyzing natural language understanding systems."

"We take into account the lessons learnt from original GLUE benchmark and present SuperGLUE, a new benchmark styled after GLUE with a new set of more difficult language understanding tasks, improved resources, and a new public leaderboard."

← PreviousPage 9 of 23Next →