blueintegral
blueintegral

Reputation: 1271

What does the period do in this line of Fortran?

I am not sure what version of Fortran this is, but the line is:

Term = F*F - 4.*E*G

I know that it multiplies F by F and then subtracts something, but I don't know what the period after the 4 is doing there.

Upvotes: 3

Views: 1623

Answers (3)

Richard Friedman
Richard Friedman

Reputation:

If you're new to Fortran, a "REAL" number is what is called in C-like languages a "float".

But only Fortran programmers can say the GOD is REAL, by default.

Upvotes: 0

tvanfosson
tvanfosson

Reputation: 532755

It makes it a real number instead of an integer.

Upvotes: 3

Promit
Promit

Reputation: 3507

I'm going to venture a guess based on every other programming language I've ever seen, and say that it's making the constant "4" of type Real, rather than Integer. In other words, it's making sure the types in the expression all match up. "4.0" would be equivalent; whoever wrote this code was just feeling extra concise that day.

Upvotes: 8

Related Questions