Average Error: 14.5 → 1.9
Time: 3.7s
Precision: binary64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} \leq -4.469027926732436 \cdot 10^{-111}:\\ \;\;\;\;\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\frac{1}{\sqrt[3]{z} \cdot \sqrt[3]{z}} \cdot \left(\sqrt[3]{x} \cdot \frac{y}{\sqrt[3]{z}}\right)\right)\\ \mathbf{elif}\;\frac{y}{z} \leq 1.3491676262115018 \cdot 10^{-212}:\\ \;\;\;\;\left(y \cdot x\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;\frac{y}{z} \leq 8.244341728009553 \cdot 10^{+226}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot x}{z}\\ \end{array}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
\mathbf{if}\;\frac{y}{z} \leq -4.469027926732436 \cdot 10^{-111}:\\
\;\;\;\;\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\frac{1}{\sqrt[3]{z} \cdot \sqrt[3]{z}} \cdot \left(\sqrt[3]{x} \cdot \frac{y}{\sqrt[3]{z}}\right)\right)\\

\mathbf{elif}\;\frac{y}{z} \leq 1.3491676262115018 \cdot 10^{-212}:\\
\;\;\;\;\left(y \cdot x\right) \cdot \frac{1}{z}\\

\mathbf{elif}\;\frac{y}{z} \leq 8.244341728009553 \cdot 10^{+226}:\\
\;\;\;\;\frac{y}{z} \cdot x\\

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

\end{array}
(FPCore (x y z t) :precision binary64 (* x (/ (* (/ y z) t) t)))
(FPCore (x y z t)
 :precision binary64
 (if (<= (/ y z) -4.469027926732436e-111)
   (*
    (* (cbrt x) (cbrt x))
    (* (/ 1.0 (* (cbrt z) (cbrt z))) (* (cbrt x) (/ y (cbrt z)))))
   (if (<= (/ y z) 1.3491676262115018e-212)
     (* (* y x) (/ 1.0 z))
     (if (<= (/ y z) 8.244341728009553e+226) (* (/ y z) x) (/ (* y x) z)))))
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 tmp;
	if ((y / z) <= -4.469027926732436e-111) {
		tmp = (cbrt(x) * cbrt(x)) * ((1.0 / (cbrt(z) * cbrt(z))) * (cbrt(x) * (y / cbrt(z))));
	} else if ((y / z) <= 1.3491676262115018e-212) {
		tmp = (y * x) * (1.0 / z);
	} else if ((y / z) <= 8.244341728009553e+226) {
		tmp = (y / z) * x;
	} else {
		tmp = (y * x) / z;
	}
	return tmp;
}

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.5
Target1.5
Herbie1.9
\[\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 (/.f64 y z) < -4.46902792673243601e-111

    1. Initial program 14.3

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

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

      \[\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*_binary646.6

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

      \[\leadsto \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \color{blue}{\left(\frac{y}{z} \cdot \sqrt[3]{x}\right)}\]
    7. Using strategy rm
    8. Applied add-cube-cbrt_binary646.9

      \[\leadsto \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\frac{y}{\color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}} \cdot \sqrt[3]{x}\right)\]
    9. Applied *-un-lft-identity_binary646.9

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

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

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

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

    if -4.46902792673243601e-111 < (/.f64 y z) < 1.34916762621150185e-212

    1. Initial program 15.9

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

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

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

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

    if 1.34916762621150185e-212 < (/.f64 y z) < 8.2443417280095532e226

    1. Initial program 8.7

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

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

    if 8.2443417280095532e226 < (/.f64 y z)

    1. Initial program 42.7

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} \leq -4.469027926732436 \cdot 10^{-111}:\\ \;\;\;\;\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\frac{1}{\sqrt[3]{z} \cdot \sqrt[3]{z}} \cdot \left(\sqrt[3]{x} \cdot \frac{y}{\sqrt[3]{z}}\right)\right)\\ \mathbf{elif}\;\frac{y}{z} \leq 1.3491676262115018 \cdot 10^{-212}:\\ \;\;\;\;\left(y \cdot x\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;\frac{y}{z} \leq 8.244341728009553 \cdot 10^{+226}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot x}{z}\\ \end{array}\]

Reproduce

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