Daniel Lemire's blog

Science and Technology links (November 14th 2020)

, 4 min read

COVID 19 forced enterprises to move to remote work. There has been decades of research showing that allowing workers to work remotely improves job satisfaction and productivity. It improves work-family balance. It reduces sick leaves. Not absolutely everything is positive, but much if it is. So…

Xbox Series X and PlayStation 5: early impressions

, 3 min read

This week, my family got a copy of each new major game console: the Microsoft Xbox Series X and the Sony PlayStation 5. I haven’t yet had time to try them out well, but I know enough to give my first impressions. They are both very similar machines from the inside. The same kind of processor, the…

Benchmarking theorem provers for programming tasks: yices vs. z3

, 2 min read

One neat family of tools that most programmers should know about are “theorem provers”. If you went to college in computer science, you may have been exposed to them… but you may not think of using them when programming. Though I am sure that they can be used to prove theorems, I have never…

How will the pandemic impact software programming jobs?

, 4 min read

Software programming is not for everyone, but among the careers that are mostly unregulated, and thus mostly free from rents, it has consistently been one of the best choices. You can earn more money if you embrace some professions that are regulated (e.g., medical professional), but if you are a…

Science and Technology links (October 31st 2020)

, 3 min read

Amazon has 1 million employees. “The iPhone 12 contains a Lidar. The first 3D Lidar was released a decade ago and cost $75,000.” (Calum Chace) There is water on the Moon, possibly enough to make fuel. Good looking people have greater social networks and may receive favorable treatment from…

What the heck is the value of “-n % n” in programming languages?

, 4 min read

When coding efficient algorithms having to do with hashing, random number generations or even cryptography, a common construction is the expression “-n%n“. My experience has been that it confuses many programmers, so let us examine it further. To illustrate, let us look at the implementation of…

Ridiculously fast unicode (UTF-8) validation

, 5 min read

One of the most common “data type” in programming is the text string. When programmers think of a string, they imagine that they are dealing with a list or an array of characters. It is often a “good enough” approximation, but reality is more complex. The characters must be encoded into…

Science and Technology links (October 17th 2020)

, 1 min read

Computer vision (i.e., artificial intelligence) and cameras are used in London to monitor citizens with respect to social distancing. A fecal transplant from old mice to young mice appears to “age the young mice“. It appears that the reverse might also work: fecal transplants from the young to…

Why is 0.1 + 0.2 not equal to 0.3?

, 2 min read

In most programming languages, the value 0.1 + 0.2 differs from 0.3. Let us try it out in Node (JavaScript): > 0.1 + 0.2 == 0.3 false Yet 1 + 2 is equal to 3. Why is that? Let us look at it a bit more closely. In most instances, your computer will represent numbers like 0.1 or 0.2 using…

Science and Technology links (October 3rd 2020)

, 1 min read

The mortality rate for kids under five have fallen by 60% since 1990. Samsung new storage drives are both affordable and really fast (up to 7GB/s). Alzheimer’s disease may be driven by overactivation of cerebral fructose metabolism. The researchers write: we propose that Alzheimer’s disease is…

How expensive is integer-overflow trapping in C++?

, 1 min read

Integers in programming languages have a valid range but arithmetic operations can result in values that exceed such ranges. For example, adding two large integers can result in an integer that cannot be represented in the integer type. We often refer to such error conditions as overflows. In a…

Science and Technology links (September 19th 2020)

, 1 min read

A large city dating back 4,300 years has been discovered in China. It predates the Chinese civilization. At its center was a wide pyramid supporting a 20-acre palace. Little is known about the people living there other than the fact that they had relatively advanced technology. Genetic testing of…

Parsing floats in C++: benchmarking strtod vs. from_chars

, 2 min read

Programmers often need to convert a string into a floating-point numbers. For example, you might get the string “3.1416” and you would like to get the resulting value as floating-point type. In C/C++, the standard way is the strtod function: char * string = "3.1416"; char * string_end…

Good students find questions, not answers

, 2 min read

It is often believed that learning is a simple matter of collecting answers and replies. I suspect that “learn mechanistically how to answer the questions” is a great way for weak students to pass courses, and for smart students to ace courses. However, I believe that if you really want to…

Science and Technology links (September 5th 2020)

, 1 min read

Single cells are able to navigate complex mazes. E.g., it works with mouse pancreatic cancer cells. Body builders and athletes sometimes take a supplement called AKG. It was found to prolong life in worms. Researchers have now found that AKG massively delays frailty in mice: old mice that took AKG…

Sentinels can be faster

, 3 min read

A standard trick in programming is to use “sentinel values”. These are special values that represent metadata efficiently. The C language represents strings as a sequences of characters terminated with the null character. The null character is a sentinel that indicates the string length. E.g.,…

Science and Technology links (August 29th 2020)

, 2 min read

In children, higher video game time is positively associated with cognition (i.e., kids who play more video games are smarter). Note that it does not follow that playing video games makes you smarter; it could be that smarter kids are more interested in video games.1. I always assumed that the…