4 ms·
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.
by nuancebydefault 11mo ago
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.
- nick__m 11mo ago2 * 1000 is 2000 ;) I think you meant 2**1000 the syntax for formatting ate your star https://news.ycombinator.com/formatdoc https://news.ycombinator.com/formatdoc
- nuancebydefault 11mo agoOh that's why i did not get any upvotes /i
- swores 11mo agoFor 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
- pansa2 11mo ago> 2**1000 = 2^1000 The reason for using `**` is that `^` is widely used for bitwise exclusive-or. So commonly `2**1000 != 2^1000`!
- kragen 11mo agoI 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.
- shawn_w 11mo agoC uses ^ for bitwise xor and a function for exponentiation, though.
- vanderZwan 10mo agoHe's explaining that C was not the reason for picking * over ^
- kragen 10mo agoNo, 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".
- shawn_w 10mo agoI 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 https://en.cppreference.com/w/c/numeric/math/pow.html
- kragen 10mo agoOh, 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!
- vincent-manis 10mo agoBCD, 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.
- kragen 10mo agoHmm, I guess you're right. Also EBCDIC does have ^ apparently, though not ↑: https://en.wikipedia.org/wiki/EBCDIC#Code_page_layout 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)#Examples_of_BCD_codes 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.
- swores 11mo agoInteresting, thanks!
- fainpul 11mo agoAnd != means ≠
- Lucasoato 11mo agoWow, I didn't know that you could write like this for code blocks
- jockm 11mo agoIt’s been around since at least occam, maybe longer
- doug-moen 11mo agoLisp 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.
- aidenn0 11mo agoPython 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
- mpweiher 10mo agoThat was kind of par-for-the-course back then. LISP had it, Smalltalk had it, Unix dc/bc had it.