Average Error: 2.0 → 1.8
Time: 4.5s
Precision: binary64
\[\frac{x}{y} \cdot \left(z - t\right) + t\]
\[\begin{array}{l} \mathbf{if}\;t \leq -5.0212560282729745 \cdot 10^{-157} \lor \neg \left(t \leq 1.9912695390203027 \cdot 10^{-120}\right):\\ \;\;\;\;t + \frac{x}{y} \cdot \left(z - t\right)\\ \mathbf{else}:\\ \;\;\;\;t + \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\left(z - t\right) \cdot \frac{\sqrt[3]{x}}{y}\right)\\ \end{array}\]
\frac{x}{y} \cdot \left(z - t\right) + t
\begin{array}{l}
\mathbf{if}\;t \leq -5.0212560282729745 \cdot 10^{-157} \lor \neg \left(t \leq 1.9912695390203027 \cdot 10^{-120}\right):\\
\;\;\;\;t + \frac{x}{y} \cdot \left(z - t\right)\\

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

\end{array}
(FPCore (x y z t) :precision binary64 (+ (* (/ x y) (- z t)) t))
(FPCore (x y z t)
 :precision binary64
 (if (or (<= t -5.0212560282729745e-157) (not (<= t 1.9912695390203027e-120)))
   (+ t (* (/ x y) (- z t)))
   (+ t (* (* (cbrt x) (cbrt x)) (* (- z t) (/ (cbrt x) y))))))
double code(double x, double y, double z, double t) {
	return ((double) (((double) ((x / y) * ((double) (z - t)))) + t));
}
double code(double x, double y, double z, double t) {
	double tmp;
	if (((t <= -5.0212560282729745e-157) || !(t <= 1.9912695390203027e-120))) {
		tmp = ((double) (t + ((double) ((x / y) * ((double) (z - t))))));
	} else {
		tmp = ((double) (t + ((double) (((double) (((double) cbrt(x)) * ((double) cbrt(x)))) * ((double) (((double) (z - t)) * (((double) cbrt(x)) / y)))))));
	}
	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

Original2.0
Target2.4
Herbie1.8
\[\begin{array}{l} \mathbf{if}\;z < 2.759456554562692 \cdot 10^{-282}:\\ \;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\ \mathbf{elif}\;z < 2.326994450874436 \cdot 10^{-110}:\\ \;\;\;\;x \cdot \frac{z - t}{y} + t\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if t < -5.02125602827297452e-157 or 1.9912695390203027e-120 < t

    1. Initial program Error: 0.8 bits

      \[\frac{x}{y} \cdot \left(z - t\right) + t\]

    if -5.02125602827297452e-157 < t < 1.9912695390203027e-120

    1. Initial program Error: 4.9 bits

      \[\frac{x}{y} \cdot \left(z - t\right) + t\]
    2. Using strategy rm
    3. Applied *-un-lft-identityError: 4.9 bits

      \[\leadsto \frac{x}{\color{blue}{1 \cdot y}} \cdot \left(z - t\right) + t\]
    4. Applied add-cube-cbrtError: 5.6 bits

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}}}{1 \cdot y} \cdot \left(z - t\right) + t\]
    5. Applied times-fracError: 5.6 bits

      \[\leadsto \color{blue}{\left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{1} \cdot \frac{\sqrt[3]{x}}{y}\right)} \cdot \left(z - t\right) + t\]
    6. Applied associate-*l*Error: 4.2 bits

      \[\leadsto \color{blue}{\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{1} \cdot \left(\frac{\sqrt[3]{x}}{y} \cdot \left(z - t\right)\right)} + t\]
    7. SimplifiedError: 4.2 bits

      \[\leadsto \frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{1} \cdot \color{blue}{\left(\left(z - t\right) \cdot \frac{\sqrt[3]{x}}{y}\right)} + t\]
  3. Recombined 2 regimes into one program.
  4. Final simplificationError: 1.8 bits

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -5.0212560282729745 \cdot 10^{-157} \lor \neg \left(t \leq 1.9912695390203027 \cdot 10^{-120}\right):\\ \;\;\;\;t + \frac{x}{y} \cdot \left(z - t\right)\\ \mathbf{else}:\\ \;\;\;\;t + \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\left(z - t\right) \cdot \frac{\sqrt[3]{x}}{y}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020203 
(FPCore (x y z t)
  :name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
  :precision binary64

  :herbie-target
  (if (< z 2.759456554562692e-282) (+ (* (/ x y) (- z t)) t) (if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t)))

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