2,602 karma · joined November 15, 2013
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.> 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?
Is Word Machine publicly available, or is it the sort of thing that has an audience of one?
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.
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.
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.
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.
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...
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.
> 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!)
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.
> Originally from Connecticut, she worked one summer on a whale-watching boat in Bar Harbor, saw the lobstermen, and thought: I want to do that, that looks real.
> .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.
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:
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.
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.
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...
> 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."
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.
I actually wouldn't mind if they throttled this a bit. I keep a tab or two (dozen) open to Hacker News posts I haven't gotten around to reading yet. I dread restarting the browser, as several tabs inevitably end up displaying the "Sorry, we're not able to serve your requests this quickly" page.
Whenever a post on PRNGs comes up, I'm reminded of this post from a while back about Chrome:
https://medium.com/@betable/tifu-by-using-math-random-f1c308...
Near the end is a Monte Carlo estimate of Pi using 10^10 iterations:
Chrome 3.1418697000 0.0002770464 1301.903s
Firefox 3.1416998084 0.0001071548 249.595s
Safari 3.1416692728 0.0000766192 7172.207s
The first observation is that the error was significantly higher for Chrome. The second is that Safari, which apparently did use a CSPRNG, was an order of magnitude slower. If you let Firefox run that long, I imagine that it would have performed many more iterations, resulting in much lower error.Is it possible to get this thing running on Windows, or do I need to do it under WSL (or another computer)? Google turned up a package called UniCurses "with syntax close to that of the original NCurses."
Edit: I found Windows wheels for curses here:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#curses
And there is a visidata.exe in the virtual environment, which I presume is equivalent to the vd command.
In fairness, the next sentence in the post is:
> Techniques like this can be a nice complement to external tools like Valgrind or AddressSanitizer.
macOS and iOS (and indeed Apple itself) would not exist as we know them today, if at all, without very liberal cross pollination of APIs. In a parallel universe where APIs are copyrighted to the extent that Oracle wants, GNU would not exist. Konqueror and Safari could not use Microsoft's XMLHttpRequest(). The list goes on and on.
Rather than curse the darkness, I'll quote the first sentence from the page: "Boa is an experimental Javascript lexer, parser and compiler written in Rust." What's so great about this particular release? "v0.10 has been the biggest release to date, with 138 issues closed!" Also, there's a test suite: 38,706 tests, of which 6,895 passed and 5,748 were ignored, for a conformance rate of 17.81%.
https://github.com/NVIDIA/enroot
It basically returns containers to their chroot origins, promising "no performance overhead." I'm looking forward to more posts on that.
My left space bar is backspace. I sometimes get confused when I switch to a different keyboard, though.