Skip to content

Commit

Permalink
Fix a couple style errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
c-blake committed Nov 29, 2024
1 parent fa79414 commit 4786856
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions adix/tdigest.nim
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func mergeNew*(s: var DigesT, force=false, cpr = -1.0) =
s.wBuf = 0

func add*(s: var DigesT, x: float, w=1) = ## Main update API
if isnan(x): raise newException(ValueError, "cannot add NaN")
if isNaN(x): raise newException(ValueError, "cannot add NaN")
if s.nT >= s.buf.len - s.nM - 1:
s.mergeNew
let i = s.nT; inc s.nT
Expand Down Expand Up @@ -183,7 +183,7 @@ func quantile*(s: var DigesT, q: float): float =
return weightedAverage(s.mrg[n-1].m, z1, s.max, z2)

func cdf*(s: var DigesT, x: float): float =
if x.isnan: return NaN
if x.isNaN: return NaN
s.mergeNew
if s.nM == 0: return NaN # no data to examine
if x < s.min: return 0.0 # -inf works fine
Expand Down

0 comments on commit 4786856

Please sign in to comment.