Average Error: 14.8 → 0.8
Time: 1.7s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -4.8517075312100841 \cdot 10^{206}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -6.28974222975093373 \cdot 10^{-132}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 0.0:\\ \;\;\;\;\frac{-y}{\frac{-z}{x}}\\ \mathbf{elif}\;\frac{y}{z} \le 1.2588805863233109 \cdot 10^{162}:\\ \;\;\;\;\frac{x \cdot -1}{\frac{-z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-y}{\frac{-z}{x}}\\ \end{array}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
\mathbf{if}\;\frac{y}{z} \le -4.8517075312100841 \cdot 10^{206}:\\
\;\;\;\;y \cdot \frac{x}{z}\\

\mathbf{elif}\;\frac{y}{z} \le -6.28974222975093373 \cdot 10^{-132}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

\mathbf{elif}\;\frac{y}{z} \le 0.0:\\
\;\;\;\;\frac{-y}{\frac{-z}{x}}\\

\mathbf{elif}\;\frac{y}{z} \le 1.2588805863233109 \cdot 10^{162}:\\
\;\;\;\;\frac{x \cdot -1}{\frac{-z}{y}}\\

\mathbf{else}:\\
\;\;\;\;\frac{-y}{\frac{-z}{x}}\\

\end{array}
double code(double x, double y, double z, double t) {
	return (x * (((y / z) * t) / t));
}
double code(double x, double y, double z, double t) {
	double VAR;
	if (((y / z) <= -4.851707531210084e+206)) {
		VAR = (y * (x / z));
	} else {
		double VAR_1;
		if (((y / z) <= -6.289742229750934e-132)) {
			VAR_1 = (x * (y / z));
		} else {
			double VAR_2;
			if (((y / z) <= 0.0)) {
				VAR_2 = (-y / (-z / x));
			} else {
				double VAR_3;
				if (((y / z) <= 1.258880586323311e+162)) {
					VAR_3 = ((x * -1.0) / (-z / y));
				} else {
					VAR_3 = (-y / (-z / x));
				}
				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.8
Target1.4
Herbie0.8
\[\begin{array}{l} \mathbf{if}\;\frac{\frac{y}{z} \cdot t}{t} \lt -1.20672205123045005 \cdot 10^{245}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt -5.90752223693390633 \cdot 10^{-275}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt 5.65895442315341522 \cdot 10^{-65}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt 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) < -4.851707531210084e+206

    1. Initial program 41.0

      \[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
    2. Simplified26.7

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

      \[\leadsto x \cdot \color{blue}{\frac{-y}{-z}}\]
    5. Applied associate-*r/1.2

      \[\leadsto \color{blue}{\frac{x \cdot \left(-y\right)}{-z}}\]
    6. Using strategy rm
    7. Applied neg-mul-11.2

      \[\leadsto \frac{x \cdot \left(-y\right)}{\color{blue}{-1 \cdot z}}\]
    8. Applied *-commutative1.2

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

      \[\leadsto \color{blue}{\frac{-y}{-1} \cdot \frac{x}{z}}\]
    10. Simplified1.0

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

    if -4.851707531210084e+206 < (/ y z) < -6.289742229750934e-132

    1. Initial program 7.1

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

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

    if -6.289742229750934e-132 < (/ y z) < 0.0 or 1.258880586323311e+162 < (/ y z)

    1. Initial program 21.8

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

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

      \[\leadsto x \cdot \color{blue}{\frac{-y}{-z}}\]
    5. Applied associate-*r/1.5

      \[\leadsto \color{blue}{\frac{x \cdot \left(-y\right)}{-z}}\]
    6. Using strategy rm
    7. Applied *-commutative1.5

      \[\leadsto \frac{\color{blue}{\left(-y\right) \cdot x}}{-z}\]
    8. Applied associate-/l*1.1

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

    if 0.0 < (/ y z) < 1.258880586323311e+162

    1. Initial program 9.0

      \[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
    2. Simplified0.4

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

      \[\leadsto x \cdot \color{blue}{\frac{-y}{-z}}\]
    5. Applied associate-*r/8.2

      \[\leadsto \color{blue}{\frac{x \cdot \left(-y\right)}{-z}}\]
    6. Using strategy rm
    7. Applied neg-mul-18.2

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

      \[\leadsto \frac{\color{blue}{\left(x \cdot -1\right) \cdot y}}{-z}\]
    9. Applied associate-/l*0.8

      \[\leadsto \color{blue}{\frac{x \cdot -1}{\frac{-z}{y}}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification0.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -4.8517075312100841 \cdot 10^{206}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -6.28974222975093373 \cdot 10^{-132}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 0.0:\\ \;\;\;\;\frac{-y}{\frac{-z}{x}}\\ \mathbf{elif}\;\frac{y}{z} \le 1.2588805863233109 \cdot 10^{162}:\\ \;\;\;\;\frac{x \cdot -1}{\frac{-z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-y}{\frac{-z}{x}}\\ \end{array}\]

Reproduce

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