nint(3f) - [M_strings:TYPE] overloads NINT(3f) so it can handle character arguments (LICENSE:PD)
Synopsis
Description
Options
Returns
Example
Author
License
impure elemental function nint(string)
character(len=*) :: string integer :: nint
nint(3f) returns an integer when given a numeric representation of a numeric value. This overloads the NINT(3f) intrinsic so that CHARACTER arguments assumed to represent a numeric value may be input.
STRING input string to be converted to an integer
NINT integer represented by input string
Sample program:
program demo_nint use M_strings, only: nint implicit none write(*,*)nint(100),nint(20.4) write(*,*)nint still works,nint(20.4) write(*,*)elemental,& & nint([character(len=23) :: 10,20.3,20.5,20.6]) end program demo_nintResults:
> 100 20 > nint still works 20 > elemental 10 20 21 21
John S. Urban
Public Domain
Nemo Release 3.1 | nint (3) | July 22, 2023 |