Average Error: 1.9 → 2.3
Time: 50.4s
Precision: 64
Internal Precision: 384
\[\frac{x}{y} \cdot \left(z - t\right) + t\]
\[\begin{array}{l} \mathbf{if}\;y \le -4.4405590618824735 \cdot 10^{+174}:\\ \;\;\;\;x \cdot \frac{z - t}{y} + t\\ \mathbf{if}\;y \le 7.842928430821296 \cdot 10^{+33}:\\ \;\;\;\;\frac{x \cdot \left(z - t\right)}{y} + t\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{z - t}{y} + t\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original1.9
Target2.2
Herbie2.3
\[\begin{array}{l} \mathbf{if}\;z \lt 2.759456554562692 \cdot 10^{-282}:\\ \;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\ \mathbf{if}\;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 y < -4.4405590618824735e+174 or 7.842928430821296e+33 < y

    1. Initial program 1.1

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

      \[\leadsto \color{blue}{\left(x \cdot \frac{1}{y}\right)} \cdot \left(z - t\right) + t\]
    4. Applied associate-*l*1.3

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

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

    if -4.4405590618824735e+174 < y < 7.842928430821296e+33

    1. Initial program 2.5

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

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

Runtime

Time bar (total: 50.4s)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit
(FPCore (x y z t)
  :name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"

  :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))