@@ -111,7 +111,7 @@ module stdlib_str2num
111
111
112
112
#:for k1, t1 in INT_KINDS_TYPES
113
113
elemental subroutine to_${k1}$_base(s,v,p,stat)
114
- !> Return an unsigned 32-bit integer
114
+ !> Return an ${k1}$ integer
115
115
! -- In/out Variables
116
116
character(*), intent(in) :: s !> input string
117
117
${t1}$, intent(out) :: v !> Output real value
@@ -128,7 +128,7 @@ module stdlib_str2num
128
128
v = 0
129
129
do while( p<=len(s) )
130
130
val = iachar(s(p:p))-digit_0
131
- if( val >= 0 .and. val <= 9) then
131
+ if( val >= 0 .and. val <= 9 ) then
132
132
v = v*10 + val
133
133
p = p + 1
134
134
else
@@ -224,7 +224,7 @@ module stdlib_str2num
224
224
i_exp = 0
225
225
do while( p<=len(s) )
226
226
val = iachar(s(p:p))-digit_0
227
- if( val >= 0 .and. val <= 9) then
227
+ if( val >= 0 .and. val <= 9 ) then
228
228
i_exp = i_exp*10_int8 + val
229
229
p = p + 1
230
230
else
@@ -233,7 +233,7 @@ module stdlib_str2num
233
233
end do
234
234
235
235
exp_aux = nwnb-1+resp-sige*i_exp
236
- if( exp_aux>0 .and. exp_aux<=nwnb+nfnb) then
236
+ if( exp_aux>0 .and. exp_aux<=nwnb+nfnb ) then
237
237
v = sign*int_wp*expbase(exp_aux)
238
238
else
239
239
v = sign*int_wp*10._dp**(sige*i_exp-resp+1)
@@ -322,7 +322,7 @@ module stdlib_str2num
322
322
i_exp = 0
323
323
do while( p<=len(s) )
324
324
val = iachar(s(p:p))-digit_0
325
- if( val >= 0 .and. val <= 9) then
325
+ if( val >= 0 .and. val <= 9 ) then
326
326
i_exp = i_exp*10_int8 + val
327
327
p = p + 1
328
328
else
@@ -331,7 +331,7 @@ module stdlib_str2num
331
331
end do
332
332
333
333
exp_aux = nwnb-1+resp-sige*i_exp
334
- if( exp_aux>0 .and. exp_aux<=nwnb+nfnb) then
334
+ if( exp_aux>0 .and. exp_aux<=nwnb+nfnb ) then
335
335
v = sign*int_wp*expbase(exp_aux)
336
336
else
337
337
v = sign*int_wp*10._wp**(sige*i_exp-resp+1)
@@ -393,9 +393,9 @@ module stdlib_str2num
393
393
val = iachar(s(i:i))-digit_0
394
394
if( val >= 0 .and. val <= 9 ) then
395
395
icount = icount + 1
396
- if(icount<=maxdpt) then
396
+ if( icount<=maxdpt ) then
397
397
int_dp1 = int_dp1*10 + val
398
- else if(icount<2*maxdpt) then
398
+ else if( icount<2*maxdpt ) then
399
399
int_dp2 = int_dp2*10 + val
400
400
end if
401
401
else if( val == period ) then
@@ -430,7 +430,7 @@ module stdlib_str2num
430
430
i_exp = 0
431
431
do while( p<=len(s) )
432
432
val = iachar(s(p:p))-digit_0
433
- if( val >= 0 .and. val <= 9) then
433
+ if( val >= 0 .and. val <= 9 ) then
434
434
i_exp = i_exp*10_int8 + val
435
435
p = p + 1
436
436
else
@@ -439,8 +439,8 @@ module stdlib_str2num
439
439
end do
440
440
441
441
exp_aux = nwnb-1+resp-sige*i_exp
442
- if( exp_aux>0 .and. exp_aux<=nwnb+nfnb) then
443
- if(icount<=maxdpt) then
442
+ if( exp_aux>0 .and. exp_aux<=nwnb+nfnb ) then
443
+ if( icount<=maxdpt ) then
444
444
v = sign*int_dp1*expbase(exp_aux)
445
445
else
446
446
v = sign*(int_dp1 + int_dp2*fractional_base(maxdpt-1))*expbase(exp_aux-icount+maxdpt)
@@ -506,9 +506,9 @@ module stdlib_str2num
506
506
val = iachar(s(i:i))-digit_0
507
507
if( val >= 0 .and. val <= 9 ) then
508
508
icount = icount + 1
509
- if(icount<=maxdpt) then
509
+ if( icount<=maxdpt ) then
510
510
int_dp1 = int_dp1*10 + val
511
- else if(icount<2*maxdpt) then
511
+ else if( icount<2*maxdpt ) then
512
512
int_dp2 = int_dp2*10 + val
513
513
end if
514
514
else if( val == period ) then
@@ -543,7 +543,7 @@ module stdlib_str2num
543
543
i_exp = 0
544
544
do while( p<=len(s) )
545
545
val = iachar(s(p:p))-digit_0
546
- if( val >= 0 .and. val <= 9) then
546
+ if( val >= 0 .and. val <= 9 ) then
547
547
i_exp = i_exp*10_int8 + val
548
548
p = p + 1
549
549
else
@@ -552,8 +552,8 @@ module stdlib_str2num
552
552
end do
553
553
554
554
exp_aux = nwnb-1+resp-sige*i_exp
555
- if( exp_aux>0 .and. exp_aux<=nwnb+nfnb) then
556
- if(icount<=maxdpt) then
555
+ if( exp_aux>0 .and. exp_aux<=nwnb+nfnb ) then
556
+ if( icount<=maxdpt ) then
557
557
v = sign*int_dp1*expbase(exp_aux)
558
558
else
559
559
v = sign*(int_dp1 + int_dp2*fractional_base(maxdpt-1))*expbase(exp_aux-icount+maxdpt)
@@ -575,7 +575,7 @@ module stdlib_str2num
575
575
integer(int8) :: p !> position
576
576
!----------------------------------------------
577
577
p = 1
578
- do while( p<len(s) .and. (iachar(s(p:p))==WS.or.iachar(s(p:p))==LF.or.iachar(s(p:p))==CR) )
578
+ do while( p<len(s) .and. (iachar(s(p:p))==WS .or. iachar(s(p:p))==LF .or. iachar(s(p:p))==CR) )
579
579
p = p + 1
580
580
end do
581
581
end function
@@ -586,7 +586,7 @@ module stdlib_str2num
586
586
integer(int8) :: p !> position
587
587
!----------------------------------------------
588
588
p = 1
589
- do while( p<len(s) .and. .not.(iachar(s(p:p))==WS.or.iachar(s(p:p))==LF.or.iachar(s(p:p))==CR) )
589
+ do while( p<len(s) .and. .not.(iachar(s(p:p))==WS .or. iachar(s(p:p))==LF .or. iachar(s(p:p))==CR) )
590
590
p = p + 1
591
591
end do
592
592
end function
0 commit comments