Average Error: 14.7 → 1.7
Time: 7.4s
Precision: binary64
\[[x, y]=\mathsf{sort}([x, y])\]
\[x \cdot \frac{\frac{y}{z} \cdot t}{t} \]
\[\begin{array}{l} t_1 := x \cdot \frac{\frac{y}{z} \cdot t}{t}\\ \mathbf{if}\;t_1 \leq -1.6687413961929113 \cdot 10^{+307}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_2 := x \cdot \frac{y}{z}\\ \mathbf{if}\;t_1 \leq -2.843252304093686 \cdot 10^{-283}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_1 \leq 4.210823815911059 \cdot 10^{-268}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;t_1 \leq 4.2617907411146433 \cdot 10^{+301}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \frac{1}{\sqrt[3]{z} \cdot \sqrt[3]{z}}\right) \cdot \frac{y}{\sqrt[3]{z}}\\ \end{array}\\ \end{array} \]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
t_1 := x \cdot \frac{\frac{y}{z} \cdot t}{t}\\
\mathbf{if}\;t_1 \leq -1.6687413961929113 \cdot 10^{+307}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\

\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_2 := x \cdot \frac{y}{z}\\
\mathbf{if}\;t_1 \leq -2.843252304093686 \cdot 10^{-283}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;t_1 \leq 4.210823815911059 \cdot 10^{-268}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

\mathbf{elif}\;t_1 \leq 4.2617907411146433 \cdot 10^{+301}:\\
\;\;\;\;t_2\\

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


\end{array}\\


\end{array}
(FPCore (x y z t) :precision binary64 (* x (/ (* (/ y z) t) t)))
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (/ (* (/ y z) t) t))))
   (if (<= t_1 -1.6687413961929113e+307)
     (* (* x y) (/ 1.0 z))
     (let* ((t_2 (* x (/ y z))))
       (if (<= t_1 -2.843252304093686e-283)
         t_2
         (if (<= t_1 4.210823815911059e-268)
           (/ (* x y) z)
           (if (<= t_1 4.2617907411146433e+301)
             t_2
             (* (* x (/ 1.0 (* (cbrt z) (cbrt z)))) (/ y (cbrt 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 t_1 = x * (((y / z) * t) / t);
	double tmp;
	if (t_1 <= -1.6687413961929113e+307) {
		tmp = (x * y) * (1.0 / z);
	} else {
		double t_2 = x * (y / z);
		double tmp_1;
		if (t_1 <= -2.843252304093686e-283) {
			tmp_1 = t_2;
		} else if (t_1 <= 4.210823815911059e-268) {
			tmp_1 = (x * y) / z;
		} else if (t_1 <= 4.2617907411146433e+301) {
			tmp_1 = t_2;
		} else {
			tmp_1 = (x * (1.0 / (cbrt(z) * cbrt(z)))) * (y / cbrt(z));
		}
		tmp = tmp_1;
	}
	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.7
Target1.6
Herbie1.7
\[\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 x (/.f64 (*.f64 (/.f64 y z) t) t)) < -1.66874139619291129e307

    1. Initial program 63.9

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
    3. Applied div-inv_binary6427.4

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

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

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

    if -1.66874139619291129e307 < (*.f64 x (/.f64 (*.f64 (/.f64 y z) t) t)) < -2.84325230409368613e-283 or 4.2108238159110592e-268 < (*.f64 x (/.f64 (*.f64 (/.f64 y z) t) t)) < 4.2617907411146433e301

    1. Initial program 0.9

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

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

    if -2.84325230409368613e-283 < (*.f64 x (/.f64 (*.f64 (/.f64 y z) t) t)) < 4.2108238159110592e-268

    1. Initial program 21.1

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
    3. Taylor expanded in x around 0 2.4

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

    if 4.2617907411146433e301 < (*.f64 x (/.f64 (*.f64 (/.f64 y z) t) t))

    1. Initial program 62.6

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
    3. Applied add-cube-cbrt_binary6428.8

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot \frac{\frac{y}{z} \cdot t}{t} \leq -1.6687413961929113 \cdot 10^{+307}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;x \cdot \frac{\frac{y}{z} \cdot t}{t} \leq -2.843252304093686 \cdot 10^{-283}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot \frac{\frac{y}{z} \cdot t}{t} \leq 4.210823815911059 \cdot 10^{-268}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;x \cdot \frac{\frac{y}{z} \cdot t}{t} \leq 4.2617907411146433 \cdot 10^{+301}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \frac{1}{\sqrt[3]{z} \cdot \sqrt[3]{z}}\right) \cdot \frac{y}{\sqrt[3]{z}}\\ \end{array} \]

Reproduce

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