#DOCUMENTATION by exept
authorClaus Gittinger <cg@exept.de>
Tue, 26 Nov 2019 00:51:11 +0100
changeset 24988 2b353bb8b70a
parent 24987 3f6eba983106
child 24989 98c3a2fa1757
#DOCUMENTATION by exept class: Number comment/format in: #cos_withAccuracy:
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...
     "
 !