\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\begin{array}{l}
\mathbf{if}\;z \leq -9.328497088022616 \cdot 10^{+141}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{elif}\;z \leq 1.0879556616863109 \cdot 10^{+222}:\\
\;\;\;\;\frac{x + \frac{z \cdot y - x}{z \cdot t - x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{x}{x + 1} + \frac{y}{t \cdot \left(x + 1\right)}\right) - \frac{x}{z \cdot \left(t \cdot \left(x + 1\right)\right)}\\
\end{array}(FPCore (x y z t) :precision binary64 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
(FPCore (x y z t)
:precision binary64
(if (<= z -9.328497088022616e+141)
(/ (+ x (/ y t)) (+ x 1.0))
(if (<= z 1.0879556616863109e+222)
(/ (+ x (/ (- (* z y) x) (- (* z t) x))) (+ x 1.0))
(-
(+ (/ x (+ x 1.0)) (/ y (* t (+ x 1.0))))
(/ x (* z (* t (+ x 1.0))))))))double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -9.328497088022616e+141) {
tmp = (x + (y / t)) / (x + 1.0);
} else if (z <= 1.0879556616863109e+222) {
tmp = (x + (((z * y) - x) / ((z * t) - x))) / (x + 1.0);
} else {
tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) - (x / (z * (t * (x + 1.0))));
}
return tmp;
}













Bits error versus x













Bits error versus y













Bits error versus z













Bits error versus t
Results
| Original | 7.3 |
|---|---|
| Target | 0.3 |
| Herbie | 3.8 |
| Alternative 1 | |
|---|---|
| Error | 3.8 |
| Cost | 1416 |
| Alternative 2 | |
|---|---|
| Error | 10.1 |
| Cost | 2244 |
| Alternative 3 | |
|---|---|
| Error | 11.7 |
| Cost | 1160 |
| Alternative 4 | |
|---|---|
| Error | 11.7 |
| Cost | 1032 |
| Alternative 5 | |
|---|---|
| Error | 14.5 |
| Cost | 1218 |
| Alternative 6 | |
|---|---|
| Error | 20.9 |
| Cost | 776 |
| Alternative 7 | |
|---|---|
| Error | 20.9 |
| Cost | 648 |
| Alternative 8 | |
|---|---|
| Error | 21.0 |
| Cost | 834 |
| Alternative 9 | |
|---|---|
| Error | 28.3 |
| Cost | 64 |

if z < -9.32849708802261581e141Initial program 21.6
Taylor expanded around inf 6.4
Simplified6.4
if -9.32849708802261581e141 < z < 1.0879556616863109e222Initial program 3.2
Simplified3.2
if 1.0879556616863109e222 < z Initial program 27.5
Taylor expanded around inf 4.9
Simplified5.6
Simplified5.6
Final simplification3.8
herbie shell --seed 2021044
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:herbie-target
(/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))