v1.09: bugfix for taking log/ln of a number with an exponent of 99

This commit is contained in:
Jeff Wang 2019-11-14 02:14:58 -05:00
parent 47459f5253
commit f25a71b74c
5 changed files with 40 additions and 7 deletions

View File

@ -66,8 +66,8 @@
:04080A00B402019B98
:202EC00000000A0000000000000000000017023A325C63282D44633C726D2F3938372A3656
:202EE00035342D3332312B3D2E305354432052504E20202020202020202043616C63756C72
:0B2F000061746F722076312E303800B3
:202FA2005354432052504E20202020202020202043616C63756C61746F722076312E30388E
:0B2F000061746F722076312E303900B2
:202FA2005354432052504E20202020202020202043616C63756C61746F722076312E30398D
:012FC200000E
:20080E00AF82AEB0741F5EF5B0758232C007120E6FD00753070FEFC454F0F5A075826412ED
:20082E000E6FD2B5758264120E6FC2B522E582FFC4540FF582C00712080ED0078F8212082E
@ -260,9 +260,9 @@
:201F1C0006088607C3EE9410EF648094A740607576107577278E828F83122E84AB828B3526
:201F3C0078BF8682088683757610757727122E4EAB82AC8378BFA60308A604757664757770
:201F5C00008B828C83C004C003122E84AA82D003D0048A367576647577008B828C83122ED4
:201F7C004EAC82AD838C377533047534008042C3EE9464EF64809480402F75766475770085
:201F7C004EAC82AD838C377533057534008042C3EE9464EF64809480402F75766475770084
:201F9C008E828F83122E84AC828C3578BF8682088683757664757700122E4EAC82AD838C4D
:201FBC003675330275340080088E35753301753400E560600990003375F04012142F757689
:201FBC003675330375340080088E35753301753400E560600990003375F04012142F757688
:201FDC001B75772F75788090009E75F040120E7C121A187576B475770075784090009E7534
:201FFC00F040120E7C021733121D1475761B75772F75788090009E75F040120E7C7576334F
:20201C0075770075784090001475F000120E7C75769E75770075784090003375F040120EBC

View File

@ -1005,13 +1005,13 @@ void ln_decn(void){
NUM_TIMES.exponent = NUM_TIMES.exponent % 10000;
AccDecn.lsu[1] = NUM_TIMES.exponent / 100;
AccDecn.lsu[2] = NUM_TIMES.exponent % 100;
AccDecn.exponent = 4;
AccDecn.exponent = 5;
} else
#endif
if (NUM_TIMES.exponent >= 100){
AccDecn.lsu[0] = NUM_TIMES.exponent / 100;
AccDecn.lsu[1] = NUM_TIMES.exponent % 100;
AccDecn.exponent = 2;
AccDecn.exponent = 3;
} else {
AccDecn.lsu[0] = NUM_TIMES.exponent;
AccDecn.exponent = 1;

View File

@ -274,6 +274,12 @@ int main(void){
"0.176091259055681242", 0
);
//new acc for log test
log_test(
"9", 99,
"230.153148783746742", 0
);
//new acc for exp test
exp_test(
"4.4", 0,

View File

@ -226,6 +226,33 @@ ln() exponent from initial: 1.
log(a): 0.176091259055681285
: 2.44191564252505631E-16
a : 9.E99
ln() accum scaled between 1,10: 9.
ln() initial accum: 1. (100)
0: num_times: 0, 1.
1: num_times: 1, 1.
2: num_times: 1, 0.1
3: num_times: 0, 1.
4: num_times: 1, 0.001
5: num_times: 0, 0.01
6: num_times: 0, 0.1
7: num_times: 0, 1.
8: num_times: 1, 1.E-7
ln() remainder: 1.E-7
8: ln() remainder: 1.0000000050001598
7: ln() remainder: 0.1000000005000159
6: ln() remainder: 0.0100000000500015
5: ln() remainder: 0.0010000000050001
4: ln() remainder: 1.0000500033335833
3: ln() remainder: 0.1000050003333583
2: ln() remainder: 1.0050335853501441
1: ln() remainder: 1.053605156578263
0: ln() remainder: 0.1053605156578263
ln() accum after summing: 0.1053605156578263
ln() exponent from initial: 100.
ln(a): 230.153148783746742
: 0
a : 4.4
exp() num_times for 10*ln(10): 4.4 (0)
exp() num_times for 255: 2.09741490700595432 (1)

View File

@ -125,7 +125,7 @@ static void latch_on(void)
__xdata char EntryBuf[MAX_CHARS_PER_LINE + 1];
__xdata uint8_t ExpBuf[2];
__xdata const char VER_STR[32+1] = "STC RPN Calculator v1.08";
__xdata const char VER_STR[32+1] = "STC RPN Calculator v1.09";
enum {