What does DATA INF / 1.D + 300 / mean in Fortran?

I have translated some Fortran into our C # application, and I'm trying to understand what the Fortran bit at the top of the function means.

  DOUBLE PRECISION INF, DMIN, D12

  DATA INF/1.D+300/

What will be the value of INF?

+3
source share
4 answers

Dmeans "* 10 ??? " or is widely known as ein 1.e+300in C #, but for double precision.

The operator defines only 3 type variables . DOUBLE PRECISIONdouble

DATA statement

DATA X/Y/

translates to

X = Y;

in c #. Therefore you get

double INF = 1.e+300, DMIN, D12;

Since it is INFso large, I believe that it means "Infinity", in this case it is better to use real infinity IEEE ( double INF = double.PositiveInfinity, ...).

+3

, INF (.. ) 10 ^ 300. double.PositiveInfinity double.MaxValue.

+2

FORTRAN IV FORTRAN 77, Fortran 90/95/2003.

Double Precision . , FORTRAN , , . 8- . INF. "D" "1.D + 300" E, FORTRAN, , .

Fortran ( >= 90) :

INF = (1.0D + 0)

+2

The value will be 1.0e300, but I'm sure it is assumed that it will be set to the largest double value that can be expressed on the current CPU. therefore, in C #, which will be double.PositiveInfinity, and not in some hard-coded value.

+1
source

Source: https://habr.com/ru/post/1734114/


All Articles