[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] 01/02: prevent division by zero
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] 01/02: prevent division by zero |
Date: |
Wed, 16 May 2018 21:33:27 +0200 |
This is an automated email from the git hooks/post-receive script.
julius-buenger pushed a commit to branch master
in repository gnunet.
commit da17249efd9e5c24471998360f7cbac5c08a7ef6
Author: Julius Bünger <address@hidden>
AuthorDate: Wed May 16 21:32:01 2018 +0200
prevent division by zero
---
src/rps/test_rps.c | 35 +++++++++++++++++++----------------
1 file changed, 19 insertions(+), 16 deletions(-)
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c
index b433a51d4..cf38219f1 100644
--- a/src/rps/test_rps.c
+++ b/src/rps/test_rps.c
@@ -2180,22 +2180,25 @@ void view_update_cb (void *cls,
rps_peer->index,
count_peer_in_views_2 (rps_peer->index));
cumulated_view_sizes();
- to_file ("/tmp/rps/repr.txt",
- "%" PRIu64 /* index */
- " %" PRIu32 /* occurrence in views */
- " %" PRIu32 /* view sizes */
- " %f" /* fraction of repr in views */
- " %f" /* average view size */
- " %f" /* prob of occurrence in view slot */
- " %f" "", /* exp frac of repr in views */
- rps_peer->index,
- count_peer_in_views_2 (rps_peer->index),
- view_sizes,
- count_peer_in_views_2 (rps_peer->index) / (view_size * 1.0), /*
fraction of representation in views */
- view_sizes / (view_size * 1.0), /* average view size */
- 1.0 /view_size, /* prob of occurrence in view slot */
- (1.0/view_size) * (view_sizes/view_size) /* expected fraction of repr
in views */
- );
+ if (0 != view_size)
+ {
+ to_file ("/tmp/rps/repr.txt",
+ "%" PRIu64 /* index */
+ " %" PRIu32 /* occurrence in views */
+ " %" PRIu32 /* view sizes */
+ " %f" /* fraction of repr in views */
+ " %f" /* average view size */
+ " %f" /* prob of occurrence in view slot */
+ " %f" "", /* exp frac of repr in views */
+ rps_peer->index,
+ count_peer_in_views_2 (rps_peer->index),
+ view_sizes,
+ count_peer_in_views_2 (rps_peer->index) / (view_size * 1.0), /*
fraction of representation in views */
+ view_sizes / (view_size * 1.0), /* average view size */
+ 1.0 /view_size, /* prob of occurrence in view slot */
+ (1.0/view_size) * (view_sizes/view_size) /* expected fraction of
repr in views */
+ );
+ }
compute_probabilities (rps_peer->index);
all_views_updated_cb();
}
--
To stop receiving notification emails like this one, please contact
address@hidden