Average Error: 3.9 → 1.9
Time: 10.5s
Precision: binary64
Cost: 960
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{\frac{t}{z}}{y}}{3} \]
(FPCore (x y z t)
 :precision binary64
 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
(FPCore (x y z t)
 :precision binary64
 (+ (- x (/ y (* z 3.0))) (/ (/ (/ t z) y) 3.0)))
double code(double x, double y, double z, double t) {
	return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
double code(double x, double y, double z, double t) {
	return (x - (y / (z * 3.0))) + (((t / z) / y) / 3.0);
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (x - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
end function
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (x - (y / (z * 3.0d0))) + (((t / z) / y) / 3.0d0)
end function
public static double code(double x, double y, double z, double t) {
	return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
public static double code(double x, double y, double z, double t) {
	return (x - (y / (z * 3.0))) + (((t / z) / y) / 3.0);
}
def code(x, y, z, t):
	return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))
def code(x, y, z, t):
	return (x - (y / (z * 3.0))) + (((t / z) / y) / 3.0)
function code(x, y, z, t)
	return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y)))
end
function code(x, y, z, t)
	return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(Float64(Float64(t / z) / y) / 3.0))
end
function tmp = code(x, y, z, t)
	tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
end
function tmp = code(x, y, z, t)
	tmp = (x - (y / (z * 3.0))) + (((t / z) / y) / 3.0);
end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t / z), $MachinePrecision] / y), $MachinePrecision] / 3.0), $MachinePrecision]), $MachinePrecision]
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{\frac{t}{z}}{y}}{3}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original3.9
Target1.9
Herbie1.9
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y} \]

Derivation

  1. Initial program 3.9

    \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
  2. Applied egg-rr3.9

    \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \color{blue}{\frac{1}{z} \cdot \frac{t}{3 \cdot y}} \]
  3. Applied egg-rr1.9

    \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \color{blue}{\frac{\frac{\frac{t}{z}}{y}}{3}} \]
  4. Final simplification1.9

    \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{\frac{t}{z}}{y}}{3} \]

Alternatives

Alternative 1
Error30.0
Cost1240
\[\begin{array}{l} t_1 := \frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\ \mathbf{if}\;y \leq -1.133510060261912 \cdot 10^{-14}:\\ \;\;\;\;\frac{y}{z \cdot -3}\\ \mathbf{elif}\;y \leq -7.5 \cdot 10^{-221}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 5.068563155566639 \cdot 10^{-114}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.6905720629930069 \cdot 10^{-105}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 3.4718100869869137 \cdot 10^{-51}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.501231466223372 \cdot 10^{+73}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z} \cdot \frac{y}{-3}\\ \end{array} \]
Alternative 2
Error28.6
Cost1112
\[\begin{array}{l} t_1 := \frac{t \cdot 0.3333333333333333}{y \cdot z}\\ \mathbf{if}\;x \leq -9.060860961590218 \cdot 10^{-65}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -4.1395957019441755 \cdot 10^{-293}:\\ \;\;\;\;\frac{y \cdot -0.3333333333333333}{z}\\ \mathbf{elif}\;x \leq -1.169941592466964 \cdot 10^{-305}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 3.1654662619889695 \cdot 10^{-237}:\\ \;\;\;\;-0.3333333333333333 \cdot \frac{y}{z}\\ \mathbf{elif}\;x \leq 1.972711498071981 \cdot 10^{-214}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 6.0052614560646486 \cdot 10^{+84}:\\ \;\;\;\;\frac{y}{z \cdot -3}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 3
Error8.7
Cost840
\[\begin{array}{l} \mathbf{if}\;y \leq -1.133510060261912 \cdot 10^{-14}:\\ \;\;\;\;x + \frac{-0.3333333333333333}{\frac{z}{y}}\\ \mathbf{elif}\;y \leq 4.946722261637669 \cdot 10^{-15}:\\ \;\;\;\;x + \frac{\frac{\frac{t}{y}}{z}}{3}\\ \mathbf{else}:\\ \;\;\;\;x + -0.3333333333333333 \cdot \frac{y}{z}\\ \end{array} \]
Alternative 4
Error5.7
Cost840
\[\begin{array}{l} \mathbf{if}\;y \leq -1.133510060261912 \cdot 10^{-14}:\\ \;\;\;\;x + \frac{-0.3333333333333333}{\frac{z}{y}}\\ \mathbf{elif}\;y \leq 4.946722261637669 \cdot 10^{-15}:\\ \;\;\;\;x + \frac{\frac{\frac{t}{z}}{y}}{3}\\ \mathbf{else}:\\ \;\;\;\;x + -0.3333333333333333 \cdot \frac{y}{z}\\ \end{array} \]
Alternative 5
Error15.8
Cost712
\[\begin{array}{l} t_1 := x + \frac{-0.3333333333333333}{\frac{z}{y}}\\ \mathbf{if}\;y \leq -7.5 \cdot 10^{-221}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 5.068563155566639 \cdot 10^{-114}:\\ \;\;\;\;\frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error15.8
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -7.5 \cdot 10^{-221}:\\ \;\;\;\;x + \frac{-0.3333333333333333}{\frac{z}{y}}\\ \mathbf{elif}\;y \leq 5.068563155566639 \cdot 10^{-114}:\\ \;\;\;\;\frac{t}{z} \cdot \frac{0.3333333333333333}{y}\\ \mathbf{else}:\\ \;\;\;\;x + -0.3333333333333333 \cdot \frac{y}{z}\\ \end{array} \]
Alternative 7
Error28.6
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -9.060860961590218 \cdot 10^{-65}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 6.0052614560646486 \cdot 10^{+84}:\\ \;\;\;\;\frac{y}{z \cdot -3}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 8
Error38.1
Cost64
\[x \]

Error

Reproduce

herbie shell --seed 2022308 
(FPCore (x y z t)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, H"
  :precision binary64

  :herbie-target
  (+ (- x (/ y (* z 3.0))) (/ (/ t (* z 3.0)) y))

  (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))