identification division.
program-id. recip.
* aus Wirth, systematisches Programmieren p. 62
author. "JD".
date-written. 15.8.2007.
date-compiled.
data division.
working-storage section.
77 c pic 9(4)V9(4).
77 eps pic 9(4)V9(4) value 0.001.
linkage section.
77 x pic 9(4)V9(4).
77 a pic 9(4)V9(4).
procedure division using x returning a.
* computes 1/x
move 1 to a
subtract x from 1 giving c
perform until c<=eps
* a*x=1-c, 0<abs(c)<1
compute a = a*(1+c)
multiply c by c
end-perform.
* (1-eps)/x<=a<1/x.
end-program recip.
¤ Dauer der Verarbeitung: 0.21 Sekunden
(vorverarbeitet)
¤
|
Haftungshinweis
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.
|