\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot x}{y \cdot y} \leq 1.023725945855721 \cdot 10^{+177}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, \frac{x}{y \cdot y}, {\left(\frac{z}{t}\right)}^{2}\right)}{1}\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{x}{y}\right)}^{2}\\
\end{array}
(FPCore (x y z t) :precision binary64 (+ (/ (* x x) (* y y)) (/ (* z z) (* t t))))
(FPCore (x y z t) :precision binary64 (if (<= (/ (* x x) (* y y)) 1.023725945855721e+177) (/ (fma x (/ x (* y y)) (pow (/ z t) 2.0)) 1.0) (pow (/ x y) 2.0)))
double code(double x, double y, double z, double t) {
return ((x * x) / (y * y)) + ((z * z) / (t * t));
}
double code(double x, double y, double z, double t) {
double tmp;
if (((x * x) / (y * y)) <= 1.023725945855721e+177) {
tmp = fma(x, (x / (y * y)), pow((z / t), 2.0)) / 1.0;
} else {
tmp = pow((x / y), 2.0);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 33.7 |
|---|---|
| Target | 0.4 |
| Herbie | 5.9 |
if (/.f64 (*.f64 x x) (*.f64 y y)) < 1.02372594585572098e177Initial program 23.8
Simplified22.1
Applied egg-rr2.4
if 1.02372594585572098e177 < (/.f64 (*.f64 x x) (*.f64 y y)) Initial program 56.8
Simplified46.3
Applied egg-rr38.0
Taylor expanded in x around inf 14.1
Final simplification5.9
herbie shell --seed 2022127
(FPCore (x y z t)
:name "Graphics.Rasterific.Svg.PathConverter:arcToSegments from rasterific-svg-0.2.3.1"
:precision binary64
:herbie-target
(+ (pow (/ x y) 2.0) (pow (/ z t) 2.0))
(+ (/ (* x x) (* y y)) (/ (* z z) (* t t))))