dble(3f) - [M_strings:TYPE] overloads DBLE(3f) so it can handle character arguments
(LICENSE:PD)
impure elemental function dble(string)
character(len=*) :: string
integer :: dble
dble(3f) returns a DOUBLE value when given a numeric representation of a
numeric value. This overloads the DBLE(3f) intrinsic so that CHARACTER
arguments assumed to represent a numeric value may be input.
STRING input string to be converted to a dble value
DBLE double precision value represented by input string
Sample program:
program demo_dble
use M_strings, only: dble
implicit none
write(*,*)dble('100'),dble('20.4')
write(*,*)'dble still works',dble(20),dble(20.4)
write(*,*)'elemental',&
& dble([character(len=23) :: '10','20.3','20.5','20.6'])
end program demo_dble
Results:
> 100.00000000000000 20.399999999999999
> dble still works 20.000000000000000 20.399999618530273
> elemental 10.00000000000000 20.30000000000000
> 20.50000000000000 20.60000000000000
John S. Urban
Public Domain
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | chars |