Skip to content

Commit ffb3b36

Browse files
alexd765griesemer
authored andcommitted
math: add more tests for special cases of Bessel functions Y0, Y1, Yn
Test finite negative x with Y0(-1), Y1(-1), Yn(2,-1), Yn(-3,-1). Also test the special case Yn(0,0). Fixes golang#19130. Change-Id: I95f05a72e1c455ed8ddf202c56f4266f03f370fd Reviewed-on: https://go-review.googlesource.com/37310 Reviewed-by: Robert Griesemer <gri@golang.org>
1 parent dc6af19 commit ffb3b36

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/math/all_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,30 +1742,35 @@ var vfy0SC = []float64{
17421742
0,
17431743
Inf(1),
17441744
NaN(),
1745+
-1,
17451746
}
17461747
var y0SC = []float64{
17471748
NaN(),
17481749
Inf(-1),
17491750
0,
17501751
NaN(),
1752+
NaN(),
17511753
}
17521754
var y1SC = []float64{
17531755
NaN(),
17541756
Inf(-1),
17551757
0,
17561758
NaN(),
1759+
NaN(),
17571760
}
17581761
var y2SC = []float64{
17591762
NaN(),
17601763
Inf(-1),
17611764
0,
17621765
NaN(),
1766+
NaN(),
17631767
}
17641768
var yM3SC = []float64{
17651769
NaN(),
17661770
Inf(1),
17671771
0,
17681772
NaN(),
1773+
NaN(),
17691774
}
17701775

17711776
// arguments and expected results for boundary cases
@@ -2716,6 +2721,9 @@ func TestYn(t *testing.T) {
27162721
t.Errorf("Yn(-3, %g) = %g, want %g", vfy0SC[i], f, yM3SC[i])
27172722
}
27182723
}
2724+
if f := Yn(0, 0); !alike(Inf(-1), f) {
2725+
t.Errorf("Yn(0, 0) = %g, want %g", f, Inf(-1))
2726+
}
27192727
}
27202728

27212729
// Check that math functions of high angle values

0 commit comments

Comments
 (0)