Average Error: 6.5 → 6.7
Time: 9.6s
Precision: 64
Internal precision: 128
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;z \le 2.1434644401519457 \cdot 10^{-300}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{if}\;z \le 8.719617136183342 \cdot 10^{-188}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{if}\;z \le 2.2547275136738512 \cdot 10^{-175}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original6.5
Comparison6.1
Herbie6.7
\[ \begin{array}{l} \mathbf{if}\;z \lt -4.262230790519429 \cdot 10^{-138}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{if}\;z \lt 1.7042130660650472 \cdot 10^{-164}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array} \]

Derivation

  1. Split input into 3 regimes.
  2. if z < 2.1434644401519457e-300

    1. Initial program 6.9

      \[\frac{x \cdot y}{z}\]

    if 2.1434644401519457e-300 < z < 8.719617136183342e-188 or 2.2547275136738512e-175 < z

    1. Initial program 5.9

      \[\frac{x \cdot y}{z}\]
    2. Using strategy rm
    3. Applied associate-/l* 6.2

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}}\]

    if 8.719617136183342e-188 < z < 2.2547275136738512e-175

    1. Initial program 17.3

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

Runtime

Time bar (total: 9.6s) Debug log

Please include this information when filing a bug report:

herbie --seed '#(1425140707 2219112211 325894078 2739722066 2235539986 2733763905)'
(FPCore (x y z)
  :name "Diagrams.Solve.Tridiagonal:solveCyclicTriDiagonal from diagrams-solve-0.1, A"

  :target
  (if (< z -4.262230790519429e-138) (/ (* x y) z) (if (< z 1.7042130660650472e-164) (/ x (/ z y)) (* (/ x z) y)))

  (/ (* x y) z))