Skip to content

Comment on The original ABC language, Python's predecessor (1991)parent

Comments

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

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

  like
    this
      for
        code
          blocks

It’s been around since at least occam, maybe longer

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.