\frac{x}{y} \cdot \left(z - t\right) + t\begin{array}{l}
\mathbf{if}\;x \leq -1.1433554134386932 \cdot 10^{+53}:\\
\;\;\;\;t + x \cdot \frac{z - t}{y}\\
\mathbf{elif}\;x \leq 2.865953165408925 \cdot 10^{-142}:\\
\;\;\;\;t + \frac{x \cdot \left(z - t\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;t + \sqrt{x} \cdot \left(\left(z - t\right) \cdot \frac{\sqrt{x}}{y}\right)\\
\end{array}(FPCore (x y z t) :precision binary64 (+ (* (/ x y) (- z t)) t))
(FPCore (x y z t)
:precision binary64
(if (<= x -1.1433554134386932e+53)
(+ t (* x (/ (- z t) y)))
(if (<= x 2.865953165408925e-142)
(+ t (/ (* x (- z t)) y))
(+ t (* (sqrt x) (* (- z t) (/ (sqrt x) y)))))))double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + t;
}
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.1433554134386932e+53) {
tmp = t + (x * ((z - t) / y));
} else if (x <= 2.865953165408925e-142) {
tmp = t + ((x * (z - t)) / y);
} else {
tmp = t + (sqrt(x) * ((z - t) * (sqrt(x) / y)));
}
return tmp;
}













Bits error versus x













Bits error versus y













Bits error versus z













Bits error versus t
Results
| Original | 2.1 |
|---|---|
| Target | 2.4 |
| Herbie | 1.7 |
| Alternative 1 | |
|---|---|
| Error | 1.0 |
| Cost | 39488 |
| Alternative 2 | |
|---|---|
| Error | 2.3 |
| Cost | 904 |
| Alternative 3 | |
|---|---|
| Error | 2.1 |
| Cost | 904 |
| Alternative 4 | |
|---|---|
| Error | 4.1 |
| Cost | 1411 |
| Alternative 5 | |
|---|---|
| Error | 11.9 |
| Cost | 2783 |
| Alternative 6 | |
|---|---|
| Error | 12.8 |
| Cost | 2783 |
| Alternative 7 | |
|---|---|
| Error | 13.6 |
| Cost | 776 |
| Alternative 8 | |
|---|---|
| Error | 24.3 |
| Cost | 448 |
| Alternative 9 | |
|---|---|
| Error | 61.8 |
| Cost | 64 |

if x < -1.14335541343869316e53Initial program 4.5
rmApplied div-inv_binary64_143974.6
Applied associate-*l*_binary64_143412.5
Simplified2.5
Simplified2.5
if -1.14335541343869316e53 < x < 2.86595316540892498e-142Initial program 1.2
rmApplied associate-*l/_binary64_143431.2
Simplified1.2
if 2.86595316540892498e-142 < x Initial program 2.4
rmApplied *-un-lft-identity_binary64_144002.4
Applied add-sqr-sqrt_binary64_144222.6
Applied times-frac_binary64_144062.6
Applied associate-*l*_binary64_143412.1
Simplified2.1
Simplified2.1
Final simplification1.7
herbie shell --seed 2021044
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
:precision binary64
:herbie-target
(if (< z 2.759456554562692e-282) (+ (* (/ x y) (- z t)) t) (if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t)))
(+ (* (/ x y) (- z t)) t))