fdoc

subroutinegroupedrecursiveprivate

recursive subroutine grouped(value, b)

Write value, not negative, with a comma between each group of three digits.

Arguments

NameTypeIntentAttributesDescription
valueinteger(kind=int64)in

the number

btype(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

Graphs

Calls

Called by