7,330 karma · joined May 12, 2008
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
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.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.
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.
Only the 3rd one is lying. You can still leave a completely misleading impression by telling partial truths.
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.
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."
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.
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?
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.
“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."
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.
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.
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."
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.
"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."