\frac{\left(\frac{8}{3} \cdot \sin \left(x \cdot 0.5\right)\right) \cdot \sin \left(x \cdot 0.5\right)}{\sin x}\begin{array}{l}
\mathbf{if}\;x \leq -1.428402078863971 \cdot 10^{-08}:\\
\;\;\;\;{\sin \left(x \cdot 0.5\right)}^{2} \cdot \frac{2.6666666666666665}{\sin x}\\
\mathbf{elif}\;x \leq 5.195819335128253 \cdot 10^{-77}:\\
\;\;\;\;\left(\sin \left(x \cdot 0.5\right) \cdot \sqrt[3]{18.962962962962962}\right) \cdot \sqrt[3]{0.125}\\
\mathbf{else}:\\
\;\;\;\;2.6666666666666665 \cdot \frac{{\sin \left(x \cdot 0.5\right)}^{2}}{\sin x}\\
\end{array}(FPCore (x) :precision binary64 (/ (* (* (/ 8.0 3.0) (sin (* x 0.5))) (sin (* x 0.5))) (sin x)))
(FPCore (x)
:precision binary64
(if (<= x -1.428402078863971e-08)
(* (pow (sin (* x 0.5)) 2.0) (/ 2.6666666666666665 (sin x)))
(if (<= x 5.195819335128253e-77)
(* (* (sin (* x 0.5)) (cbrt 18.962962962962962)) (cbrt 0.125))
(* 2.6666666666666665 (/ (pow (sin (* x 0.5)) 2.0) (sin x))))))double code(double x) {
return (((8.0 / 3.0) * sin(x * 0.5)) * sin(x * 0.5)) / sin(x);
}
double code(double x) {
double tmp;
if (x <= -1.428402078863971e-08) {
tmp = pow(sin(x * 0.5), 2.0) * (2.6666666666666665 / sin(x));
} else if (x <= 5.195819335128253e-77) {
tmp = (sin(x * 0.5) * cbrt(18.962962962962962)) * cbrt(0.125);
} else {
tmp = 2.6666666666666665 * (pow(sin(x * 0.5), 2.0) / sin(x));
}
return tmp;
}













Bits error versus x
Results
| Original | 14.6 |
|---|---|
| Target | 0.3 |
| Herbie | 0.5 |
| Alternative 1 | |
|---|---|
| Error | 0.5 |
| Cost | 32832 |
| Alternative 2 | |
|---|---|
| Error | 0.5 |
| Cost | 19904 |
| Alternative 3 | |
|---|---|
| Error | 0.4 |
| Cost | 20040 |
| Alternative 4 | |
|---|---|
| Error | 29.1 |
| Cost | 19648 |
| Alternative 5 | |
|---|---|
| Error | 29.3 |
| Cost | 13248 |
| Alternative 6 | |
|---|---|
| Error | 29.4 |
| Cost | 7554 |
| Alternative 7 | |
|---|---|
| Error | 29.5 |
| Cost | 834 |
| Alternative 8 | |
|---|---|
| Error | 59.5 |
| Cost | 64 |
| Alternative 9 | |
|---|---|
| Error | 59.6 |
| Cost | 64 |

if x < -1.4284020788639711e-8Initial program 0.6
Simplified0.6
rmApplied *-un-lft-identity_binary64_171280.6
Applied times-frac_binary64_171340.6
Simplified0.6
Simplified0.6
rmApplied *-un-lft-identity_binary64_171280.6
Applied times-frac_binary64_171340.6
Applied associate-*r*_binary64_170680.6
Simplified0.6
Simplified0.6
if -1.4284020788639711e-8 < x < 5.195819335128253e-77Initial program 33.2
Simplified33.2
rmApplied *-un-lft-identity_binary64_1712833.2
Applied times-frac_binary64_171340.3
Simplified0.3
Simplified0.3
rmApplied add-cbrt-cube_binary64_171640.8
Simplified0.7
rmApplied cbrt-prod_binary64_171590.3
Applied associate-*r*_binary64_170680.3
Taylor expanded around 0 0.3
Simplified0.3
if 5.195819335128253e-77 < x Initial program 0.6
Simplified0.6
Taylor expanded around inf 0.6
Simplified0.6
Simplified0.6
Final simplification0.5
herbie shell --seed 2021044
(FPCore (x)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, A"
:precision binary64
:herbie-target
(/ (/ (* 8.0 (sin (* x 0.5))) 3.0) (/ (sin x) (sin (* x 0.5))))
(/ (* (* (/ 8.0 3.0) (sin (* x 0.5))) (sin (* x 0.5))) (sin x)))