Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

It makes it a real number instead of an integer.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top