| Alternative 1 | |
|---|---|
| Error | 0.4 |
| Cost | 6720 |
\[\tan \left(\frac{x}{2}\right) \cdot 1.3333333333333333
\]
(FPCore (x) :precision binary64 (/ (* (* (/ 8.0 3.0) (sin (* x 0.5))) (sin (* x 0.5))) (sin x)))
(FPCore (x) :precision binary64 (/ 1.0 (/ 0.75 (tan (/ x 2.0)))))
double code(double x) {
return (((8.0 / 3.0) * sin((x * 0.5))) * sin((x * 0.5))) / sin(x);
}
double code(double x) {
return 1.0 / (0.75 / tan((x / 2.0)));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (((8.0d0 / 3.0d0) * sin((x * 0.5d0))) * sin((x * 0.5d0))) / sin(x)
end function
real(8) function code(x)
real(8), intent (in) :: x
code = 1.0d0 / (0.75d0 / tan((x / 2.0d0)))
end function
public static double code(double x) {
return (((8.0 / 3.0) * Math.sin((x * 0.5))) * Math.sin((x * 0.5))) / Math.sin(x);
}
public static double code(double x) {
return 1.0 / (0.75 / Math.tan((x / 2.0)));
}
def code(x): return (((8.0 / 3.0) * math.sin((x * 0.5))) * math.sin((x * 0.5))) / math.sin(x)
def code(x): return 1.0 / (0.75 / math.tan((x / 2.0)))
function code(x) return Float64(Float64(Float64(Float64(8.0 / 3.0) * sin(Float64(x * 0.5))) * sin(Float64(x * 0.5))) / sin(x)) end
function code(x) return Float64(1.0 / Float64(0.75 / tan(Float64(x / 2.0)))) end
function tmp = code(x) tmp = (((8.0 / 3.0) * sin((x * 0.5))) * sin((x * 0.5))) / sin(x); end
function tmp = code(x) tmp = 1.0 / (0.75 / tan((x / 2.0))); end
code[x_] := N[(N[(N[(N[(8.0 / 3.0), $MachinePrecision] * N[Sin[N[(x * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[N[(x * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[x], $MachinePrecision]), $MachinePrecision]
code[x_] := N[(1.0 / N[(0.75 / N[Tan[N[(x / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\left(\frac{8}{3} \cdot \sin \left(x \cdot 0.5\right)\right) \cdot \sin \left(x \cdot 0.5\right)}{\sin x}
\frac{1}{\frac{0.75}{\tan \left(\frac{x}{2}\right)}}
Results
| Original | 14.5 |
|---|---|
| Target | 0.3 |
| Herbie | 0.3 |
Initial program 14.5
Simplified14.5
Applied egg-rr30.2
Simplified30.2
Applied egg-rr30.2
Taylor expanded in x around inf 30.2
Simplified0.3
Final simplification0.3
| Alternative 1 | |
|---|---|
| Error | 0.4 |
| Cost | 6720 |
| Alternative 2 | |
|---|---|
| Error | 31.1 |
| Cost | 704 |
| Alternative 3 | |
|---|---|
| Error | 29.6 |
| Cost | 704 |
| Alternative 4 | |
|---|---|
| Error | 31.5 |
| Cost | 320 |
| Alternative 5 | |
|---|---|
| Error | 31.5 |
| Cost | 192 |
herbie shell --seed 2022330
(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)))