Average Error: 6.0 → 0.2
Time: 7.4s
Precision: binary64
Cost: 704
\[\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3} \]
\[\frac{1 - x}{\frac{3}{\frac{3 - x}{y}}} \]
(FPCore (x y) :precision binary64 (/ (* (- 1.0 x) (- 3.0 x)) (* y 3.0)))
(FPCore (x y) :precision binary64 (/ (- 1.0 x) (/ 3.0 (/ (- 3.0 x) y))))
double code(double x, double y) {
	return ((1.0 - x) * (3.0 - x)) / (y * 3.0);
}
double code(double x, double y) {
	return (1.0 - x) / (3.0 / ((3.0 - x) / y));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = ((1.0d0 - x) * (3.0d0 - x)) / (y * 3.0d0)
end function
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (1.0d0 - x) / (3.0d0 / ((3.0d0 - x) / y))
end function
public static double code(double x, double y) {
	return ((1.0 - x) * (3.0 - x)) / (y * 3.0);
}
public static double code(double x, double y) {
	return (1.0 - x) / (3.0 / ((3.0 - x) / y));
}
def code(x, y):
	return ((1.0 - x) * (3.0 - x)) / (y * 3.0)
def code(x, y):
	return (1.0 - x) / (3.0 / ((3.0 - x) / y))
function code(x, y)
	return Float64(Float64(Float64(1.0 - x) * Float64(3.0 - x)) / Float64(y * 3.0))
end
function code(x, y)
	return Float64(Float64(1.0 - x) / Float64(3.0 / Float64(Float64(3.0 - x) / y)))
end
function tmp = code(x, y)
	tmp = ((1.0 - x) * (3.0 - x)) / (y * 3.0);
end
function tmp = code(x, y)
	tmp = (1.0 - x) / (3.0 / ((3.0 - x) / y));
end
code[x_, y_] := N[(N[(N[(1.0 - x), $MachinePrecision] * N[(3.0 - x), $MachinePrecision]), $MachinePrecision] / N[(y * 3.0), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := N[(N[(1.0 - x), $MachinePrecision] / N[(3.0 / N[(N[(3.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3}
\frac{1 - x}{\frac{3}{\frac{3 - x}{y}}}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.0
Target0.1
Herbie0.2
\[\frac{1 - x}{y} \cdot \frac{3 - x}{3} \]

Derivation

  1. Initial program 6.0

    \[\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3} \]
  2. Applied egg-rr0.2

    \[\leadsto \color{blue}{\frac{1}{3 \cdot \frac{y}{3 - x}} - \frac{x}{3 \cdot \frac{y}{3 - x}}} \]
  3. Applied egg-rr0.2

    \[\leadsto \color{blue}{\frac{1 - x}{\frac{3}{\frac{3 - x}{y}}}} \]
  4. Final simplification0.2

    \[\leadsto \frac{1 - x}{\frac{3}{\frac{3 - x}{y}}} \]

Alternatives

Alternative 1
Error1.6
Cost840
\[\begin{array}{l} t_0 := 0.3333333333333333 \cdot \left(\frac{x}{y} \cdot \left(x + -4\right)\right)\\ \mathbf{if}\;x \leq -2779.5202706725067:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 0.052238416830708456:\\ \;\;\;\;\frac{1 - x}{y}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error1.6
Cost840
\[\begin{array}{l} \mathbf{if}\;x \leq -2779.5202706725067:\\ \;\;\;\;\frac{x}{y} \cdot \left(-1.3333333333333333 + x \cdot 0.3333333333333333\right)\\ \mathbf{elif}\;x \leq 0.052238416830708456:\\ \;\;\;\;\frac{1 - x}{y}\\ \mathbf{else}:\\ \;\;\;\;0.3333333333333333 \cdot \left(\frac{x}{y} \cdot \left(x + -4\right)\right)\\ \end{array} \]
Alternative 3
Error1.2
Cost840
\[\begin{array}{l} \mathbf{if}\;x \leq -2779.5202706725067:\\ \;\;\;\;\frac{x}{y} \cdot \left(-1.3333333333333333 + x \cdot 0.3333333333333333\right)\\ \mathbf{elif}\;x \leq 0.052238416830708456:\\ \;\;\;\;\frac{1}{y} + \frac{x}{y} \cdot -1.3333333333333333\\ \mathbf{else}:\\ \;\;\;\;0.3333333333333333 \cdot \left(\frac{x}{y} \cdot \left(x + -4\right)\right)\\ \end{array} \]
Alternative 4
Error2.0
Cost712
\[\begin{array}{l} t_0 := \frac{x}{\frac{3 \cdot y}{x}}\\ \mathbf{if}\;x \leq -2779.5202706725067:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 0.052238416830708456:\\ \;\;\;\;\frac{1 - x}{y}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error2.0
Cost712
\[\begin{array}{l} \mathbf{if}\;x \leq -2779.5202706725067:\\ \;\;\;\;\frac{x}{\frac{3 \cdot y}{x}}\\ \mathbf{elif}\;x \leq 0.052238416830708456:\\ \;\;\;\;\frac{1 - x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot 0.3333333333333333}{\frac{y}{x}}\\ \end{array} \]
Alternative 6
Error2.0
Cost712
\[\begin{array}{l} t_0 := \frac{x}{\frac{3}{\frac{x}{y}}}\\ \mathbf{if}\;x \leq -2779.5202706725067:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 0.052238416830708456:\\ \;\;\;\;\frac{1 - x}{y}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error2.0
Cost712
\[\begin{array}{l} \mathbf{if}\;x \leq -2779.5202706725067:\\ \;\;\;\;\frac{x}{\frac{3}{\frac{x}{y}}}\\ \mathbf{elif}\;x \leq 0.052238416830708456:\\ \;\;\;\;\frac{1 - x}{y}\\ \mathbf{else}:\\ \;\;\;\;0.3333333333333333 \cdot \left(x \cdot \frac{x}{y}\right)\\ \end{array} \]
Alternative 8
Error2.0
Cost712
\[\begin{array}{l} \mathbf{if}\;x \leq -2779.5202706725067:\\ \;\;\;\;\frac{x}{\frac{3}{\frac{x}{y}}}\\ \mathbf{elif}\;x \leq 0.052238416830708456:\\ \;\;\;\;\frac{1 - x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{3 \cdot \frac{y}{x}}\\ \end{array} \]
Alternative 9
Error21.6
Cost192
\[\frac{1}{y} \]

Error

Reproduce

herbie shell --seed 2022217 
(FPCore (x y)
  :name "Diagrams.TwoD.Arc:bezierFromSweepQ1 from diagrams-lib-1.3.0.3"
  :precision binary64

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

  (/ (* (- 1.0 x) (- 3.0 x)) (* y 3.0)))