?

Average Error: 0.4 → 0.4
Time: 1.7min
Precision: binary64
Cost: 20032

?

\[\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right) \]
\[\begin{array}{l} t_0 := 3 \cdot \sqrt{x}\\ \mathsf{fma}\left(\frac{0.1111111111111111 - x}{x}, t_0, y \cdot t_0\right) \end{array} \]
(FPCore (x y)
 :precision binary64
 (* (* 3.0 (sqrt x)) (- (+ y (/ 1.0 (* x 9.0))) 1.0)))
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* 3.0 (sqrt x))))
   (fma (/ (- 0.1111111111111111 x) x) t_0 (* y t_0))))
double code(double x, double y) {
	return (3.0 * sqrt(x)) * ((y + (1.0 / (x * 9.0))) - 1.0);
}
double code(double x, double y) {
	double t_0 = 3.0 * sqrt(x);
	return fma(((0.1111111111111111 - x) / x), t_0, (y * t_0));
}
function code(x, y)
	return Float64(Float64(3.0 * sqrt(x)) * Float64(Float64(y + Float64(1.0 / Float64(x * 9.0))) - 1.0))
end
function code(x, y)
	t_0 = Float64(3.0 * sqrt(x))
	return fma(Float64(Float64(0.1111111111111111 - x) / x), t_0, Float64(y * t_0))
end
code[x_, y_] := N[(N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * N[(N[(y + N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := Block[{t$95$0 = N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(0.1111111111111111 - x), $MachinePrecision] / x), $MachinePrecision] * t$95$0 + N[(y * t$95$0), $MachinePrecision]), $MachinePrecision]]
\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right)
\begin{array}{l}
t_0 := 3 \cdot \sqrt{x}\\
\mathsf{fma}\left(\frac{0.1111111111111111 - x}{x}, t_0, y \cdot t_0\right)
\end{array}

Error?

Target

Original0.4
Target0.4
Herbie0.4
\[3 \cdot \left(y \cdot \sqrt{x} + \left(\frac{1}{x \cdot 9} - 1\right) \cdot \sqrt{x}\right) \]

Derivation?

  1. Initial program 0.4

    \[\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right) \]
  2. Simplified0.4

    \[\leadsto \color{blue}{3 \cdot \left(\sqrt{x} \cdot \left(y + \frac{0.1111111111111111 - x}{x}\right)\right)} \]
    Proof
  3. Applied egg-rr0.4

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{0.1111111111111111 - x}{x}, 3 \cdot \sqrt{x}, y \cdot \left(3 \cdot \sqrt{x}\right)\right)} \]

Alternatives

Alternative 1
Error0.4
Cost19904
\[3 \cdot \mathsf{fma}\left(\frac{0.1111111111111111 - x}{x}, \sqrt{x}, y \cdot \sqrt{x}\right) \]
Alternative 2
Error21.8
Cost7248
\[\begin{array}{l} t_0 := \sqrt{x} \cdot -3\\ t_1 := 3 \cdot \left(\sqrt{x} \cdot y\right)\\ \mathbf{if}\;x \leq 3.3 \cdot 10^{-50}:\\ \;\;\;\;\sqrt{x} \cdot \frac{0.3333333333333333}{x}\\ \mathbf{elif}\;x \leq 6.2 \cdot 10^{+23}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.48 \cdot 10^{+51}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 1.55 \cdot 10^{+69}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error1.3
Cost7240
\[\begin{array}{l} t_0 := 3 \cdot \left(\sqrt{x} \cdot \left(y + \frac{0.1111111111111111}{x}\right)\right)\\ \mathbf{if}\;y \leq -1.1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{-11}:\\ \;\;\;\;\sqrt{x} \cdot \left(\frac{0.3333333333333333}{x} + -3\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error1.3
Cost7240
\[\begin{array}{l} t_0 := 3 \cdot \left(\sqrt{x} \cdot \left(y + \frac{0.1111111111111111}{x}\right)\right)\\ \mathbf{if}\;y \leq -1:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{-11}:\\ \;\;\;\;\sqrt{x} \cdot \frac{\frac{0.1111111111111111 - x}{x}}{0.3333333333333333}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error1.3
Cost7240
\[\begin{array}{l} t_0 := y + \frac{0.1111111111111111}{x}\\ \mathbf{if}\;y \leq -0.95:\\ \;\;\;\;t_0 \cdot \left(3 \cdot \sqrt{x}\right)\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{-11}:\\ \;\;\;\;\sqrt{x} \cdot \frac{\frac{0.1111111111111111 - x}{x}}{0.3333333333333333}\\ \mathbf{else}:\\ \;\;\;\;3 \cdot \left(\sqrt{x} \cdot t_0\right)\\ \end{array} \]
Alternative 6
Error0.4
Cost7232
\[\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right) \]
Alternative 7
Error9.1
Cost7112
\[\begin{array}{l} \mathbf{if}\;y \leq -8 \cdot 10^{+26}:\\ \;\;\;\;y \cdot \left(3 \cdot \sqrt{x}\right)\\ \mathbf{elif}\;y \leq 3.4:\\ \;\;\;\;\sqrt{x} \cdot \left(\frac{0.3333333333333333}{x} + -3\right)\\ \mathbf{else}:\\ \;\;\;\;3 \cdot \left(\sqrt{x} \cdot \left(y - 1\right)\right)\\ \end{array} \]
Alternative 8
Error0.4
Cost7104
\[3 \cdot \left(\sqrt{x} \cdot \left(y + \frac{0.1111111111111111 - x}{x}\right)\right) \]
Alternative 9
Error0.4
Cost7104
\[\left(\frac{0.3333333333333333}{x} + \left(-1 + y\right) \cdot 3\right) \cdot \sqrt{x} \]
Alternative 10
Error26.7
Cost6984
\[\begin{array}{l} t_0 := 3 \cdot \left(\sqrt{x} \cdot y\right)\\ \mathbf{if}\;y \leq -0.0084:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{-11}:\\ \;\;\;\;\sqrt{x} \cdot -3\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 11
Error26.7
Cost6984
\[\begin{array}{l} \mathbf{if}\;y \leq -0.0084:\\ \;\;\;\;y \cdot \left(3 \cdot \sqrt{x}\right)\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{-11}:\\ \;\;\;\;\sqrt{x} \cdot -3\\ \mathbf{else}:\\ \;\;\;\;3 \cdot \left(\sqrt{x} \cdot y\right)\\ \end{array} \]
Alternative 12
Error9.7
Cost6980
\[\begin{array}{l} \mathbf{if}\;x \leq 3.5 \cdot 10^{-50}:\\ \;\;\;\;\sqrt{x} \cdot \frac{0.3333333333333333}{x}\\ \mathbf{else}:\\ \;\;\;\;3 \cdot \left(\sqrt{x} \cdot \left(y - 1\right)\right)\\ \end{array} \]
Alternative 13
Error46.3
Cost6592
\[\sqrt{x} \cdot -3 \]

Error

Reproduce?

herbie shell --seed 2023033 
(FPCore (x y)
  :name "Numeric.SpecFunctions:incompleteGamma from math-functions-0.1.5.2, B"
  :precision binary64

  :herbie-target
  (* 3.0 (+ (* y (sqrt x)) (* (- (/ 1.0 (* x 9.0)) 1.0) (sqrt x))))

  (* (* 3.0 (sqrt x)) (- (+ y (/ 1.0 (* x 9.0))) 1.0)))