Average Error: 3.5 → 1.0
Time: 3.6s
Precision: 64
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
\[\begin{array}{l} \mathbf{if}\;z \cdot 3 \le -1.5357642338074745 \cdot 10^{112}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{{\left(3 \cdot \left(z \cdot y\right)\right)}^{1}}\\ \mathbf{elif}\;z \cdot 3 \le 1.3948728084198543 \cdot 10^{77}:\\ \;\;\;\;\left(x - \frac{1}{z} \cdot \frac{y}{3}\right) + \frac{1}{z} \cdot \frac{\frac{t}{3}}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{\frac{y}{z}}{3}\right) + \frac{0.333333333333333315 \cdot \frac{t}{z}}{y}\\ \end{array}\]
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\begin{array}{l}
\mathbf{if}\;z \cdot 3 \le -1.5357642338074745 \cdot 10^{112}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{{\left(3 \cdot \left(z \cdot y\right)\right)}^{1}}\\

\mathbf{elif}\;z \cdot 3 \le 1.3948728084198543 \cdot 10^{77}:\\
\;\;\;\;\left(x - \frac{1}{z} \cdot \frac{y}{3}\right) + \frac{1}{z} \cdot \frac{\frac{t}{3}}{y}\\

\mathbf{else}:\\
\;\;\;\;\left(x - \frac{\frac{y}{z}}{3}\right) + \frac{0.333333333333333315 \cdot \frac{t}{z}}{y}\\

\end{array}
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 temp;
	if (((z * 3.0) <= -1.5357642338074745e+112)) {
		temp = ((x - (y / (z * 3.0))) + (t / pow((3.0 * (z * y)), 1.0)));
	} else {
		double temp_1;
		if (((z * 3.0) <= 1.3948728084198543e+77)) {
			temp_1 = ((x - ((1.0 / z) * (y / 3.0))) + ((1.0 / z) * ((t / 3.0) / y)));
		} else {
			temp_1 = ((x - ((y / z) / 3.0)) + ((0.3333333333333333 * (t / z)) / y));
		}
		temp = temp_1;
	}
	return temp;
}

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.5
Target1.6
Herbie1.0
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}\]

Derivation

  1. Split input into 3 regimes
  2. if (* z 3.0) < -1.5357642338074745e+112

    1. Initial program 0.8

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
    2. Using strategy rm
    3. Applied pow10.8

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

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

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(\color{blue}{{z}^{1}} \cdot {3}^{1}\right) \cdot {y}^{1}}\]
    6. Applied pow-prod-down0.8

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\color{blue}{{\left(z \cdot 3\right)}^{1}} \cdot {y}^{1}}\]
    7. Applied pow-prod-down0.8

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

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

    if -1.5357642338074745e+112 < (* z 3.0) < 1.3948728084198543e+77

    1. Initial program 6.1

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
    2. Using strategy rm
    3. Applied associate-/r*1.9

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \color{blue}{\frac{\frac{t}{z \cdot 3}}{y}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity1.9

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

      \[\leadsto \left(x - \color{blue}{\frac{1}{z} \cdot \frac{y}{3}}\right) + \frac{\frac{t}{z \cdot 3}}{y}\]
    7. Using strategy rm
    8. Applied *-un-lft-identity1.9

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

      \[\leadsto \left(x - \frac{1}{z} \cdot \frac{y}{3}\right) + \frac{\frac{\color{blue}{1 \cdot t}}{z \cdot 3}}{1 \cdot y}\]
    10. Applied times-frac2.0

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

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

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

    if 1.3948728084198543e+77 < (* z 3.0)

    1. Initial program 0.6

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
    2. Using strategy rm
    3. Applied associate-/r*1.1

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \color{blue}{\frac{\frac{t}{z \cdot 3}}{y}}\]
    4. Using strategy rm
    5. Applied associate-/r*1.1

      \[\leadsto \left(x - \color{blue}{\frac{\frac{y}{z}}{3}}\right) + \frac{\frac{t}{z \cdot 3}}{y}\]
    6. Taylor expanded around 0 1.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot 3 \le -1.5357642338074745 \cdot 10^{112}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{{\left(3 \cdot \left(z \cdot y\right)\right)}^{1}}\\ \mathbf{elif}\;z \cdot 3 \le 1.3948728084198543 \cdot 10^{77}:\\ \;\;\;\;\left(x - \frac{1}{z} \cdot \frac{y}{3}\right) + \frac{1}{z} \cdot \frac{\frac{t}{3}}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{\frac{y}{z}}{3}\right) + \frac{0.333333333333333315 \cdot \frac{t}{z}}{y}\\ \end{array}\]

Reproduce

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

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

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