Write the big integer out as a decimal digit string, no leading zeros.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int64), | intent(in) | :: | limb(:) | |||
| integer(kind=default_int), | intent(in) | :: | n_limb | |||
| character(len=*), | intent(out) | :: | exact | |||
| integer(kind=default_int), | intent(out) | :: | n_exact |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(len=LIMB_DIGITS), | private | :: | chunk | ||||
| integer(kind=default_int), | private | :: | first | ||||
| integer(kind=default_int), | private | :: | i | ||||
| integer(kind=default_int), | private | :: | pos |
pure subroutine bd_to_digits(limb, n_limb, exact, n_exact) !! Write the big integer out as a decimal digit string, no leading zeros. integer(int64), intent(in) :: limb(:) integer(default_int), intent(in) :: n_limb character(len=*), intent(out) :: exact integer(default_int), intent(out) :: n_exact character(len=LIMB_DIGITS) :: chunk integer(default_int) :: i, first, pos exact = "" call limb_to_digits(limb(n_limb), chunk) first = 1_default_int do while (first < LIMB_DIGITS .and. chunk(first:first) == "0") first = first + 1_default_int end do pos = LIMB_DIGITS - first + 1_default_int exact(1:pos) = chunk(first:LIMB_DIGITS) do i = n_limb - 1_default_int, 1_default_int, -1_default_int call limb_to_digits(limb(i), chunk) exact(pos + 1_default_int:pos + LIMB_DIGITS) = chunk pos = pos + LIMB_DIGITS end do n_exact = pos end subroutine bd_to_digits