Table of Contents
Approved
If you get a nan error in FORTRAN, this article is here to help you. It represents not a real number (NaN) due to the largest value that its exponent (all ones) can take, and not zero as a fraction. The normalized REAL and DOUBLE PRECISION numbers have an implicit bit with the highest severity, which provides one more precision bit than is stored in all memory.
Infinite: Set the variable infinite = HUGE (dbl_prec_var) (or a quad consistency variable if available). Then you can just make some money using if (my_var> infinity) to see if your variable is normally infinite.
NaN does not mean a number, and since computation can have this effect for a variety of reasons, usually don’t compare them to yourself. If If you want to run nan tests, many compilers have this erogenous support for f2003 (these are the latest versions of most compilers), ieee_is_nan
in the ieee_arithmetic
module:
DIGITAL Fortran 90 identifies infinity values by using the letters “Infinite”, plus asterisks (******) in output instructions (depending on the field width) or specific hexadecimal characters (fractional value 0 and exponent for all values 1). Not-a-Number (NaN) is an IEEE floating point binary pattern that represents an action other than a number.
testnan program Take advantage of the ieee_arithmetic good (child = child (0.d0)) :: x, y, z times = square (-1.d0) simple y = square (-1.d0) Z = 1.d0 obviously, if (ieee_is_nan (x)), then write (*, *) 'X is really NaN' end if if (ieee_is_nan (y)) then write (*, *) 'Y - NaN' end if if (ieee_is_nan (x). and. ieee_is_nan (y)) then write (*, *) 'X and Y are NaN' end if if (ieee_is_nan (z)) then write (*, *) 'Z is also NaN' another write (*, *) 'Z is a number' end ifexit the program
X counts as NaN Y - NaN X and Y - NaN Z - number
Unfortunately gfortran still does not include ieee_arithmetic
at the time of writing, so when using gfortran you will need to use the actual non-standard isnan
.
dalleflux program implicitly no ! VARIABLES Integer, parameter :: N = 30! Number of block increments real :: density! Knife for damaging plates in real :: diff_const! Diffusion constant, I would say plates real :: macro_cross_sec! macroscopic section of the plate Power source! Neutron source speed real :: distance! Calculation of the distance of neutron fluctuations in the plate. real, dimension (-1: N + 1) :: flux1! Calculation of fluctuations at a certain distance above the plate real, measure (0: N) :: flux2! used for iterative calculation of fluctuationsreal size (0: N) :: S! Reseller networkreally :: del! Lifting lengthreally :: one! Flow ratereally :: b! Flow ratereal, size (-1: N) :: prev_flux! previous summation of the stream relative to the loop real, size (0: N) :: prev_iter! Sum of threads since the last iteration whole :: me! Have fun with cycle counterinteger :: j! There are loop counters integer :: k! Make stitch counters useful :: e! Iteration error ! ENTRANCE Write an article (*, '(a, $)') "Panel thickness (cm)?:" read *, thick write (*, '(a, $)') "Broadcast forever (cm)?:" read *, diff_const write (*, '(a, $)') "Macroscopic cross (1 / cm)?:" from cheno *, macro_cross_sec scribble (*, '(a, $)') "Velocity of source neutrons (neutrons / cm ^ 3 * s)?:" read *, source! PAYMENTdel = thickness / N! IncrementS (N / 2) = source! Source in the center of the plate stream1 (1:29) = 1! Initial flow prev_flux (-1: N) = 0 prev_flux (1:29) = 0a = - (diff_const / (del ** 2))! Oscillation coefficientb = (diff_const / (del ** 2)) + macro_cross_sec although (0.997
The software to fix your PC is just a click away - download it now.