Average Error: 15.9 → 13.3
Time: 2.4m
Precision: 64
Internal Precision: 384
\[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1.0\right) + \frac{y \cdot b}{t}}\]
↓
\[\begin{array}{l}
\mathbf{if}\;t \le -3.97056359992514 \cdot 10^{+146}:\\
\;\;\;\;\frac{1}{\frac{\frac{b}{\frac{t}{y}} + \left(1.0 + a\right)}{x + y \cdot \frac{z}{t}}}\\
\mathbf{if}\;t \le 2.719931656851136 \cdot 10^{+86}:\\
\;\;\;\;\frac{x + \left(y \cdot z\right) \cdot \frac{1}{t}}{\left(a + 1.0\right) + \frac{y \cdot b}{t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\frac{b}{\frac{t}{y}} + \left(1.0 + a\right)}{x + y \cdot \frac{z}{t}}}\\
\end{array}\]
Target
| Original | 15.9 |
|---|
| Target | 13.0 |
|---|
| Herbie | 13.3 |
|---|
\[\begin{array}{l}
\mathbf{if}\;t \lt -1.3659085366310088 \cdot 10^{-271}:\\
\;\;\;\;1 \cdot \left(\left(x + \frac{y}{t} \cdot z\right) \cdot \frac{1}{\left(a + 1.0\right) + \frac{y}{t} \cdot b}\right)\\
\mathbf{if}\;t \lt 3.036967103737246 \cdot 10^{-130}:\\
\;\;\;\;\frac{z}{b}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(\left(x + \frac{y}{t} \cdot z\right) \cdot \frac{1}{\left(a + 1.0\right) + \frac{y}{t} \cdot b}\right)\\
\end{array}\]
Derivation
- Split input into 2 regimes
if t < -3.97056359992514e+146 or 2.719931656851136e+86 < t
Initial program 11.4
\[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1.0\right) + \frac{y \cdot b}{t}}\]
- Using strategy
rm Applied div-inv11.4
\[\leadsto \frac{x + \color{blue}{\left(y \cdot z\right) \cdot \frac{1}{t}}}{\left(a + 1.0\right) + \frac{y \cdot b}{t}}\]
- Using strategy
rm Applied clear-num11.7
\[\leadsto \color{blue}{\frac{1}{\frac{\left(a + 1.0\right) + \frac{y \cdot b}{t}}{x + \left(y \cdot z\right) \cdot \frac{1}{t}}}}\]
Applied simplify2.9
\[\leadsto \frac{1}{\color{blue}{\frac{\frac{b}{\frac{t}{y}} + \left(1.0 + a\right)}{x + y \cdot \frac{z}{t}}}}\]
if -3.97056359992514e+146 < t < 2.719931656851136e+86
Initial program 18.0
\[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1.0\right) + \frac{y \cdot b}{t}}\]
- Using strategy
rm Applied div-inv18.1
\[\leadsto \frac{x + \color{blue}{\left(y \cdot z\right) \cdot \frac{1}{t}}}{\left(a + 1.0\right) + \frac{y \cdot b}{t}}\]
- Recombined 2 regimes into one program.
- Removed slow
pow expressions.
Runtime
herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit +o reduce:binary-search
(FPCore (x y z t a b)
:name "Diagrams.Solve.Tridiagonal:solveCyclicTriDiagonal from diagrams-solve-0.1, B"
:herbie-target
(if (< t -1.3659085366310088e-271) (* 1 (* (+ x (* (/ y t) z)) (/ 1 (+ (+ a 1.0) (* (/ y t) b))))) (if (< t 3.036967103737246e-130) (/ z b) (* 1 (* (+ x (* (/ y t) z)) (/ 1 (+ (+ a 1.0) (* (/ y t) b)))))))
(/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))))