Average Error: 25.0 → 6.6
Time: 9.8s
Precision: binary64
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.2327965780524498 \cdot 10^{154}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \le 5.4385652297170126 \cdot 10^{104}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original25.0
Target7.5
Herbie6.6
\[\begin{array}{l} \mathbf{if}\;z \lt -3.1921305903852764 \cdot 10^{46}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;z \lt 5.9762681209208942 \cdot 10^{90}:\\ \;\;\;\;\frac{x \cdot z}{\frac{\sqrt{z \cdot z - a \cdot t}}{y}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if z < -1.2327965780524498e154

    1. Initial program 54.5

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Simplified54.1

      \[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)}\]
    3. Taylor expanded around -inf 1.6

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot y\right)}\]
    4. Simplified1.6

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

    if -1.2327965780524498e154 < z < 5.4385652297170126e104

    1. Initial program 11.3

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Simplified8.7

      \[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)}\]
    3. Using strategy rm
    4. Applied associate-*r*9.0

      \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}}\]
    5. Using strategy rm
    6. Applied clear-num9.3

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

    if 5.4385652297170126e104 < z

    1. Initial program 44.2

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Simplified41.2

      \[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)}\]
    3. Taylor expanded around inf 2.3

      \[\leadsto \color{blue}{x \cdot y}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification6.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.2327965780524498 \cdot 10^{154}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \le 5.4385652297170126 \cdot 10^{104}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]

Reproduce

herbie shell --seed 2020181 
(FPCore (x y z t a)
  :name "Statistics.Math.RootFinding:ridders from math-functions-0.1.5.2"
  :precision binary64

  :herbie-target
  (if (< z -3.1921305903852764e+46) (neg (* y x)) (if (< z 5.976268120920894e+90) (/ (* x z) (/ (sqrt (- (* z z) (* a t))) y)) (* y x)))

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