[UP]


Manual Reference Pages  - inf (3)

NAME

inf(3f) - [M_units] return an inf (Infinity) (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Returns
Example
Author
License

SYNOPSIS

function inf(value) use,intrinsic :: iso_fortran_env, only: real32, real64, real128 real(kind=real32|real64|real128) :: inf real(kind=real32|real64|real128) :: value

DESCRIPTION

Return an inf (Infinity) value. The type returned will be the same kind as the passed value.

OPTIONS

value A real value whose kind is used to define the kind of the returned value.

RETURNS

inf returns an inf value ("Infinity") on platforms that support inf values. The kind is determined by the kind of the input value.

EXAMPLE

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_inf
Results:

    Infinity Infinity Infinity
7F800000 7FF0000000000000 7FFF0000000000000000000000000000 Inf Inf Inf Inf Inf Inf ** ** **

AUTHOR

John S. Urban

LICENSE

Public Domain


inf (3) October 17, 2020
Generated by manServer 1.08 from 6d34e2e9-1332-4399-905b-813e2877c238 using man macros.