aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGavin D. Howard <gavin@gavinhoward.com>2023-08-22 21:24:22 -0600
committerGavin D. Howard <gavin@gavinhoward.com>2023-08-22 21:24:22 -0600
commit30e671105414d48ba1007291db97572628e1e569 (patch)
tree7d6c5a36392939f44eaeb4421f4e0302766ab3bc
parent84ab7982fa36d5cdb5dcb7e30f35608522310db7 (diff)
downloadbc-30e671105414d48ba1007291db97572628e1e569.tar.gz
Make a tiny tweak to TediusTimmy's algorithm
I just increased the scale a bit. Signed-off-by: Gavin D. Howard <gavin@gavinhoward.com>
-rw-r--r--gen/lib2.bc2
-rw-r--r--manuals/algorithms.md8
2 files changed, 5 insertions, 5 deletions
diff --git a/gen/lib2.bc b/gen/lib2.bc
index 2d508714..1d7d48c6 100644
--- a/gen/lib2.bc
+++ b/gen/lib2.bc
@@ -54,7 +54,7 @@ define p(x,y){
}
i=x^a
s=scale
- scale+=length(i)
+ scale+=length(i)+5
if(z){
x=1/z
i=x^a
diff --git a/manuals/algorithms.md b/manuals/algorithms.md
index fa4c3511..e0a5e8a4 100644
--- a/manuals/algorithms.md
+++ b/manuals/algorithms.md
@@ -237,10 +237,10 @@ get clever.
We then compute the integral portion of the power by computing the number to
power of the integral portion of the exponent.
-Then we have the most clever trick: we add the length of that integer power to
-the `scale`. Why? Because this will ensure that the next part is calculated to
-at least as many digits as should be in the integer *plus* any extra `scale`
-that was wanted.
+Then we have the most clever trick: we add the length of that integer power (and
+a little extra) to the `scale`. Why? Because this will ensure that the next part
+is calculated to at least as many digits as should be in the integer *plus* any
+extra `scale` that was wanted.
Then we check `z`, which, if it is not zero, is the original value of the
number. If it is not zero, we need to take the take the reciprocal *again*