\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 2.276682948737203 \cdot 10^{+305}:\\
\;\;\;\;\frac{1}{\sqrt[3]{y} \cdot \sqrt[3]{y}} \cdot \left(\frac{x}{y} \cdot \frac{x}{\sqrt[3]{y}}\right) + \frac{z}{t} \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \left(\frac{z}{t} \cdot \frac{\sqrt[3]{z}}{t}\right)\\
\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)) 2.276682948737203e+305)
(+
(* (/ 1.0 (* (cbrt y) (cbrt y))) (* (/ x y) (/ x (cbrt y))))
(* (/ z t) (/ z t)))
(+
(* (/ x y) (/ x y))
(* (* (cbrt z) (cbrt z)) (* (/ z t) (/ (cbrt z) t))))))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)) <= 2.276682948737203e+305) {
tmp = ((1.0 / (cbrt(y) * cbrt(y))) * ((x / y) * (x / cbrt(y)))) + ((z / t) * (z / t));
} else {
tmp = ((x / y) * (x / y)) + ((cbrt(z) * cbrt(z)) * ((z / t) * (cbrt(z) / t)));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 33.6 |
|---|---|
| Target | 0.4 |
| Herbie | 1.4 |
if (/.f64 (*.f64 x x) (*.f64 y y)) < 2.27668294873720283e305Initial program 23.4
rmApplied times-frac_binary64_105304.1
rmApplied times-frac_binary64_105300.4
rmApplied add-cube-cbrt_binary64_105560.7
Applied *-un-lft-identity_binary64_105240.7
Applied times-frac_binary64_105300.7
Applied associate-*l*_binary64_104671.1
Simplified1.1
if 2.27668294873720283e305 < (/.f64 (*.f64 x x) (*.f64 y y)) Initial program 63.8
rmApplied times-frac_binary64_1053063.7
rmApplied times-frac_binary64_105300.5
rmApplied *-un-lft-identity_binary64_105240.5
Applied add-cube-cbrt_binary64_105560.7
Applied times-frac_binary64_105300.7
Applied associate-*l*_binary64_104672.1
Simplified2.1
Final simplification1.4
herbie shell --seed 2020281
(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))))