1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-12-23 09:57:24 +02:00

b2/: normalize relative values to 1, not 100

This commit is contained in:
Werner Almesberger 2012-04-28 23:24:25 -03:00
parent e7b2e65795
commit edcc61a6f4
2 changed files with 6 additions and 2 deletions

View File

@ -198,7 +198,11 @@ int eval_rel(const struct format *fmt, const char *s,
if (perc) {
if (perc[1])
return 0;
return relative(s, perc, &res->u.rel.plus, &res->u.rel.minus);
if (!relative(s, perc, &res->u.rel.plus, &res->u.rel.minus))
return 0;
res->u.rel.plus /= 100;
res->u.rel.minus /= 100;
return 1;
}
assert(fmt->u.rel->ops == &param_ops_abs);
stop = strchr(s, 0);

View File

@ -63,7 +63,7 @@ struct value {
struct bitset set;
double abs;
struct rel_value {
double plus, minus;
double plus, minus; /* rel: 100% = 1 */
int fract; /* 0: abs. offset; 1: fract. offs. */
} rel;
} u;