Skip to content

Commit

Permalink
pd_str(): log prob distrib with the new syntax introduced in 184e55c (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
tomcucinotta committed Sep 7, 2023
1 parent c74b920 commit 1a6a27c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/distrib.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,23 @@ char *pd_str(pd_spec_t *p) {
sprintf(s, "%g", p->val);
break;
case UNIF:
sprintf(s, "unif(%g,%g)", p->min, p->max);
sprintf(s, "unif:");
break;
case EXPON:
sprintf(s, "exp(%g)", p->val);
sprintf(s, "exp:%g", p->val);
break;
case NORM:
sprintf(s, "norm(%g,%g)", p->val, p->std);
sprintf(s, "norm:%g", p->val);
break;
default:
fprintf(stderr, "Unexpected prob type: %d\n", p->prob);
exit(1);
}
if (!isnan(p->std))
sprintf(s + strlen(s), ",std=%g", p->std);
if (!isnan(p->min))
sprintf(s + strlen(s), ",min=%g", p->min);
if (!isnan(p->max))
sprintf(s + strlen(s), ",max=%g", p->max);
return s;
}

0 comments on commit 1a6a27c

Please sign in to comment.