identification division.
program-id. root.
* aus Wirth, systematisches Programmieren p. 63
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 sqrt(x), 0<x<2
move x to a
subtract x from 1 giving c
perform until c<=eps
* a*a=x*(1-c), c>=0
compute a = a*(1+0.5*c)
compute c = c*c*(0.75+0.25*c)
end-perform.
* x*(1-eps)/x<=a*a<x.
end-program root.
¤ Dauer der Verarbeitung: 0.13 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.
|