Average Error: 11.9 → 2.3
Time: 3.2s
Precision: binary64
\[\frac{x \cdot \left(y - z\right)}{t - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.26749391035091697 \cdot 10^{-13}:\\ \;\;\;\;x \cdot \frac{y - z}{t - z}\\ \mathbf{elif}\;z \le 3.44342535139107114 \cdot 10^{-292}:\\ \;\;\;\;\frac{x \cdot y + x \cdot \left(-z\right)}{t - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original11.9
Target2.3
Herbie2.3
\[\frac{x}{\frac{t - z}{y - z}}\]

Derivation

  1. Split input into 3 regimes
  2. if z < -2.26749391035091697e-13

    1. Initial program 18.3

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

      \[\leadsto \frac{x \cdot \left(y - z\right)}{\color{blue}{1 \cdot \left(t - z\right)}}\]
    4. Applied times-frac0.1

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

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

    if -2.26749391035091697e-13 < z < 3.44342535139107114e-292

    1. Initial program 5.2

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

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

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

    if 3.44342535139107114e-292 < z

    1. Initial program 11.6

      \[\frac{x \cdot \left(y - z\right)}{t - z}\]
    2. Using strategy rm
    3. Applied associate-/l*2.1

      \[\leadsto \color{blue}{\frac{x}{\frac{t - z}{y - z}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification2.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -2.26749391035091697 \cdot 10^{-13}:\\ \;\;\;\;x \cdot \frac{y - z}{t - z}\\ \mathbf{elif}\;z \le 3.44342535139107114 \cdot 10^{-292}:\\ \;\;\;\;\frac{x \cdot y + x \cdot \left(-z\right)}{t - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{t - z}{y - z}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020152 
(FPCore (x y z t)
  :name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
  :precision binary64

  :herbie-target
  (/ x (/ (- t z) (- y z)))

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