Average Error: 3.6 → 2.5
Time: 4.3s
Precision: 64
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
\[\begin{array}{l} \mathbf{if}\;x \le -7.9826398313164716 \cdot 10^{-55} \lor \neg \left(x \le 2.32423509502939807 \cdot 10^{98}\right):\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{\frac{y}{z}}{3}\right) + \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}
\mathbf{if}\;x \le -7.9826398313164716 \cdot 10^{-55} \lor \neg \left(x \le 2.32423509502939807 \cdot 10^{98}\right):\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}\\

\mathbf{else}:\\
\;\;\;\;\left(x - \frac{\frac{y}{z}}{3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot 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 VAR;
	if (((x <= -7.982639831316472e-55) || !(x <= 2.324235095029398e+98))) {
		VAR = ((x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y));
	} else {
		VAR = ((x - ((y / z) / 3.0)) + (t / ((z * 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.6
Target1.7
Herbie2.5
\[\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 < -7.982639831316472e-55 or 2.324235095029398e+98 < x

    1. Initial program 3.2

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

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

    if -7.982639831316472e-55 < x < 2.324235095029398e+98

    1. Initial program 3.8

      \[\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*3.8

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

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

Reproduce

herbie shell --seed 2020102 +o rules:numerics
(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))))