Average Error: 24.9 → 6.0
Time: 5.2s
Precision: binary64
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.1852152297756325 \cdot 10^{100}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \le 3.85022636748244099 \cdot 10^{62}:\\ \;\;\;\;x \cdot \left(\left(y \cdot \left(\sqrt[3]{z} \cdot \frac{\sqrt[3]{z}}{\sqrt[3]{\sqrt{z \cdot z - t \cdot a}} \cdot \sqrt[3]{\sqrt{z \cdot z - t \cdot a}}}\right)\right) \cdot \frac{\sqrt[3]{z}}{\sqrt[3]{\sqrt[3]{\sqrt{z \cdot z - t \cdot a}} \cdot \sqrt[3]{z \cdot z - t \cdot a}}}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{z}{z + \left(t \cdot \frac{a}{z}\right) \cdot \frac{-1}{2}}\right)\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original24.9
Target7.5
Herbie6.0
\[\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 < -2.1852152297756325e100

    1. Initial program 42.3

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

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

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

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

    if -2.1852152297756325e100 < z < 3.85022636748244099e62

    1. Initial program 11.6

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

      \[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt10.2

      \[\leadsto x \cdot \left(y \cdot \frac{z}{\color{blue}{\left(\sqrt[3]{\sqrt{z \cdot z - t \cdot a}} \cdot \sqrt[3]{\sqrt{z \cdot z - t \cdot a}}\right) \cdot \sqrt[3]{\sqrt{z \cdot z - t \cdot a}}}}\right)\]
    5. Applied add-cube-cbrt9.9

      \[\leadsto x \cdot \left(y \cdot \frac{\color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}}{\left(\sqrt[3]{\sqrt{z \cdot z - t \cdot a}} \cdot \sqrt[3]{\sqrt{z \cdot z - t \cdot a}}\right) \cdot \sqrt[3]{\sqrt{z \cdot z - t \cdot a}}}\right)\]
    6. Applied times-frac9.9

      \[\leadsto x \cdot \left(y \cdot \color{blue}{\left(\frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{\sqrt[3]{\sqrt{z \cdot z - t \cdot a}} \cdot \sqrt[3]{\sqrt{z \cdot z - t \cdot a}}} \cdot \frac{\sqrt[3]{z}}{\sqrt[3]{\sqrt{z \cdot z - t \cdot a}}}\right)}\right)\]
    7. Applied associate-*r*8.8

      \[\leadsto x \cdot \color{blue}{\left(\left(y \cdot \frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{\sqrt[3]{\sqrt{z \cdot z - t \cdot a}} \cdot \sqrt[3]{\sqrt{z \cdot z - t \cdot a}}}\right) \cdot \frac{\sqrt[3]{z}}{\sqrt[3]{\sqrt{z \cdot z - t \cdot a}}}\right)}\]
    8. Simplified8.9

      \[\leadsto x \cdot \left(\color{blue}{\left(y \cdot \left(\sqrt[3]{z} \cdot \frac{\sqrt[3]{z}}{\sqrt[3]{\sqrt{z \cdot z - t \cdot a}} \cdot \sqrt[3]{\sqrt{z \cdot z - t \cdot a}}}\right)\right)} \cdot \frac{\sqrt[3]{z}}{\sqrt[3]{\sqrt{z \cdot z - t \cdot a}}}\right)\]
    9. Using strategy rm
    10. Applied add-cube-cbrt9.1

      \[\leadsto x \cdot \left(\left(y \cdot \left(\sqrt[3]{z} \cdot \frac{\sqrt[3]{z}}{\sqrt[3]{\sqrt{z \cdot z - t \cdot a}} \cdot \sqrt[3]{\sqrt{z \cdot z - t \cdot a}}}\right)\right) \cdot \frac{\sqrt[3]{z}}{\sqrt[3]{\color{blue}{\left(\sqrt[3]{\sqrt{z \cdot z - t \cdot a}} \cdot \sqrt[3]{\sqrt{z \cdot z - t \cdot a}}\right) \cdot \sqrt[3]{\sqrt{z \cdot z - t \cdot a}}}}}\right)\]
    11. Simplified9.0

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

    if 3.85022636748244099e62 < z

    1. Initial program 39.4

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

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

      \[\leadsto x \cdot \left(y \cdot \frac{z}{\color{blue}{z - \frac{1}{2} \cdot \frac{a \cdot t}{z}}}\right)\]
    4. Simplified3.0

      \[\leadsto x \cdot \left(y \cdot \frac{z}{\color{blue}{z + \left(t \cdot \frac{a}{z}\right) \cdot \frac{-1}{2}}}\right)\]
  3. Recombined 3 regimes into one program.
  4. Final simplification6.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -2.1852152297756325 \cdot 10^{100}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \le 3.85022636748244099 \cdot 10^{62}:\\ \;\;\;\;x \cdot \left(\left(y \cdot \left(\sqrt[3]{z} \cdot \frac{\sqrt[3]{z}}{\sqrt[3]{\sqrt{z \cdot z - t \cdot a}} \cdot \sqrt[3]{\sqrt{z \cdot z - t \cdot a}}}\right)\right) \cdot \frac{\sqrt[3]{z}}{\sqrt[3]{\sqrt[3]{\sqrt{z \cdot z - t \cdot a}} \cdot \sqrt[3]{z \cdot z - t \cdot a}}}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{z}{z + \left(t \cdot \frac{a}{z}\right) \cdot \frac{-1}{2}}\right)\\ \end{array}\]

Reproduce

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