
(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 28 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}
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(+
1.0
(*
(/ (/ (* M (* D 0.5)) (* d 2.0)) l)
(/ (/ (* M D) (* d 2.0)) (/ -1.0 h))))))
(if (<= d -2e-310)
(* (* (sqrt (/ d h)) (/ (sqrt (- d)) (sqrt (- l)))) t_0)
(if (<= d 4.4e+206)
(* t_0 (* (/ (sqrt d) (sqrt h)) (sqrt (/ d l))))
(/ d (* (sqrt h) (sqrt l)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 + ((((M * (D * 0.5)) / (d * 2.0)) / l) * (((M * D) / (d * 2.0)) / (-1.0 / h)));
double tmp;
if (d <= -2e-310) {
tmp = (sqrt((d / h)) * (sqrt(-d) / sqrt(-l))) * t_0;
} else if (d <= 4.4e+206) {
tmp = t_0 * ((sqrt(d) / sqrt(h)) * sqrt((d / l)));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
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
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + ((((m * (d_1 * 0.5d0)) / (d * 2.0d0)) / l) * (((m * d_1) / (d * 2.0d0)) / ((-1.0d0) / h)))
if (d <= (-2d-310)) then
tmp = (sqrt((d / h)) * (sqrt(-d) / sqrt(-l))) * t_0
else if (d <= 4.4d+206) then
tmp = t_0 * ((sqrt(d) / sqrt(h)) * sqrt((d / l)))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 + ((((M * (D * 0.5)) / (d * 2.0)) / l) * (((M * D) / (d * 2.0)) / (-1.0 / h)));
double tmp;
if (d <= -2e-310) {
tmp = (Math.sqrt((d / h)) * (Math.sqrt(-d) / Math.sqrt(-l))) * t_0;
} else if (d <= 4.4e+206) {
tmp = t_0 * ((Math.sqrt(d) / Math.sqrt(h)) * Math.sqrt((d / l)));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = 1.0 + ((((M * (D * 0.5)) / (d * 2.0)) / l) * (((M * D) / (d * 2.0)) / (-1.0 / h))) tmp = 0 if d <= -2e-310: tmp = (math.sqrt((d / h)) * (math.sqrt(-d) / math.sqrt(-l))) * t_0 elif d <= 4.4e+206: tmp = t_0 * ((math.sqrt(d) / math.sqrt(h)) * math.sqrt((d / l))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
function code(d, h, l, M, D) t_0 = Float64(1.0 + Float64(Float64(Float64(Float64(M * Float64(D * 0.5)) / Float64(d * 2.0)) / l) * Float64(Float64(Float64(M * D) / Float64(d * 2.0)) / Float64(-1.0 / h)))) tmp = 0.0 if (d <= -2e-310) tmp = Float64(Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))) * t_0); elseif (d <= 4.4e+206) tmp = Float64(t_0 * Float64(Float64(sqrt(d) / sqrt(h)) * sqrt(Float64(d / l)))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = 1.0 + ((((M * (D * 0.5)) / (d * 2.0)) / l) * (((M * D) / (d * 2.0)) / (-1.0 / h))); tmp = 0.0; if (d <= -2e-310) tmp = (sqrt((d / h)) * (sqrt(-d) / sqrt(-l))) * t_0; elseif (d <= 4.4e+206) tmp = t_0 * ((sqrt(d) / sqrt(h)) * sqrt((d / l))); else tmp = d / (sqrt(h) * sqrt(l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(1.0 + N[(N[(N[(N[(M * N[(D * 0.5), $MachinePrecision]), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision] / N[(-1.0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2e-310], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[d, 4.4e+206], N[(t$95$0 * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{\frac{M \cdot \left(D \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \frac{\frac{M \cdot D}{d \cdot 2}}{\frac{-1}{h}}\\
\mathbf{if}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right) \cdot t\_0\\
\mathbf{elif}\;d \leq 4.4 \cdot 10^{+206}:\\
\;\;\;\;t\_0 \cdot \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.999999999999994e-310Initial program 59.3%
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.7%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7
Applied rewrites66.7%
lift-/.f64N/A
metadata-eval66.7
lift-pow.f64N/A
pow1/2N/A
lower-sqrt.f6466.7
Applied rewrites66.7%
lift-/.f64N/A
lift-sqrt.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.f6480.0
Applied rewrites80.0%
if -1.999999999999994e-310 < d < 4.40000000000000003e206Initial program 67.6%
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 rewrites70.3%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6470.3
Applied rewrites70.3%
lift-/.f64N/A
metadata-eval70.3
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
lower-/.f64N/A
lower-sqrt.f64N/A
pow1/2N/A
lower-sqrt.f6482.8
Applied rewrites82.8%
if 4.40000000000000003e206 < d Initial program 63.7%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6484.5
Applied rewrites84.5%
Applied rewrites84.5%
Applied rewrites96.5%
Final simplification83.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1 (sqrt (* h l)))
(t_2 (fabs (/ d t_1)))
(t_3
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(+
1.0
(* (/ h l) (* (pow (/ (* M D) (* d 2.0)) 2.0) (/ -1.0 2.0)))))))
(if (<= t_3 -2e-29)
(*
(* t_0 (sqrt (/ d l)))
(fma (/ (* (* M D) (/ (* D (* M (* h -0.5))) l)) d) (/ 0.25 d) 1.0))
(if (<= t_3 0.0)
t_2
(if (<= t_3 5e+268)
(/ t_0 (sqrt (/ l d)))
(if (<= t_3 INFINITY)
t_2
(/
(*
d
(+
1.0
(/ (* (* M (* D (* M D))) (* h -0.5)) (* l (* (* d d) 4.0)))))
t_1)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double t_1 = sqrt((h * l));
double t_2 = fabs((d / t_1));
double t_3 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M * D) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double tmp;
if (t_3 <= -2e-29) {
tmp = (t_0 * sqrt((d / l))) * fma((((M * D) * ((D * (M * (h * -0.5))) / l)) / d), (0.25 / d), 1.0);
} else if (t_3 <= 0.0) {
tmp = t_2;
} else if (t_3 <= 5e+268) {
tmp = t_0 / sqrt((l / d));
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = (d * (1.0 + (((M * (D * (M * D))) * (h * -0.5)) / (l * ((d * d) * 4.0))))) / t_1;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) t_1 = sqrt(Float64(h * l)) t_2 = abs(Float64(d / t_1)) t_3 = 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((Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0))))) tmp = 0.0 if (t_3 <= -2e-29) tmp = Float64(Float64(t_0 * sqrt(Float64(d / l))) * fma(Float64(Float64(Float64(M * D) * Float64(Float64(D * Float64(M * Float64(h * -0.5))) / l)) / d), Float64(0.25 / d), 1.0)); elseif (t_3 <= 0.0) tmp = t_2; elseif (t_3 <= 5e+268) tmp = Float64(t_0 / sqrt(Float64(l / d))); elseif (t_3 <= Inf) tmp = t_2; else tmp = Float64(Float64(d * Float64(1.0 + Float64(Float64(Float64(M * Float64(D * Float64(M * D))) * Float64(h * -0.5)) / Float64(l * Float64(Float64(d * d) * 4.0))))) / t_1); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(d / t$95$1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = 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[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -2e-29], N[(N[(t$95$0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(M * D), $MachinePrecision] * N[(N[(D * N[(M * N[(h * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(0.25 / d), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.0], t$95$2, If[LessEqual[t$95$3, 5e+268], N[(t$95$0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], t$95$2, N[(N[(d * N[(1.0 + N[(N[(N[(M * N[(D * N[(M * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h * -0.5), $MachinePrecision]), $MachinePrecision] / N[(l * N[(N[(d * d), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{h \cdot \ell}\\
t_2 := \left|\frac{d}{t\_1}\right|\\
t_3 := \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({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
\mathbf{if}\;t\_3 \leq -2 \cdot 10^{-29}:\\
\;\;\;\;\left(t\_0 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \mathsf{fma}\left(\frac{\left(M \cdot D\right) \cdot \frac{D \cdot \left(M \cdot \left(h \cdot -0.5\right)\right)}{\ell}}{d}, \frac{0.25}{d}, 1\right)\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{+268}:\\
\;\;\;\;\frac{t\_0}{\sqrt{\frac{\ell}{d}}}\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{d \cdot \left(1 + \frac{\left(M \cdot \left(D \cdot \left(M \cdot D\right)\right)\right) \cdot \left(h \cdot -0.5\right)}{\ell \cdot \left(\left(d \cdot d\right) \cdot 4\right)}\right)}{t\_1}\\
\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)))) < -1.99999999999999989e-29Initial program 86.1%
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 rewrites90.4%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6490.4
Applied rewrites90.4%
lift-/.f64N/A
metadata-eval90.4
lift-pow.f64N/A
pow1/2N/A
lower-sqrt.f6490.4
Applied rewrites90.4%
Applied rewrites82.1%
if -1.99999999999999989e-29 < (*.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)))) < -0.0 or 5.0000000000000002e268 < (*.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 49.9%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6448.3
Applied rewrites48.3%
Applied rewrites83.6%
if -0.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)))) < 5.0000000000000002e268Initial program 98.7%
Applied rewrites85.6%
Taylor expanded in d around inf
lower-sqrt.f64N/A
lower-/.f6497.3
Applied rewrites97.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 rewrites0.0%
Applied rewrites28.3%
Final simplification76.6%
herbie shell --seed 2024233
(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)))))