3

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.

4

3 回答 3

8

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.

于 2009-04-29T02:16:17.713 回答
3

It makes it a real number instead of an integer.

于 2009-04-29T02:16:24.373 回答
0

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.

于 2009-05-17T07:16:50.340 回答