Average Error: 24.7 → 5.4
Time: 38.5s
Precision: 64
Internal precision: 128
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
\[\begin{array}{l} \mathbf{if}\;z \le -3.2246321692628075 \cdot 10^{+96}:\\ \;\;\;\;\left(-y\right) \cdot x\\ \mathbf{if}\;z \le 4.1304744243716236 \cdot 10^{+108}:\\ \;\;\;\;\frac{x}{1} \cdot \left(\frac{y}{\sqrt{1}} \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \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.7
Comparison6.6
Herbie5.4
\[ \begin{array}{l} \mathbf{if}\;z \lt -3.1921305903852764 \cdot 10^{+46}:\\ \;\;\;\;-y \cdot x\\ \mathbf{if}\;z \lt 5.976268120920894 \cdot 10^{+90}:\\ \;\;\;\;\frac{x \cdot z}{\frac{\sqrt{{z}^2 - a \cdot t}}{y}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]

Derivation

  1. Split input into 3 regimes.
  2. if z < -3.2246321692628075e+96

    1. Initial program 44.7

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

      \[\leadsto -1 \cdot \left(y \cdot x\right)\]
    3. Taylor expanded around -inf 0

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot x\right)}\]
    4. Applied simplify 0

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

    if -3.2246321692628075e+96 < z < 4.1304744243716236e+108

    1. Initial program 10.7

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

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{\sqrt{1}} \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity 9.4

      \[\leadsto \frac{x \cdot y}{\color{blue}{1 \cdot \sqrt{1}}} \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\]
    8. Applied times-frac 9.4

      \[\leadsto \color{blue}{\left(\frac{x}{1} \cdot \frac{y}{\sqrt{1}}\right)} \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\]
    9. Applied associate-*l* 9.2

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

    if 4.1304744243716236e+108 < z

    1. Initial program 43.9

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

      \[\leadsto y \cdot x\]
    3. Taylor expanded around inf 0

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

Runtime

Time bar (total: 38.5s) Debug log

Please include this information when filing a bug report:

herbie --seed '#(2345100582 1887689069 3711651343 3495082782 3738689660 2422492864)'
(FPCore (x y z t a)
  :name "Statistics.Math.RootFinding:ridders from math-functions-0.1.5.2"

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

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