Average Error: 0.4 → 0.4
Time: 4.9s
Precision: binary64
Cost: 13568
\[\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right)\]
\[3 \cdot \left(\sqrt{x} \cdot \left(-1 + y\right)\right) + 0.3333333333333333 \cdot {x}^{-0.5}\]
\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(y + \frac{1}{x \cdot 9}\right) - 1\right)
3 \cdot \left(\sqrt{x} \cdot \left(-1 + y\right)\right) + 0.3333333333333333 \cdot {x}^{-0.5}
(FPCore (x y)
 :precision binary64
 (* (* 3.0 (sqrt x)) (- (+ y (/ 1.0 (* x 9.0))) 1.0)))
(FPCore (x y)
 :precision binary64
 (+ (* 3.0 (* (sqrt x) (+ -1.0 y))) (* 0.3333333333333333 (pow x -0.5))))
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) {
	return (3.0 * (sqrt(x) * (-1.0 + y))) + (0.3333333333333333 * pow(x, -0.5));
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

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)\]

Alternatives

Alternative 1
Error0.4
Cost13504
\[3 \cdot \left(\sqrt{x} \cdot \left(-1 + y\right)\right) + \frac{0.3333333333333333}{\sqrt{x}}\]
Alternative 2
Error0.4
Cost7232
\[\left(3 \cdot \sqrt{x}\right) \cdot \left(-1 + \left(y + \frac{1}{x \cdot 9}\right)\right)\]
Alternative 3
Error0.4
Cost7104
\[\left(3 \cdot \sqrt{x}\right) \cdot \left(\left(-1 + y\right) + \frac{0.1111111111111111}{x}\right)\]
Alternative 4
Error11.0
Cost7618
\[\begin{array}{l} \mathbf{if}\;y \leq -2.3300122767632005 \cdot 10^{+33}:\\ \;\;\;\;y \cdot \left(3 \cdot \sqrt{x}\right)\\ \mathbf{elif}\;y \leq 1.8858905797142277 \cdot 10^{+113}:\\ \;\;\;\;\left(3 \cdot \sqrt{x}\right) \cdot \left(-1 + \frac{0.1111111111111111}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-1 + y\right) \cdot \left(3 \cdot \sqrt{x}\right)\\ \end{array}\]
Alternative 5
Error26.1
Cost6848
\[\left(-1 + y\right) \cdot \left(3 \cdot \sqrt{x}\right)\]
Alternative 6
Error42.2
Cost6720
\[y \cdot \left(3 \cdot \sqrt{x}\right)\]
Alternative 7
Error42.2
Cost6720
\[y \cdot \frac{\sqrt{x}}{0.3333333333333333}\]
Alternative 8
Error60.5
Cost385
\[\begin{array}{l} \mathbf{if}\;x \leq 0.10999074355716452:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array}\]
Alternative 9
Error61.5
Cost64
\[1\]

Error

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. Taylor expanded around 0 0.4

    \[\leadsto \color{blue}{\left(0.3333333333333333 \cdot \sqrt{\frac{1}{x}} + 3 \cdot \left(\sqrt{x} \cdot y\right)\right) - 3 \cdot \sqrt{x}}\]
  3. Simplified0.4

    \[\leadsto \color{blue}{0.3333333333333333 \cdot \sqrt{\frac{1}{x}} + 3 \cdot \left(\sqrt{x} \cdot \left(y + -1\right)\right)}\]
  4. Using strategy rm
  5. Applied inv-pow_binary64_138030.4

    \[\leadsto 0.3333333333333333 \cdot \sqrt{\color{blue}{{x}^{-1}}} + 3 \cdot \left(\sqrt{x} \cdot \left(y + -1\right)\right)\]
  6. Applied sqrt-pow1_binary64_137360.4

    \[\leadsto 0.3333333333333333 \cdot \color{blue}{{x}^{\left(\frac{-1}{2}\right)}} + 3 \cdot \left(\sqrt{x} \cdot \left(y + -1\right)\right)\]
  7. Simplified0.4

    \[\leadsto 0.3333333333333333 \cdot {x}^{\color{blue}{-0.5}} + 3 \cdot \left(\sqrt{x} \cdot \left(y + -1\right)\right)\]
  8. Simplified0.4

    \[\leadsto \color{blue}{3 \cdot \left(\sqrt{x} \cdot \left(-1 + y\right)\right) + 0.3333333333333333 \cdot {x}^{-0.5}}\]
  9. Final simplification0.4

    \[\leadsto 3 \cdot \left(\sqrt{x} \cdot \left(-1 + y\right)\right) + 0.3333333333333333 \cdot {x}^{-0.5}\]

Reproduce

herbie shell --seed 2021044 
(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)))