Average Error: 5.8 → 0.1
Time: 2.4s
Precision: binary64
\[\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3} \]
\[\frac{x + -1}{y \cdot \frac{-3}{3 - x}} \]
(FPCore (x y) :precision binary64 (/ (* (- 1.0 x) (- 3.0 x)) (* y 3.0)))
(FPCore (x y) :precision binary64 (/ (+ x -1.0) (* y (/ -3.0 (- 3.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 (x + -1.0) / (y * (-3.0 / (3.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 = (x + (-1.0d0)) / (y * ((-3.0d0) / (3.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 (x + -1.0) / (y * (-3.0 / (3.0 - x)));
}
def code(x, y):
	return ((1.0 - x) * (3.0 - x)) / (y * 3.0)
def code(x, y):
	return (x + -1.0) / (y * (-3.0 / (3.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(x + -1.0) / Float64(y * Float64(-3.0 / Float64(3.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 = (x + -1.0) / (y * (-3.0 / (3.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[(x + -1.0), $MachinePrecision] / N[(y * N[(-3.0 / N[(3.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3}
\frac{x + -1}{y \cdot \frac{-3}{3 - x}}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original5.8
Target0.1
Herbie0.1
\[\frac{1 - x}{y} \cdot \frac{3 - x}{3} \]

Derivation

  1. Initial program 5.8

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

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

    \[\leadsto \left(1 - x\right) \cdot \color{blue}{\frac{1}{\frac{y}{0.3333333333333333 \cdot \left(3 - x\right)}}} \]
  4. Applied egg-rr0.1

    \[\leadsto \color{blue}{\frac{-\left(1 - x\right)}{y \cdot \left(-\frac{3}{3 - x}\right)}} \]
  5. Final simplification0.1

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

Reproduce

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