Average Error: 3.7 → 1.9
Time: 3.6s
Precision: binary64
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
\[\begin{array}{l} \mathbf{if}\;x \le 1.94081360655672242 \cdot 10^{-258} \lor \neg \left(x \le 6.24118608736230798 \cdot 10^{-59}\right):\\ \;\;\;\;\left(x - \frac{\frac{y}{3}}{z}\right) + \frac{\frac{t}{z \cdot 3}}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot \left(3 \cdot y\right)}\\ \end{array}\]
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\begin{array}{l}
\mathbf{if}\;x \le 1.94081360655672242 \cdot 10^{-258} \lor \neg \left(x \le 6.24118608736230798 \cdot 10^{-59}\right):\\
\;\;\;\;\left(x - \frac{\frac{y}{3}}{z}\right) + \frac{\frac{t}{z \cdot 3}}{y}\\

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

\end{array}
double code(double x, double y, double z, double t) {
	return ((double) (((double) (x - ((double) (y / ((double) (z * 3.0)))))) + ((double) (t / ((double) (((double) (z * 3.0)) * y))))));
}
double code(double x, double y, double z, double t) {
	double VAR;
	if (((x <= 1.9408136065567224e-258) || !(x <= 6.241186087362308e-59))) {
		VAR = ((double) (((double) (x - ((double) (((double) (y / 3.0)) / z)))) + ((double) (((double) (t / ((double) (z * 3.0)))) / y))));
	} else {
		VAR = ((double) (((double) (x - ((double) (y / ((double) (z * 3.0)))))) + ((double) (t / ((double) (z * ((double) (3.0 * y))))))));
	}
	return VAR;
}

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

Derivation

  1. Split input into 2 regimes
  2. if x < 1.94081360655672242e-258 or 6.24118608736230798e-59 < x

    1. Initial program 3.7

      \[\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.5

      \[\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.5

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

      \[\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 associate-*l/1.5

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

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

    if 1.94081360655672242e-258 < x < 6.24118608736230798e-59

    1. Initial program 3.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le 1.94081360655672242 \cdot 10^{-258} \lor \neg \left(x \le 6.24118608736230798 \cdot 10^{-59}\right):\\ \;\;\;\;\left(x - \frac{\frac{y}{3}}{z}\right) + \frac{\frac{t}{z \cdot 3}}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot \left(3 \cdot y\right)}\\ \end{array}\]

Reproduce

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