fix: apply correct bounds to sf and tf (#5274)

This commit is contained in:
Noah Labrecque 2023-11-13 19:17:16 -05:00 committed by Aliaksandr Valialkin
parent 9760221214
commit fbb572a180
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1
2 changed files with 6 additions and 6 deletions

View file

@ -955,11 +955,11 @@ func newRollupHoltWinters(args []interface{}) (rollupFunc, error) {
return rfa.prevValue return rfa.prevValue
} }
sf := sfs[rfa.idx] sf := sfs[rfa.idx]
if sf <= 0 || sf >= 1 { if sf < 0 || sf > 1 {
return nan return nan
} }
tf := tfs[rfa.idx] tf := tfs[rfa.idx]
if tf <= 0 || tf >= 1 { if tf < 0 || tf > 1 {
return nan return nan
} }

View file

@ -470,12 +470,12 @@ func TestRollupHoltWinters(t *testing.T) {
} }
f(-1, 0.5, nan) f(-1, 0.5, nan)
f(0, 0.5, nan) f(0, 0.5, -856)
f(1, 0.5, nan) f(1, 0.5, 34)
f(2, 0.5, nan) f(2, 0.5, nan)
f(0.5, -1, nan) f(0.5, -1, nan)
f(0.5, 0, nan) f(0.5, 0, -54.1474609375)
f(0.5, 1, nan) f(0.5, 1, 25.25)
f(0.5, 2, nan) f(0.5, 2, nan)
f(0.5, 0.5, 34.97794532775879) f(0.5, 0.5, 34.97794532775879)
f(0.1, 0.5, -131.30529492371622) f(0.1, 0.5, -131.30529492371622)