For anyone else who, like me a moment ago, doesn't know the meaning of ** but is curious: it's how many (but not all) programming languages express "to the power of", aka 2**1000 = 2^1000
BCD, actually, given that Fortran dates from the mid-1950s. EBCDIC only appeared more or less around Fortran IV, in the early 1960s. Many printers in those days had a 48-character chain/train. After upper-case letters, digits, and a few essential punctuation marks (like . and ,), you weren't left with many options. The 60-character set of PL/I was a luxury back then, let alone lower case.
Oh, I interpreted "a function for exponentiation" as being part of a list of things C uses ^ for. It didn't even occur to me that the sentence had an alternative parsing where it was part of a list of things C uses. C does indeed use a function for exponentiation. And time flies like an arrow!
Python 3.11.13 (main, Jun 3 2025, 18:38:25) [GCC 14.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 2**1000
10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069376
>>> _/2**999
2.0
Comments
Wow 2 * 1000 without rounding errors, 40 years ago this must have been super impressive, since I find that quite a feat of today's python.
2 * 1000 is 2000 ;)
I think you meant 2**1000
the syntax for formatting ate your star https://news.ycombinator.com/formatdoc
For anyone else who, like me a moment ago, doesn't know the meaning of ** but is curious: it's how many (but not all) programming languages express "to the power of", aka 2**1000 = 2^1000
The reason for using `**` is that `^` is widely used for bitwise exclusive-or. So commonly `2**1000 != 2^1000`!
I think Fortran used ** because EBCDIC didn't have ^ or uparrow. ABC and Python followed Fortran rather than C on this point. units(1) supports both.
BCD, actually, given that Fortran dates from the mid-1950s. EBCDIC only appeared more or less around Fortran IV, in the early 1960s. Many printers in those days had a 48-character chain/train. After upper-case letters, digits, and a few essential punctuation marks (like . and ,), you weren't left with many options. The 60-character set of PL/I was a luxury back then, let alone lower case.
Hmm, I guess you're right. Also EBCDIC does have ^ apparently, though not ↑: https://en.wikipedia.org/wiki/EBCDIC#Code_page_layout
But IBM's BCD character sets, including the 48-character ones you allude to, didn't: https://en.wikipedia.org/wiki/BCD_(character_encoding)#Examp... (though Honeywell's did)
There are a lot of decisions in Fortran that stem from the absence of useful characters. .LT., .LE., .EQ., .NE., .GT., and .GE. is another.
C uses ^ for bitwise xor and a function for exponentiation, though.
No, C does not have an exponentiation operator! Possibly you meant "and not a function for exponentiation".
I should have said "followed Fortran rather than BASIC".
I meant exactly what I said. C uses a function for exponentiation. Nothing that uses ^ for powers follows C's lead.
https://en.cppreference.com/w/c/numeric/math/pow.html
Oh, I interpreted "a function for exponentiation" as being part of a list of things C uses ^ for. It didn't even occur to me that the sentence had an alternative parsing where it was part of a list of things C uses. C does indeed use a function for exponentiation. And time flies like an arrow!
He's explaining that C was not the reason for picking * over ^
Interesting, thanks!
And != means ≠
Oh that's why i did not get any upvotes /i
Wow, I didn't know that you could write
It’s been around since at least occam, maybe longer
Lisp has had arbitrary precision arithmetic since the early 1970s. So did dc on Unix, also in the early 1970s. ABC didn't arrive until 1987.
That was kind of par-for-the-course back then.
LISP had it, Smalltalk had it, Unix dc/bc had it.