Continued fraction/Arithmetic/G(matrix ng, continued fraction n1, continued fraction n2): Difference between revisions
Content deleted Content added
Line 2,632: | Line 2,632: | ||
{{trans|ObjectIcon}} |
{{trans|ObjectIcon}} |
||
This program includes a primitive module for multiple-precision integer arithmetic. |
This program includes a primitive module for multiple-precision integer arithmetic. It is adequate for the task. |
||
<syntaxhighlight lang="fortran"> |
<syntaxhighlight lang="fortran"> |
||
Line 3,524: | Line 3,524: | ||
type(big_integer), intent(inout) :: a |
type(big_integer), intent(inout) :: a |
||
logical :: done |
|||
integer :: i |
integer :: i |
||
character, allocatable :: fewer_bytes(:) |
character, allocatable :: fewer_bytes(:) |
||
Line 3,529: | Line 3,530: | ||
! Shorten to the minimum number of bytes. |
! Shorten to the minimum number of bytes. |
||
i = size (a%bytes) |
i = size (a%bytes) |
||
done = .false. |
|||
do while (.not. done) |
|||
if (i == 1) then |
|||
done = .true. |
|||
else if (a%bytes(i) /= zero) then |
|||
done = .true. |
|||
else |
|||
i = i - 1 |
i = i - 1 |
||
end |
end if |
||
end |
end do |
||
if (i /= size (a%bytes)) then |
if (i /= size (a%bytes)) then |
||
allocate (fewer_bytes (i)) |
allocate (fewer_bytes (i)) |