| Alternative 1 | |
|---|---|
| Error | 1.7 |
| Cost | 51904 |
\[\frac{-4 \cdot \log \left(\frac{1 + {\left(\sqrt{e^{f}}\right)}^{\pi}}{\mathsf{expm1}\left(\left(f \cdot 0.5\right) \cdot \pi\right)}\right)}{\pi}
\]
(FPCore (f)
:precision binary64
(-
(*
(/ 1.0 (/ PI 4.0))
(log
(/
(+ (exp (* (/ PI 4.0) f)) (exp (- (* (/ PI 4.0) f))))
(- (exp (* (/ PI 4.0) f)) (exp (- (* (/ PI 4.0) f)))))))))(FPCore (f)
:precision binary64
(*
(/ -4.0 PI)
(log
(pow
(pow
(/ (+ 1.0 (pow (sqrt (exp f)) PI)) (expm1 (* (* f 0.5) PI)))
0.3333333333333333)
3.0))))double code(double f) {
return -((1.0 / (((double) M_PI) / 4.0)) * log(((exp(((((double) M_PI) / 4.0) * f)) + exp(-((((double) M_PI) / 4.0) * f))) / (exp(((((double) M_PI) / 4.0) * f)) - exp(-((((double) M_PI) / 4.0) * f))))));
}
double code(double f) {
return (-4.0 / ((double) M_PI)) * log(pow(pow(((1.0 + pow(sqrt(exp(f)), ((double) M_PI))) / expm1(((f * 0.5) * ((double) M_PI)))), 0.3333333333333333), 3.0));
}
public static double code(double f) {
return -((1.0 / (Math.PI / 4.0)) * Math.log(((Math.exp(((Math.PI / 4.0) * f)) + Math.exp(-((Math.PI / 4.0) * f))) / (Math.exp(((Math.PI / 4.0) * f)) - Math.exp(-((Math.PI / 4.0) * f))))));
}
public static double code(double f) {
return (-4.0 / Math.PI) * Math.log(Math.pow(Math.pow(((1.0 + Math.pow(Math.sqrt(Math.exp(f)), Math.PI)) / Math.expm1(((f * 0.5) * Math.PI))), 0.3333333333333333), 3.0));
}
def code(f): return -((1.0 / (math.pi / 4.0)) * math.log(((math.exp(((math.pi / 4.0) * f)) + math.exp(-((math.pi / 4.0) * f))) / (math.exp(((math.pi / 4.0) * f)) - math.exp(-((math.pi / 4.0) * f))))))
def code(f): return (-4.0 / math.pi) * math.log(math.pow(math.pow(((1.0 + math.pow(math.sqrt(math.exp(f)), math.pi)) / math.expm1(((f * 0.5) * math.pi))), 0.3333333333333333), 3.0))
function code(f) return Float64(-Float64(Float64(1.0 / Float64(pi / 4.0)) * log(Float64(Float64(exp(Float64(Float64(pi / 4.0) * f)) + exp(Float64(-Float64(Float64(pi / 4.0) * f)))) / Float64(exp(Float64(Float64(pi / 4.0) * f)) - exp(Float64(-Float64(Float64(pi / 4.0) * f)))))))) end
function code(f) return Float64(Float64(-4.0 / pi) * log(((Float64(Float64(1.0 + (sqrt(exp(f)) ^ pi)) / expm1(Float64(Float64(f * 0.5) * pi))) ^ 0.3333333333333333) ^ 3.0))) end
code[f_] := (-N[(N[(1.0 / N[(Pi / 4.0), $MachinePrecision]), $MachinePrecision] * N[Log[N[(N[(N[Exp[N[(N[(Pi / 4.0), $MachinePrecision] * f), $MachinePrecision]], $MachinePrecision] + N[Exp[(-N[(N[(Pi / 4.0), $MachinePrecision] * f), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] / N[(N[Exp[N[(N[(Pi / 4.0), $MachinePrecision] * f), $MachinePrecision]], $MachinePrecision] - N[Exp[(-N[(N[(Pi / 4.0), $MachinePrecision] * f), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])
code[f_] := N[(N[(-4.0 / Pi), $MachinePrecision] * N[Log[N[Power[N[Power[N[(N[(1.0 + N[Power[N[Sqrt[N[Exp[f], $MachinePrecision]], $MachinePrecision], Pi], $MachinePrecision]), $MachinePrecision] / N[(Exp[N[(N[(f * 0.5), $MachinePrecision] * Pi), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision], 0.3333333333333333], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
-\frac{1}{\frac{\pi}{4}} \cdot \log \left(\frac{e^{\frac{\pi}{4} \cdot f} + e^{-\frac{\pi}{4} \cdot f}}{e^{\frac{\pi}{4} \cdot f} - e^{-\frac{\pi}{4} \cdot f}}\right)
\frac{-4}{\pi} \cdot \log \left({\left({\left(\frac{1 + {\left(\sqrt{e^{f}}\right)}^{\pi}}{\mathsf{expm1}\left(\left(f \cdot 0.5\right) \cdot \pi\right)}\right)}^{0.3333333333333333}\right)}^{3}\right)
Results
Initial program 61.5
Simplified1.8
Applied egg-rr32.1
Simplified32.1
Applied egg-rr1.8
Applied egg-rr1.6
| Alternative 1 | |
|---|---|
| Error | 1.7 |
| Cost | 51904 |
| Alternative 2 | |
|---|---|
| Error | 1.8 |
| Cost | 45632 |
| Alternative 3 | |
|---|---|
| Error | 42.3 |
| Cost | 39556 |
| Alternative 4 | |
|---|---|
| Error | 43.7 |
| Cost | 19968 |
| Alternative 5 | |
|---|---|
| Error | 43.8 |
| Cost | 13184 |
| Alternative 6 | |
|---|---|
| Error | 43.8 |
| Cost | 13184 |
herbie shell --seed 2023010
(FPCore (f)
:name "VandenBroeck and Keller, Equation (20)"
:precision binary64
(- (* (/ 1.0 (/ PI 4.0)) (log (/ (+ (exp (* (/ PI 4.0) f)) (exp (- (* (/ PI 4.0) f)))) (- (exp (* (/ PI 4.0) f)) (exp (- (* (/ PI 4.0) f)))))))))