Average Error: 3.8 → 1.4
Time: 5.1s
Precision: binary64
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
\[\begin{array}{l} t_1 := x - \frac{y}{z \cdot 3}\\ \mathbf{if}\;t \leq -5.3 \cdot 10^{+76}:\\ \;\;\;\;t_1 + \frac{t \cdot 0.3333333333333333}{y \cdot z}\\ \mathbf{else}:\\ \;\;\;\;t_1 + \frac{t}{z \cdot 3} \cdot \frac{1}{y}\\ \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- x (/ y (* z 3.0)))))
   (if (<= t -5.3e+76)
     (+ t_1 (/ (* t 0.3333333333333333) (* y z)))
     (+ t_1 (* (/ t (* z 3.0)) (/ 1.0 y))))))
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) {
	double t_1 = x - (y / (z * 3.0));
	double tmp;
	if (t <= -5.3e+76) {
		tmp = t_1 + ((t * 0.3333333333333333) / (y * z));
	} else {
		tmp = t_1 + ((t / (z * 3.0)) * (1.0 / y));
	}
	return tmp;
}
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
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x - (y / (z * 3.0d0))
    if (t <= (-5.3d+76)) then
        tmp = t_1 + ((t * 0.3333333333333333d0) / (y * z))
    else
        tmp = t_1 + ((t / (z * 3.0d0)) * (1.0d0 / y))
    end if
    code = tmp
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) {
	double t_1 = x - (y / (z * 3.0));
	double tmp;
	if (t <= -5.3e+76) {
		tmp = t_1 + ((t * 0.3333333333333333) / (y * z));
	} else {
		tmp = t_1 + ((t / (z * 3.0)) * (1.0 / y));
	}
	return tmp;
}
def code(x, y, z, t):
	return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))
def code(x, y, z, t):
	t_1 = x - (y / (z * 3.0))
	tmp = 0
	if t <= -5.3e+76:
		tmp = t_1 + ((t * 0.3333333333333333) / (y * z))
	else:
		tmp = t_1 + ((t / (z * 3.0)) * (1.0 / y))
	return tmp
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)
	t_1 = Float64(x - Float64(y / Float64(z * 3.0)))
	tmp = 0.0
	if (t <= -5.3e+76)
		tmp = Float64(t_1 + Float64(Float64(t * 0.3333333333333333) / Float64(y * z)));
	else
		tmp = Float64(t_1 + Float64(Float64(t / Float64(z * 3.0)) * Float64(1.0 / y)));
	end
	return tmp
end
function tmp = code(x, y, z, t)
	tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
end
function tmp_2 = code(x, y, z, t)
	t_1 = x - (y / (z * 3.0));
	tmp = 0.0;
	if (t <= -5.3e+76)
		tmp = t_1 + ((t * 0.3333333333333333) / (y * z));
	else
		tmp = t_1 + ((t / (z * 3.0)) * (1.0 / y));
	end
	tmp_2 = tmp;
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_] := Block[{t$95$1 = N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -5.3e+76], N[(t$95$1 + N[(N[(t * 0.3333333333333333), $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(t / N[(z * 3.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\begin{array}{l}
t_1 := x - \frac{y}{z \cdot 3}\\
\mathbf{if}\;t \leq -5.3 \cdot 10^{+76}:\\
\;\;\;\;t_1 + \frac{t \cdot 0.3333333333333333}{y \cdot z}\\

\mathbf{else}:\\
\;\;\;\;t_1 + \frac{t}{z \cdot 3} \cdot \frac{1}{y}\\


\end{array}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Split input into 2 regimes
  2. if t < -5.30000000000000015e76

    1. Initial program 1.0

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

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

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

    if -5.30000000000000015e76 < t

    1. Initial program 4.3

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

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

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \color{blue}{\frac{t}{z \cdot 3}} \cdot \frac{1}{y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -5.3 \cdot 10^{+76}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t \cdot 0.3333333333333333}{y \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot 3} \cdot \frac{1}{y}\\ \end{array} \]

Reproduce

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