# HG changeset patch # User Claus Gittinger # Date 1574725871 -3600 # Node ID 2b353bb8b70a8c1c8dc2dfcd1f80142d62ff6ee0 # Parent 3f6eba9831064713b35d9b526d3efa0709015b28 #DOCUMENTATION by exept class: Number comment/format in: #cos_withAccuracy: diff -r 3f6eba983106 -r 2b353bb8b70a Number.st --- a/Number.st Mon Nov 25 16:00:51 2019 +0100 +++ b/Number.st Tue Nov 26 00:51:11 2019 +0100 @@ -2822,22 +2822,28 @@ lastApprox := 1. [ (lastApprox - approx) abs > epsilon ] whileTrue:[ - facN := facN + 2. - den := den * (facN - 1) * facN. - num := (num * x2) negated. - lastApprox := approx. - approx := approx + (num / den). + facN := facN + 2. + den := den * (facN - 1) * facN. + num := (num * x2) negated. + lastApprox := approx. + approx := approx + (num / den). ]. ^ approx " 1.0 cos 0.540302 + 1.0 asLongFloat cos 0.5403023058681397174 1.0 asLongFloat cos_withAccuracy:1 0.5 1.0 asLongFloat cos_withAccuracy:0.1 0.541666667 1.0 asLongFloat cos_withAccuracy:0.01 0.540277778 1.0 asLongFloat cos_withAccuracy:0.001 0.540302579 - 1.0 asLongFloat cos_withAccuracy:1e-40 0.540302306 + 1.0 asLongFloat cos_withAccuracy:1e-40 0.5403023058681397175 + 1.0 asQDouble cos 0.5403023058681396874081335957994 + 1.0 asQDouble cos_withAccuracy:1e-40 + Wolfram: + 0.5403023058681396874081335957994 + 0.540302305868139717400936607442976603732310420617922227670... " !