
(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:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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}
(FPCore (f)
:precision binary64
(/
(log
(+
(pow (pow (expm1 (* PI (* f 0.5))) -0.5) 2.0)
(/ -1.0 (expm1 (* PI (* f -0.5))))))
(/ PI -4.0)))
double code(double f) {
return log((pow(pow(expm1((((double) M_PI) * (f * 0.5))), -0.5), 2.0) + (-1.0 / expm1((((double) M_PI) * (f * -0.5)))))) / (((double) M_PI) / -4.0);
}
public static double code(double f) {
return Math.log((Math.pow(Math.pow(Math.expm1((Math.PI * (f * 0.5))), -0.5), 2.0) + (-1.0 / Math.expm1((Math.PI * (f * -0.5)))))) / (Math.PI / -4.0);
}
def code(f): return math.log((math.pow(math.pow(math.expm1((math.pi * (f * 0.5))), -0.5), 2.0) + (-1.0 / math.expm1((math.pi * (f * -0.5)))))) / (math.pi / -4.0)
function code(f) return Float64(log(Float64(((expm1(Float64(pi * Float64(f * 0.5))) ^ -0.5) ^ 2.0) + Float64(-1.0 / expm1(Float64(pi * Float64(f * -0.5)))))) / Float64(pi / -4.0)) end
code[f_] := N[(N[Log[N[(N[Power[N[Power[N[(Exp[N[(Pi * N[(f * 0.5), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision], -0.5], $MachinePrecision], 2.0], $MachinePrecision] + N[(-1.0 / N[(Exp[N[(Pi * N[(f * -0.5), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(Pi / -4.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\log \left({\left({\left(\mathsf{expm1}\left(\pi \cdot \left(f \cdot 0.5\right)\right)\right)}^{-0.5}\right)}^{2} + \frac{-1}{\mathsf{expm1}\left(\pi \cdot \left(f \cdot -0.5\right)\right)}\right)}{\frac{\pi}{-4}}
\end{array}
Initial program 6.2%
Simplified99.1%
clear-numN/A
inv-powN/A
sqr-powN/A
pow2N/A
pow-lowering-pow.f64N/A
metadata-evalN/A
pow-lowering-pow.f64N/A
/-rgt-identityN/A
accelerator-lowering-expm1.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
*-lowering-*.f6499.1%
Applied egg-rr99.1%
(FPCore (f) :precision binary64 (/ (log (+ (/ -1.0 (expm1 (* PI (* f -0.5)))) (/ 1.0 (expm1 (* PI (* f 0.5)))))) (/ PI -4.0)))
double code(double f) {
return log(((-1.0 / expm1((((double) M_PI) * (f * -0.5)))) + (1.0 / expm1((((double) M_PI) * (f * 0.5)))))) / (((double) M_PI) / -4.0);
}
public static double code(double f) {
return Math.log(((-1.0 / Math.expm1((Math.PI * (f * -0.5)))) + (1.0 / Math.expm1((Math.PI * (f * 0.5)))))) / (Math.PI / -4.0);
}
def code(f): return math.log(((-1.0 / math.expm1((math.pi * (f * -0.5)))) + (1.0 / math.expm1((math.pi * (f * 0.5)))))) / (math.pi / -4.0)
function code(f) return Float64(log(Float64(Float64(-1.0 / expm1(Float64(pi * Float64(f * -0.5)))) + Float64(1.0 / expm1(Float64(pi * Float64(f * 0.5)))))) / Float64(pi / -4.0)) end
code[f_] := N[(N[Log[N[(N[(-1.0 / N[(Exp[N[(Pi * N[(f * -0.5), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(Exp[N[(Pi * N[(f * 0.5), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(Pi / -4.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\log \left(\frac{-1}{\mathsf{expm1}\left(\pi \cdot \left(f \cdot -0.5\right)\right)} + \frac{1}{\mathsf{expm1}\left(\pi \cdot \left(f \cdot 0.5\right)\right)}\right)}{\frac{\pi}{-4}}
\end{array}
Initial program 6.2%
Simplified99.1%
Final simplification99.1%
(FPCore (f)
:precision binary64
(/
-4.0
(/
PI
(log
(+ (/ -1.0 (expm1 (* PI (* f -0.5)))) (/ 1.0 (expm1 (* PI (* f 0.5)))))))))
double code(double f) {
return -4.0 / (((double) M_PI) / log(((-1.0 / expm1((((double) M_PI) * (f * -0.5)))) + (1.0 / expm1((((double) M_PI) * (f * 0.5)))))));
}
public static double code(double f) {
return -4.0 / (Math.PI / Math.log(((-1.0 / Math.expm1((Math.PI * (f * -0.5)))) + (1.0 / Math.expm1((Math.PI * (f * 0.5)))))));
}
def code(f): return -4.0 / (math.pi / math.log(((-1.0 / math.expm1((math.pi * (f * -0.5)))) + (1.0 / math.expm1((math.pi * (f * 0.5)))))))
function code(f) return Float64(-4.0 / Float64(pi / log(Float64(Float64(-1.0 / expm1(Float64(pi * Float64(f * -0.5)))) + Float64(1.0 / expm1(Float64(pi * Float64(f * 0.5)))))))) end
code[f_] := N[(-4.0 / N[(Pi / N[Log[N[(N[(-1.0 / N[(Exp[N[(Pi * N[(f * -0.5), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(Exp[N[(Pi * N[(f * 0.5), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-4}{\frac{\pi}{\log \left(\frac{-1}{\mathsf{expm1}\left(\pi \cdot \left(f \cdot -0.5\right)\right)} + \frac{1}{\mathsf{expm1}\left(\pi \cdot \left(f \cdot 0.5\right)\right)}\right)}}
\end{array}
Initial program 6.2%
Simplified99.1%
associate-/r/N/A
*-commutativeN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
PI-lowering-PI.f64N/A
log-lowering-log.f64N/A
Applied egg-rr99.0%
Final simplification99.0%
(FPCore (f)
:precision binary64
(if (<= f 230.0)
(/
(/
1.0
(/
1.0
(-
(+
(log (/ 4.0 PI))
(* 0.25 (* f (* f (* PI (* PI 0.08333333333333333))))))
(log f))))
(/ PI -4.0))
(/ (* -4.0 (log (/ -1.0 (expm1 (* f (* PI -0.5)))))) PI)))
double code(double f) {
double tmp;
if (f <= 230.0) {
tmp = (1.0 / (1.0 / ((log((4.0 / ((double) M_PI))) + (0.25 * (f * (f * (((double) M_PI) * (((double) M_PI) * 0.08333333333333333)))))) - log(f)))) / (((double) M_PI) / -4.0);
} else {
tmp = (-4.0 * log((-1.0 / expm1((f * (((double) M_PI) * -0.5)))))) / ((double) M_PI);
}
return tmp;
}
public static double code(double f) {
double tmp;
if (f <= 230.0) {
tmp = (1.0 / (1.0 / ((Math.log((4.0 / Math.PI)) + (0.25 * (f * (f * (Math.PI * (Math.PI * 0.08333333333333333)))))) - Math.log(f)))) / (Math.PI / -4.0);
} else {
tmp = (-4.0 * Math.log((-1.0 / Math.expm1((f * (Math.PI * -0.5)))))) / Math.PI;
}
return tmp;
}
def code(f): tmp = 0 if f <= 230.0: tmp = (1.0 / (1.0 / ((math.log((4.0 / math.pi)) + (0.25 * (f * (f * (math.pi * (math.pi * 0.08333333333333333)))))) - math.log(f)))) / (math.pi / -4.0) else: tmp = (-4.0 * math.log((-1.0 / math.expm1((f * (math.pi * -0.5)))))) / math.pi return tmp
function code(f) tmp = 0.0 if (f <= 230.0) tmp = Float64(Float64(1.0 / Float64(1.0 / Float64(Float64(log(Float64(4.0 / pi)) + Float64(0.25 * Float64(f * Float64(f * Float64(pi * Float64(pi * 0.08333333333333333)))))) - log(f)))) / Float64(pi / -4.0)); else tmp = Float64(Float64(-4.0 * log(Float64(-1.0 / expm1(Float64(f * Float64(pi * -0.5)))))) / pi); end return tmp end
code[f_] := If[LessEqual[f, 230.0], N[(N[(1.0 / N[(1.0 / N[(N[(N[Log[N[(4.0 / Pi), $MachinePrecision]], $MachinePrecision] + N[(0.25 * N[(f * N[(f * N[(Pi * N[(Pi * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Log[f], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(Pi / -4.0), $MachinePrecision]), $MachinePrecision], N[(N[(-4.0 * N[Log[N[(-1.0 / N[(Exp[N[(f * N[(Pi * -0.5), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;f \leq 230:\\
\;\;\;\;\frac{\frac{1}{\frac{1}{\left(\log \left(\frac{4}{\pi}\right) + 0.25 \cdot \left(f \cdot \left(f \cdot \left(\pi \cdot \left(\pi \cdot 0.08333333333333333\right)\right)\right)\right)\right) - \log f}}}{\frac{\pi}{-4}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-4 \cdot \log \left(\frac{-1}{\mathsf{expm1}\left(f \cdot \left(\pi \cdot -0.5\right)\right)}\right)}{\pi}\\
\end{array}
\end{array}
if f < 230Initial program 6.3%
Simplified99.1%
/-rgt-identityN/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
+-lowering-+.f64N/A
Applied egg-rr99.0%
Taylor expanded in f around 0
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
Simplified98.6%
if 230 < f Initial program 0.0%
Simplified100.0%
Taylor expanded in f around 0
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f643.2%
Simplified3.2%
Taylor expanded in f around inf
associate-*r/N/A
/-lowering-/.f64N/A
Simplified100.0%
Final simplification98.7%
(FPCore (f)
:precision binary64
(if (<= f 2.3)
(/
(log
(/
(+
(/ 4.0 PI)
(*
(* f f)
(+
(* PI 0.08333333333333333)
(*
f
(*
f
(*
2.0
(*
PI
(-
(* (* PI 0.0) (/ PI 4.0))
(* PI (* PI 0.00017361111111111112))))))))))
f))
(/ PI -4.0))
(/ (* -4.0 (log (/ -1.0 (expm1 (* f (* PI -0.5)))))) PI)))
double code(double f) {
double tmp;
if (f <= 2.3) {
tmp = log((((4.0 / ((double) M_PI)) + ((f * f) * ((((double) M_PI) * 0.08333333333333333) + (f * (f * (2.0 * (((double) M_PI) * (((((double) M_PI) * 0.0) * (((double) M_PI) / 4.0)) - (((double) M_PI) * (((double) M_PI) * 0.00017361111111111112)))))))))) / f)) / (((double) M_PI) / -4.0);
} else {
tmp = (-4.0 * log((-1.0 / expm1((f * (((double) M_PI) * -0.5)))))) / ((double) M_PI);
}
return tmp;
}
public static double code(double f) {
double tmp;
if (f <= 2.3) {
tmp = Math.log((((4.0 / Math.PI) + ((f * f) * ((Math.PI * 0.08333333333333333) + (f * (f * (2.0 * (Math.PI * (((Math.PI * 0.0) * (Math.PI / 4.0)) - (Math.PI * (Math.PI * 0.00017361111111111112)))))))))) / f)) / (Math.PI / -4.0);
} else {
tmp = (-4.0 * Math.log((-1.0 / Math.expm1((f * (Math.PI * -0.5)))))) / Math.PI;
}
return tmp;
}
def code(f): tmp = 0 if f <= 2.3: tmp = math.log((((4.0 / math.pi) + ((f * f) * ((math.pi * 0.08333333333333333) + (f * (f * (2.0 * (math.pi * (((math.pi * 0.0) * (math.pi / 4.0)) - (math.pi * (math.pi * 0.00017361111111111112)))))))))) / f)) / (math.pi / -4.0) else: tmp = (-4.0 * math.log((-1.0 / math.expm1((f * (math.pi * -0.5)))))) / math.pi return tmp
function code(f) tmp = 0.0 if (f <= 2.3) tmp = Float64(log(Float64(Float64(Float64(4.0 / pi) + Float64(Float64(f * f) * Float64(Float64(pi * 0.08333333333333333) + Float64(f * Float64(f * Float64(2.0 * Float64(pi * Float64(Float64(Float64(pi * 0.0) * Float64(pi / 4.0)) - Float64(pi * Float64(pi * 0.00017361111111111112)))))))))) / f)) / Float64(pi / -4.0)); else tmp = Float64(Float64(-4.0 * log(Float64(-1.0 / expm1(Float64(f * Float64(pi * -0.5)))))) / pi); end return tmp end
code[f_] := If[LessEqual[f, 2.3], N[(N[Log[N[(N[(N[(4.0 / Pi), $MachinePrecision] + N[(N[(f * f), $MachinePrecision] * N[(N[(Pi * 0.08333333333333333), $MachinePrecision] + N[(f * N[(f * N[(2.0 * N[(Pi * N[(N[(N[(Pi * 0.0), $MachinePrecision] * N[(Pi / 4.0), $MachinePrecision]), $MachinePrecision] - N[(Pi * N[(Pi * 0.00017361111111111112), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / f), $MachinePrecision]], $MachinePrecision] / N[(Pi / -4.0), $MachinePrecision]), $MachinePrecision], N[(N[(-4.0 * N[Log[N[(-1.0 / N[(Exp[N[(f * N[(Pi * -0.5), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;f \leq 2.3:\\
\;\;\;\;\frac{\log \left(\frac{\frac{4}{\pi} + \left(f \cdot f\right) \cdot \left(\pi \cdot 0.08333333333333333 + f \cdot \left(f \cdot \left(2 \cdot \left(\pi \cdot \left(\left(\pi \cdot 0\right) \cdot \frac{\pi}{4} - \pi \cdot \left(\pi \cdot 0.00017361111111111112\right)\right)\right)\right)\right)\right)}{f}\right)}{\frac{\pi}{-4}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-4 \cdot \log \left(\frac{-1}{\mathsf{expm1}\left(f \cdot \left(\pi \cdot -0.5\right)\right)}\right)}{\pi}\\
\end{array}
\end{array}
if f < 2.2999999999999998Initial program 6.3%
Simplified99.1%
Taylor expanded in f around 0
Simplified98.5%
count-2N/A
*-commutativeN/A
*-lowering-*.f64N/A
Applied egg-rr98.5%
if 2.2999999999999998 < f Initial program 0.0%
Simplified100.0%
Taylor expanded in f around 0
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f643.2%
Simplified3.2%
Taylor expanded in f around inf
associate-*r/N/A
/-lowering-/.f64N/A
Simplified100.0%
Final simplification98.5%
(FPCore (f)
:precision binary64
(/
(log
(/
(+
(/ 4.0 PI)
(*
(* f f)
(+
(* PI 0.08333333333333333)
(*
f
(*
f
(*
2.0
(*
PI
(-
(* (* PI 0.0) (/ PI 4.0))
(* PI (* PI 0.00017361111111111112))))))))))
f))
(/ PI -4.0)))
double code(double f) {
return log((((4.0 / ((double) M_PI)) + ((f * f) * ((((double) M_PI) * 0.08333333333333333) + (f * (f * (2.0 * (((double) M_PI) * (((((double) M_PI) * 0.0) * (((double) M_PI) / 4.0)) - (((double) M_PI) * (((double) M_PI) * 0.00017361111111111112)))))))))) / f)) / (((double) M_PI) / -4.0);
}
public static double code(double f) {
return Math.log((((4.0 / Math.PI) + ((f * f) * ((Math.PI * 0.08333333333333333) + (f * (f * (2.0 * (Math.PI * (((Math.PI * 0.0) * (Math.PI / 4.0)) - (Math.PI * (Math.PI * 0.00017361111111111112)))))))))) / f)) / (Math.PI / -4.0);
}
def code(f): return math.log((((4.0 / math.pi) + ((f * f) * ((math.pi * 0.08333333333333333) + (f * (f * (2.0 * (math.pi * (((math.pi * 0.0) * (math.pi / 4.0)) - (math.pi * (math.pi * 0.00017361111111111112)))))))))) / f)) / (math.pi / -4.0)
function code(f) return Float64(log(Float64(Float64(Float64(4.0 / pi) + Float64(Float64(f * f) * Float64(Float64(pi * 0.08333333333333333) + Float64(f * Float64(f * Float64(2.0 * Float64(pi * Float64(Float64(Float64(pi * 0.0) * Float64(pi / 4.0)) - Float64(pi * Float64(pi * 0.00017361111111111112)))))))))) / f)) / Float64(pi / -4.0)) end
function tmp = code(f) tmp = log((((4.0 / pi) + ((f * f) * ((pi * 0.08333333333333333) + (f * (f * (2.0 * (pi * (((pi * 0.0) * (pi / 4.0)) - (pi * (pi * 0.00017361111111111112)))))))))) / f)) / (pi / -4.0); end
code[f_] := N[(N[Log[N[(N[(N[(4.0 / Pi), $MachinePrecision] + N[(N[(f * f), $MachinePrecision] * N[(N[(Pi * 0.08333333333333333), $MachinePrecision] + N[(f * N[(f * N[(2.0 * N[(Pi * N[(N[(N[(Pi * 0.0), $MachinePrecision] * N[(Pi / 4.0), $MachinePrecision]), $MachinePrecision] - N[(Pi * N[(Pi * 0.00017361111111111112), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / f), $MachinePrecision]], $MachinePrecision] / N[(Pi / -4.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\log \left(\frac{\frac{4}{\pi} + \left(f \cdot f\right) \cdot \left(\pi \cdot 0.08333333333333333 + f \cdot \left(f \cdot \left(2 \cdot \left(\pi \cdot \left(\left(\pi \cdot 0\right) \cdot \frac{\pi}{4} - \pi \cdot \left(\pi \cdot 0.00017361111111111112\right)\right)\right)\right)\right)\right)}{f}\right)}{\frac{\pi}{-4}}
\end{array}
Initial program 6.2%
Simplified99.1%
Taylor expanded in f around 0
Simplified96.6%
count-2N/A
*-commutativeN/A
*-lowering-*.f64N/A
Applied egg-rr96.6%
Final simplification96.6%
(FPCore (f)
:precision binary64
(let* ((t_0 (* PI (* f f))))
(/
(log
(/
(/
(- (/ 16.0 (* PI PI)) (* (* t_0 t_0) 0.006944444444444444))
(- (/ 4.0 PI) (* PI (* 0.08333333333333333 (* f f)))))
f))
(/ PI -4.0))))
double code(double f) {
double t_0 = ((double) M_PI) * (f * f);
return log(((((16.0 / (((double) M_PI) * ((double) M_PI))) - ((t_0 * t_0) * 0.006944444444444444)) / ((4.0 / ((double) M_PI)) - (((double) M_PI) * (0.08333333333333333 * (f * f))))) / f)) / (((double) M_PI) / -4.0);
}
public static double code(double f) {
double t_0 = Math.PI * (f * f);
return Math.log(((((16.0 / (Math.PI * Math.PI)) - ((t_0 * t_0) * 0.006944444444444444)) / ((4.0 / Math.PI) - (Math.PI * (0.08333333333333333 * (f * f))))) / f)) / (Math.PI / -4.0);
}
def code(f): t_0 = math.pi * (f * f) return math.log(((((16.0 / (math.pi * math.pi)) - ((t_0 * t_0) * 0.006944444444444444)) / ((4.0 / math.pi) - (math.pi * (0.08333333333333333 * (f * f))))) / f)) / (math.pi / -4.0)
function code(f) t_0 = Float64(pi * Float64(f * f)) return Float64(log(Float64(Float64(Float64(Float64(16.0 / Float64(pi * pi)) - Float64(Float64(t_0 * t_0) * 0.006944444444444444)) / Float64(Float64(4.0 / pi) - Float64(pi * Float64(0.08333333333333333 * Float64(f * f))))) / f)) / Float64(pi / -4.0)) end
function tmp = code(f) t_0 = pi * (f * f); tmp = log(((((16.0 / (pi * pi)) - ((t_0 * t_0) * 0.006944444444444444)) / ((4.0 / pi) - (pi * (0.08333333333333333 * (f * f))))) / f)) / (pi / -4.0); end
code[f_] := Block[{t$95$0 = N[(Pi * N[(f * f), $MachinePrecision]), $MachinePrecision]}, N[(N[Log[N[(N[(N[(N[(16.0 / N[(Pi * Pi), $MachinePrecision]), $MachinePrecision] - N[(N[(t$95$0 * t$95$0), $MachinePrecision] * 0.006944444444444444), $MachinePrecision]), $MachinePrecision] / N[(N[(4.0 / Pi), $MachinePrecision] - N[(Pi * N[(0.08333333333333333 * N[(f * f), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / f), $MachinePrecision]], $MachinePrecision] / N[(Pi / -4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \pi \cdot \left(f \cdot f\right)\\
\frac{\log \left(\frac{\frac{\frac{16}{\pi \cdot \pi} - \left(t\_0 \cdot t\_0\right) \cdot 0.006944444444444444}{\frac{4}{\pi} - \pi \cdot \left(0.08333333333333333 \cdot \left(f \cdot f\right)\right)}}{f}\right)}{\frac{\pi}{-4}}
\end{array}
\end{array}
Initial program 6.2%
Simplified99.1%
Taylor expanded in f around 0
/-lowering-/.f64N/A
Simplified96.5%
+-commutativeN/A
flip-+N/A
/-lowering-/.f64N/A
Applied egg-rr96.5%
(FPCore (f) :precision binary64 (/ (log (/ (+ (/ 4.0 PI) (* (* PI 0.08333333333333333) (* f f))) f)) (/ PI -4.0)))
double code(double f) {
return log((((4.0 / ((double) M_PI)) + ((((double) M_PI) * 0.08333333333333333) * (f * f))) / f)) / (((double) M_PI) / -4.0);
}
public static double code(double f) {
return Math.log((((4.0 / Math.PI) + ((Math.PI * 0.08333333333333333) * (f * f))) / f)) / (Math.PI / -4.0);
}
def code(f): return math.log((((4.0 / math.pi) + ((math.pi * 0.08333333333333333) * (f * f))) / f)) / (math.pi / -4.0)
function code(f) return Float64(log(Float64(Float64(Float64(4.0 / pi) + Float64(Float64(pi * 0.08333333333333333) * Float64(f * f))) / f)) / Float64(pi / -4.0)) end
function tmp = code(f) tmp = log((((4.0 / pi) + ((pi * 0.08333333333333333) * (f * f))) / f)) / (pi / -4.0); end
code[f_] := N[(N[Log[N[(N[(N[(4.0 / Pi), $MachinePrecision] + N[(N[(Pi * 0.08333333333333333), $MachinePrecision] * N[(f * f), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / f), $MachinePrecision]], $MachinePrecision] / N[(Pi / -4.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\log \left(\frac{\frac{4}{\pi} + \left(\pi \cdot 0.08333333333333333\right) \cdot \left(f \cdot f\right)}{f}\right)}{\frac{\pi}{-4}}
\end{array}
Initial program 6.2%
Simplified99.1%
Taylor expanded in f around 0
/-lowering-/.f64N/A
Simplified96.5%
Final simplification96.5%
(FPCore (f) :precision binary64 (/ (* 4.0 (log (/ (* PI f) 4.0))) PI))
double code(double f) {
return (4.0 * log(((((double) M_PI) * f) / 4.0))) / ((double) M_PI);
}
public static double code(double f) {
return (4.0 * Math.log(((Math.PI * f) / 4.0))) / Math.PI;
}
def code(f): return (4.0 * math.log(((math.pi * f) / 4.0))) / math.pi
function code(f) return Float64(Float64(4.0 * log(Float64(Float64(pi * f) / 4.0))) / pi) end
function tmp = code(f) tmp = (4.0 * log(((pi * f) / 4.0))) / pi; end
code[f_] := N[(N[(4.0 * N[Log[N[(N[(Pi * f), $MachinePrecision] / 4.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision]
\begin{array}{l}
\\
\frac{4 \cdot \log \left(\frac{\pi \cdot f}{4}\right)}{\pi}
\end{array}
Initial program 6.2%
Simplified99.1%
Taylor expanded in f around 0
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f6496.0%
Simplified96.0%
frac-2negN/A
div-invN/A
distribute-neg-frac2N/A
metadata-evalN/A
clear-numN/A
*-lowering-*.f64N/A
neg-logN/A
clear-numN/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
/-lowering-/.f64N/A
PI-lowering-PI.f6496.3%
Applied egg-rr96.3%
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
PI-lowering-PI.f6496.4%
Applied egg-rr96.4%
(FPCore (f) :precision binary64 (* (/ 4.0 PI) (log (/ (* PI f) 4.0))))
double code(double f) {
return (4.0 / ((double) M_PI)) * log(((((double) M_PI) * f) / 4.0));
}
public static double code(double f) {
return (4.0 / Math.PI) * Math.log(((Math.PI * f) / 4.0));
}
def code(f): return (4.0 / math.pi) * math.log(((math.pi * f) / 4.0))
function code(f) return Float64(Float64(4.0 / pi) * log(Float64(Float64(pi * f) / 4.0))) end
function tmp = code(f) tmp = (4.0 / pi) * log(((pi * f) / 4.0)); end
code[f_] := N[(N[(4.0 / Pi), $MachinePrecision] * N[Log[N[(N[(Pi * f), $MachinePrecision] / 4.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{4}{\pi} \cdot \log \left(\frac{\pi \cdot f}{4}\right)
\end{array}
Initial program 6.2%
Simplified99.1%
Taylor expanded in f around 0
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f6496.0%
Simplified96.0%
frac-2negN/A
div-invN/A
distribute-neg-frac2N/A
metadata-evalN/A
clear-numN/A
*-lowering-*.f64N/A
neg-logN/A
clear-numN/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
/-lowering-/.f64N/A
PI-lowering-PI.f6496.3%
Applied egg-rr96.3%
Final simplification96.3%
(FPCore (f) :precision binary64 (* (* PI (* f f)) -0.08333333333333333))
double code(double f) {
return (((double) M_PI) * (f * f)) * -0.08333333333333333;
}
public static double code(double f) {
return (Math.PI * (f * f)) * -0.08333333333333333;
}
def code(f): return (math.pi * (f * f)) * -0.08333333333333333
function code(f) return Float64(Float64(pi * Float64(f * f)) * -0.08333333333333333) end
function tmp = code(f) tmp = (pi * (f * f)) * -0.08333333333333333; end
code[f_] := N[(N[(Pi * N[(f * f), $MachinePrecision]), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]
\begin{array}{l}
\\
\left(\pi \cdot \left(f \cdot f\right)\right) \cdot -0.08333333333333333
\end{array}
Initial program 6.2%
Simplified99.1%
/-rgt-identityN/A
clear-numN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
+-lowering-+.f64N/A
Applied egg-rr99.0%
Taylor expanded in f around 0
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
Simplified96.8%
Taylor expanded in f around inf
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
PI-lowering-PI.f64N/A
unpow2N/A
*-lowering-*.f644.2%
Simplified4.2%
Final simplification4.2%
herbie shell --seed 2024192
(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)))))))))