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

前端 未结 4 1864
傲寒
傲寒 2021-01-20 17:06

I\'m translating some Fortran to our C# app and I\'m trying to figure out what a bit of Fortran means at the top of a function.

  DOUBLE PRECISION INF, DMIN,         


        
4条回答
  •  旧时难觅i
    2021-01-20 17:45

    The code is in the style of FORTRAN IV or FORTRAN 77 rather than Fortran 90/95/2003.

    Double Precision declares the variables to be double the precision of a regular real. I'm not sure that the FORTRAN standards of that era were extremely precise about what that meant, since there was a greater variety of numeric hardware then. Today, it will virtually always obtain an 8-byte real. The Data statement initializes the variable INF. The use of "D" in the constant "1.D+300", instead of E, is old FORTRAN to specify that the constant is double precision.

    The Fortran (>=90) way of obtaining the largest positive double is:

    INF = huge (1.0D+0)

提交回复
热议问题