inf(3f) - [M_units] return an inf (Infinity) (LICENSE:PD)
Synopsis
Description
Options
Returns
Example
Author
License
function inf(value)
use,intrinsic :: iso_fortran_env, only: real32, real64, real128 real(kind=real32|real64|real128) :: inf real(kind=real32|real64|real128) :: value
Return an inf (Infinity) value. The type returned will be the same kind as the passed value.
value A real value whose kind is used to define the kind of the returned value.
inf returns an inf value ("Infinity") on platforms that support inf values. The kind is determined by the kind of the input value.
Sample program
program demo_inf use,intrinsic :: iso_fortran_env, only: real32, real64, real128 use M_units, only : inf implicit none real(kind=real32) :: r32 real(kind=real64) :: r64 real(kind=real128) :: r128 character(len=256) :: message integer :: ios r32=inf(0.0_real32) r64=inf(0.0_real64) r128=inf(0.0_real128) write(*,*,iomsg=message,iostat=ios)r32,r64,r128 if(ios.ne.0)write(*,*)trim(message) write(*,(z0),iomsg=message,iostat=ios)r32,r64,r128 if(ios.ne.0)write(*,*)trim(message) write(*,(g0),iomsg=message,iostat=ios)r32,r64,r128 if(ios.ne.0)write(*,*)trim(message) write(*,(f3.1),iomsg=message,iostat=ios)r32,r64,r128 if(ios.ne.0)write(*,*)trim(message) write(*,(f2.1),iomsg=message,iostat=ios)r32,r64,r128 if(ios.ne.0)write(*,*)trim(message) end program demo_infResults:
Infinity Infinity Infinity7F800000 7FF0000000000000 7FFF0000000000000000000000000000 Inf Inf Inf Inf Inf Inf ** ** **
John S. Urban
Public Domain
Nemo Release 3.1 | inf (3) | February 23, 2025 |