Average Error: 14.4 → 0.8
Time: 4.2s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -2.08840760953013912 \cdot 10^{267}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -5.48232839298885 \cdot 10^{-239}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 2.62565703 \cdot 10^{-317}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 1.8823609581851615 \cdot 10^{94}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
\mathbf{if}\;\frac{y}{z} \le -2.08840760953013912 \cdot 10^{267}:\\
\;\;\;\;y \cdot \frac{x}{z}\\

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

\mathbf{elif}\;\frac{y}{z} \le 2.62565703 \cdot 10^{-317}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\

\mathbf{elif}\;\frac{y}{z} \le 1.8823609581851615 \cdot 10^{94}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

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

\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) <= -2.088407609530139e+267)) {
		VAR = (y * (x / z));
	} else {
		double VAR_1;
		if (((y / z) <= -5.48232839298885e-239)) {
			VAR_1 = (x * (y / z));
		} else {
			double VAR_2;
			if (((y / z) <= 2.6256570335366e-317)) {
				VAR_2 = ((x * y) * (1.0 / z));
			} else {
				double VAR_3;
				if (((y / z) <= 1.8823609581851615e+94)) {
					VAR_3 = (x * (y / z));
				} else {
					VAR_3 = ((x * y) / 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

Derivation

  1. Split input into 4 regimes
  2. if (/ y z) < -2.088407609530139e+267

    1. Initial program 52.3

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity44.1

      \[\leadsto x \cdot \frac{y}{\color{blue}{1 \cdot z}}\]
    5. Applied add-cube-cbrt44.4

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

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

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

      \[\leadsto \color{blue}{\left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot x\right)} \cdot \frac{\sqrt[3]{y}}{z}\]
    9. Using strategy rm
    10. Applied associate-*l*12.9

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}}\]
    12. Simplified0.5

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

    if -2.088407609530139e+267 < (/ y z) < -5.48232839298885e-239 or 2.6256570335366e-317 < (/ y z) < 1.8823609581851615e+94

    1. Initial program 8.4

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

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

    if -5.48232839298885e-239 < (/ y z) < 2.6256570335366e-317

    1. Initial program 18.9

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

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

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

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

    if 1.8823609581851615e+94 < (/ y z)

    1. Initial program 27.9

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -2.08840760953013912 \cdot 10^{267}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -5.48232839298885 \cdot 10^{-239}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 2.62565703 \cdot 10^{-317}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 1.8823609581851615 \cdot 10^{94}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2020106 +o rules:numerics
(FPCore (x y z t)
  :name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1"
  :precision binary64
  (* x (/ (* (/ y z) t) t)))