aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorMaxime Devos <maximedevos@telenet.be>2021-09-22 20:29:21 +0200
committerMaxime Devos <maximedevos@telenet.be>2021-09-22 20:29:21 +0200
commit97dcd0b885881ed86ef726d1604873fde6f2affa (patch)
treeb0635c3bdd488dc483bd7e810d103038da50b162 /gnu
parent749ced44b5baf6555dee1cd0c0f977b91670a547 (diff)
downloadgnunet-scheme-97dcd0b885881ed86ef726d1604873fde6f2affa.tar.gz
gnunet-scheme-97dcd0b885881ed86ef726d1604873fde6f2affa.zip
nse/client: Allow NaN as standard deviation.
See <https://bugs.gnunet.org/view.php?id=7021#c18399>. * doc/scheme-gnunet.tm (Estimation of the size of the network)[estimate:standard-deviation]: Document it.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/gnunet/nse/client.scm11
1 files changed, 8 insertions, 3 deletions
diff --git a/gnu/gnunet/nse/client.scm b/gnu/gnunet/nse/client.scm
index 7b0c6dd..d240c28 100644
--- a/gnu/gnunet/nse/client.scm
+++ b/gnu/gnunet/nse/client.scm
@@ -36,7 +36,7 @@
36 estimate) 36 estimate)
37 (import (only (rnrs base) 37 (import (only (rnrs base)
38 begin define quote lambda case values expt = else apply 38 begin define quote lambda case values expt = else apply
39 and >=) 39 and >= let or nan?)
40 (only (rnrs control) 40 (only (rnrs control)
41 when unless) 41 when unless)
42 (only (rnrs records syntactic) 42 (only (rnrs records syntactic)
@@ -104,7 +104,7 @@ in @var{estimate} as a positive flonum (possibly zero or infinite)."
104 (define (estimate:standard-deviation estimate) 104 (define (estimate:standard-deviation estimate)
105 "Return the standard deviation of the logarithmic estimate 105 "Return the standard deviation of the logarithmic estimate
106of the number of peers of the last 64 rounds as a positive flonum 106of the number of peers of the last 64 rounds as a positive flonum
107(possibly zero or infinite)." 107(possibly zero or infinite), or not-a-number."
108 (%estimate:standard-deviation estimate)) 108 (%estimate:standard-deviation estimate))
109 109
110 (define (estimate:number-peers estimate) 110 (define (estimate:number-peers estimate)
@@ -147,7 +147,12 @@ even if not connected. This is an idempotent operation."
147 (sizeof /:msg:nse:estimate '())) 147 (sizeof /:msg:nse:estimate '()))
148 ;; XXX: these two lines below are not tested 148 ;; XXX: these two lines below are not tested
149 (>= (read% /:msg:nse:estimate '(size-estimate) slice) 0) 149 (>= (read% /:msg:nse:estimate '(size-estimate) slice) 0)
150 (>= (read% /:msg:nse:estimate '(std-deviation) slice) 0))) 150 ;; See <https://bugs.gnunet.org/view.php?id=7021#c18399> for
151 ;; situations in which the deviation can be infinite or NaN.
152 (let ((stddev
153 (read% /:msg:nse:estimate '(std-deviation) slice)))
154 (or (>= stddev 0)
155 (nan? stddev)))))
151 ((handle! slice) (handle-estimate! slice))))) 156 ((handle! slice) (handle-estimate! slice)))))
152 (define (send-start!) 157 (define (send-start!)
153 ;; The service only starts sending estimates once 158 ;; The service only starts sending estimates once