
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 25 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1
(+
1.0
(*
(/ (/ (* M_m (* D_m 0.5)) (* d 2.0)) l)
(/ (/ (* M_m D_m) (* d 2.0)) (/ -1.0 h)))))
(t_2 (sqrt (- d))))
(if (<= h -7e+254)
(/
(*
(*
(fma
(/ (* M_m (* h (* M_m (* D_m D_m)))) d)
(/ -0.5 (* l (* d 4.0)))
1.0)
(sqrt (/ d l)))
t_2)
(sqrt (- h)))
(if (<= h -5e-310)
(* (* t_0 (/ t_2 (sqrt (- l)))) t_1)
(* t_1 (* t_0 (/ (sqrt d) (sqrt l))))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((d / h));
double t_1 = 1.0 + ((((M_m * (D_m * 0.5)) / (d * 2.0)) / l) * (((M_m * D_m) / (d * 2.0)) / (-1.0 / h)));
double t_2 = sqrt(-d);
double tmp;
if (h <= -7e+254) {
tmp = ((fma(((M_m * (h * (M_m * (D_m * D_m)))) / d), (-0.5 / (l * (d * 4.0))), 1.0) * sqrt((d / l))) * t_2) / sqrt(-h);
} else if (h <= -5e-310) {
tmp = (t_0 * (t_2 / sqrt(-l))) * t_1;
} else {
tmp = t_1 * (t_0 * (sqrt(d) / sqrt(l)));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(d / h)) t_1 = Float64(1.0 + Float64(Float64(Float64(Float64(M_m * Float64(D_m * 0.5)) / Float64(d * 2.0)) / l) * Float64(Float64(Float64(M_m * D_m) / Float64(d * 2.0)) / Float64(-1.0 / h)))) t_2 = sqrt(Float64(-d)) tmp = 0.0 if (h <= -7e+254) tmp = Float64(Float64(Float64(fma(Float64(Float64(M_m * Float64(h * Float64(M_m * Float64(D_m * D_m)))) / d), Float64(-0.5 / Float64(l * Float64(d * 4.0))), 1.0) * sqrt(Float64(d / l))) * t_2) / sqrt(Float64(-h))); elseif (h <= -5e-310) tmp = Float64(Float64(t_0 * Float64(t_2 / sqrt(Float64(-l)))) * t_1); else tmp = Float64(t_1 * Float64(t_0 * Float64(sqrt(d) / sqrt(l)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(N[(N[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision] / N[(-1.0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[h, -7e+254], N[(N[(N[(N[(N[(N[(M$95$m * N[(h * N[(M$95$m * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(-0.5 / N[(l * N[(d * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-310], N[(N[(t$95$0 * N[(t$95$2 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(t$95$1 * N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := 1 + \frac{\frac{M\_m \cdot \left(D\_m \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \frac{\frac{M\_m \cdot D\_m}{d \cdot 2}}{\frac{-1}{h}}\\
t_2 := \sqrt{-d}\\
\mathbf{if}\;h \leq -7 \cdot 10^{+254}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{M\_m \cdot \left(h \cdot \left(M\_m \cdot \left(D\_m \cdot D\_m\right)\right)\right)}{d}, \frac{-0.5}{\ell \cdot \left(d \cdot 4\right)}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot t\_2}{\sqrt{-h}}\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(t\_0 \cdot \frac{t\_2}{\sqrt{-\ell}}\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(t\_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
\end{array}
\end{array}
if h < -7.00000000000000034e254Initial program 10.4%
Applied rewrites75.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6475.0
Applied rewrites75.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
times-fracN/A
lower-fma.f64N/A
Applied rewrites88.5%
if -7.00000000000000034e254 < h < -4.999999999999985e-310Initial program 61.2%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites68.1%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6468.1
Applied rewrites68.1%
lift-/.f64N/A
metadata-eval68.1
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6468.1
Applied rewrites68.1%
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f6481.0
Applied rewrites81.0%
if -4.999999999999985e-310 < h Initial program 65.7%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites66.0%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6466.0
Applied rewrites66.0%
lift-/.f64N/A
metadata-eval66.0
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6466.0
Applied rewrites66.0%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
lower-/.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f6475.7
Applied rewrites75.7%
Final simplification78.8%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1 (/ (* M_m D_m) (* d 2.0)))
(t_2
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(+ 1.0 (* (/ h l) (* (pow t_1 2.0) (/ -1.0 2.0)))))))
(if (<= t_2 2e+244)
(*
(* t_0 (sqrt (/ d h)))
(+ 1.0 (* (/ (/ (* M_m (* D_m 0.5)) l) (* d 2.0)) (/ t_1 (/ -1.0 h)))))
(if (<= t_2 INFINITY)
(/ (* d (sqrt (/ h l))) h)
(/
(*
(*
(fma
(/ (* M_m (* h (* M_m (* D_m D_m)))) d)
(/ -0.5 (* l (* d 4.0)))
1.0)
t_0)
(sqrt (- d)))
(sqrt (- h)))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((d / l));
double t_1 = (M_m * D_m) / (d * 2.0);
double t_2 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(t_1, 2.0) * (-1.0 / 2.0))));
double tmp;
if (t_2 <= 2e+244) {
tmp = (t_0 * sqrt((d / h))) * (1.0 + ((((M_m * (D_m * 0.5)) / l) / (d * 2.0)) * (t_1 / (-1.0 / h))));
} else if (t_2 <= ((double) INFINITY)) {
tmp = (d * sqrt((h / l))) / h;
} else {
tmp = ((fma(((M_m * (h * (M_m * (D_m * D_m)))) / d), (-0.5 / (l * (d * 4.0))), 1.0) * t_0) * sqrt(-d)) / sqrt(-h);
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(d / l)) t_1 = Float64(Float64(M_m * D_m) / Float64(d * 2.0)) t_2 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((t_1 ^ 2.0) * Float64(-1.0 / 2.0))))) tmp = 0.0 if (t_2 <= 2e+244) tmp = Float64(Float64(t_0 * sqrt(Float64(d / h))) * Float64(1.0 + Float64(Float64(Float64(Float64(M_m * Float64(D_m * 0.5)) / l) / Float64(d * 2.0)) * Float64(t_1 / Float64(-1.0 / h))))); elseif (t_2 <= Inf) tmp = Float64(Float64(d * sqrt(Float64(h / l))) / h); else tmp = Float64(Float64(Float64(fma(Float64(Float64(M_m * Float64(h * Float64(M_m * Float64(D_m * D_m)))) / d), Float64(-0.5 / Float64(l * Float64(d * 4.0))), 1.0) * t_0) * sqrt(Float64(-d))) / sqrt(Float64(-h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[t$95$1, 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 2e+244], N[(N[(t$95$0 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 / N[(-1.0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(N[(N[(N[(M$95$m * N[(h * N[(M$95$m * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(-0.5 / N[(l * N[(d * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \frac{M\_m \cdot D\_m}{d \cdot 2}\\
t_2 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 + \frac{h}{\ell} \cdot \left({t\_1}^{2} \cdot \frac{-1}{2}\right)\right)\\
\mathbf{if}\;t\_2 \leq 2 \cdot 10^{+244}:\\
\;\;\;\;\left(t\_0 \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 + \frac{\frac{M\_m \cdot \left(D\_m \cdot 0.5\right)}{\ell}}{d \cdot 2} \cdot \frac{t\_1}{\frac{-1}{h}}\right)\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{M\_m \cdot \left(h \cdot \left(M\_m \cdot \left(D\_m \cdot D\_m\right)\right)\right)}{d}, \frac{-0.5}{\ell \cdot \left(d \cdot 4\right)}, 1\right) \cdot t\_0\right) \cdot \sqrt{-d}}{\sqrt{-h}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000015e244Initial program 86.8%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites88.5%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6488.5
Applied rewrites88.5%
lift-/.f64N/A
metadata-eval88.5
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6488.5
Applied rewrites88.5%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6488.5
Applied rewrites88.5%
if 2.00000000000000015e244 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 51.5%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites31.9%
Taylor expanded in d around inf
Applied rewrites69.3%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Applied rewrites12.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6412.1
Applied rewrites17.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
times-fracN/A
lower-fma.f64N/A
Applied rewrites18.6%
Final simplification73.1%
herbie shell --seed 2024227
(FPCore (d h l M D)
:name "Henrywood and Agarwal, Equation (12)"
:precision binary64
(* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))