VandenBroeck and Keller, Equation (20)

Percentage Accurate: 6.7% → 96.7%
Time: 20.7s
Alternatives: 14
Speedup: 1027.0×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\pi}{4} \cdot f\\ t_1 := e^{t_0}\\ t_2 := e^{-t_0}\\ -\frac{1}{\frac{\pi}{4}} \cdot \log \left(\frac{t_1 + t_2}{t_1 - t_2}\right) \end{array} \end{array} \]
(FPCore (f)
 :precision binary64
 (let* ((t_0 (* (/ PI 4.0) f)) (t_1 (exp t_0)) (t_2 (exp (- t_0))))
   (- (* (/ 1.0 (/ PI 4.0)) (log (/ (+ t_1 t_2) (- t_1 t_2)))))))
double code(double f) {
	double t_0 = (((double) M_PI) / 4.0) * f;
	double t_1 = exp(t_0);
	double t_2 = exp(-t_0);
	return -((1.0 / (((double) M_PI) / 4.0)) * log(((t_1 + t_2) / (t_1 - t_2))));
}
public static double code(double f) {
	double t_0 = (Math.PI / 4.0) * f;
	double t_1 = Math.exp(t_0);
	double t_2 = Math.exp(-t_0);
	return -((1.0 / (Math.PI / 4.0)) * Math.log(((t_1 + t_2) / (t_1 - t_2))));
}
def code(f):
	t_0 = (math.pi / 4.0) * f
	t_1 = math.exp(t_0)
	t_2 = math.exp(-t_0)
	return -((1.0 / (math.pi / 4.0)) * math.log(((t_1 + t_2) / (t_1 - t_2))))
function code(f)
	t_0 = Float64(Float64(pi / 4.0) * f)
	t_1 = exp(t_0)
	t_2 = exp(Float64(-t_0))
	return Float64(-Float64(Float64(1.0 / Float64(pi / 4.0)) * log(Float64(Float64(t_1 + t_2) / Float64(t_1 - t_2)))))
end
function tmp = code(f)
	t_0 = (pi / 4.0) * f;
	t_1 = exp(t_0);
	t_2 = exp(-t_0);
	tmp = -((1.0 / (pi / 4.0)) * log(((t_1 + t_2) / (t_1 - t_2))));
end
code[f_] := Block[{t$95$0 = N[(N[(Pi / 4.0), $MachinePrecision] * f), $MachinePrecision]}, Block[{t$95$1 = N[Exp[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[Exp[(-t$95$0)], $MachinePrecision]}, (-N[(N[(1.0 / N[(Pi / 4.0), $MachinePrecision]), $MachinePrecision] * N[Log[N[(N[(t$95$1 + t$95$2), $MachinePrecision] / N[(t$95$1 - t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\pi}{4} \cdot f\\
t_1 := e^{t_0}\\
t_2 := e^{-t_0}\\
-\frac{1}{\frac{\pi}{4}} \cdot \log \left(\frac{t_1 + t_2}{t_1 - t_2}\right)
\end{array}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 14 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 6.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\pi}{4} \cdot f\\ t_1 := e^{t_0}\\ t_2 := e^{-t_0}\\ -\frac{1}{\frac{\pi}{4}} \cdot \log \left(\frac{t_1 + t_2}{t_1 - t_2}\right) \end{array} \end{array} \]
(FPCore (f)
 :precision binary64
 (let* ((t_0 (* (/ PI 4.0) f)) (t_1 (exp t_0)) (t_2 (exp (- t_0))))
   (- (* (/ 1.0 (/ PI 4.0)) (log (/ (+ t_1 t_2) (- t_1 t_2)))))))
double code(double f) {
	double t_0 = (((double) M_PI) / 4.0) * f;
	double t_1 = exp(t_0);
	double t_2 = exp(-t_0);
	return -((1.0 / (((double) M_PI) / 4.0)) * log(((t_1 + t_2) / (t_1 - t_2))));
}
public static double code(double f) {
	double t_0 = (Math.PI / 4.0) * f;
	double t_1 = Math.exp(t_0);
	double t_2 = Math.exp(-t_0);
	return -((1.0 / (Math.PI / 4.0)) * Math.log(((t_1 + t_2) / (t_1 - t_2))));
}
def code(f):
	t_0 = (math.pi / 4.0) * f
	t_1 = math.exp(t_0)
	t_2 = math.exp(-t_0)
	return -((1.0 / (math.pi / 4.0)) * math.log(((t_1 + t_2) / (t_1 - t_2))))
function code(f)
	t_0 = Float64(Float64(pi / 4.0) * f)
	t_1 = exp(t_0)
	t_2 = exp(Float64(-t_0))
	return Float64(-Float64(Float64(1.0 / Float64(pi / 4.0)) * log(Float64(Float64(t_1 + t_2) / Float64(t_1 - t_2)))))
end
function tmp = code(f)
	t_0 = (pi / 4.0) * f;
	t_1 = exp(t_0);
	t_2 = exp(-t_0);
	tmp = -((1.0 / (pi / 4.0)) * log(((t_1 + t_2) / (t_1 - t_2))));
end
code[f_] := Block[{t$95$0 = N[(N[(Pi / 4.0), $MachinePrecision] * f), $MachinePrecision]}, Block[{t$95$1 = N[Exp[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[Exp[(-t$95$0)], $MachinePrecision]}, (-N[(N[(1.0 / N[(Pi / 4.0), $MachinePrecision]), $MachinePrecision] * N[Log[N[(N[(t$95$1 + t$95$2), $MachinePrecision] / N[(t$95$1 - t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\pi}{4} \cdot f\\
t_1 := e^{t_0}\\
t_2 := e^{-t_0}\\
-\frac{1}{\frac{\pi}{4}} \cdot \log \left(\frac{t_1 + t_2}{t_1 - t_2}\right)
\end{array}
\end{array}

Alternative 1: 96.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \frac{\log \left(\frac{e^{0.25 \cdot \left(\pi \cdot \left(-f\right)\right)} + e^{0.25 \cdot \left(f \cdot \pi\right)}}{\mathsf{fma}\left(f, \pi \cdot 0.5, \mathsf{fma}\left({f}^{3}, {\pi}^{3} \cdot 0.005208333333333333, \mathsf{fma}\left({f}^{7}, {\pi}^{7} \cdot 2.422030009920635 \cdot 10^{-8}, 1.6276041666666666 \cdot 10^{-5} \cdot \left({f}^{5} \cdot {\pi}^{5}\right)\right)\right)\right)}\right)}{\pi} \cdot -4 \end{array} \]
(FPCore (f)
 :precision binary64
 (*
  (/
   (log
    (/
     (+ (exp (* 0.25 (* PI (- f)))) (exp (* 0.25 (* f PI))))
     (fma
      f
      (* PI 0.5)
      (fma
       (pow f 3.0)
       (* (pow PI 3.0) 0.005208333333333333)
       (fma
        (pow f 7.0)
        (* (pow PI 7.0) 2.422030009920635e-8)
        (* 1.6276041666666666e-5 (* (pow f 5.0) (pow PI 5.0))))))))
   PI)
  -4.0))
double code(double f) {
	return (log(((exp((0.25 * (((double) M_PI) * -f))) + exp((0.25 * (f * ((double) M_PI))))) / fma(f, (((double) M_PI) * 0.5), fma(pow(f, 3.0), (pow(((double) M_PI), 3.0) * 0.005208333333333333), fma(pow(f, 7.0), (pow(((double) M_PI), 7.0) * 2.422030009920635e-8), (1.6276041666666666e-5 * (pow(f, 5.0) * pow(((double) M_PI), 5.0)))))))) / ((double) M_PI)) * -4.0;
}
function code(f)
	return Float64(Float64(log(Float64(Float64(exp(Float64(0.25 * Float64(pi * Float64(-f)))) + exp(Float64(0.25 * Float64(f * pi)))) / fma(f, Float64(pi * 0.5), fma((f ^ 3.0), Float64((pi ^ 3.0) * 0.005208333333333333), fma((f ^ 7.0), Float64((pi ^ 7.0) * 2.422030009920635e-8), Float64(1.6276041666666666e-5 * Float64((f ^ 5.0) * (pi ^ 5.0)))))))) / pi) * -4.0)
end
code[f_] := N[(N[(N[Log[N[(N[(N[Exp[N[(0.25 * N[(Pi * (-f)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(0.25 * N[(f * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(f * N[(Pi * 0.5), $MachinePrecision] + N[(N[Power[f, 3.0], $MachinePrecision] * N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.005208333333333333), $MachinePrecision] + N[(N[Power[f, 7.0], $MachinePrecision] * N[(N[Power[Pi, 7.0], $MachinePrecision] * 2.422030009920635e-8), $MachinePrecision] + N[(1.6276041666666666e-5 * N[(N[Power[f, 5.0], $MachinePrecision] * N[Power[Pi, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * -4.0), $MachinePrecision]
\begin{array}{l}

\\
\frac{\log \left(\frac{e^{0.25 \cdot \left(\pi \cdot \left(-f\right)\right)} + e^{0.25 \cdot \left(f \cdot \pi\right)}}{\mathsf{fma}\left(f, \pi \cdot 0.5, \mathsf{fma}\left({f}^{3}, {\pi}^{3} \cdot 0.005208333333333333, \mathsf{fma}\left({f}^{7}, {\pi}^{7} \cdot 2.422030009920635 \cdot 10^{-8}, 1.6276041666666666 \cdot 10^{-5} \cdot \left({f}^{5} \cdot {\pi}^{5}\right)\right)\right)\right)}\right)}{\pi} \cdot -4
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 2: 96.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \frac{\log \left(\frac{e^{0.25 \cdot \left(\pi \cdot \left(-f\right)\right)} + e^{0.25 \cdot \left(f \cdot \pi\right)}}{\mathsf{fma}\left(f, \pi \cdot 0.5, \mathsf{fma}\left({f}^{3}, {\pi}^{3} \cdot 0.005208333333333333, {f}^{5} \cdot \left(1.6276041666666666 \cdot 10^{-5} \cdot {\pi}^{5}\right)\right)\right)}\right)}{\pi} \cdot -4 \end{array} \]
(FPCore (f)
 :precision binary64
 (*
  (/
   (log
    (/
     (+ (exp (* 0.25 (* PI (- f)))) (exp (* 0.25 (* f PI))))
     (fma
      f
      (* PI 0.5)
      (fma
       (pow f 3.0)
       (* (pow PI 3.0) 0.005208333333333333)
       (* (pow f 5.0) (* 1.6276041666666666e-5 (pow PI 5.0)))))))
   PI)
  -4.0))
double code(double f) {
	return (log(((exp((0.25 * (((double) M_PI) * -f))) + exp((0.25 * (f * ((double) M_PI))))) / fma(f, (((double) M_PI) * 0.5), fma(pow(f, 3.0), (pow(((double) M_PI), 3.0) * 0.005208333333333333), (pow(f, 5.0) * (1.6276041666666666e-5 * pow(((double) M_PI), 5.0))))))) / ((double) M_PI)) * -4.0;
}
function code(f)
	return Float64(Float64(log(Float64(Float64(exp(Float64(0.25 * Float64(pi * Float64(-f)))) + exp(Float64(0.25 * Float64(f * pi)))) / fma(f, Float64(pi * 0.5), fma((f ^ 3.0), Float64((pi ^ 3.0) * 0.005208333333333333), Float64((f ^ 5.0) * Float64(1.6276041666666666e-5 * (pi ^ 5.0))))))) / pi) * -4.0)
end
code[f_] := N[(N[(N[Log[N[(N[(N[Exp[N[(0.25 * N[(Pi * (-f)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(0.25 * N[(f * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(f * N[(Pi * 0.5), $MachinePrecision] + N[(N[Power[f, 3.0], $MachinePrecision] * N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.005208333333333333), $MachinePrecision] + N[(N[Power[f, 5.0], $MachinePrecision] * N[(1.6276041666666666e-5 * N[Power[Pi, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * -4.0), $MachinePrecision]
\begin{array}{l}

\\
\frac{\log \left(\frac{e^{0.25 \cdot \left(\pi \cdot \left(-f\right)\right)} + e^{0.25 \cdot \left(f \cdot \pi\right)}}{\mathsf{fma}\left(f, \pi \cdot 0.5, \mathsf{fma}\left({f}^{3}, {\pi}^{3} \cdot 0.005208333333333333, {f}^{5} \cdot \left(1.6276041666666666 \cdot 10^{-5} \cdot {\pi}^{5}\right)\right)\right)}\right)}{\pi} \cdot -4
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 3: 96.5% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \frac{\log \left(\frac{e^{0.25 \cdot \left(\pi \cdot \left(-f\right)\right)} + e^{0.25 \cdot \left(f \cdot \pi\right)}}{\mathsf{fma}\left(f, \pi \cdot 0.5, {f}^{3} \cdot \left({\pi}^{3} \cdot 0.005208333333333333\right)\right)}\right)}{\pi} \cdot -4 \end{array} \]
(FPCore (f)
 :precision binary64
 (*
  (/
   (log
    (/
     (+ (exp (* 0.25 (* PI (- f)))) (exp (* 0.25 (* f PI))))
     (fma f (* PI 0.5) (* (pow f 3.0) (* (pow PI 3.0) 0.005208333333333333)))))
   PI)
  -4.0))
double code(double f) {
	return (log(((exp((0.25 * (((double) M_PI) * -f))) + exp((0.25 * (f * ((double) M_PI))))) / fma(f, (((double) M_PI) * 0.5), (pow(f, 3.0) * (pow(((double) M_PI), 3.0) * 0.005208333333333333))))) / ((double) M_PI)) * -4.0;
}
function code(f)
	return Float64(Float64(log(Float64(Float64(exp(Float64(0.25 * Float64(pi * Float64(-f)))) + exp(Float64(0.25 * Float64(f * pi)))) / fma(f, Float64(pi * 0.5), Float64((f ^ 3.0) * Float64((pi ^ 3.0) * 0.005208333333333333))))) / pi) * -4.0)
end
code[f_] := N[(N[(N[Log[N[(N[(N[Exp[N[(0.25 * N[(Pi * (-f)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(0.25 * N[(f * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(f * N[(Pi * 0.5), $MachinePrecision] + N[(N[Power[f, 3.0], $MachinePrecision] * N[(N[Power[Pi, 3.0], $MachinePrecision] * 0.005208333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * -4.0), $MachinePrecision]
\begin{array}{l}

\\
\frac{\log \left(\frac{e^{0.25 \cdot \left(\pi \cdot \left(-f\right)\right)} + e^{0.25 \cdot \left(f \cdot \pi\right)}}{\mathsf{fma}\left(f, \pi \cdot 0.5, {f}^{3} \cdot \left({\pi}^{3} \cdot 0.005208333333333333\right)\right)}\right)}{\pi} \cdot -4
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 4: 96.5% accurate, 1.4× speedup?

\[\begin{array}{l} \\ -\mathsf{fma}\left(4, \frac{\log \left(\frac{4}{\pi}\right) - \log f}{\pi}, {f}^{2} \cdot \left(\pi \cdot 0.08333333333333333\right)\right) \end{array} \]
(FPCore (f)
 :precision binary64
 (-
  (fma
   4.0
   (/ (- (log (/ 4.0 PI)) (log f)) PI)
   (* (pow f 2.0) (* PI 0.08333333333333333)))))
double code(double f) {
	return -fma(4.0, ((log((4.0 / ((double) M_PI))) - log(f)) / ((double) M_PI)), (pow(f, 2.0) * (((double) M_PI) * 0.08333333333333333)));
}
function code(f)
	return Float64(-fma(4.0, Float64(Float64(log(Float64(4.0 / pi)) - log(f)) / pi), Float64((f ^ 2.0) * Float64(pi * 0.08333333333333333))))
end
code[f_] := (-N[(4.0 * N[(N[(N[Log[N[(4.0 / Pi), $MachinePrecision]], $MachinePrecision] - N[Log[f], $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision] + N[(N[Power[f, 2.0], $MachinePrecision] * N[(Pi * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])
\begin{array}{l}

\\
-\mathsf{fma}\left(4, \frac{\log \left(\frac{4}{\pi}\right) - \log f}{\pi}, {f}^{2} \cdot \left(\pi \cdot 0.08333333333333333\right)\right)
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 5: 96.1% accurate, 1.7× speedup?

\[\begin{array}{l} \\ 4 \cdot \frac{\log f - \log \left(\frac{4}{\pi}\right)}{\pi} - 0.125 \cdot \left(\pi \cdot {f}^{2}\right) \end{array} \]
(FPCore (f)
 :precision binary64
 (- (* 4.0 (/ (- (log f) (log (/ 4.0 PI))) PI)) (* 0.125 (* PI (pow f 2.0)))))
double code(double f) {
	return (4.0 * ((log(f) - log((4.0 / ((double) M_PI)))) / ((double) M_PI))) - (0.125 * (((double) M_PI) * pow(f, 2.0)));
}
public static double code(double f) {
	return (4.0 * ((Math.log(f) - Math.log((4.0 / Math.PI))) / Math.PI)) - (0.125 * (Math.PI * Math.pow(f, 2.0)));
}
def code(f):
	return (4.0 * ((math.log(f) - math.log((4.0 / math.pi))) / math.pi)) - (0.125 * (math.pi * math.pow(f, 2.0)))
function code(f)
	return Float64(Float64(4.0 * Float64(Float64(log(f) - log(Float64(4.0 / pi))) / pi)) - Float64(0.125 * Float64(pi * (f ^ 2.0))))
end
function tmp = code(f)
	tmp = (4.0 * ((log(f) - log((4.0 / pi))) / pi)) - (0.125 * (pi * (f ^ 2.0)));
end
code[f_] := N[(N[(4.0 * N[(N[(N[Log[f], $MachinePrecision] - N[Log[N[(4.0 / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision] - N[(0.125 * N[(Pi * N[Power[f, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
4 \cdot \frac{\log f - \log \left(\frac{4}{\pi}\right)}{\pi} - 0.125 \cdot \left(\pi \cdot {f}^{2}\right)
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 6: 96.0% accurate, 2.5× speedup?

\[\begin{array}{l} \\ 4 \cdot \frac{\log f - \log \left(\frac{4}{\pi}\right)}{\pi} \end{array} \]
(FPCore (f) :precision binary64 (* 4.0 (/ (- (log f) (log (/ 4.0 PI))) PI)))
double code(double f) {
	return 4.0 * ((log(f) - log((4.0 / ((double) M_PI)))) / ((double) M_PI));
}
public static double code(double f) {
	return 4.0 * ((Math.log(f) - Math.log((4.0 / Math.PI))) / Math.PI);
}
def code(f):
	return 4.0 * ((math.log(f) - math.log((4.0 / math.pi))) / math.pi)
function code(f)
	return Float64(4.0 * Float64(Float64(log(f) - log(Float64(4.0 / pi))) / pi))
end
function tmp = code(f)
	tmp = 4.0 * ((log(f) - log((4.0 / pi))) / pi);
end
code[f_] := N[(4.0 * N[(N[(N[Log[f], $MachinePrecision] - N[Log[N[(4.0 / Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
4 \cdot \frac{\log f - \log \left(\frac{4}{\pi}\right)}{\pi}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 7: 96.0% accurate, 3.3× speedup?

\[\begin{array}{l} \\ \frac{\log \left(\frac{\frac{4}{\pi}}{f}\right)}{\pi} \cdot -4 \end{array} \]
(FPCore (f) :precision binary64 (* (/ (log (/ (/ 4.0 PI) f)) PI) -4.0))
double code(double f) {
	return (log(((4.0 / ((double) M_PI)) / f)) / ((double) M_PI)) * -4.0;
}
public static double code(double f) {
	return (Math.log(((4.0 / Math.PI) / f)) / Math.PI) * -4.0;
}
def code(f):
	return (math.log(((4.0 / math.pi) / f)) / math.pi) * -4.0
function code(f)
	return Float64(Float64(log(Float64(Float64(4.0 / pi) / f)) / pi) * -4.0)
end
function tmp = code(f)
	tmp = (log(((4.0 / pi) / f)) / pi) * -4.0;
end
code[f_] := N[(N[(N[Log[N[(N[(4.0 / Pi), $MachinePrecision] / f), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * -4.0), $MachinePrecision]
\begin{array}{l}

\\
\frac{\log \left(\frac{\frac{4}{\pi}}{f}\right)}{\pi} \cdot -4
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 8: 40.2% accurate, 5.0× speedup?

\[\begin{array}{l} \\ 4 \cdot \frac{\log f - 0.25}{\pi} \end{array} \]
(FPCore (f) :precision binary64 (* 4.0 (/ (- (log f) 0.25) PI)))
double code(double f) {
	return 4.0 * ((log(f) - 0.25) / ((double) M_PI));
}
public static double code(double f) {
	return 4.0 * ((Math.log(f) - 0.25) / Math.PI);
}
def code(f):
	return 4.0 * ((math.log(f) - 0.25) / math.pi)
function code(f)
	return Float64(4.0 * Float64(Float64(log(f) - 0.25) / pi))
end
function tmp = code(f)
	tmp = 4.0 * ((log(f) - 0.25) / pi);
end
code[f_] := N[(4.0 * N[(N[(N[Log[f], $MachinePrecision] - 0.25), $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
4 \cdot \frac{\log f - 0.25}{\pi}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 9: 5.1% accurate, 1027.0× speedup?

\[\begin{array}{l} \\ 0 \end{array} \]
(FPCore (f) :precision binary64 0.0)
double code(double f) {
	return 0.0;
}
real(8) function code(f)
    real(8), intent (in) :: f
    code = 0.0d0
end function
public static double code(double f) {
	return 0.0;
}
def code(f):
	return 0.0
function code(f)
	return 0.0
end
function tmp = code(f)
	tmp = 0.0;
end
code[f_] := 0.0
\begin{array}{l}

\\
0
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 10: 12.1% accurate, 1027.0× speedup?

\[\begin{array}{l} \\ -0.001953125 \end{array} \]
(FPCore (f) :precision binary64 -0.001953125)
double code(double f) {
	return -0.001953125;
}
real(8) function code(f)
    real(8), intent (in) :: f
    code = -0.001953125d0
end function
public static double code(double f) {
	return -0.001953125;
}
def code(f):
	return -0.001953125
function code(f)
	return -0.001953125
end
function tmp = code(f)
	tmp = -0.001953125;
end
code[f_] := -0.001953125
\begin{array}{l}

\\
-0.001953125
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 11: 14.4% accurate, 1027.0× speedup?

\[\begin{array}{l} \\ -4 \end{array} \]
(FPCore (f) :precision binary64 -4.0)
double code(double f) {
	return -4.0;
}
real(8) function code(f)
    real(8), intent (in) :: f
    code = -4.0d0
end function
public static double code(double f) {
	return -4.0;
}
def code(f):
	return -4.0
function code(f)
	return -4.0
end
function tmp = code(f)
	tmp = -4.0;
end
code[f_] := -4.0
\begin{array}{l}

\\
-4
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 12: 14.6% accurate, 1027.0× speedup?

\[\begin{array}{l} \\ -6 \end{array} \]
(FPCore (f) :precision binary64 -6.0)
double code(double f) {
	return -6.0;
}
real(8) function code(f)
    real(8), intent (in) :: f
    code = -6.0d0
end function
public static double code(double f) {
	return -6.0;
}
def code(f):
	return -6.0
function code(f)
	return -6.0
end
function tmp = code(f)
	tmp = -6.0;
end
code[f_] := -6.0
\begin{array}{l}

\\
-6
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 13: 15.3% accurate, 1027.0× speedup?

\[\begin{array}{l} \\ -16 \end{array} \]
(FPCore (f) :precision binary64 -16.0)
double code(double f) {
	return -16.0;
}
real(8) function code(f)
    real(8), intent (in) :: f
    code = -16.0d0
end function
public static double code(double f) {
	return -16.0;
}
def code(f):
	return -16.0
function code(f)
	return -16.0
end
function tmp = code(f)
	tmp = -16.0;
end
code[f_] := -16.0
\begin{array}{l}

\\
-16
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 14: 16.7% accurate, 1027.0× speedup?

\[\begin{array}{l} \\ -64 \end{array} \]
(FPCore (f) :precision binary64 -64.0)
double code(double f) {
	return -64.0;
}
real(8) function code(f)
    real(8), intent (in) :: f
    code = -64.0d0
end function
public static double code(double f) {
	return -64.0;
}
def code(f):
	return -64.0
function code(f)
	return -64.0
end
function tmp = code(f)
	tmp = -64.0;
end
code[f_] := -64.0
\begin{array}{l}

\\
-64
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Reproduce

?
herbie shell --seed 2024010 
(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)))))))))