ENA, Section 1.4, Exercise 4d

Specification

?
\[\left(0 \leq x \land x \leq 1000000000\right) \land \left(-1 \leq \varepsilon \land \varepsilon \leq 1\right)\]
\[\begin{array}{l} \\ x - \sqrt{x \cdot x - \varepsilon} \end{array} \]
(FPCore (x eps) :precision binary64 (- x (sqrt (- (* x x) eps))))
double code(double x, double eps) {
	return x - sqrt(((x * x) - eps));
}
real(8) function code(x, eps)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps
    code = x - sqrt(((x * x) - eps))
end function
public static double code(double x, double eps) {
	return x - Math.sqrt(((x * x) - eps));
}
def code(x, eps):
	return x - math.sqrt(((x * x) - eps))
function code(x, eps)
	return Float64(x - sqrt(Float64(Float64(x * x) - eps)))
end
function tmp = code(x, eps)
	tmp = x - sqrt(((x * x) - eps));
end
code[x_, eps_] := N[(x - N[Sqrt[N[(N[(x * x), $MachinePrecision] - eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x - \sqrt{x \cdot x - \varepsilon}
\end{array}

Reproduce

?
herbie shell --seed 2024035 
(FPCore (x eps)
  :name "ENA, Section 1.4, Exercise 4d"
  :precision binary64
  :pre (and (and (<= 0.0 x) (<= x 1000000000.0)) (and (<= -1.0 eps) (<= eps 1.0)))

  :herbie-target
  (/ eps (+ x (sqrt (- (* x x) eps))))

  (- x (sqrt (- (* x x) eps))))

Please file a bug report with this information.

Backtrace

list-ref: index too large for list index: 256 in: '(#f #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t #t...LC
valid-splitindices?/home/nightlies/herbie/zane-regimes-2/src/core/regimes.rkt1700
(unnamed).../private/arr-i.rkt9618
option-on-expr/home/nightlies/herbie/zane-regimes-2/src/core/regimes.rkt1060
infer-splitpoints/home/nightlies/herbie/zane-regimes-2/src/core/regimes.rkt390
loop/home/nightlies/herbie/zane-regimes-2/src/core/regimes.rkt272
extract!/home/nightlies/herbie/zane-regimes-2/src/mainloop.rkt3650
run-improve!/home/nightlies/herbie/zane-regimes-2/src/mainloop.rkt3390
get-alternatives/report/home/nightlies/herbie/zane-regimes-2/src/sandbox.rkt1690
(unnamed)/home/nightlies/herbie/zane-regimes-2/src/sandbox.rkt2626
(unnamed)/usr/local/racket/share/pkgs/profile-lib/main.rkt4010
profile-thunk/usr/local/racket/share/pkgs/profile-lib/main.rkt90
(unnamed)/usr/local/racket/collects/racket/engine.rkt4224