Average Error: 14.6 → 1.6
Time: 3.8s
Precision: binary64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\frac{y}{z} \cdot t}{t} \leq -3.563046468116238 \cdot 10^{+267}:\\ \;\;\;\;\frac{y \cdot x}{z}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \leq -1.1287556868815893 \cdot 10^{-194}:\\ \;\;\;\;\frac{\frac{y}{z} \cdot t}{t} \cdot x\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \leq 1.4821969375237 \cdot 10^{-323}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \leq 9.664313956054862 \cdot 10^{+112}:\\ \;\;\;\;\frac{\frac{y}{z} \cdot t}{t} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot x\right) \cdot \frac{1}{z}\\ \end{array}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
\mathbf{if}\;\frac{\frac{y}{z} \cdot t}{t} \leq -3.563046468116238 \cdot 10^{+267}:\\
\;\;\;\;\frac{y \cdot x}{z}\\

\mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \leq -1.1287556868815893 \cdot 10^{-194}:\\
\;\;\;\;\frac{\frac{y}{z} \cdot t}{t} \cdot x\\

\mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \leq 1.4821969375237 \cdot 10^{-323}:\\
\;\;\;\;y \cdot \frac{x}{z}\\

\mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \leq 9.664313956054862 \cdot 10^{+112}:\\
\;\;\;\;\frac{\frac{y}{z} \cdot t}{t} \cdot x\\

\mathbf{else}:\\
\;\;\;\;\left(y \cdot x\right) \cdot \frac{1}{z}\\

\end{array}
double code(double x, double y, double z, double t) {
	return ((double) (x * (((double) ((y / z) * t)) / t)));
}
double code(double x, double y, double z, double t) {
	double VAR;
	if (((((double) ((y / z) * t)) / t) <= -3.563046468116238e+267)) {
		VAR = (((double) (y * x)) / z);
	} else {
		double VAR_1;
		if (((((double) ((y / z) * t)) / t) <= -1.1287556868815893e-194)) {
			VAR_1 = ((double) ((((double) ((y / z) * t)) / t) * x));
		} else {
			double VAR_2;
			if (((((double) ((y / z) * t)) / t) <= 1.4821969375237e-323)) {
				VAR_2 = ((double) (y * (x / z)));
			} else {
				double VAR_3;
				if (((((double) ((y / z) * t)) / t) <= 9.664313956054862e+112)) {
					VAR_3 = ((double) ((((double) ((y / z) * t)) / t) * x));
				} else {
					VAR_3 = ((double) (((double) (y * x)) * (1.0 / z)));
				}
				VAR_2 = VAR_3;
			}
			VAR_1 = VAR_2;
		}
		VAR = VAR_1;
	}
	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

Original14.6
Target1.6
Herbie1.6
\[\begin{array}{l} \mathbf{if}\;\frac{\frac{y}{z} \cdot t}{t} < -1.20672205123045 \cdot 10^{+245}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} < -5.907522236933906 \cdot 10^{-275}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} < 5.658954423153415 \cdot 10^{-65}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} < 2.0087180502407133 \cdot 10^{+217}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot x}{z}\\ \end{array}\]

Derivation

  1. Split input into 4 regimes
  2. if (/ (* (/ y z) t) t) < -3.5630464681162382e267

    1. Initial program 58.2

      \[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
    2. Simplified25.1

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}}\]
    3. Using strategy rm
    4. Applied associate-*r/3.4

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}}\]

    if -3.5630464681162382e267 < (/ (* (/ y z) t) t) < -1.1287556868815893e-194 or 1.4822e-323 < (/ (* (/ y z) t) t) < 9.66431395605486189e112

    1. Initial program 0.8

      \[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]

    if -1.1287556868815893e-194 < (/ (* (/ y z) t) t) < 1.4822e-323

    1. Initial program 23.5

      \[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
    2. Simplified9.5

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt9.8

      \[\leadsto \color{blue}{\left(\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}\right)} \cdot \frac{y}{z}\]
    5. Applied associate-*l*9.8

      \[\leadsto \color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \frac{y}{z}\right)}\]
    6. Simplified5.8

      \[\leadsto \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \color{blue}{\left(y \cdot \frac{\sqrt[3]{x}}{z}\right)}\]
    7. Taylor expanded around 0 1.6

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}}\]
    8. Simplified1.6

      \[\leadsto \color{blue}{y \cdot \frac{x}{z}}\]

    if 9.66431395605486189e112 < (/ (* (/ y z) t) t)

    1. Initial program 32.2

      \[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
    2. Simplified13.3

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}}\]
    3. Using strategy rm
    4. Applied div-inv13.4

      \[\leadsto x \cdot \color{blue}{\left(y \cdot \frac{1}{z}\right)}\]
    5. Applied associate-*r*3.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\frac{y}{z} \cdot t}{t} \leq -3.563046468116238 \cdot 10^{+267}:\\ \;\;\;\;\frac{y \cdot x}{z}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \leq -1.1287556868815893 \cdot 10^{-194}:\\ \;\;\;\;\frac{\frac{y}{z} \cdot t}{t} \cdot x\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \leq 1.4821969375237 \cdot 10^{-323}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \leq 9.664313956054862 \cdot 10^{+112}:\\ \;\;\;\;\frac{\frac{y}{z} \cdot t}{t} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot x\right) \cdot \frac{1}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2020199 
(FPCore (x y z t)
  :name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, B"
  :precision binary64

  :herbie-target
  (if (< (/ (* (/ y z) t) t) -1.20672205123045e+245) (/ y (/ z x)) (if (< (/ (* (/ y z) t) t) -5.907522236933906e-275) (* x (/ y z)) (if (< (/ (* (/ y z) t) t) 5.658954423153415e-65) (/ y (/ z x)) (if (< (/ (* (/ y z) t) t) 2.0087180502407133e+217) (* x (/ y z)) (/ (* y x) z)))))

  (* x (/ (* (/ y z) t) t)))