Silverfrost Forums

Welcome to our forums

Infinity in Fortran

22 Dec 2023 8:51 #30887

Hello

What is the best way to represent the result of a calculation as +infinity or -infinity in ftn95? In Matlab/Scilab there is a special variable that can be used.

Thanks

Lester

22 Dec 2023 9:54 #30892

If you have a calculation that generates a floating point overflow, you can have it detected. Other than that, you are out of luck. This ability is documented in the HELP file that comes with PLATO. Search for floating point trap, or just 'floating point' to get references.

MATLAB traps these conditions (overflow, underflow) and signals internally that infinity is reached. Remember, MATLAB is NOT a compiler that generates native code, as does FTN95. So it can deal with INFINITY in whatever way it chooses.

Please login to reply.