?

Average Error: 8.3% → 0.26%
Time: 10.0s
Precision: binary64
Cost: 704

?

\[\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3} \]
\[\frac{1 - x \cdot 0.3333333333333333}{\frac{y}{1 - x}} \]
(FPCore (x y) :precision binary64 (/ (* (- 1.0 x) (- 3.0 x)) (* y 3.0)))
(FPCore (x y)
 :precision binary64
 (/ (- 1.0 (* x 0.3333333333333333)) (/ y (- 1.0 x))))
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 * 0.3333333333333333)) / (y / (1.0 - x));
}
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 * 0.3333333333333333d0)) / (y / (1.0d0 - x))
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 * 0.3333333333333333)) / (y / (1.0 - x));
}
def code(x, y):
	return ((1.0 - x) * (3.0 - x)) / (y * 3.0)
def code(x, y):
	return (1.0 - (x * 0.3333333333333333)) / (y / (1.0 - x))
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 - Float64(x * 0.3333333333333333)) / Float64(y / Float64(1.0 - x)))
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 * 0.3333333333333333)) / (y / (1.0 - x));
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 - N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] / N[(y / N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3}
\frac{1 - x \cdot 0.3333333333333333}{\frac{y}{1 - x}}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original8.3%
Target0.2%
Herbie0.26%
\[\frac{1 - x}{y} \cdot \frac{3 - x}{3} \]

Derivation?

  1. Initial program 8.3

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

    \[\leadsto \color{blue}{\frac{1 - x}{y} \cdot \frac{3 - x}{3}} \]
    Proof

    [Start]8.3

    \[ \frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3} \]

    times-frac [=>]0.2

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

    \[\leadsto \color{blue}{\frac{1 - x \cdot 0.3333333333333333}{\frac{y}{1 - x}}} \]
  4. Final simplification0.26

    \[\leadsto \frac{1 - x \cdot 0.3333333333333333}{\frac{y}{1 - x}} \]

Alternatives

Alternative 1
Error1.69%
Cost841
\[\begin{array}{l} \mathbf{if}\;x \leq -1.72 \lor \neg \left(x \leq 1.7\right):\\ \;\;\;\;\frac{x}{y} \cdot \frac{x + -4}{3}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 + x \cdot -1.3333333333333333}{y}\\ \end{array} \]
Alternative 2
Error2.41%
Cost840
\[\begin{array}{l} \mathbf{if}\;x \leq -4.5:\\ \;\;\;\;\frac{x \cdot \left(-\frac{x}{y}\right)}{-3}\\ \mathbf{elif}\;x \leq 3:\\ \;\;\;\;\frac{1 + x \cdot -1.3333333333333333}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(1 - x\right) \cdot \left(\frac{x}{y} \cdot -0.3333333333333333\right)\\ \end{array} \]
Alternative 3
Error2.4%
Cost840
\[\begin{array}{l} \mathbf{if}\;x \leq -4.5:\\ \;\;\;\;\frac{x \cdot \left(-\frac{x}{y}\right)}{-3}\\ \mathbf{elif}\;x \leq 3:\\ \;\;\;\;\frac{1 + x \cdot -1.3333333333333333}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(1 - x\right) \cdot \frac{\frac{x}{-3}}{y}\\ \end{array} \]
Alternative 4
Error1.73%
Cost840
\[\begin{array}{l} \mathbf{if}\;x \leq -1.72:\\ \;\;\;\;\frac{x}{y} \cdot \frac{x + -4}{3}\\ \mathbf{elif}\;x \leq 1.7:\\ \;\;\;\;\frac{1 + x \cdot -1.3333333333333333}{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{x + -4}{y \cdot 3}\\ \end{array} \]
Alternative 5
Error2.41%
Cost777
\[\begin{array}{l} \mathbf{if}\;x \leq -4.5 \lor \neg \left(x \leq 3\right):\\ \;\;\;\;\frac{x \cdot \left(-\frac{x}{y}\right)}{-3}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 + x \cdot -1.3333333333333333}{y}\\ \end{array} \]
Alternative 6
Error3.32%
Cost713
\[\begin{array}{l} \mathbf{if}\;x \leq -1.72 \lor \neg \left(x \leq 5.2\right):\\ \;\;\;\;0.3333333333333333 \cdot \left(x \cdot \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y}\\ \end{array} \]
Alternative 7
Error3.31%
Cost712
\[\begin{array}{l} \mathbf{if}\;x \leq -1.72:\\ \;\;\;\;0.3333333333333333 \cdot \left(x \cdot \frac{x}{y}\right)\\ \mathbf{elif}\;x \leq 5.2:\\ \;\;\;\;\frac{1}{y}\\ \mathbf{else}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{x}{\frac{y}{x}}\\ \end{array} \]
Alternative 8
Error3.18%
Cost712
\[\begin{array}{l} \mathbf{if}\;x \leq -3.8:\\ \;\;\;\;0.3333333333333333 \cdot \left(x \cdot \frac{x}{y}\right)\\ \mathbf{elif}\;x \leq 3:\\ \;\;\;\;\frac{1 - x}{y}\\ \mathbf{else}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{x}{\frac{y}{x}}\\ \end{array} \]
Alternative 9
Error3.16%
Cost712
\[\begin{array}{l} \mathbf{if}\;x \leq -3.8:\\ \;\;\;\;\frac{x \cdot 0.3333333333333333}{\frac{y}{x}}\\ \mathbf{elif}\;x \leq 3:\\ \;\;\;\;\frac{1 - x}{y}\\ \mathbf{else}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{x}{\frac{y}{x}}\\ \end{array} \]
Alternative 10
Error2.45%
Cost712
\[\begin{array}{l} \mathbf{if}\;x \leq -4.5:\\ \;\;\;\;\frac{x \cdot 0.3333333333333333}{\frac{y}{x}}\\ \mathbf{elif}\;x \leq 3:\\ \;\;\;\;\frac{1 + x \cdot -1.3333333333333333}{y}\\ \mathbf{else}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{x}{\frac{y}{x}}\\ \end{array} \]
Alternative 11
Error0.67%
Cost704
\[\left(1 - x\right) \cdot \left(\left(3 - x\right) \cdot \frac{0.3333333333333333}{y}\right) \]
Alternative 12
Error0.2%
Cost704
\[\frac{1 - x}{y} \cdot \frac{3 - x}{3} \]
Alternative 13
Error32.59%
Cost192
\[\frac{1}{y} \]

Error

Reproduce?

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