Average Error: 11.4 → 2.2
Time: 44.1s
Precision: 64
Internal Precision: 384
\[\frac{x \cdot \left(y - z\right)}{t - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.8904526391866433 \cdot 10^{-46}:\\ \;\;\;\;\frac{x}{1} \cdot \frac{y - z}{t - z}\\ \mathbf{if}\;z \le -2.2005782380220625 \cdot 10^{-285}:\\ \;\;\;\;\left(x \cdot \left(y - z\right)\right) \cdot \frac{1}{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.4
Target2.0
Herbie2.2
\[\frac{x}{\frac{t - z}{y - z}}\]

Derivation

  1. Split input into 3 regimes
  2. if z < -1.8904526391866433e-46

    1. Initial program 14.6

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

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

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

    if -1.8904526391866433e-46 < z < -2.2005782380220625e-285

    1. Initial program 5.6

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

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

    if -2.2005782380220625e-285 < z

    1. Initial program 11.5

      \[\frac{x \cdot \left(y - z\right)}{t - z}\]
    2. Taylor expanded around 0 11.6

      \[\leadsto \frac{\color{blue}{y \cdot x - z \cdot x}}{t - z}\]
    3. Applied simplify2.0

      \[\leadsto \color{blue}{\frac{x}{\frac{t - z}{y - z}}}\]
  3. Recombined 3 regimes into one program.
  4. Removed slow pow expressions.

Runtime

Time bar (total: 44.1s)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit +o reduce:binary-search
(FPCore (x y z t)
  :name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"

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

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