summaryrefslogtreecommitdiff
path: root/src/runtime/c/pgf/reader.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/c/pgf/reader.c')
-rw-r--r--src/runtime/c/pgf/reader.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/c/pgf/reader.c b/src/runtime/c/pgf/reader.c
index 8e2a634e8..81ec46f31 100644
--- a/src/runtime/c/pgf/reader.c
+++ b/src/runtime/c/pgf/reader.c
@@ -655,11 +655,11 @@ pgf_compute_meta_probs(GuMapItor* fn, const void* key, void* value, GuExn* err)
cat->name = name;
- double mass = 0;
+ prob_t mass = 0;
for (size_t i = 0; i < cat->n_functions; i++) {
mass += cat->functions[i].prob;
}
- cat->meta_prob = - log(fabs(1 - mass));
+ cat->meta_prob = (mass > 1) ? INFINITY : - log(1 - mass);
cat->meta_token_prob = INFINITY;
cat->meta_child_probs = NULL;
}