internal/amos: return error conditions
MODIFY
mathext/airy.go
mathext/airy.go
@@ -17,7 +17,7 @@ func AiryAi(z complex128) complex128 {
// documentation for the exact behavior.
id := 0
kode := 1
- air, aii, _ := amos.Zairy(real(z), imag(z), id, kode)
+ air, aii, _, _ := amos.Zairy(real(z), imag(z), id, kode)
return complex(air, aii)
}
@@ -32,6 +32,6 @@ func AiryAiDeriv(z complex128) complex128 {
// documentation for the exact behavior.
id := 1
kode := 1
- air, aii, _ := amos.Zairy(real(z), imag(z), id, kode)
+ air, aii, _, _ := amos.Zairy(real(z), imag(z), id, kode)
return complex(air, aii)
}

MODIFY
mathext/internal/amos/amos.go
mathext/internal/amos/amos.go
@@ -42,7 +42,7 @@ func max(a, b int) int {
return b
}
-func Zairy(ZR, ZI float64, ID, KODE int) (AIR, AII float64, NZ int) {
+func Zairy(ZR, ZI float64, ID, KODE int) (AIR, AII float64, NZ, IERR int) {
// zairy is adapted from the original Netlib code by Donald Amos.
// http://www.netlib.no/netlib/amos/zairy.f
@@ -179,7 +179,7 @@ func Zairy(ZR, ZI float64, ID, KODE int) (AIR, AII float64, NZ int) {
DK, D1, D2, ELIM, FID, FNU, PTR, RL, R1M5, SFAC, STI, STR,
S1I, S1R, S2I, S2R, TOL, TRM1I, TRM1R, TRM2I, TRM2R, TTH, ZEROI,
ZEROR, ZTAI, ZTAR, Z3I, Z3R, ALAZ, BB float64
- var IERR, IFLAG, K, K1, K2, MR, NN int
+ var IFLAG, K, K1, K2, MR, NN int
var tmp complex128
// Extra element for padding.

MODIFY
mathext/internal/amos/amos_test.go
mathext/internal/amos/amos_test.go
@@ -418,12 +418,13 @@ func zairytest(t *testing.T, x []float64, kode, id int) {
KODE := kode
ID := id
- AIRfort, AIIfort, NZfort := zairyOrig(ZR, ZI, ID, KODE)
- AIRamos, AIIamos, NZamos := Zairy(ZR, ZI, ID, KODE)
+ AIRfort, AIIfort, NZfort, IERRfort := zairyOrig(ZR, ZI, ID, KODE)
+ AIRamos, AIIamos, NZamos, IERRamos := Zairy(ZR, ZI, ID, KODE)
sameF64Approx(t, "zairy air", AIRfort, AIRamos, 1e-12)
sameF64Approx(t, "zairy aii", AIIfort, AIIamos, 1e-12)
sameInt(t, "zairy nz", NZfort, NZamos)
+ sameInt(t, "zairy ierr", IERRfort, IERRamos)
}
func zacaitest(t *testing.T, x []float64, is []int, tol float64, n int, yr, yi []float64, kode int) {

MODIFY
mathext/internal/amos/origcode_test.go
mathext/internal/amos/origcode_test.go
@@ -35,7 +35,7 @@ func max0(a, b int) int {
return b
}
-func zairyOrig(ZR, ZI float64, ID, KODE int) (AIR, AII float64, NZ int) {
+func zairyOrig(ZR, ZI float64, ID, KODE int) (AIR, AII float64, NZ, IERR int) {
// zairy is adapted from the original Netlib code by Donald Amos.
// http://www.netlib.no/netlib/amos/zairy.f
@@ -172,7 +172,7 @@ func zairyOrig(ZR, ZI float64, ID, KODE int) (AIR, AII float64, NZ int) {
DK, D1, D2, ELIM, FID, FNU, PTR, RL, R1M5, SFAC, STI, STR,
S1I, S1R, S2I, S2R, TOL, TRM1I, TRM1R, TRM2I, TRM2R, TTH, ZEROI,
ZEROR, ZTAI, ZTAR, Z3I, Z3R, ALAZ, BB float64
- var IERR, IFLAG, K, K1, K2, MR, NN int
+ var IFLAG, K, K1, K2, MR, NN int
var tmp complex128
// Extra element for padding.

internal/amos: return error conditions