Average Error: 11.3 → 1.4
Time: 4.4s
Precision: binary64
\[\frac{x \cdot \left(y - z\right)}{t - z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y - z\right)}{t - z} \le -0.0:\\ \;\;\;\;\frac{x}{\left(t - z\right) \cdot \frac{1}{y - z}}\\ \mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{t - z} \le 1.4588945007818368 \cdot 10^{286}:\\ \;\;\;\;\frac{x \cdot y + x \cdot \left(-z\right)}{t - z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y - z}{t - z}\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original11.3
Target2.3
Herbie1.4
\[\frac{x}{\frac{t - z}{y - z}}\]

Derivation

  1. Split input into 3 regimes
  2. if (/ (* x (- y z)) (- t z)) < -0.0

    1. Initial program 11.0

      \[\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}}}\]
    4. Using strategy rm
    5. Applied div-inv2.2

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

    if -0.0 < (/ (* x (- y z)) (- t z)) < 1.4588945007818368e+286

    1. Initial program 0.3

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

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

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

    if 1.4588945007818368e+286 < (/ (* x (- y z)) (- t z))

    1. Initial program 60.3

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y - z\right)}{t - z} \le -0.0:\\ \;\;\;\;\frac{x}{\left(t - z\right) \cdot \frac{1}{y - z}}\\ \mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{t - z} \le 1.4588945007818368 \cdot 10^{286}:\\ \;\;\;\;\frac{x \cdot y + x \cdot \left(-z\right)}{t - z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y - z}{t - z}\\ \end{array}\]

Reproduce

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