Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Cobol/verschiedene-Autoren/Goedel/   (verschiedene Autoren Version 0.7©)  Datei vom 19.4.2008 mit Größe 823 B image not shown  

Quelle  divfast.cob   Sprache: Cobol

 

       identification division.
       program-id. divfast.
      *  aus Wirth, systematisches Programmieren p. 43
      * vorsichtig: q ist der Zähler und r das Ergebnis 
       author. "JD".
       date-written. 25.10.2004.
       date-compiled.
       data division.
       working-storage section.
       77 q pic 9(4).
       77 w pic 9(4).
       linkage section.
       77 x   pic 9(4).
       77 y   pic 9(4).
       77 r   pic 9(4).
       procedure division using x y r.
      * computes x / y
         move x to r.
         move 0 to q
         move y to w
      * invariant w = 2**n * y > x   
         perform until w = y with test after
      *   q * w + r = x, r >= 0    
           multiply 2 by q
           divide 2 into w
           if w <= r then
             subtract r from w
             add 1 to q
           end-if
         end-perform.
      *  q * y + r = x  0 <= r < y  q = x div y
        end-program divfast.

Messung
CHZG
979810098

¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet am  2026-11-25) ¤

*© Formatika GbR, Deutschland