2,613 karma · joined Nov 15, 2013 (13y ago) · 775 submissions
comment 5y ago · link · parent
The trick is figuring out what's necessary. The first half of the post made me nervous, because it simply applied a gain of threshold - basedB. As he discovered, that's too loud.
What you want is a compressor. The second half of the post boosts the signal just above the threshold, but it's a little more complex than that. I haven't really studied this, but for starters you want to take into account things like the Fletcher-Munson curves.
I am intrigued by these types of projects. As my hearing gets worse, I'd like to be able to listen to music and watch movies with nice headphones, but with the assistance that comes from hearing aids.
comment 5y ago · link · parent
BigInteger bi = rational.asBigInteger();
if (bi != null) {
...
}
One of the classes is essentially a node in a graph, so in my first pass its objects were wrapped in a shared_ptr, which can be null. However, objects of the other two types are typically passed by value in C++, so I had to think about that. Exactly what std::optional was designed for, but do I want to require C++17, both in the implementation and the public interface? The syntax looks nice enough: if (auto bi = rational.asBigInteger()) {
... // bi is like a non-null pointer
}
Java has java.util.Optional, but the source predates Java 8.TypeScript's type guard approach is really clever. Once you've checked the value, you can use it like normal. No need for a wrapper class, or different syntax.
comment 5y ago · link · parent
https://news.ycombinator.com/item?id=25289921
https://news.ycombinator.com/item?id=25261441
https://news.ycombinator.com/item?id=25113595
https://news.ycombinator.com/item?id=25077519
https://news.ycombinator.com/item?id=24912172
https://news.ycombinator.com/item?id=24768721
comment 5y ago · link · parent
My question for the Rocky Linux team: if CentOS was struggling for resources before Red Hat's involvement in 2014, how is Rocky any better positioned to succeed?
comment 5y ago · link · parent
Edit: here's the HN post at the time:
comment 5y ago · link · parent
comment 5y ago · link · parent
Edit: answers to a similar question on the other thread suggest that it's NBD to move the memory off package.
comment 5y ago · link · parent
https://www.argon40.com/argon-neo-raspberry-pi-4-case.html
It gets hot to the touch, so I presume that it's dissipating heat like it's supposed to.
comment 5y ago · link · parent
max(
static_cast<intmax_t>(
numeric_limits<T>::lowest()),
static_cast<intmax_t>(
numeric_limits<U>::lowest()))
I tried std::common_type first, but it didn't quite do the trick.comment 5y ago · link · parent
> Do you know where the line is? C++11? Later versions?
It's funny to read this, because I purposely avoided C++ for the better part of twenty years after dabbling with it in college--not worth it to deal with so much complexity. I've started using it in the last couple of years for work, and the modern part is what makes it bearable.
C++ is a big beast, so there is a cost to each new standard simply by virtue of adding features. However, the types of things I want to use in C++14 are pretty simple and worthwhile; e.g., better constexpr functions, and the _t aliases (like std::enable_if_t<>, rather than typename std::enable_if<>::type). Similarly, C++17 has a few new templates, like std::optional and yes, std::variant, along with ergonomic improvements like the _v aliases (like std::is_floating_point_v<>, rather than std::is_floating_point<>::value).
Now that the glacial pace of standardization has been replaced with a three-year cycle, I almost want something like LTS releases. I use C++11, and a bit of C++14, but when is it safe to use C++17 or C++20?
comment 5y ago · link · parent
Is Word Machine publicly available, or is it the sort of thing that has an audience of one?
comment 5y ago · link · parent
These statements are pitted against each other, even though they are both very much true:
> emulating or translating apps ... is necessarily going to be ... somewhat incompatible at best ... But Apple’s Rosetta 2 ... is a technical marvel.
He's upset about this quote from Moorhead's review:
> there were some very positive things about the new laptop. The new M1 processor is impressive, but far from perfect — it has many warts
Moorhead perhaps punctuated this poorly, but I think it's reasonable to assume that the warts refer to "the new laptop" in general, not just "the new M1 processor" in particular. Yes, his problems are generally software related (although he cited fan noise as a complaint), but that's a huge part of the product. Lots of people would love to use an M1 Mac without macOS, including one particular Finn.
Gruber can say, "There is no 'Well, here’s the downside' with regard to the state of Apple Silicon," but that remains to be seen. How much of the M1's advantage is due to a trillion dollar company buying up every last bit of TSMC's 5nm production capacity? Can they scale the unified memory architecture much beyond 16 GB? If they can, great; they've truly lapped the field.
> There is no balance, if by balance, you’re looking for a story that says any PC hardware, ARM or x86, is competitive in any way with the M1 Macs for low-energy computing.
This review wasn't about "low-energy computing." It was about using a new Mac as a replacement for an old Mac. This is a real, shipping product, not a beta. You can snicker at Moorhead's Microsoft-centric workflow and choice of apps., but that's his perspective.
comment 5y ago · link · parent
MajorFunction() {
// fast inverse square root
float x2 = number * 0.5F;
float y = number;
// several more lines of code
// find decimal point
char *c = input;
while (*c && *c != '.')
++c;
}
A goal of style A or B is for the names of the minor functions to make the shape more obvious, ideally self documenting: MajorFunction() {
y = Q_rsqrt(number);
char *c = strchr(input, '.');
}
This is the kind of advice you'll find in, say, Code Complete. Although I generally accept the premise, there is a readability cost to indirection. The bigger and more complex MinorFunction() is, the more likely I'm going to have to jump into it and remind myself what it does.There are two concepts that underlie DRY: coupling and cohesion. There are good expositions on this in old writings on structured programming and design (e.g., Yourdon and Constantine). If MinorFunction() is cohesive, and MajorFunction() is appropriately coupled to MinorFunction(), then style A/B is likely to be superior to style C. One of Carmack's points is that "very little of our real code" ends up that way.
comment 6y ago · link · parent
https://news.ycombinator.com/item?id=24700705
The Android calculator app. got some nice usability improvements by using a combination of rationals, as described in this story, and recursive (aka constructive or computable) reals.
A previous post on Microsoft's calculator brought my attention to an old package it uses called Ratpack (aka ratpak), another implementation of rationals:
https://news.ycombinator.com/item?id=19321217
It has some nice properties for use in a calculator, but it can be quite slow.
When I come across a library with, shall we say, an exotic numeric representation, it's nice to have a library of mathematical functions included. I see that python-cf indeed includes a solid batch.
comment 6y ago · link · parent
https://www.python.org/dev/peps/pep-0237/
This was a nice enhancement with very few drawbacks, but I can see how it wouldn't necessarily be appropriate in Go.
comment 6y ago · link · parent
https://minnie.tuhs.org/cgi-bin/utree.pl?file=V4/man/man3/ct...
It confirms that the day of the month element was one based. This function is different in earlier editions:
https://minnie.tuhs.org/cgi-bin/utree.pl?file=V3/man/man3/ct...
https://minnie.tuhs.org/cgi-bin/utree.pl?file=V1/man/man3/ct...
comment 6y ago · link · parent
Of course they did: "With the introduction of Rosetta 2, M1 and macOS Big Sur seamlessly run apps that haven't yet transitioned to Universal versions. So without updating, you can keep working on Fusion360 projects or reach the next level in your favorite game."
Rosetta 2 (and Rosetta before it) may be an amazing technical accomplishment, but it's entirely fair for a reviewer to say it doesn't cut it for him. As funny as some of his choices are (Edge on a Mac, on purpose?), he's not reaching; this is what he uses everyday. It's also fair to point out that if your favorite game doesn't happen to be Rise of the Tomb Raider, your mileage may vary.
I think the reviewer is a little unfair in his emphasis on "Apple-chosen" reviewers, but this frankly is the kind of thing I look for. Five-star reviews are rarely as useful to me as three-star reviews.
comment 6y ago · link · parent
> The new tensorflow_macos fork of TensorFlow 2.4 leverages ML Compute to enable machine learning libraries to take full advantage of not only the CPU, but also the GPU in both M1- and Intel-powered Macs for dramatically faster training performance.
This isn't about being locked in to some Apple framework. TensorFlow for Mac is accelerated again. (As Gruber likes to say: finally!)
comment 6y ago · link · parent
https://simonsapin.github.io/wtf-8/
To be clear, this is not an official Unicode spec. It's a hack (albeit a pretty natural and obvious one) to deal with systems that don't do Unicode quite right.
I recently came across some old code that narrows wchar_t to UCS-2 by zeroing out the high-order bytes. Even though my test was careful not to generate any surrogates in the input, they showed up in the output when a randomly generated code point like U+1DF7C was mangled into U+DF7C.
A corrupted value like that is not necessarily a great example of something you want to preserve, but it's the sort of thing that late 90s code assumed about Unicode.
comment 6y ago · link · parent
> .NET 5.0 is a current release. That means that it will be supported for three months after .NET 6.0 is released. As a result, we expect to support .NET 5.0 through the middle of February 2022. .NET 6.0 will be an LTS release and will be supported for three years, just like .NET Core 3.1.
comment 6y ago · link · parent
https://developer.amd.com/amd-aocl/amd-math-library-libm/
The license there looks much less friendly than the 3-clause BSD on Github.
I was unable to build this on macOS 10.13, because "aliases are not supported on darwin".
I'm curious to see the tests, which have not been checked in yet. There was a story a month ago about the Android calculator's library, and how it is used to test java.lang.Math:
https://news.ycombinator.com/item?id=24700705
I wonder what this library's accuracy tests look like.
I'm also curious, of course, to see what kind of performance difference there is. An old post by Agner Fog shows an 85% reduction in run time relative to glibc on AMD hardware:
comment 6y ago · link · parent
The HP laser printer I bought recently, on the other hand, did come with starter cartridges with a smaller amount of toner. My impression is that starter cartridges are more common with toner than ink.
comment 6y ago · link · parent
The first thing I notice is this comment in a later changelog:
> I believe we have a very fast numerical conversion that appears to be reliably generating about 15 to 16 digits out output [last digit may be off by 1 or 2 in typical case].
If the last digit of a fifteen- to sixteen-digit output is off by one or two, are we sure it round trips?
Second, the test coverage for this feature in tests/format.cpp looks pretty sparse, and it's not obvious to me how the output is verified.
Interesting find. I may play around with this later.
Edit: I tried the test cases from here:
https://www.exploringbinary.com/the-shortest-decimal-string-...
Here's the result:
format="%.30g" output="0.1"
format="%.30g" output="50388143.06823721984"
format="%.30g" output="54167628.18"
format="%.30g" output="9161196241250.051072"
The first and third cases output the correct string. The second case outputs nineteen digits, instead of seventeen, and does not round trip (i.e., it rounded incorrectly). The last case outputs nineteen digits instead of fifteen, but does round trip.
comment 6y ago · link · parent
https://bugs.python.org/issue1580
After they did that, I learned that Scheme specifies similar behavior. In fact, I think it was added to R4RS after the Steele and White paper. As the article says, this behavior spread across languages, so that it's weird to see something different now.
If you want to nerd out on this, here are a few other posts that explore the topic:
https://www.exploringbinary.com/the-shortest-decimal-string-...
https://www.exploringbinary.com/the-shortest-decimal-string-...
https://www.exploringbinary.com/java-doesnt-print-the-shorte...
comment 6y ago · link · parent
> Mazda responded that its system was not designed or intended to center the vehicle in a lane and that the automaker doesn’t believe its vehicles are equipped with technology that meets the criteria CR is using in its evaluation.
Not necessarily something I would have understood from its website or brochure. This probably takes the CX-5 off of my short list.
Incidentally, the submitted title casts this as Cadillac vs. Tesla, but the actual title is "Cadillac's Super Cruise Outperforms Other Driving Assistance Systems." In fairness, their 2018 article did have a similar title: "Cadillac Tops Tesla in Consumer Reports' First Ranking of Automated Driving Systems."
comment 6y ago · link · parent
I use KeePassXC with a password and key file. I sync the database, but not the file, using Syncthing. On the whole a satisfied customer, although the browser integration isn't perfect.