“GOD is real, unless declared integer.”

119

18

I'm unable to interpret a sentence though searched and read multiple explanations.

“GOD is real, unless declared integer.” a Fortran-based witticism

Real is real number,
What's the idioms it refers to ?

JawSaw

Posted 2018-04-10T11:11:09.090

Reputation: 1 176

69Fortran is a programming language, you need first to understand variable, real, integer and declare in the context of that language, and consider what type the variable GOD would be. You then move into amateur theology for the joke. – djna – 2018-04-10T13:39:09.027

61Just to point out, most native English speakers wouldn't understand this joke at all without some programming knowledge, and even then they could only guess at the real meaning unless they were specifically familiar with FORTRAN, a language that was apparently invented 61 years ago. As an electrical engineer friend once told me, "If any of your courses try to teach you FORTRAN, run out of the room screaming." – Excrubulent – 2018-04-11T07:40:13.137

Answers

249

This has little to do with English language and usage: it is entirely to do with the conventions of Fortran, a computer programming language.

Fortran has two kinds of variables: Integer variables (that hold an integer number) and real variables (that hold a real number).

By default, any variable whose name begins with the letters I,J,K,L,M or N is integer, otherwise it is real. So a variable called GOD would by default be a "real variable" - in short, "GOD is real".

The joke is that this might be presented as an argument for the existence of God.

Colin Fine

Posted 2018-04-10T11:11:09.090

Reputation: 26 607

131This explanation is excellent. However, I'm not sure the joke is so much that it might be presented as an argument for the existence of God, as it is that it sounds at first like it is intended as a solemn pronouncement that God exists but then turns out to be just a bit of word play. – Eliah Kagan – 2018-04-10T16:19:02.817

2

Comments are not for extended discussion; this conversation has been moved to chat.

– snailboat – 2018-04-11T12:34:05.183

1@EliahKagan Exactly. Many jokes rely on making a statement that leads the audience to think you are talking about one thing, and then suddenly making it apparent that you are talking about something else. Usually you start out making it sound like you are talking about something profound and/or important and then reveal you were really talking about something trivial. Or very commonly, start out making them think you're talking about sex and then, no, you're talking about something boring. – Jay – 2018-04-12T20:14:51.970

1For this answer to be useful on this site, it should at least specify that Fortran is a computer programming language. The upvotes seem to come from stackexchange readers who've seen it on the hot questions list. However, the answer should stand on its own. – vsz – 2018-04-16T06:03:02.563

9

In computer programming, a value has a type. Two kinds of numeric types are real and integer.

Integers are only whole numbers. Reals are numbers with exponents and fractional parts (parts after a decimal point) accurate to a certain precision, so you can store, say, 3.1415926.

None of the above is specific to Fortran. What is specific to Fortran is that numeric variables can be real or integer, with real being the default, unless specifically declared to be integer (see also other answer about variables beginning with I,J,K,L,M or N defaulting to integer).

thomasrutter

Posted 2018-04-10T11:11:09.090

Reputation: 190

7“specific to Fortran is that all variables are either real or integer”... um, Fortran is dumb, but it's not that dumb! It does have types other than real and integer. I'd say what's specific to Fortran is that despite being statically typed (and not supporting type inference), it permits variables to be used without any explicit type declaration. – leftaroundabout – 2018-04-12T14:56:47.850

3Sorry, I meant to say all numeric variables are real or integer. And even then it's ignoring complex numbers. Edited to remove confusion. – thomasrutter – 2018-04-12T22:36:38.793

1"Fortran allows implicit declaration of variables, just by using (assigning) the name. Their type (integer or real) is then inferred from their first letter of their name (I...N vs everything else)" – smci – 2018-04-13T03:47:39.913

3

Previous answers, though good, are not clear enough about types and declaration, in my humble opinion.

Most programming languages allow (or require) you to say, at the top of each program or subroutine, what variables you are going to use and what kind of data they will hold. The most common types are boolean (one bit), integer, real (now more usually called floating point), complex, character, string. Type matters because the same sequence of bits can be interpreted in all of these different ways, and thus represent different values.

When Fortran finds a sequence of characters (beginning with a letter) that is neither a reserved word (like IF) nor a declared variable, it will treat that string as the name of a variable, assigning it type INTEGER or REAL according to the first letter. Variables beginning with I through N are integers by default because these letters are conventionally preferred for use as indices to sequences: xk means the kth entry in sequence x.

(Fortran has a command, which I've forgotten, to change the defaults; if you're using a lot of COMPLEX variables, you might assign them the letters C,W,Z, which would otherwise default to REAL.)

So. If the command INTEGER GOD appears near the top, then the label GOD is assigned to a variable whose content will be processed as an integer; if not, and the word GOD appears elsewhere in the code, then the label GOD is assigned to a variable whose content will be processed as a floating-point number.

Anton Sherwood

Posted 2018-04-10T11:11:09.090

Reputation: 317

9This is a Stack Exchange about learning English, not learning programming. I think the previous answers were plenty clear on types and declarations. You’ve taken a lot of the humor out of the original statement. – J.R. – 2018-04-13T09:40:35.673

To quote Housman; "Perfect understanding will sometimes almost extinguish pleasure." – copper.hat – 2018-04-15T03:33:11.183

-1: FORTRAN has no reserved words. – kevin cline – 2018-04-15T08:57:18.280

If there are no reserved words, perhaps someone can edit that passage to indicate how Fortran decides that a string is a new identifier rather than something else. – Anton Sherwood – 2018-04-15T23:08:51.757