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?
Dmeans "* 10 ??? " or is widely known as ein 1.e+300in C #, but for double precision.
D
e
1.e+300
The operator defines only 3 type variables . DOUBLE PRECISIONdouble
DOUBLE PRECISION
double
DATA statement
DATA
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, ...).
INF
double INF = double.PositiveInfinity, ...
, INF (.. ) 10 ^ 300. double.PositiveInfinity double.MaxValue.
double.PositiveInfinity
double.MaxValue
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)
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.
Source: https://habr.com/ru/post/1734114/More articles:Question mark ASP.NET MVC URL search parameter - urlMake an array of data from $ (this) .serialize () - javascriptHow to do custom initialization with autofac - inversion-of-controlЛучший способ переместить проект в новый проект - iphoneFinding Distribution of Each Cluster from Kmeans - c ++Convert xs: listings to XSD for dropdowns in Excel - xmlHow to move forward with real GUI development using Java Swing and MVC - javajava / gwt UI coding - pure code - javaПолучение списка фильтров действий из базового контроллера - c#jQuery modal window with animation? - jqueryAll Articles