diff --git a/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/Discrete.res b/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/Discrete.res index 45a92447..0f2e2eb3 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/Discrete.res +++ b/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/Discrete.res @@ -239,9 +239,11 @@ module T = Dist({ if referenceIsZero { Ok(0.0) } else { - combinePointwise(~fn=PointSetDist_Scoring.KLDivergence.logScore, base, reference) |> E.R2.bind( - integralEndYResult, - ) + combinePointwise( + ~fn=PointSetDist_Scoring.KLDivergence.logScore, + base, + reference, + ) |> E.R2.bind(integralEndYResult) } } }) diff --git a/packages/squiggle-lang/src/rescript/Utility/Operation.res b/packages/squiggle-lang/src/rescript/Utility/Operation.res index a14fdcdc..bd4e799f 100644 --- a/packages/squiggle-lang/src/rescript/Utility/Operation.res +++ b/packages/squiggle-lang/src/rescript/Utility/Operation.res @@ -157,8 +157,8 @@ module Scale = { | #Divide => divide(a, b) | #Power => power(a, b) | #Logarithm => - if a < MagicNumbers.Epsilon.seven { - Ok(0.0) + if a < MagicNumbers.Epsilon.ten { + Error(NegativeInfinityError) } else { logarithm(a, b) }