mirror of
https://github.com/cathugger/mkp224o.git
synced 2025-05-25 11:22:22 +00:00
a bit of calcest and some other stuff
This commit is contained in:
parent
e12a3eb7c9
commit
eea863e3ac
3 changed files with 9 additions and 5 deletions
11
calcest.c
11
calcest.c
|
@ -15,19 +15,20 @@
|
|||
*/
|
||||
|
||||
const double probs[] = { 0.5, 0.8, 0.9, 0.95, 0.99 };
|
||||
const int charcounts[] = { 2, 3, 4, 5, 6, 7 };
|
||||
const int charcounts[] = { 2, 3, 4, 5, 6, 7, 8, 9, 10 };
|
||||
|
||||
int main(void)
|
||||
int main(int argc,char **argv)
|
||||
{
|
||||
|
||||
printf(" |");
|
||||
for (size_t i = 0; i < sizeof(probs)/sizeof(probs[0]); ++i) {
|
||||
printf(" %11d%% |",(int)((probs[i]*100)+0.5));
|
||||
printf(" %15d%% |",(int)((probs[i]*100)+0.5));
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
printf("---+");
|
||||
for (size_t i = 0; i < sizeof(probs)/sizeof(probs[0]); ++i) {
|
||||
printf("--------------+");
|
||||
printf("------------------+");
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
|
@ -35,7 +36,7 @@ int main(void)
|
|||
printf("%2d |",charcounts[i]);
|
||||
for (size_t j = 0; j < sizeof(probs)/sizeof(probs[0]); ++j) {
|
||||
double t = log2(1 - probs[j]) / log2(1 - (1 / pow(32,charcounts[i])));
|
||||
printf(" %12.0f |",t);
|
||||
printf(" %16.0f |",t);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue