diff options
author | Mango0x45 <thomasvoss@live.com> | 2021-01-03 16:13:30 +0000 |
---|---|---|
committer | Mango0x45 <thomasvoss@live.com> | 2021-01-03 16:13:30 +0000 |
commit | d0747f3aca848525622cd6aa177434e8e2ef3ad3 (patch) | |
tree | cc14afa915ea77fb682c2277716cfb8fdaff2eb3 /bc_funcs | |
parent | 6bc48cc78c6451b82de359ba2a5f209748d1159b (diff) | |
download | steve-bot-d0747f3aca848525622cd6aa177434e8e2ef3ad3.tar steve-bot-d0747f3aca848525622cd6aa177434e8e2ef3ad3.tar.gz steve-bot-d0747f3aca848525622cd6aa177434e8e2ef3ad3.tar.bz2 steve-bot-d0747f3aca848525622cd6aa177434e8e2ef3ad3.tar.lz steve-bot-d0747f3aca848525622cd6aa177434e8e2ef3ad3.tar.xz steve-bot-d0747f3aca848525622cd6aa177434e8e2ef3ad3.tar.zst steve-bot-d0747f3aca848525622cd6aa177434e8e2ef3ad3.zip |
Fix bugs
Diffstat (limited to 'bc_funcs')
-rw-r--r-- | bc_funcs/misc.bc | 7 | ||||
-rw-r--r-- | bc_funcs/trig.bc | 66 |
2 files changed, 38 insertions, 35 deletions
diff --git a/bc_funcs/misc.bc b/bc_funcs/misc.bc index 7c0a9db..a768397 100644 --- a/bc_funcs/misc.bc +++ b/bc_funcs/misc.bc @@ -1,9 +1,12 @@ define void findseed() { - auto x, i + auto x, i, s + s = scale + scale = 0 for (i = 0; i < 12; i++) if (rand() % 10 < 1) - x++ + x += 1 + scale = s print "Your seed is a ", x, " eye" } diff --git a/bc_funcs/trig.bc b/bc_funcs/trig.bc index c127753..9a4fcb3 100644 --- a/bc_funcs/trig.bc +++ b/bc_funcs/trig.bc @@ -1,33 +1,33 @@ define sin(x) { - auto b, s, r, a, q, i - - if (x < 0) - return (-sin(-x)) - - b = ibase - ibase = A - s = scale - scale = 1.1 * s + 2 - a = atan(1) - scale = 0 - q = (x / a + 2) / 4 - x -= 4 * q * a - - if (q % 2) - x = -x - - scale = s + 2 - r = a = x - q = -x * x - - for (i = 3; a; i += 2) { - a *= q / (i * (i - 1)) - r += a - } - - scale = s - ibase = b - return (r / 1) + auto b, s, r, a, q, i + + if (x < 0) + return (-sin(-x)) + + b = ibase + ibase = A + s = scale + scale = 1.1 * s + 2 + a = atan(1) + scale = 0 + q = (x / a + 2) / 4 + x -= 4 * q * a + + if (q % 2) + x = -x + + scale = s + 2 + r = a = x + q = -x * x + + for (i = 3; a; i += 2) { + a *= q / (i * (i - 1)) + r += a + } + + scale = s + ibase = b + return (r / 1) } define cos(x) { @@ -53,7 +53,7 @@ define atan(x) { n = -1 x = -x } - + if (scale < 65) { if (x == 1) { r = .7853981633974483096156608458198757210492923498437764552437361480/n @@ -74,11 +74,11 @@ define atan(x) { scale += 5 a = atan(.2) } - + scale = s + 3 while (x > .2) { - m++ + m += 1 x = (x - .2) / (1 + .2 * x) } @@ -95,4 +95,4 @@ define atan(x) { scale = s ibase = b return ((m * a + r) / n) -}
\ No newline at end of file +} |