subroutinegroupedrecursiveprivate
recursive subroutine grouped(value, b)
Write value, not negative, with a comma between each group of three digits.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| value | integer(kind=int64) | in | the number | |
| b | type(buffer_t) | inout | the HTML |
Calls
Source
Show the code
recursive subroutine grouped(value, b)
integer(int64), intent(in) :: value !! the number
type(buffer_t), intent(inout) :: b !! the HTML
integer(int64), parameter :: GROUP = 1000
integer :: rest
if (value < GROUP) then
call add_int(b, value)
return
end if
call grouped(value/GROUP, b)
rest = int(mod(value, GROUP))
call add(b, ',')
if (rest < 100) call add(b, '0')
if (rest < 10) call add(b, '0')
call add_int(b, int(rest, int64))
end subroutine grouped