mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-16 21:19:43 +02:00
b2/: normalize relative values to 1, not 100
This commit is contained in:
parent
e7b2e65795
commit
edcc61a6f4
@ -198,7 +198,11 @@ int eval_rel(const struct format *fmt, const char *s,
|
|||||||
if (perc) {
|
if (perc) {
|
||||||
if (perc[1])
|
if (perc[1])
|
||||||
return 0;
|
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 == ¶m_ops_abs);
|
assert(fmt->u.rel->ops == ¶m_ops_abs);
|
||||||
stop = strchr(s, 0);
|
stop = strchr(s, 0);
|
||||||
|
@ -63,7 +63,7 @@ struct value {
|
|||||||
struct bitset set;
|
struct bitset set;
|
||||||
double abs;
|
double abs;
|
||||||
struct rel_value {
|
struct rel_value {
|
||||||
double plus, minus;
|
double plus, minus; /* rel: 100% = 1 */
|
||||||
int fract; /* 0: abs. offset; 1: fract. offs. */
|
int fract; /* 0: abs. offset; 1: fract. offs. */
|
||||||
} rel;
|
} rel;
|
||||||
} u;
|
} u;
|
||||||
|
Loading…
Reference in New Issue
Block a user