Aufgabe 17: algorithm ln(x, n) input : x - Gleitkommazahl der zu berechnenden Stelle n - natürliche Zahl für die Genauigkeit output: Näherung für ln(x) if n = 1 then return x - 1 else return taylor(x, n - 1) - pot(1 - x, n) / n algorithm pot(x, n) input : x - Gleitkommazahl der Basis n - natürliche Zahl für den Exponenten output: xn als Gleitkommazahl p <- 1 for i <- 1 to n do p <- p * x return p algorithm ln_opt(x, n) input : x - Gleitkommazahl der zu berechnenden Stelle n - natürliche Zahl für die Genauigkeit output: Näherung für ln(x) reverse <- x > 1 // boolean-Wert if reverse then x = 1 / x t <- 0 pow <- 1 - x for i <- 1 to n do t <- t - pow / i pow <- pow * (1 - x) if reverse then return -t else return t