-\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)\begin{array}{l}
\mathbf{if}\;\frac{\pi}{4} \cdot f \leq 34.04800377750026:\\
\;\;\;\;-\frac{\log \left(\frac{1}{\sqrt{\sinh \left(\frac{\pi}{4} \cdot f\right)}} \cdot \frac{\cosh \left(\frac{\pi}{4} \cdot f\right)}{\sqrt{\sinh \left(\frac{\pi}{4} \cdot f\right)}}\right) + \log 1}{\frac{\pi}{4}}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}(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
(if (<= (* (/ PI 4.0) f) 34.04800377750026)
(-
(/
(+
(log
(*
(/ 1.0 (sqrt (sinh (* (/ PI 4.0) f))))
(/ (cosh (* (/ PI 4.0) f)) (sqrt (sinh (* (/ PI 4.0) f))))))
(log 1.0))
(/ PI 4.0)))
0.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) {
double tmp;
if (((((double) M_PI) / 4.0) * f) <= 34.04800377750026) {
tmp = -((log((1.0 / sqrt(sinh((((double) M_PI) / 4.0) * f))) * (cosh((((double) M_PI) / 4.0) * f) / sqrt(sinh((((double) M_PI) / 4.0) * f)))) + log(1.0)) / (((double) M_PI) / 4.0));
} else {
tmp = 0.0;
}
return tmp;
}













Bits error versus f
Results
| Alternative 1 | |
|---|---|
| Error | 0.7 |
| Cost | 20737 |
| Alternative 2 | |
|---|---|
| Error | 1.0 |
| Cost | 14209 |
| Alternative 3 | |
|---|---|
| Error | 1.1 |
| Cost | 14273 |
| Alternative 4 | |
|---|---|
| Error | 1.1 |
| Cost | 7809 |
| Alternative 5 | |
|---|---|
| Error | 1.2 |
| Cost | 7809 |
| Alternative 6 | |
|---|---|
| Error | 1.4 |
| Cost | 7297 |
| Alternative 7 | |
|---|---|
| Error | 1.5 |
| Cost | 7297 |
| Alternative 8 | |
|---|---|
| Error | 54.0 |
| Cost | 385 |
| Alternative 9 | |
|---|---|
| Error | 60.8 |
| Cost | 64 |
| Alternative 10 | |
|---|---|
| Error | 63.0 |
| Cost | 64 |


if (*.f64 (/.f64 PI.f64 4) f) < 34.0480037775002629Initial program 61.5
rmApplied sinh-undef_binary640.6
Applied cosh-undef_binary640.6
Applied times-frac_binary640.6
Applied log-prod_binary640.6
Simplified0.6
rmApplied associate-*l/_binary640.5
Simplified0.5
rmApplied add-sqr-sqrt_binary640.5
Applied *-un-lft-identity_binary640.5
Applied times-frac_binary640.5
Simplified0.5
if 34.0480037775002629 < (*.f64 (/.f64 PI.f64 4) f) Initial program 8.8
Simplified8.8
Final simplification0.7
herbie shell --seed 2021065
(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)))))))))