Average Error: 4.5 → 4.5
Time: 56.1s
Precision: 64
Internal precision: 128
\[x \cdot \left(\frac{y}{z} - \frac{t}{1.0 - z}\right)\]
⬇
\[\begin{array}{l}
\mathbf{if}\;z \le -3.419654050674021 \cdot 10^{+32}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - \frac{t}{1.0 - z}\right)\\
\mathbf{if}\;z \le 5.012870678088807 \cdot 10^{-64}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1.0 - z}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - \frac{t}{1.0 - z}\right)\\
\end{array}\]
Target
| Original | 4.5 |
| Comparison | 4.2 |
| Herbie | 4.5 |
\[ \begin{array}{l}
\mathbf{if}\;x \cdot \left(\frac{y}{z} - \frac{t}{1.0 - z}\right) \lt -7.623226303312042 \cdot 10^{-196}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1.0 - z}\right)\\
\mathbf{if}\;x \cdot \left(\frac{y}{z} - \frac{t}{1.0 - z}\right) \lt 1.4133944927702302 \cdot 10^{-211}:\\
\;\;\;\;\frac{y \cdot x}{z} + \left(-\frac{t \cdot x}{1.0 - z}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1.0 - z}\right)\\
\end{array} \]
Derivation
- Split input into 2 regimes.
-
if z < -3.419654050674021e+32 or 5.012870678088807e-64 < z
Initial program 2.3
\[x \cdot \left(\frac{y}{z} - \frac{t}{1.0 - z}\right)\]
if -3.419654050674021e+32 < z < 5.012870678088807e-64
Initial program 8.0
\[x \cdot \left(\frac{y}{z} - \frac{t}{1.0 - z}\right)\]
- Using strategy
rm
Applied div-inv 8.0
\[\leadsto x \cdot \left(\frac{y}{z} - \color{blue}{t \cdot \frac{1}{1.0 - z}}\right)\]
- Recombined 2 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie --seed '#(2793257380 3094807930 3205236181 503322065 4225904532 3249456527)'
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
:target
(if (< (* x (- (/ y z) (/ t (- 1.0 z)))) -7.623226303312042e-196) (* x (- (/ y z) (* t (/ 1 (- 1.0 z))))) (if (< (* x (- (/ y z) (/ t (- 1.0 z)))) 1.4133944927702302e-211) (+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z)))) (* x (- (/ y z) (* t (/ 1 (- 1.0 z)))))))
(* x (- (/ y z) (/ t (- 1.0 z)))))