diff --git a/js-api.c b/js-api.c index c4af0b5..8dbd92f 100644 --- a/js-api.c +++ b/js-api.c @@ -44,9 +44,9 @@ void EMSCRIPTEN_KEEPALIVE webdice(char* str){ yyparse((void*) scanner, &root); if(root != NULL){ result = resolve(root); - length = strlen(result.text) + 4 * ceill(log10l(result.max)) + 100; + length = strlen(result.text) + 4 * ceill(10 + log10l(result.max)) + 100; out_block = (char*) malloc(length * sizeof(char)); - sprintf(out_block,"

%s = %Lf

", result.text, result.min, result.expected, result.max, result.actual); + sprintf(out_block,"

%s = %Lg

", result.text, result.min, result.expected, result.max, result.actual); output_print(out_block);