
(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 15 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)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1 (sqrt (- d)))
(t_2 (/ t_1 (sqrt (- h))))
(t_3 (pow (* (/ D_m d) (* M 0.5)) 2.0))
(t_4 (- 1.0 (* 0.5 (/ (* h t_3) l)))))
(if (<= l -7e-40)
(*
(/ t_1 (sqrt (- l)))
(* t_2 (+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M 2.0) d)) 2.0) -0.5)))))
(if (<= l -2e-310)
(* (* t_2 t_0) t_4)
(if (<= l 2.2e-110)
(* t_4 (* (sqrt (/ d h)) (/ (sqrt d) (sqrt l))))
(if (<= l 1.25e+208)
(* (/ (sqrt d) (sqrt h)) (* t_0 (+ 1.0 (* t_3 (* (/ h l) -0.5)))))
(* d (* (pow l -0.5) (pow h -0.5)))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt((d / l));
double t_1 = sqrt(-d);
double t_2 = t_1 / sqrt(-h);
double t_3 = pow(((D_m / d) * (M * 0.5)), 2.0);
double t_4 = 1.0 - (0.5 * ((h * t_3) / l));
double tmp;
if (l <= -7e-40) {
tmp = (t_1 / sqrt(-l)) * (t_2 * (1.0 + ((h / l) * (pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5))));
} else if (l <= -2e-310) {
tmp = (t_2 * t_0) * t_4;
} else if (l <= 2.2e-110) {
tmp = t_4 * (sqrt((d / h)) * (sqrt(d) / sqrt(l)));
} else if (l <= 1.25e+208) {
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 + (t_3 * ((h / l) * -0.5))));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = sqrt(-d)
t_2 = t_1 / sqrt(-h)
t_3 = ((d_m / d) * (m * 0.5d0)) ** 2.0d0
t_4 = 1.0d0 - (0.5d0 * ((h * t_3) / l))
if (l <= (-7d-40)) then
tmp = (t_1 / sqrt(-l)) * (t_2 * (1.0d0 + ((h / l) * (((d_m * ((m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))))
else if (l <= (-2d-310)) then
tmp = (t_2 * t_0) * t_4
else if (l <= 2.2d-110) then
tmp = t_4 * (sqrt((d / h)) * (sqrt(d) / sqrt(l)))
else if (l <= 1.25d+208) then
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0d0 + (t_3 * ((h / l) * (-0.5d0)))))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.sqrt((d / l));
double t_1 = Math.sqrt(-d);
double t_2 = t_1 / Math.sqrt(-h);
double t_3 = Math.pow(((D_m / d) * (M * 0.5)), 2.0);
double t_4 = 1.0 - (0.5 * ((h * t_3) / l));
double tmp;
if (l <= -7e-40) {
tmp = (t_1 / Math.sqrt(-l)) * (t_2 * (1.0 + ((h / l) * (Math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5))));
} else if (l <= -2e-310) {
tmp = (t_2 * t_0) * t_4;
} else if (l <= 2.2e-110) {
tmp = t_4 * (Math.sqrt((d / h)) * (Math.sqrt(d) / Math.sqrt(l)));
} else if (l <= 1.25e+208) {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (t_0 * (1.0 + (t_3 * ((h / l) * -0.5))));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.sqrt((d / l)) t_1 = math.sqrt(-d) t_2 = t_1 / math.sqrt(-h) t_3 = math.pow(((D_m / d) * (M * 0.5)), 2.0) t_4 = 1.0 - (0.5 * ((h * t_3) / l)) tmp = 0 if l <= -7e-40: tmp = (t_1 / math.sqrt(-l)) * (t_2 * (1.0 + ((h / l) * (math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5)))) elif l <= -2e-310: tmp = (t_2 * t_0) * t_4 elif l <= 2.2e-110: tmp = t_4 * (math.sqrt((d / h)) * (math.sqrt(d) / math.sqrt(l))) elif l <= 1.25e+208: tmp = (math.sqrt(d) / math.sqrt(h)) * (t_0 * (1.0 + (t_3 * ((h / l) * -0.5)))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(d / l)) t_1 = sqrt(Float64(-d)) t_2 = Float64(t_1 / sqrt(Float64(-h))) t_3 = Float64(Float64(D_m / d) * Float64(M * 0.5)) ^ 2.0 t_4 = Float64(1.0 - Float64(0.5 * Float64(Float64(h * t_3) / l))) tmp = 0.0 if (l <= -7e-40) tmp = Float64(Float64(t_1 / sqrt(Float64(-l))) * Float64(t_2 * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D_m * Float64(Float64(M / 2.0) / d)) ^ 2.0) * -0.5))))); elseif (l <= -2e-310) tmp = Float64(Float64(t_2 * t_0) * t_4); elseif (l <= 2.2e-110) tmp = Float64(t_4 * Float64(sqrt(Float64(d / h)) * Float64(sqrt(d) / sqrt(l)))); elseif (l <= 1.25e+208) tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_0 * Float64(1.0 + Float64(t_3 * Float64(Float64(h / l) * -0.5))))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = sqrt((d / l));
t_1 = sqrt(-d);
t_2 = t_1 / sqrt(-h);
t_3 = ((D_m / d) * (M * 0.5)) ^ 2.0;
t_4 = 1.0 - (0.5 * ((h * t_3) / l));
tmp = 0.0;
if (l <= -7e-40)
tmp = (t_1 / sqrt(-l)) * (t_2 * (1.0 + ((h / l) * (((D_m * ((M / 2.0) / d)) ^ 2.0) * -0.5))));
elseif (l <= -2e-310)
tmp = (t_2 * t_0) * t_4;
elseif (l <= 2.2e-110)
tmp = t_4 * (sqrt((d / h)) * (sqrt(d) / sqrt(l)));
elseif (l <= 1.25e+208)
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 + (t_3 * ((h / l) * -0.5))));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[(1.0 - N[(0.5 * N[(N[(h * t$95$3), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -7e-40], N[(N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(t$95$2 * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D$95$m * N[(N[(M / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-310], N[(N[(t$95$2 * t$95$0), $MachinePrecision] * t$95$4), $MachinePrecision], If[LessEqual[l, 2.2e-110], N[(t$95$4 * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.25e+208], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 + N[(t$95$3 * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{-d}\\
t_2 := \frac{t\_1}{\sqrt{-h}}\\
t_3 := {\left(\frac{D\_m}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}\\
t_4 := 1 - 0.5 \cdot \frac{h \cdot t\_3}{\ell}\\
\mathbf{if}\;\ell \leq -7 \cdot 10^{-40}:\\
\;\;\;\;\frac{t\_1}{\sqrt{-\ell}} \cdot \left(t\_2 \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(D\_m \cdot \frac{\frac{M}{2}}{d}\right)}^{2} \cdot -0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(t\_2 \cdot t\_0\right) \cdot t\_4\\
\mathbf{elif}\;\ell \leq 2.2 \cdot 10^{-110}:\\
\;\;\;\;t\_4 \cdot \left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
\mathbf{elif}\;\ell \leq 1.25 \cdot 10^{+208}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_0 \cdot \left(1 + t\_3 \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -7.0000000000000003e-40Initial program 60.9%
Simplified59.5%
frac-2neg59.5%
sqrt-div75.1%
Applied egg-rr75.1%
frac-2neg75.1%
sqrt-div83.4%
Applied egg-rr83.4%
if -7.0000000000000003e-40 < l < -1.999999999999994e-310Initial program 69.5%
Simplified71.3%
associate-*r/80.3%
*-commutative80.3%
div-inv80.3%
metadata-eval80.3%
Applied egg-rr80.3%
frac-2neg69.5%
sqrt-div76.6%
Applied egg-rr87.6%
if -1.999999999999994e-310 < l < 2.1999999999999999e-110Initial program 68.9%
Simplified68.9%
associate-*r/76.9%
*-commutative76.9%
div-inv76.9%
metadata-eval76.9%
Applied egg-rr76.9%
sqrt-div89.3%
Applied egg-rr89.3%
if 2.1999999999999999e-110 < l < 1.2500000000000001e208Initial program 67.9%
Simplified67.9%
sqrt-div83.8%
Applied egg-rr83.8%
fma-undefine83.8%
associate-*r*83.8%
Applied egg-rr83.8%
if 1.2500000000000001e208 < l Initial program 48.7%
Simplified52.7%
associate-*r/48.8%
*-commutative48.8%
div-inv48.8%
metadata-eval48.8%
Applied egg-rr48.8%
Taylor expanded in d around inf 69.1%
unpow-169.1%
metadata-eval69.1%
pow-sqr69.0%
rem-sqrt-square69.0%
rem-square-sqrt68.8%
fabs-sqr68.8%
rem-square-sqrt69.0%
Simplified69.0%
*-commutative69.0%
unpow-prod-down84.1%
Applied egg-rr84.1%
Final simplification85.3%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1 (/ (sqrt (- d)) (sqrt (- h))))
(t_2 (pow (* (/ D_m d) (* M 0.5)) 2.0))
(t_3 (- 1.0 (* 0.5 (/ (* h t_2) l)))))
(if (<= l -1e-39)
(*
(* t_1 (+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M 2.0) d)) 2.0) -0.5))))
t_0)
(if (<= l -2e-310)
(* (* t_1 t_0) t_3)
(if (<= l 3.6e-116)
(* t_3 (* (sqrt (/ d h)) (/ (sqrt d) (sqrt l))))
(if (<= l 6.4e+207)
(* (/ (sqrt d) (sqrt h)) (* t_0 (+ 1.0 (* t_2 (* (/ h l) -0.5)))))
(* d (* (pow l -0.5) (pow h -0.5)))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt((d / l));
double t_1 = sqrt(-d) / sqrt(-h);
double t_2 = pow(((D_m / d) * (M * 0.5)), 2.0);
double t_3 = 1.0 - (0.5 * ((h * t_2) / l));
double tmp;
if (l <= -1e-39) {
tmp = (t_1 * (1.0 + ((h / l) * (pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5)))) * t_0;
} else if (l <= -2e-310) {
tmp = (t_1 * t_0) * t_3;
} else if (l <= 3.6e-116) {
tmp = t_3 * (sqrt((d / h)) * (sqrt(d) / sqrt(l)));
} else if (l <= 6.4e+207) {
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 + (t_2 * ((h / l) * -0.5))));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = sqrt(-d) / sqrt(-h)
t_2 = ((d_m / d) * (m * 0.5d0)) ** 2.0d0
t_3 = 1.0d0 - (0.5d0 * ((h * t_2) / l))
if (l <= (-1d-39)) then
tmp = (t_1 * (1.0d0 + ((h / l) * (((d_m * ((m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0))))) * t_0
else if (l <= (-2d-310)) then
tmp = (t_1 * t_0) * t_3
else if (l <= 3.6d-116) then
tmp = t_3 * (sqrt((d / h)) * (sqrt(d) / sqrt(l)))
else if (l <= 6.4d+207) then
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0d0 + (t_2 * ((h / l) * (-0.5d0)))))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.sqrt((d / l));
double t_1 = Math.sqrt(-d) / Math.sqrt(-h);
double t_2 = Math.pow(((D_m / d) * (M * 0.5)), 2.0);
double t_3 = 1.0 - (0.5 * ((h * t_2) / l));
double tmp;
if (l <= -1e-39) {
tmp = (t_1 * (1.0 + ((h / l) * (Math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5)))) * t_0;
} else if (l <= -2e-310) {
tmp = (t_1 * t_0) * t_3;
} else if (l <= 3.6e-116) {
tmp = t_3 * (Math.sqrt((d / h)) * (Math.sqrt(d) / Math.sqrt(l)));
} else if (l <= 6.4e+207) {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (t_0 * (1.0 + (t_2 * ((h / l) * -0.5))));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.sqrt((d / l)) t_1 = math.sqrt(-d) / math.sqrt(-h) t_2 = math.pow(((D_m / d) * (M * 0.5)), 2.0) t_3 = 1.0 - (0.5 * ((h * t_2) / l)) tmp = 0 if l <= -1e-39: tmp = (t_1 * (1.0 + ((h / l) * (math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5)))) * t_0 elif l <= -2e-310: tmp = (t_1 * t_0) * t_3 elif l <= 3.6e-116: tmp = t_3 * (math.sqrt((d / h)) * (math.sqrt(d) / math.sqrt(l))) elif l <= 6.4e+207: tmp = (math.sqrt(d) / math.sqrt(h)) * (t_0 * (1.0 + (t_2 * ((h / l) * -0.5)))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(d / l)) t_1 = Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) t_2 = Float64(Float64(D_m / d) * Float64(M * 0.5)) ^ 2.0 t_3 = Float64(1.0 - Float64(0.5 * Float64(Float64(h * t_2) / l))) tmp = 0.0 if (l <= -1e-39) tmp = Float64(Float64(t_1 * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D_m * Float64(Float64(M / 2.0) / d)) ^ 2.0) * -0.5)))) * t_0); elseif (l <= -2e-310) tmp = Float64(Float64(t_1 * t_0) * t_3); elseif (l <= 3.6e-116) tmp = Float64(t_3 * Float64(sqrt(Float64(d / h)) * Float64(sqrt(d) / sqrt(l)))); elseif (l <= 6.4e+207) tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_0 * Float64(1.0 + Float64(t_2 * Float64(Float64(h / l) * -0.5))))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = sqrt((d / l));
t_1 = sqrt(-d) / sqrt(-h);
t_2 = ((D_m / d) * (M * 0.5)) ^ 2.0;
t_3 = 1.0 - (0.5 * ((h * t_2) / l));
tmp = 0.0;
if (l <= -1e-39)
tmp = (t_1 * (1.0 + ((h / l) * (((D_m * ((M / 2.0) / d)) ^ 2.0) * -0.5)))) * t_0;
elseif (l <= -2e-310)
tmp = (t_1 * t_0) * t_3;
elseif (l <= 3.6e-116)
tmp = t_3 * (sqrt((d / h)) * (sqrt(d) / sqrt(l)));
elseif (l <= 6.4e+207)
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 + (t_2 * ((h / l) * -0.5))));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(1.0 - N[(0.5 * N[(N[(h * t$95$2), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1e-39], N[(N[(t$95$1 * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D$95$m * N[(N[(M / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[l, -2e-310], N[(N[(t$95$1 * t$95$0), $MachinePrecision] * t$95$3), $MachinePrecision], If[LessEqual[l, 3.6e-116], N[(t$95$3 * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.4e+207], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 + N[(t$95$2 * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \frac{\sqrt{-d}}{\sqrt{-h}}\\
t_2 := {\left(\frac{D\_m}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}\\
t_3 := 1 - 0.5 \cdot \frac{h \cdot t\_2}{\ell}\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-39}:\\
\;\;\;\;\left(t\_1 \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(D\_m \cdot \frac{\frac{M}{2}}{d}\right)}^{2} \cdot -0.5\right)\right)\right) \cdot t\_0\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(t\_1 \cdot t\_0\right) \cdot t\_3\\
\mathbf{elif}\;\ell \leq 3.6 \cdot 10^{-116}:\\
\;\;\;\;t\_3 \cdot \left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
\mathbf{elif}\;\ell \leq 6.4 \cdot 10^{+207}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_0 \cdot \left(1 + t\_2 \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -9.99999999999999929e-40Initial program 60.9%
Simplified59.5%
frac-2neg59.5%
sqrt-div75.1%
Applied egg-rr75.1%
if -9.99999999999999929e-40 < l < -1.999999999999994e-310Initial program 69.5%
Simplified71.3%
associate-*r/80.3%
*-commutative80.3%
div-inv80.3%
metadata-eval80.3%
Applied egg-rr80.3%
frac-2neg69.5%
sqrt-div76.6%
Applied egg-rr87.6%
if -1.999999999999994e-310 < l < 3.59999999999999975e-116Initial program 68.9%
Simplified68.9%
associate-*r/76.9%
*-commutative76.9%
div-inv76.9%
metadata-eval76.9%
Applied egg-rr76.9%
sqrt-div89.3%
Applied egg-rr89.3%
if 3.59999999999999975e-116 < l < 6.4000000000000002e207Initial program 67.9%
Simplified67.9%
sqrt-div83.8%
Applied egg-rr83.8%
fma-undefine83.8%
associate-*r*83.8%
Applied egg-rr83.8%
if 6.4000000000000002e207 < l Initial program 48.7%
Simplified52.7%
associate-*r/48.8%
*-commutative48.8%
div-inv48.8%
metadata-eval48.8%
Applied egg-rr48.8%
Taylor expanded in d around inf 69.1%
unpow-169.1%
metadata-eval69.1%
pow-sqr69.0%
rem-sqrt-square69.0%
rem-square-sqrt68.8%
fabs-sqr68.8%
rem-square-sqrt69.0%
Simplified69.0%
*-commutative69.0%
unpow-prod-down84.1%
Applied egg-rr84.1%
Final simplification83.0%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (pow (* (/ D_m d) (* M 0.5)) 2.0)) (t_1 (sqrt (/ d l))))
(if (<= l -3.5e-174)
(*
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M 2.0) d)) 2.0) -0.5))))
t_1)
(if (<= l 6e-117)
(*
(- 1.0 (* 0.5 (/ (* h t_0) l)))
(* (sqrt (/ d h)) (pow (/ l d) -0.5)))
(if (<= l 6.8e+207)
(* (/ (sqrt d) (sqrt h)) (* t_1 (+ 1.0 (* t_0 (* (/ h l) -0.5)))))
(* d (* (pow l -0.5) (pow h -0.5))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = pow(((D_m / d) * (M * 0.5)), 2.0);
double t_1 = sqrt((d / l));
double tmp;
if (l <= -3.5e-174) {
tmp = ((sqrt(-d) / sqrt(-h)) * (1.0 + ((h / l) * (pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5)))) * t_1;
} else if (l <= 6e-117) {
tmp = (1.0 - (0.5 * ((h * t_0) / l))) * (sqrt((d / h)) * pow((l / d), -0.5));
} else if (l <= 6.8e+207) {
tmp = (sqrt(d) / sqrt(h)) * (t_1 * (1.0 + (t_0 * ((h / l) * -0.5))));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ((d_m / d) * (m * 0.5d0)) ** 2.0d0
t_1 = sqrt((d / l))
if (l <= (-3.5d-174)) then
tmp = ((sqrt(-d) / sqrt(-h)) * (1.0d0 + ((h / l) * (((d_m * ((m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0))))) * t_1
else if (l <= 6d-117) then
tmp = (1.0d0 - (0.5d0 * ((h * t_0) / l))) * (sqrt((d / h)) * ((l / d) ** (-0.5d0)))
else if (l <= 6.8d+207) then
tmp = (sqrt(d) / sqrt(h)) * (t_1 * (1.0d0 + (t_0 * ((h / l) * (-0.5d0)))))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.pow(((D_m / d) * (M * 0.5)), 2.0);
double t_1 = Math.sqrt((d / l));
double tmp;
if (l <= -3.5e-174) {
tmp = ((Math.sqrt(-d) / Math.sqrt(-h)) * (1.0 + ((h / l) * (Math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5)))) * t_1;
} else if (l <= 6e-117) {
tmp = (1.0 - (0.5 * ((h * t_0) / l))) * (Math.sqrt((d / h)) * Math.pow((l / d), -0.5));
} else if (l <= 6.8e+207) {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (t_1 * (1.0 + (t_0 * ((h / l) * -0.5))));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.pow(((D_m / d) * (M * 0.5)), 2.0) t_1 = math.sqrt((d / l)) tmp = 0 if l <= -3.5e-174: tmp = ((math.sqrt(-d) / math.sqrt(-h)) * (1.0 + ((h / l) * (math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5)))) * t_1 elif l <= 6e-117: tmp = (1.0 - (0.5 * ((h * t_0) / l))) * (math.sqrt((d / h)) * math.pow((l / d), -0.5)) elif l <= 6.8e+207: tmp = (math.sqrt(d) / math.sqrt(h)) * (t_1 * (1.0 + (t_0 * ((h / l) * -0.5)))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(D_m / d) * Float64(M * 0.5)) ^ 2.0 t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -3.5e-174) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D_m * Float64(Float64(M / 2.0) / d)) ^ 2.0) * -0.5)))) * t_1); elseif (l <= 6e-117) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * t_0) / l))) * Float64(sqrt(Float64(d / h)) * (Float64(l / d) ^ -0.5))); elseif (l <= 6.8e+207) tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_1 * Float64(1.0 + Float64(t_0 * Float64(Float64(h / l) * -0.5))))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = ((D_m / d) * (M * 0.5)) ^ 2.0;
t_1 = sqrt((d / l));
tmp = 0.0;
if (l <= -3.5e-174)
tmp = ((sqrt(-d) / sqrt(-h)) * (1.0 + ((h / l) * (((D_m * ((M / 2.0) / d)) ^ 2.0) * -0.5)))) * t_1;
elseif (l <= 6e-117)
tmp = (1.0 - (0.5 * ((h * t_0) / l))) * (sqrt((d / h)) * ((l / d) ^ -0.5));
elseif (l <= 6.8e+207)
tmp = (sqrt(d) / sqrt(h)) * (t_1 * (1.0 + (t_0 * ((h / l) * -0.5))));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -3.5e-174], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D$95$m * N[(N[(M / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[l, 6e-117], N[(N[(1.0 - N[(0.5 * N[(N[(h * t$95$0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Power[N[(l / d), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.8e+207], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * N[(1.0 + N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{D\_m}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -3.5 \cdot 10^{-174}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(D\_m \cdot \frac{\frac{M}{2}}{d}\right)}^{2} \cdot -0.5\right)\right)\right) \cdot t\_1\\
\mathbf{elif}\;\ell \leq 6 \cdot 10^{-117}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot t\_0}{\ell}\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot {\left(\frac{\ell}{d}\right)}^{-0.5}\right)\\
\mathbf{elif}\;\ell \leq 6.8 \cdot 10^{+207}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_1 \cdot \left(1 + t\_0 \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -3.49999999999999987e-174Initial program 60.6%
Simplified59.6%
frac-2neg59.6%
sqrt-div74.6%
Applied egg-rr74.6%
if -3.49999999999999987e-174 < l < 5.99999999999999982e-117Initial program 73.5%
Simplified75.1%
clear-num75.1%
inv-pow75.1%
Applied egg-rr75.1%
sqrt-pow177.3%
metadata-eval77.3%
Applied egg-rr77.3%
associate-*r/84.4%
*-commutative84.4%
div-inv84.4%
metadata-eval84.4%
Applied egg-rr86.7%
if 5.99999999999999982e-117 < l < 6.7999999999999997e207Initial program 67.9%
Simplified67.9%
sqrt-div83.8%
Applied egg-rr83.8%
fma-undefine83.8%
associate-*r*83.8%
Applied egg-rr83.8%
if 6.7999999999999997e207 < l Initial program 48.7%
Simplified52.7%
associate-*r/48.8%
*-commutative48.8%
div-inv48.8%
metadata-eval48.8%
Applied egg-rr48.8%
Taylor expanded in d around inf 69.1%
unpow-169.1%
metadata-eval69.1%
pow-sqr69.0%
rem-sqrt-square69.0%
rem-square-sqrt68.8%
fabs-sqr68.8%
rem-square-sqrt69.0%
Simplified69.0%
*-commutative69.0%
unpow-prod-down84.1%
Applied egg-rr84.1%
Final simplification80.9%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= h -2.3e+110)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D_m d) (* M 0.5)) 2.0)) l)))
(* (sqrt (/ d h)) (/ 1.0 (sqrt (/ l d)))))
(if (<= h -2e-310)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ -1.0 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D_m d)) 2.0)))))
(*
(sqrt (/ d l))
(*
(+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M 2.0) d)) 2.0) -0.5)))
(/ (sqrt d) (sqrt h)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (h <= -2.3e+110) {
tmp = (1.0 - (0.5 * ((h * pow(((D_m / d) * (M * 0.5)), 2.0)) / l))) * (sqrt((d / h)) * (1.0 / sqrt((l / d))));
} else if (h <= -2e-310) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h / l) * pow(((M / 2.0) * (D_m / d)), 2.0))));
} else {
tmp = sqrt((d / l)) * ((1.0 + ((h / l) * (pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5))) * (sqrt(d) / sqrt(h)));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (h <= (-2.3d+110)) then
tmp = (1.0d0 - (0.5d0 * ((h * (((d_m / d) * (m * 0.5d0)) ** 2.0d0)) / l))) * (sqrt((d / h)) * (1.0d0 / sqrt((l / d))))
else if (h <= (-2d-310)) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + (0.5d0 * ((h / l) * (((m / 2.0d0) * (d_m / d)) ** 2.0d0))))
else
tmp = sqrt((d / l)) * ((1.0d0 + ((h / l) * (((d_m * ((m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))) * (sqrt(d) / sqrt(h)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (h <= -2.3e+110) {
tmp = (1.0 - (0.5 * ((h * Math.pow(((D_m / d) * (M * 0.5)), 2.0)) / l))) * (Math.sqrt((d / h)) * (1.0 / Math.sqrt((l / d))));
} else if (h <= -2e-310) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h / l) * Math.pow(((M / 2.0) * (D_m / d)), 2.0))));
} else {
tmp = Math.sqrt((d / l)) * ((1.0 + ((h / l) * (Math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5))) * (Math.sqrt(d) / Math.sqrt(h)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if h <= -2.3e+110: tmp = (1.0 - (0.5 * ((h * math.pow(((D_m / d) * (M * 0.5)), 2.0)) / l))) * (math.sqrt((d / h)) * (1.0 / math.sqrt((l / d)))) elif h <= -2e-310: tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h / l) * math.pow(((M / 2.0) * (D_m / d)), 2.0)))) else: tmp = math.sqrt((d / l)) * ((1.0 + ((h / l) * (math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5))) * (math.sqrt(d) / math.sqrt(h))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (h <= -2.3e+110) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D_m / d) * Float64(M * 0.5)) ^ 2.0)) / l))) * Float64(sqrt(Float64(d / h)) * Float64(1.0 / sqrt(Float64(l / d))))); elseif (h <= -2e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.0))))); else tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D_m * Float64(Float64(M / 2.0) / d)) ^ 2.0) * -0.5))) * Float64(sqrt(d) / sqrt(h)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (h <= -2.3e+110)
tmp = (1.0 - (0.5 * ((h * (((D_m / d) * (M * 0.5)) ^ 2.0)) / l))) * (sqrt((d / h)) * (1.0 / sqrt((l / d))));
elseif (h <= -2e-310)
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h / l) * (((M / 2.0) * (D_m / d)) ^ 2.0))));
else
tmp = sqrt((d / l)) * ((1.0 + ((h / l) * (((D_m * ((M / 2.0) / d)) ^ 2.0) * -0.5))) * (sqrt(d) / sqrt(h)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[h, -2.3e+110], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D$95$m * N[(N[(M / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -2.3 \cdot 10^{+110}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D\_m}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot \frac{1}{\sqrt{\frac{\ell}{d}}}\right)\\
\mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left({\left(D\_m \cdot \frac{\frac{M}{2}}{d}\right)}^{2} \cdot -0.5\right)\right) \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\end{array}
\end{array}
if h < -2.3e110Initial program 60.8%
Simplified58.2%
associate-*r/71.0%
*-commutative71.0%
div-inv71.0%
metadata-eval71.0%
Applied egg-rr71.0%
clear-num71.1%
sqrt-div71.2%
metadata-eval71.2%
Applied egg-rr71.2%
if -2.3e110 < h < -1.999999999999994e-310Initial program 66.2%
Simplified67.3%
clear-num66.2%
sqrt-div67.8%
metadata-eval67.8%
Applied egg-rr67.8%
Taylor expanded in d around -inf 79.0%
if -1.999999999999994e-310 < h Initial program 64.5%
Simplified64.4%
sqrt-div77.3%
Applied egg-rr76.4%
Final simplification76.5%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= l -1.2e-174)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ -1.0 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D_m d)) 2.0)))))
(if (<= l 1.5e+94)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D_m d) (* M 0.5)) 2.0)) l)))
(* (sqrt (/ d l)) (sqrt (/ d h))))
(* d (* (pow l -0.5) (pow h -0.5))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -1.2e-174) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h / l) * pow(((M / 2.0) * (D_m / d)), 2.0))));
} else if (l <= 1.5e+94) {
tmp = (1.0 - (0.5 * ((h * pow(((D_m / d) * (M * 0.5)), 2.0)) / l))) * (sqrt((d / l)) * sqrt((d / h)));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (l <= (-1.2d-174)) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + (0.5d0 * ((h / l) * (((m / 2.0d0) * (d_m / d)) ** 2.0d0))))
else if (l <= 1.5d+94) then
tmp = (1.0d0 - (0.5d0 * ((h * (((d_m / d) * (m * 0.5d0)) ** 2.0d0)) / l))) * (sqrt((d / l)) * sqrt((d / h)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -1.2e-174) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h / l) * Math.pow(((M / 2.0) * (D_m / d)), 2.0))));
} else if (l <= 1.5e+94) {
tmp = (1.0 - (0.5 * ((h * Math.pow(((D_m / d) * (M * 0.5)), 2.0)) / l))) * (Math.sqrt((d / l)) * Math.sqrt((d / h)));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if l <= -1.2e-174: tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h / l) * math.pow(((M / 2.0) * (D_m / d)), 2.0)))) elif l <= 1.5e+94: tmp = (1.0 - (0.5 * ((h * math.pow(((D_m / d) * (M * 0.5)), 2.0)) / l))) * (math.sqrt((d / l)) * math.sqrt((d / h))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= -1.2e-174) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.0))))); elseif (l <= 1.5e+94) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D_m / d) * Float64(M * 0.5)) ^ 2.0)) / l))) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= -1.2e-174)
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h / l) * (((M / 2.0) * (D_m / d)) ^ 2.0))));
elseif (l <= 1.5e+94)
tmp = (1.0 - (0.5 * ((h * (((D_m / d) * (M * 0.5)) ^ 2.0)) / l))) * (sqrt((d / l)) * sqrt((d / h)));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -1.2e-174], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.5e+94], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.2 \cdot 10^{-174}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right)\\
\mathbf{elif}\;\ell \leq 1.5 \cdot 10^{+94}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D\_m}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -1.2e-174Initial program 60.6%
Simplified59.7%
clear-num58.7%
sqrt-div60.1%
metadata-eval60.1%
Applied egg-rr60.1%
Taylor expanded in d around -inf 66.1%
if -1.2e-174 < l < 1.5e94Initial program 73.6%
Simplified74.5%
associate-*r/79.9%
*-commutative79.9%
div-inv79.9%
metadata-eval79.9%
Applied egg-rr79.9%
if 1.5e94 < l Initial program 52.1%
Simplified54.3%
associate-*r/52.3%
*-commutative52.3%
div-inv52.3%
metadata-eval52.3%
Applied egg-rr52.3%
Taylor expanded in d around inf 64.9%
unpow-164.9%
metadata-eval64.9%
pow-sqr64.9%
rem-sqrt-square64.9%
rem-square-sqrt64.5%
fabs-sqr64.5%
rem-square-sqrt64.9%
Simplified64.9%
*-commutative64.9%
unpow-prod-down79.0%
Applied egg-rr79.0%
Final simplification74.3%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= l 8.8e+86)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D_m d) (* M 0.5)) 2.0)) l)))
(* (sqrt (/ d h)) (pow (/ l d) -0.5)))
(* d (* (pow l -0.5) (pow h -0.5)))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= 8.8e+86) {
tmp = (1.0 - (0.5 * ((h * pow(((D_m / d) * (M * 0.5)), 2.0)) / l))) * (sqrt((d / h)) * pow((l / d), -0.5));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (l <= 8.8d+86) then
tmp = (1.0d0 - (0.5d0 * ((h * (((d_m / d) * (m * 0.5d0)) ** 2.0d0)) / l))) * (sqrt((d / h)) * ((l / d) ** (-0.5d0)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= 8.8e+86) {
tmp = (1.0 - (0.5 * ((h * Math.pow(((D_m / d) * (M * 0.5)), 2.0)) / l))) * (Math.sqrt((d / h)) * Math.pow((l / d), -0.5));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if l <= 8.8e+86: tmp = (1.0 - (0.5 * ((h * math.pow(((D_m / d) * (M * 0.5)), 2.0)) / l))) * (math.sqrt((d / h)) * math.pow((l / d), -0.5)) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= 8.8e+86) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D_m / d) * Float64(M * 0.5)) ^ 2.0)) / l))) * Float64(sqrt(Float64(d / h)) * (Float64(l / d) ^ -0.5))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= 8.8e+86)
tmp = (1.0 - (0.5 * ((h * (((D_m / d) * (M * 0.5)) ^ 2.0)) / l))) * (sqrt((d / h)) * ((l / d) ^ -0.5));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, 8.8e+86], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Power[N[(l / d), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 8.8 \cdot 10^{+86}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D\_m}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot {\left(\frac{\ell}{d}\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < 8.80000000000000013e86Initial program 67.6%
Simplified67.6%
clear-num67.2%
inv-pow67.2%
Applied egg-rr67.2%
sqrt-pow168.3%
metadata-eval68.3%
Applied egg-rr68.3%
associate-*r/71.4%
*-commutative71.4%
div-inv71.4%
metadata-eval71.4%
Applied egg-rr72.1%
if 8.80000000000000013e86 < l Initial program 51.2%
Simplified53.2%
associate-*r/51.4%
*-commutative51.4%
div-inv51.4%
metadata-eval51.4%
Applied egg-rr51.4%
Taylor expanded in d around inf 63.6%
unpow-163.6%
metadata-eval63.6%
pow-sqr63.6%
rem-sqrt-square63.6%
rem-square-sqrt63.2%
fabs-sqr63.2%
rem-square-sqrt63.6%
Simplified63.6%
*-commutative63.6%
unpow-prod-down77.4%
Applied egg-rr77.4%
Final simplification73.1%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= l 3.15e+88)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D_m d) (* M 0.5)) 2.0)) l)))
(/ (sqrt (/ d h)) (sqrt (/ l d))))
(* d (* (pow l -0.5) (pow h -0.5)))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= 3.15e+88) {
tmp = (1.0 - (0.5 * ((h * pow(((D_m / d) * (M * 0.5)), 2.0)) / l))) * (sqrt((d / h)) / sqrt((l / d)));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (l <= 3.15d+88) then
tmp = (1.0d0 - (0.5d0 * ((h * (((d_m / d) * (m * 0.5d0)) ** 2.0d0)) / l))) * (sqrt((d / h)) / sqrt((l / d)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= 3.15e+88) {
tmp = (1.0 - (0.5 * ((h * Math.pow(((D_m / d) * (M * 0.5)), 2.0)) / l))) * (Math.sqrt((d / h)) / Math.sqrt((l / d)));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if l <= 3.15e+88: tmp = (1.0 - (0.5 * ((h * math.pow(((D_m / d) * (M * 0.5)), 2.0)) / l))) * (math.sqrt((d / h)) / math.sqrt((l / d))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= 3.15e+88) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D_m / d) * Float64(M * 0.5)) ^ 2.0)) / l))) * Float64(sqrt(Float64(d / h)) / sqrt(Float64(l / d)))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= 3.15e+88)
tmp = (1.0 - (0.5 * ((h * (((D_m / d) * (M * 0.5)) ^ 2.0)) / l))) * (sqrt((d / h)) / sqrt((l / d)));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, 3.15e+88], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 3.15 \cdot 10^{+88}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D\_m}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}}{\ell}\right) \cdot \frac{\sqrt{\frac{d}{h}}}{\sqrt{\frac{\ell}{d}}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < 3.15e88Initial program 67.6%
Simplified67.6%
associate-*r/71.4%
*-commutative71.4%
div-inv71.4%
metadata-eval71.4%
Applied egg-rr71.4%
clear-num71.0%
sqrt-div72.0%
metadata-eval72.0%
Applied egg-rr72.0%
un-div-inv72.0%
Applied egg-rr72.0%
if 3.15e88 < l Initial program 51.2%
Simplified53.2%
associate-*r/51.4%
*-commutative51.4%
div-inv51.4%
metadata-eval51.4%
Applied egg-rr51.4%
Taylor expanded in d around inf 63.6%
unpow-163.6%
metadata-eval63.6%
pow-sqr63.6%
rem-sqrt-square63.6%
rem-square-sqrt63.2%
fabs-sqr63.2%
rem-square-sqrt63.6%
Simplified63.6%
*-commutative63.6%
unpow-prod-down77.4%
Applied egg-rr77.4%
Final simplification73.0%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= l 1.02e+95)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (/ (* h (* -0.5 (pow (/ (* D_m (* M 0.5)) d) 2.0))) l))))
(* d (* (pow l -0.5) (pow h -0.5)))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= 1.02e+95) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * (-0.5 * pow(((D_m * (M * 0.5)) / d), 2.0))) / l)));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (l <= 1.02d+95) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((h * ((-0.5d0) * (((d_m * (m * 0.5d0)) / d) ** 2.0d0))) / l)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= 1.02e+95) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h * (-0.5 * Math.pow(((D_m * (M * 0.5)) / d), 2.0))) / l)));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if l <= 1.02e+95: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((h * (-0.5 * math.pow(((D_m * (M * 0.5)) / d), 2.0))) / l))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= 1.02e+95) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(Float64(D_m * Float64(M * 0.5)) / d) ^ 2.0))) / l)))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= 1.02e+95)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * (-0.5 * (((D_m * (M * 0.5)) / d) ^ 2.0))) / l)));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, 1.02e+95], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(N[(D$95$m * N[(M * 0.5), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.02 \cdot 10^{+95}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(\frac{D\_m \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2}\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < 1.0200000000000001e95Initial program 67.3%
Simplified66.8%
associate-*l/70.1%
*-commutative70.1%
associate-*r/70.6%
div-inv70.6%
metadata-eval70.6%
Applied egg-rr70.6%
if 1.0200000000000001e95 < l Initial program 52.1%
Simplified54.3%
associate-*r/52.3%
*-commutative52.3%
div-inv52.3%
metadata-eval52.3%
Applied egg-rr52.3%
Taylor expanded in d around inf 64.9%
unpow-164.9%
metadata-eval64.9%
pow-sqr64.9%
rem-sqrt-square64.9%
rem-square-sqrt64.5%
fabs-sqr64.5%
rem-square-sqrt64.9%
Simplified64.9%
*-commutative64.9%
unpow-prod-down79.0%
Applied egg-rr79.0%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= l 5.2e+89)
(*
(sqrt (/ d h))
(* (sqrt (/ d l)) (- 1.0 (* h (* (/ 0.125 l) (pow (* D_m (/ M d)) 2.0))))))
(* d (* (pow l -0.5) (pow h -0.5)))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= 5.2e+89) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (h * ((0.125 / l) * pow((D_m * (M / d)), 2.0)))));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (l <= 5.2d+89) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 - (h * ((0.125d0 / l) * ((d_m * (m / d)) ** 2.0d0)))))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= 5.2e+89) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - (h * ((0.125 / l) * Math.pow((D_m * (M / d)), 2.0)))));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if l <= 5.2e+89: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - (h * ((0.125 / l) * math.pow((D_m * (M / d)), 2.0))))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= 5.2e+89) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(h * Float64(Float64(0.125 / l) * (Float64(D_m * Float64(M / d)) ^ 2.0)))))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= 5.2e+89)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (h * ((0.125 / l) * ((D_m * (M / d)) ^ 2.0)))));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, 5.2e+89], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(h * N[(N[(0.125 / l), $MachinePrecision] * N[Power[N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 5.2 \cdot 10^{+89}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - h \cdot \left(\frac{0.125}{\ell} \cdot {\left(D\_m \cdot \frac{M}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < 5.2000000000000001e89Initial program 67.3%
Simplified67.3%
Taylor expanded in h around -inf 44.1%
associate-*r*44.1%
neg-mul-144.1%
sub-neg44.1%
distribute-lft-in44.1%
Simplified69.3%
if 5.2000000000000001e89 < l Initial program 52.1%
Simplified54.3%
associate-*r/52.3%
*-commutative52.3%
div-inv52.3%
metadata-eval52.3%
Applied egg-rr52.3%
Taylor expanded in d around inf 64.9%
unpow-164.9%
metadata-eval64.9%
pow-sqr64.9%
rem-sqrt-square64.9%
rem-square-sqrt64.5%
fabs-sqr64.5%
rem-square-sqrt64.9%
Simplified64.9%
*-commutative64.9%
unpow-prod-down79.0%
Applied egg-rr79.0%
Final simplification71.0%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= l -3.4e-174)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ -1.0 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D_m d)) 2.0)))))
(if (<= l 3.5e+89)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D_m d) (* M 0.5)) 2.0)) l)))
(sqrt (* (/ d l) (/ d h))))
(* d (* (pow l -0.5) (pow h -0.5))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -3.4e-174) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h / l) * pow(((M / 2.0) * (D_m / d)), 2.0))));
} else if (l <= 3.5e+89) {
tmp = (1.0 - (0.5 * ((h * pow(((D_m / d) * (M * 0.5)), 2.0)) / l))) * sqrt(((d / l) * (d / h)));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (l <= (-3.4d-174)) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + (0.5d0 * ((h / l) * (((m / 2.0d0) * (d_m / d)) ** 2.0d0))))
else if (l <= 3.5d+89) then
tmp = (1.0d0 - (0.5d0 * ((h * (((d_m / d) * (m * 0.5d0)) ** 2.0d0)) / l))) * sqrt(((d / l) * (d / h)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -3.4e-174) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h / l) * Math.pow(((M / 2.0) * (D_m / d)), 2.0))));
} else if (l <= 3.5e+89) {
tmp = (1.0 - (0.5 * ((h * Math.pow(((D_m / d) * (M * 0.5)), 2.0)) / l))) * Math.sqrt(((d / l) * (d / h)));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if l <= -3.4e-174: tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h / l) * math.pow(((M / 2.0) * (D_m / d)), 2.0)))) elif l <= 3.5e+89: tmp = (1.0 - (0.5 * ((h * math.pow(((D_m / d) * (M * 0.5)), 2.0)) / l))) * math.sqrt(((d / l) * (d / h))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= -3.4e-174) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.0))))); elseif (l <= 3.5e+89) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D_m / d) * Float64(M * 0.5)) ^ 2.0)) / l))) * sqrt(Float64(Float64(d / l) * Float64(d / h)))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= -3.4e-174)
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h / l) * (((M / 2.0) * (D_m / d)) ^ 2.0))));
elseif (l <= 3.5e+89)
tmp = (1.0 - (0.5 * ((h * (((D_m / d) * (M * 0.5)) ^ 2.0)) / l))) * sqrt(((d / l) * (d / h)));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -3.4e-174], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.5e+89], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.4 \cdot 10^{-174}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right)\\
\mathbf{elif}\;\ell \leq 3.5 \cdot 10^{+89}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D\_m}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}}{\ell}\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -3.4000000000000002e-174Initial program 60.6%
Simplified59.7%
clear-num58.7%
sqrt-div60.1%
metadata-eval60.1%
Applied egg-rr60.1%
Taylor expanded in d around -inf 66.1%
if -3.4000000000000002e-174 < l < 3.5000000000000001e89Initial program 73.6%
Simplified74.5%
associate-*r/79.9%
*-commutative79.9%
div-inv79.9%
metadata-eval79.9%
Applied egg-rr79.9%
pow179.9%
sqrt-unprod71.6%
Applied egg-rr71.6%
unpow171.6%
Simplified71.6%
if 3.5000000000000001e89 < l Initial program 52.1%
Simplified54.3%
associate-*r/52.3%
*-commutative52.3%
div-inv52.3%
metadata-eval52.3%
Applied egg-rr52.3%
Taylor expanded in d around inf 64.9%
unpow-164.9%
metadata-eval64.9%
pow-sqr64.9%
rem-sqrt-square64.9%
rem-square-sqrt64.5%
fabs-sqr64.5%
rem-square-sqrt64.9%
Simplified64.9%
*-commutative64.9%
unpow-prod-down79.0%
Applied egg-rr79.0%
Final simplification70.8%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= l -1.25e+153)
(* (- d) (pow (* l h) -0.5))
(if (<= l 7.3e+93)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D_m d) (* M 0.5)) 2.0)) l)))
(sqrt (* (/ d l) (/ d h))))
(* d (* (pow l -0.5) (pow h -0.5))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -1.25e+153) {
tmp = -d * pow((l * h), -0.5);
} else if (l <= 7.3e+93) {
tmp = (1.0 - (0.5 * ((h * pow(((D_m / d) * (M * 0.5)), 2.0)) / l))) * sqrt(((d / l) * (d / h)));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (l <= (-1.25d+153)) then
tmp = -d * ((l * h) ** (-0.5d0))
else if (l <= 7.3d+93) then
tmp = (1.0d0 - (0.5d0 * ((h * (((d_m / d) * (m * 0.5d0)) ** 2.0d0)) / l))) * sqrt(((d / l) * (d / h)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -1.25e+153) {
tmp = -d * Math.pow((l * h), -0.5);
} else if (l <= 7.3e+93) {
tmp = (1.0 - (0.5 * ((h * Math.pow(((D_m / d) * (M * 0.5)), 2.0)) / l))) * Math.sqrt(((d / l) * (d / h)));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if l <= -1.25e+153: tmp = -d * math.pow((l * h), -0.5) elif l <= 7.3e+93: tmp = (1.0 - (0.5 * ((h * math.pow(((D_m / d) * (M * 0.5)), 2.0)) / l))) * math.sqrt(((d / l) * (d / h))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= -1.25e+153) tmp = Float64(Float64(-d) * (Float64(l * h) ^ -0.5)); elseif (l <= 7.3e+93) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D_m / d) * Float64(M * 0.5)) ^ 2.0)) / l))) * sqrt(Float64(Float64(d / l) * Float64(d / h)))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= -1.25e+153)
tmp = -d * ((l * h) ^ -0.5);
elseif (l <= 7.3e+93)
tmp = (1.0 - (0.5 * ((h * (((D_m / d) * (M * 0.5)) ^ 2.0)) / l))) * sqrt(((d / l) * (d / h)));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -1.25e+153], N[((-d) * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.3e+93], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.25 \cdot 10^{+153}:\\
\;\;\;\;\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{elif}\;\ell \leq 7.3 \cdot 10^{+93}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D\_m}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}}{\ell}\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -1.25000000000000005e153Initial program 47.9%
Simplified47.9%
associate-*r/47.7%
*-commutative47.7%
div-inv47.7%
metadata-eval47.7%
Applied egg-rr47.7%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt62.6%
neg-mul-162.6%
Simplified62.6%
if -1.25000000000000005e153 < l < 7.30000000000000026e93Initial program 70.1%
Simplified70.1%
associate-*r/74.4%
*-commutative74.4%
div-inv74.4%
metadata-eval74.4%
Applied egg-rr74.4%
pow174.4%
sqrt-unprod63.8%
Applied egg-rr63.8%
unpow163.8%
Simplified63.8%
if 7.30000000000000026e93 < l Initial program 52.1%
Simplified54.3%
associate-*r/52.3%
*-commutative52.3%
div-inv52.3%
metadata-eval52.3%
Applied egg-rr52.3%
Taylor expanded in d around inf 64.9%
unpow-164.9%
metadata-eval64.9%
pow-sqr64.9%
rem-sqrt-square64.9%
rem-square-sqrt64.5%
fabs-sqr64.5%
rem-square-sqrt64.9%
Simplified64.9%
*-commutative64.9%
unpow-prod-down79.0%
Applied egg-rr79.0%
Final simplification66.5%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= l -4.7e+151)
(* (- d) (pow (* l h) -0.5))
(if (<= l 1.45e+90)
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D_m d)) 2.0))))
(sqrt (* (/ d l) (/ d h))))
(* d (* (pow l -0.5) (pow h -0.5))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -4.7e+151) {
tmp = -d * pow((l * h), -0.5);
} else if (l <= 1.45e+90) {
tmp = (1.0 - (0.5 * ((h / l) * pow(((M / 2.0) * (D_m / d)), 2.0)))) * sqrt(((d / l) * (d / h)));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (l <= (-4.7d+151)) then
tmp = -d * ((l * h) ** (-0.5d0))
else if (l <= 1.45d+90) then
tmp = (1.0d0 - (0.5d0 * ((h / l) * (((m / 2.0d0) * (d_m / d)) ** 2.0d0)))) * sqrt(((d / l) * (d / h)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -4.7e+151) {
tmp = -d * Math.pow((l * h), -0.5);
} else if (l <= 1.45e+90) {
tmp = (1.0 - (0.5 * ((h / l) * Math.pow(((M / 2.0) * (D_m / d)), 2.0)))) * Math.sqrt(((d / l) * (d / h)));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if l <= -4.7e+151: tmp = -d * math.pow((l * h), -0.5) elif l <= 1.45e+90: tmp = (1.0 - (0.5 * ((h / l) * math.pow(((M / 2.0) * (D_m / d)), 2.0)))) * math.sqrt(((d / l) * (d / h))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= -4.7e+151) tmp = Float64(Float64(-d) * (Float64(l * h) ^ -0.5)); elseif (l <= 1.45e+90) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.0)))) * sqrt(Float64(Float64(d / l) * Float64(d / h)))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= -4.7e+151)
tmp = -d * ((l * h) ^ -0.5);
elseif (l <= 1.45e+90)
tmp = (1.0 - (0.5 * ((h / l) * (((M / 2.0) * (D_m / d)) ^ 2.0)))) * sqrt(((d / l) * (d / h)));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -4.7e+151], N[((-d) * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.45e+90], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.7 \cdot 10^{+151}:\\
\;\;\;\;\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{elif}\;\ell \leq 1.45 \cdot 10^{+90}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -4.69999999999999989e151Initial program 47.9%
Simplified47.9%
associate-*r/47.7%
*-commutative47.7%
div-inv47.7%
metadata-eval47.7%
Applied egg-rr47.7%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt62.6%
neg-mul-162.6%
Simplified62.6%
if -4.69999999999999989e151 < l < 1.4500000000000001e90Initial program 70.1%
Simplified70.1%
pow174.4%
sqrt-unprod63.8%
Applied egg-rr59.5%
unpow163.8%
Simplified59.5%
if 1.4500000000000001e90 < l Initial program 52.1%
Simplified54.3%
associate-*r/52.3%
*-commutative52.3%
div-inv52.3%
metadata-eval52.3%
Applied egg-rr52.3%
Taylor expanded in d around inf 64.9%
unpow-164.9%
metadata-eval64.9%
pow-sqr64.9%
rem-sqrt-square64.9%
rem-square-sqrt64.5%
fabs-sqr64.5%
rem-square-sqrt64.9%
Simplified64.9%
*-commutative64.9%
unpow-prod-down79.0%
Applied egg-rr79.0%
Final simplification63.4%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (if (<= d 9e-177) (* (- d) (pow (* l h) -0.5)) (* d (* (pow l -0.5) (pow h -0.5)))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= 9e-177) {
tmp = -d * pow((l * h), -0.5);
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (d <= 9d-177) then
tmp = -d * ((l * h) ** (-0.5d0))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= 9e-177) {
tmp = -d * Math.pow((l * h), -0.5);
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if d <= 9e-177: tmp = -d * math.pow((l * h), -0.5) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (d <= 9e-177) tmp = Float64(Float64(-d) * (Float64(l * h) ^ -0.5)); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (d <= 9e-177)
tmp = -d * ((l * h) ^ -0.5);
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[d, 9e-177], N[((-d) * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 9 \cdot 10^{-177}:\\
\;\;\;\;\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < 9.0000000000000007e-177Initial program 62.3%
Simplified62.3%
associate-*r/64.9%
*-commutative64.9%
div-inv64.9%
metadata-eval64.9%
Applied egg-rr64.9%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt40.0%
neg-mul-140.0%
Simplified40.0%
if 9.0000000000000007e-177 < d Initial program 67.6%
Simplified68.5%
associate-*r/71.3%
*-commutative71.3%
div-inv71.3%
metadata-eval71.3%
Applied egg-rr71.3%
Taylor expanded in d around inf 54.1%
unpow-154.1%
metadata-eval54.1%
pow-sqr54.1%
rem-sqrt-square54.8%
rem-square-sqrt54.6%
fabs-sqr54.6%
rem-square-sqrt54.8%
Simplified54.8%
*-commutative54.8%
unpow-prod-down64.6%
Applied egg-rr64.6%
Final simplification50.4%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (let* ((t_0 (pow (* l h) -0.5))) (if (<= d 9e-177) (* (- d) t_0) (* d t_0))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = pow((l * h), -0.5);
double tmp;
if (d <= 9e-177) {
tmp = -d * t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: tmp
t_0 = (l * h) ** (-0.5d0)
if (d <= 9d-177) then
tmp = -d * t_0
else
tmp = d * t_0
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.pow((l * h), -0.5);
double tmp;
if (d <= 9e-177) {
tmp = -d * t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.pow((l * h), -0.5) tmp = 0 if d <= 9e-177: tmp = -d * t_0 else: tmp = d * t_0 return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(l * h) ^ -0.5 tmp = 0.0 if (d <= 9e-177) tmp = Float64(Float64(-d) * t_0); else tmp = Float64(d * t_0); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = (l * h) ^ -0.5;
tmp = 0.0;
if (d <= 9e-177)
tmp = -d * t_0;
else
tmp = d * t_0;
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[d, 9e-177], N[((-d) * t$95$0), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;d \leq 9 \cdot 10^{-177}:\\
\;\;\;\;\left(-d\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
\end{array}
if d < 9.0000000000000007e-177Initial program 62.3%
Simplified62.3%
associate-*r/64.9%
*-commutative64.9%
div-inv64.9%
metadata-eval64.9%
Applied egg-rr64.9%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt40.0%
neg-mul-140.0%
Simplified40.0%
if 9.0000000000000007e-177 < d Initial program 67.6%
Simplified68.5%
associate-*r/71.3%
*-commutative71.3%
div-inv71.3%
metadata-eval71.3%
Applied egg-rr71.3%
Taylor expanded in d around inf 54.1%
unpow-154.1%
metadata-eval54.1%
pow-sqr54.1%
rem-sqrt-square54.8%
rem-square-sqrt54.6%
fabs-sqr54.6%
rem-square-sqrt54.8%
Simplified54.8%
Final simplification46.3%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (* d (pow (* l h) -0.5)))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
return d * pow((l * h), -0.5);
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
code = d * ((l * h) ** (-0.5d0))
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
return d * Math.pow((l * h), -0.5);
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): return d * math.pow((l * h), -0.5)
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) return Float64(d * (Float64(l * h) ^ -0.5)) end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp = code(d, h, l, M, D_m)
tmp = d * ((l * h) ^ -0.5);
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
d \cdot {\left(\ell \cdot h\right)}^{-0.5}
\end{array}
Initial program 64.5%
Simplified64.9%
associate-*r/67.6%
*-commutative67.6%
div-inv67.6%
metadata-eval67.6%
Applied egg-rr67.6%
Taylor expanded in d around inf 28.3%
unpow-128.3%
metadata-eval28.3%
pow-sqr28.3%
rem-sqrt-square28.6%
rem-square-sqrt28.5%
fabs-sqr28.5%
rem-square-sqrt28.6%
Simplified28.6%
Final simplification28.6%
herbie shell --seed 2024114
(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)))))