Average Error: 2.2 → 1.7
Time: 9.8s
Precision: binary64
\[\frac{x}{y} \cdot \left(z - t\right) + t\]
\[\begin{array}{l} \mathbf{if}\;x \le -2.2597023320458045 \cdot 10^{76} \lor \neg \left(x \le 685516672564733568\right):\\ \;\;\;\;t + \left(\frac{\sqrt[3]{x}}{y} \cdot \left(z - t\right)\right) \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{x \cdot z}{y} + \left(-\frac{t \cdot x}{y}\right)\right) + t\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original2.2
Target2.4
Herbie1.7
\[\begin{array}{l} \mathbf{if}\;z \lt 2.7594565545626922 \cdot 10^{-282}:\\ \;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\ \mathbf{elif}\;z \lt 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 x < -2.2597023320458045e76 or 685516672564733568 < x

    1. Initial program 4.8

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

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

      \[\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-frac5.5

      \[\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*2.3

      \[\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\]

    if -2.2597023320458045e76 < x < 685516672564733568

    1. Initial program 1.0

      \[\frac{x}{y} \cdot \left(z - t\right) + t\]
    2. Using strategy rm
    3. Applied sub-neg1.0

      \[\leadsto \frac{x}{y} \cdot \color{blue}{\left(z + \left(-t\right)\right)} + t\]
    4. Applied distribute-lft-in1.0

      \[\leadsto \color{blue}{\left(\frac{x}{y} \cdot z + \frac{x}{y} \cdot \left(-t\right)\right)} + t\]
    5. Simplified1.0

      \[\leadsto \left(\color{blue}{\frac{x \cdot z}{y}} + \frac{x}{y} \cdot \left(-t\right)\right) + t\]
    6. Simplified1.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -2.2597023320458045 \cdot 10^{76} \lor \neg \left(x \le 685516672564733568\right):\\ \;\;\;\;t + \left(\frac{\sqrt[3]{x}}{y} \cdot \left(z - t\right)\right) \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{x \cdot z}{y} + \left(-\frac{t \cdot x}{y}\right)\right) + t\\ \end{array}\]

Reproduce

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