Average Error: 3.7 → 0.9
Time: 7.7s
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 - {\left(3 \cdot \frac{z}{y}\right)}^{-1}\\ \mathbf{if}\;z \cdot 3 \leq -1.3444085709928015 \cdot 10^{-66}:\\ \;\;\;\;\left(x - \frac{0.3333333333333333}{\frac{z}{y}}\right) + \frac{t}{z \cdot 3} \cdot \frac{1}{y}\\ \mathbf{elif}\;z \cdot 3 \leq 9.590884663341987 \cdot 10^{+90}:\\ \;\;\;\;t_1 + \frac{\frac{\frac{t}{y}}{z}}{3}\\ \mathbf{else}:\\ \;\;\;\;t_1 + \frac{t}{\left(z \cdot 3\right) \cdot y}\\ \end{array} \]
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\begin{array}{l}
t_1 := x - {\left(3 \cdot \frac{z}{y}\right)}^{-1}\\
\mathbf{if}\;z \cdot 3 \leq -1.3444085709928015 \cdot 10^{-66}:\\
\;\;\;\;\left(x - \frac{0.3333333333333333}{\frac{z}{y}}\right) + \frac{t}{z \cdot 3} \cdot \frac{1}{y}\\

\mathbf{elif}\;z \cdot 3 \leq 9.590884663341987 \cdot 10^{+90}:\\
\;\;\;\;t_1 + \frac{\frac{\frac{t}{y}}{z}}{3}\\

\mathbf{else}:\\
\;\;\;\;t_1 + \frac{t}{\left(z \cdot 3\right) \cdot 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 (pow (* 3.0 (/ z y)) -1.0))))
   (if (<= (* z 3.0) -1.3444085709928015e-66)
     (+ (- x (/ 0.3333333333333333 (/ z y))) (* (/ t (* z 3.0)) (/ 1.0 y)))
     (if (<= (* z 3.0) 9.590884663341987e+90)
       (+ t_1 (/ (/ (/ t y) z) 3.0))
       (+ t_1 (/ t (* (* z 3.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 - pow((3.0 * (z / y)), -1.0);
	double tmp;
	if ((z * 3.0) <= -1.3444085709928015e-66) {
		tmp = (x - (0.3333333333333333 / (z / y))) + ((t / (z * 3.0)) * (1.0 / y));
	} else if ((z * 3.0) <= 9.590884663341987e+90) {
		tmp = t_1 + (((t / y) / z) / 3.0);
	} else {
		tmp = t_1 + (t / ((z * 3.0) * y));
	}
	return tmp;
}

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.7
Target1.8
Herbie0.9
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y} \]

Derivation

  1. Split input into 3 regimes
  2. if (*.f64 z 3) < -1.3444085709928015e-66

    1. Initial program 0.7

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

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

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

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

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

    if -1.3444085709928015e-66 < (*.f64 z 3) < 9.59088466334198744e90

    1. Initial program 9.0

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

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

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

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

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

    if 9.59088466334198744e90 < (*.f64 z 3)

    1. Initial program 0.4

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

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

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

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

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

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

Reproduce

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