Browse Source

Fix unnecessary precision issue

main
raffitz 5 years ago
parent
commit
4290bb8580
Signed by: raffitz
GPG Key ID: 0224483A6E6AC710
  1. 4
      js-api.c

4
js-api.c

@ -44,9 +44,9 @@ void EMSCRIPTEN_KEEPALIVE webdice(char* str){ @@ -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,"<p>%s = <span title=\"min: %Lf, expected: %Lf, max: %Lf\">%Lf</span></p>", result.text, result.min, result.expected, result.max, result.actual);
sprintf(out_block,"<p>%s = <span title=\"min: %Lg, expected: %Lg, max: %Lg\">%Lg</span></p>", result.text, result.min, result.expected, result.max, result.actual);
output_print(out_block);

Loading…
Cancel
Save