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

@ -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 {