Average Error: 1.9 → 2.0
Time: 42.5s
Precision: 64
Internal Precision: 384
\[\frac{x}{y} \cdot \left(z - t\right) + t\]
\[\begin{array}{l} \mathbf{if}\;t \le -1.0656602041483226 \cdot 10^{-38}:\\ \;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\ \mathbf{if}\;t \le 6.223312755956837 \cdot 10^{-188}:\\ \;\;\;\;\left(x \cdot \left(z - t\right)\right) \cdot \frac{1}{y} + t\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original1.9
Target2.1
Herbie2.0
\[\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 t < -1.0656602041483226e-38 or 6.223312755956837e-188 < t

    1. Initial program 0.6

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

    if -1.0656602041483226e-38 < t < 6.223312755956837e-188

    1. Initial program 4.2

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

      \[\leadsto \color{blue}{\frac{x \cdot \left(z - t\right)}{y}} + t\]
    4. Using strategy rm
    5. Applied div-inv4.7

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

Runtime

Time bar (total: 42.5s)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))