are int, float, long, double, side-effects of computer engineering?

Roy Smith roy at
Tue Mar 6 14:49:33 CET 2012

[intentionally violating the followup-to header]

In article <7ol5r.29957$zD5.14377 at newsfe12.iad>,
 Chiron < at> wrote:

> On Mon, 05 Mar 2012 22:34:46 -0800, Xah Lee wrote:
> > while what you said is true, but the problem is that 99.99% of
> > programers do NOT know this. They do not know Mathematica. They've never
> > seen a
> Could you please offer some evidence to support this claim?  Most of the 
> programmers I've ever run into, were quite familiar with the notion that 
> many aspects of their languages were artifacts of hardware limitations.

While I doubt Xah's claim that 99.99% of programmers are unaware of 
this, oddly enough, we ran across an instance of this just yesterday.  
We have a test problem we give to job candidates:

> Write a program that counts the number of times the subsequence "1, 2, 3" 
> appears in the first 100,000 digits of pi. Note "subsequence" does not imply 
> consecutive digits. For example, "1, 2, 3" appears in "3.141592653" twice. 
> You may use Google or the link above to find the digits of pi. Please include 
> the correct count when submitting your application.

We had a candidate submit a solution in Python which ran in O(n) time.  
The algorithm was essentially correct, but unfortunately, he used a 
numpy.array to hold some counters, and suffered integer overflow.  Had 
he used regular python lists, he would have been fine.

What's unclear (at the moment) is whether he falls into Xah's camp of 
people who are unaware of such issues (unlikely, IMHO).  Possibly he 
just didn't realize that the numbers in this problem might get big 
enough to overflow a 32-bit int.  Or had been lulled into a false sense 
of security knowing that python does arbitrary precision integer math 
and didn't realize that doesn't extend to numpy.

More information about the Python-list mailing list