diff --git a/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/Continuous.res b/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/Continuous.res index c713900f..b9b6b985 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/Continuous.res +++ b/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/Continuous.res @@ -281,7 +281,7 @@ module T = Dist({ Ok(0.0) } else { combinePointwise( - PointSetDist_Scoring.KLDivergence.logScore(~eps=MagicNumbers.Epsilon.seven), + PointSetDist_Scoring.KLDivergence.logScore(~eps=MagicNumbers.Epsilon.ten), base, reference, ) diff --git a/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/PointSetDist_Scoring.res b/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/PointSetDist_Scoring.res index d43aeba6..34113edb 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/PointSetDist_Scoring.res +++ b/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/PointSetDist_Scoring.res @@ -6,7 +6,7 @@ module KLDivergence = { if a == 0.0 { Error(Operation.NegativeInfinityError) } else if b == 0.0 { - Error(Operation.DivisionByZeroError) + Ok(b) } else { let quot = a /. b quot < 0.0 ? Error(Operation.ComplexNumberError) : Ok(b *. logFn(quot)) diff --git a/packages/squiggle-lang/src/rescript/Utility/Operation.res b/packages/squiggle-lang/src/rescript/Utility/Operation.res index f124ffcd..3a5f667c 100644 --- a/packages/squiggle-lang/src/rescript/Utility/Operation.res +++ b/packages/squiggle-lang/src/rescript/Utility/Operation.res @@ -164,12 +164,7 @@ module Scale = { | #Multiply => Ok(a *. b) | #Divide => divide(a, b) | #Power => power(a, b) - | #Logarithm => - if a < MagicNumbers.Epsilon.ten { - Error(NegativeInfinityError) - } else { - logarithm(a, b) - } + | #Logarithm => logarithm(a, b) | #LogarithmWithThreshold(eps) => if a < eps { Ok(0.0)