
(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 24 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))) (t_1 (/ (cbrt h) l)))
(if (<= d -5e-310)
(*
(/ t_0 (sqrt (- l)))
(*
(/ t_0 (sqrt (- h)))
(+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M 2.0) d)) 2.0) -0.5)))))
(if (<= d 3.3e-211)
(*
-0.125
(* (* (* (fabs t_1) (sqrt t_1)) (/ (pow M 2.0) d)) (pow D_m 2.0)))
(*
(/ d (* (sqrt h) (sqrt l)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D_m d)) 2.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 = sqrt(-d);
double t_1 = cbrt(h) / l;
double tmp;
if (d <= -5e-310) {
tmp = (t_0 / sqrt(-l)) * ((t_0 / sqrt(-h)) * (1.0 + ((h / l) * (pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5))));
} else if (d <= 3.3e-211) {
tmp = -0.125 * (((fabs(t_1) * sqrt(t_1)) * (pow(M, 2.0) / d)) * pow(D_m, 2.0));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 - (0.5 * ((h / l) * pow(((M / 2.0) * (D_m / d)), 2.0))));
}
return tmp;
}
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);
double t_1 = Math.cbrt(h) / l;
double tmp;
if (d <= -5e-310) {
tmp = (t_0 / Math.sqrt(-l)) * ((t_0 / Math.sqrt(-h)) * (1.0 + ((h / l) * (Math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5))));
} else if (d <= 3.3e-211) {
tmp = -0.125 * (((Math.abs(t_1) * Math.sqrt(t_1)) * (Math.pow(M, 2.0) / d)) * Math.pow(D_m, 2.0));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 - (0.5 * ((h / l) * Math.pow(((M / 2.0) * (D_m / d)), 2.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 = sqrt(Float64(-d)) t_1 = Float64(cbrt(h) / l) tmp = 0.0 if (d <= -5e-310) tmp = Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D_m * Float64(Float64(M / 2.0) / d)) ^ 2.0) * -0.5))))); elseif (d <= 3.3e-211) tmp = Float64(-0.125 * Float64(Float64(Float64(abs(t_1) * sqrt(t_1)) * Float64((M ^ 2.0) / d)) * (D_m ^ 2.0))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.0))))); end return 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[(-d)], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[h, 1/3], $MachinePrecision] / l), $MachinePrecision]}, If[LessEqual[d, -5e-310], N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 / 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]), $MachinePrecision], If[LessEqual[d, 3.3e-211], N[(-0.125 * N[(N[(N[(N[Abs[t$95$1], $MachinePrecision] * N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision] * N[(N[Power[M, 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[Power[D$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $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]]]]]
\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{-d}\\
t_1 := \frac{\sqrt[3]{h}}{\ell}\\
\mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-\ell}} \cdot \left(\frac{t\_0}{\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)\\
\mathbf{elif}\;d \leq 3.3 \cdot 10^{-211}:\\
\;\;\;\;-0.125 \cdot \left(\left(\left(\left|t\_1\right| \cdot \sqrt{t\_1}\right) \cdot \frac{{M}^{2}}{d}\right) \cdot {D\_m}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if d < -4.999999999999985e-310Initial program 63.6%
Simplified63.7%
frac-2neg63.7%
sqrt-div74.4%
Applied egg-rr74.4%
frac-2neg74.4%
sqrt-div85.1%
Applied egg-rr85.1%
if -4.999999999999985e-310 < d < 3.3000000000000002e-211Initial program 37.4%
Simplified37.4%
Taylor expanded in d around 0 52.6%
*-commutative52.6%
associate-/l*53.5%
associate-*l*53.6%
associate-*r*53.6%
*-commutative53.6%
*-commutative53.6%
associate-*l*53.6%
*-commutative53.6%
Simplified53.6%
pow1/253.6%
add-cube-cbrt53.5%
unpow-prod-down53.5%
pow253.5%
cbrt-div53.4%
unpow353.4%
add-cbrt-cube53.5%
cbrt-div58.7%
unpow358.7%
add-cbrt-cube64.1%
Applied egg-rr64.1%
unpow1/264.1%
unpow264.1%
rem-sqrt-square74.1%
unpow1/274.1%
Simplified74.1%
if 3.3000000000000002e-211 < d Initial program 76.9%
Simplified77.8%
pow177.8%
sqrt-unprod62.1%
Applied egg-rr62.1%
unpow162.1%
*-commutative62.1%
Simplified62.1%
frac-times48.5%
unpow248.5%
*-commutative48.5%
associate-/l/55.9%
sqrt-div66.0%
sqrt-div70.0%
sqrt-pow191.1%
metadata-eval91.1%
pow191.1%
Applied egg-rr91.1%
associate-/l/91.1%
Simplified91.1%
Final simplification86.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 (<=
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* D_m M) (* d 2.0)) 2.0)))))
2e+215)
(*
(sqrt (/ d l))
(*
(+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M 2.0) d)) 2.0) -0.5)))
(sqrt (/ d h))))
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D_m d)) 2.0))))
(fabs (/ d (sqrt (* l 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 (((pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((D_m * M) / (d * 2.0)), 2.0))))) <= 2e+215) {
tmp = sqrt((d / l)) * ((1.0 + ((h / l) * (pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5))) * sqrt((d / h)));
} else {
tmp = (1.0 - (0.5 * ((h / l) * pow(((M / 2.0) * (D_m / d)), 2.0)))) * fabs((d / sqrt((l * 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 (((((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((h / l) * (0.5d0 * (((d_m * m) / (d * 2.0d0)) ** 2.0d0))))) <= 2d+215) then
tmp = sqrt((d / l)) * ((1.0d0 + ((h / l) * (((d_m * ((m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))) * sqrt((d / h)))
else
tmp = (1.0d0 - (0.5d0 * ((h / l) * (((m / 2.0d0) * (d_m / d)) ** 2.0d0)))) * abs((d / sqrt((l * 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 (((Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((D_m * M) / (d * 2.0)), 2.0))))) <= 2e+215) {
tmp = Math.sqrt((d / l)) * ((1.0 + ((h / l) * (Math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5))) * Math.sqrt((d / h)));
} else {
tmp = (1.0 - (0.5 * ((h / l) * Math.pow(((M / 2.0) * (D_m / d)), 2.0)))) * Math.abs((d / Math.sqrt((l * 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 ((math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((D_m * M) / (d * 2.0)), 2.0))))) <= 2e+215: tmp = math.sqrt((d / l)) * ((1.0 + ((h / l) * (math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5))) * math.sqrt((d / h))) else: tmp = (1.0 - (0.5 * ((h / l) * math.pow(((M / 2.0) * (D_m / d)), 2.0)))) * math.fabs((d / math.sqrt((l * 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 (Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(D_m * M) / Float64(d * 2.0)) ^ 2.0))))) <= 2e+215) 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))) * sqrt(Float64(d / h)))); else tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.0)))) * abs(Float64(d / sqrt(Float64(l * 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 (((((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((D_m * M) / (d * 2.0)) ^ 2.0))))) <= 2e+215)
tmp = sqrt((d / l)) * ((1.0 + ((h / l) * (((D_m * ((M / 2.0) / d)) ^ 2.0) * -0.5))) * sqrt((d / h)));
else
tmp = (1.0 - (0.5 * ((h / l) * (((M / 2.0) * (D_m / d)) ^ 2.0)))) * abs((d / sqrt((l * 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[N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(D$95$m * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+215], 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[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $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}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2}\right)\right) \leq 2 \cdot 10^{+215}:\\
\;\;\;\;\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 \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right) \cdot \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\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.99999999999999981e215Initial program 87.1%
Simplified86.6%
if 1.99999999999999981e215 < (*.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 21.3%
Simplified22.6%
pow122.6%
sqrt-unprod21.4%
Applied egg-rr21.4%
unpow121.4%
*-commutative21.4%
Simplified21.4%
add-sqr-sqrt21.4%
rem-sqrt-square21.4%
frac-times21.4%
unpow221.4%
sqrt-div27.7%
sqrt-pow160.3%
metadata-eval60.3%
pow160.3%
Applied egg-rr60.3%
Final simplification78.7%
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))))
(if (<= l -4e-310)
(*
(/ t_0 (sqrt (- l)))
(*
(/ t_0 (sqrt (- h)))
(+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M 2.0) d)) 2.0) -0.5)))))
(*
(/ d (* (sqrt h) (sqrt l)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D_m d)) 2.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 = sqrt(-d);
double tmp;
if (l <= -4e-310) {
tmp = (t_0 / sqrt(-l)) * ((t_0 / sqrt(-h)) * (1.0 + ((h / l) * (pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5))));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 - (0.5 * ((h / l) * pow(((M / 2.0) * (D_m / d)), 2.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 = sqrt(-d)
if (l <= (-4d-310)) then
tmp = (t_0 / sqrt(-l)) * ((t_0 / sqrt(-h)) * (1.0d0 + ((h / l) * (((d_m * ((m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 - (0.5d0 * ((h / l) * (((m / 2.0d0) * (d_m / d)) ** 2.0d0))))
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);
double tmp;
if (l <= -4e-310) {
tmp = (t_0 / Math.sqrt(-l)) * ((t_0 / Math.sqrt(-h)) * (1.0 + ((h / l) * (Math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5))));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 - (0.5 * ((h / l) * Math.pow(((M / 2.0) * (D_m / d)), 2.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.sqrt(-d) tmp = 0 if l <= -4e-310: tmp = (t_0 / math.sqrt(-l)) * ((t_0 / math.sqrt(-h)) * (1.0 + ((h / l) * (math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5)))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 - (0.5 * ((h / l) * math.pow(((M / 2.0) * (D_m / d)), 2.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 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -4e-310) tmp = Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D_m * Float64(Float64(M / 2.0) / d)) ^ 2.0) * -0.5))))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.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 = sqrt(-d);
tmp = 0.0;
if (l <= -4e-310)
tmp = (t_0 / sqrt(-l)) * ((t_0 / sqrt(-h)) * (1.0 + ((h / l) * (((D_m * ((M / 2.0) / d)) ^ 2.0) * -0.5))));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 - (0.5 * ((h / l) * (((M / 2.0) * (D_m / d)) ^ 2.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[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -4e-310], N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 / 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]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $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]]]
\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{-d}\\
\mathbf{if}\;\ell \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-\ell}} \cdot \left(\frac{t\_0}{\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)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if l < -3.999999999999988e-310Initial program 63.6%
Simplified63.7%
frac-2neg63.7%
sqrt-div74.4%
Applied egg-rr74.4%
frac-2neg74.4%
sqrt-div85.1%
Applied egg-rr85.1%
if -3.999999999999988e-310 < l Initial program 71.0%
Simplified71.8%
pow171.8%
sqrt-unprod55.1%
Applied egg-rr55.1%
unpow155.1%
*-commutative55.1%
Simplified55.1%
frac-times41.4%
unpow241.4%
*-commutative41.4%
associate-/l/47.7%
sqrt-div56.3%
sqrt-div59.7%
sqrt-pow184.7%
metadata-eval84.7%
pow184.7%
Applied egg-rr84.7%
associate-/l/84.7%
Simplified84.7%
Final simplification84.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
(let* ((t_0 (sqrt (- d))))
(if (<= h -1.22e+126)
(*
(*
(/ t_0 (sqrt (- h)))
(+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M 2.0) d)) 2.0) -0.5))))
(/ 1.0 (sqrt (/ l d))))
(if (<= h -1e-310)
(*
(sqrt (/ d h))
(*
(/ t_0 (sqrt (- l)))
(- 1.0 (* h (* (/ 0.125 l) (pow (* D_m (/ M d)) 2.0))))))
(*
(/ d (* (sqrt h) (sqrt l)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D_m d)) 2.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 = sqrt(-d);
double tmp;
if (h <= -1.22e+126) {
tmp = ((t_0 / sqrt(-h)) * (1.0 + ((h / l) * (pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5)))) * (1.0 / sqrt((l / d)));
} else if (h <= -1e-310) {
tmp = sqrt((d / h)) * ((t_0 / sqrt(-l)) * (1.0 - (h * ((0.125 / l) * pow((D_m * (M / d)), 2.0)))));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 - (0.5 * ((h / l) * pow(((M / 2.0) * (D_m / d)), 2.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 = sqrt(-d)
if (h <= (-1.22d+126)) then
tmp = ((t_0 / sqrt(-h)) * (1.0d0 + ((h / l) * (((d_m * ((m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0))))) * (1.0d0 / sqrt((l / d)))
else if (h <= (-1d-310)) then
tmp = sqrt((d / h)) * ((t_0 / sqrt(-l)) * (1.0d0 - (h * ((0.125d0 / l) * ((d_m * (m / d)) ** 2.0d0)))))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 - (0.5d0 * ((h / l) * (((m / 2.0d0) * (d_m / d)) ** 2.0d0))))
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);
double tmp;
if (h <= -1.22e+126) {
tmp = ((t_0 / Math.sqrt(-h)) * (1.0 + ((h / l) * (Math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5)))) * (1.0 / Math.sqrt((l / d)));
} else if (h <= -1e-310) {
tmp = Math.sqrt((d / h)) * ((t_0 / Math.sqrt(-l)) * (1.0 - (h * ((0.125 / l) * Math.pow((D_m * (M / d)), 2.0)))));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 - (0.5 * ((h / l) * Math.pow(((M / 2.0) * (D_m / d)), 2.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.sqrt(-d) tmp = 0 if h <= -1.22e+126: tmp = ((t_0 / math.sqrt(-h)) * (1.0 + ((h / l) * (math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5)))) * (1.0 / math.sqrt((l / d))) elif h <= -1e-310: tmp = math.sqrt((d / h)) * ((t_0 / math.sqrt(-l)) * (1.0 - (h * ((0.125 / l) * math.pow((D_m * (M / d)), 2.0))))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 - (0.5 * ((h / l) * math.pow(((M / 2.0) * (D_m / d)), 2.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 = sqrt(Float64(-d)) tmp = 0.0 if (h <= -1.22e+126) tmp = Float64(Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D_m * Float64(Float64(M / 2.0) / d)) ^ 2.0) * -0.5)))) * Float64(1.0 / sqrt(Float64(l / d)))); elseif (h <= -1e-310) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(1.0 - Float64(h * Float64(Float64(0.125 / l) * (Float64(D_m * Float64(M / d)) ^ 2.0)))))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.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 = sqrt(-d);
tmp = 0.0;
if (h <= -1.22e+126)
tmp = ((t_0 / sqrt(-h)) * (1.0 + ((h / l) * (((D_m * ((M / 2.0) / d)) ^ 2.0) * -0.5)))) * (1.0 / sqrt((l / d)));
elseif (h <= -1e-310)
tmp = sqrt((d / h)) * ((t_0 / sqrt(-l)) * (1.0 - (h * ((0.125 / l) * ((D_m * (M / d)) ^ 2.0)))));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 - (0.5 * ((h / l) * (((M / 2.0) * (D_m / d)) ^ 2.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[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[h, -1.22e+126], N[(N[(N[(t$95$0 / 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] * N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -1e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-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[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $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]]]]
\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{-d}\\
\mathbf{if}\;h \leq -1.22 \cdot 10^{+126}:\\
\;\;\;\;\left(\frac{t\_0}{\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 \frac{1}{\sqrt{\frac{\ell}{d}}}\\
\mathbf{elif}\;h \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t\_0}{\sqrt{-\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}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if h < -1.21999999999999995e126Initial program 53.0%
Simplified55.4%
clear-num55.4%
sqrt-div55.3%
metadata-eval55.3%
Applied egg-rr55.3%
frac-2neg55.5%
sqrt-div82.8%
Applied egg-rr80.3%
if -1.21999999999999995e126 < h < -9.999999999999969e-311Initial program 68.5%
Simplified68.4%
Taylor expanded in h around -inf 43.2%
associate-*r*43.2%
neg-mul-143.2%
sub-neg43.2%
distribute-lft-in43.2%
Simplified66.5%
frac-2neg67.4%
sqrt-div83.1%
Applied egg-rr85.6%
if -9.999999999999969e-311 < h Initial program 71.0%
Simplified71.8%
pow171.8%
sqrt-unprod55.1%
Applied egg-rr55.1%
unpow155.1%
*-commutative55.1%
Simplified55.1%
frac-times41.4%
unpow241.4%
*-commutative41.4%
associate-/l/47.7%
sqrt-div56.3%
sqrt-div59.7%
sqrt-pow184.7%
metadata-eval84.7%
pow184.7%
Applied egg-rr84.7%
associate-/l/84.7%
Simplified84.7%
Final simplification84.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 (- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D_m d)) 2.0)))))
(t_1 (sqrt (- d))))
(if (<= h -4.25e+127)
(* t_0 (* (/ t_1 (sqrt (- h))) (sqrt (/ d l))))
(if (<= h -1e-310)
(*
(sqrt (/ d h))
(*
(/ t_1 (sqrt (- l)))
(- 1.0 (* h (* (/ 0.125 l) (pow (* D_m (/ M d)) 2.0))))))
(* (/ d (* (sqrt h) (sqrt l))) 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 = 1.0 - (0.5 * ((h / l) * pow(((M / 2.0) * (D_m / d)), 2.0)));
double t_1 = sqrt(-d);
double tmp;
if (h <= -4.25e+127) {
tmp = t_0 * ((t_1 / sqrt(-h)) * sqrt((d / l)));
} else if (h <= -1e-310) {
tmp = sqrt((d / h)) * ((t_1 / sqrt(-l)) * (1.0 - (h * ((0.125 / l) * pow((D_m * (M / d)), 2.0)))));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * 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) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - (0.5d0 * ((h / l) * (((m / 2.0d0) * (d_m / d)) ** 2.0d0)))
t_1 = sqrt(-d)
if (h <= (-4.25d+127)) then
tmp = t_0 * ((t_1 / sqrt(-h)) * sqrt((d / l)))
else if (h <= (-1d-310)) then
tmp = sqrt((d / h)) * ((t_1 / sqrt(-l)) * (1.0d0 - (h * ((0.125d0 / l) * ((d_m * (m / d)) ** 2.0d0)))))
else
tmp = (d / (sqrt(h) * sqrt(l))) * 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 = 1.0 - (0.5 * ((h / l) * Math.pow(((M / 2.0) * (D_m / d)), 2.0)));
double t_1 = Math.sqrt(-d);
double tmp;
if (h <= -4.25e+127) {
tmp = t_0 * ((t_1 / Math.sqrt(-h)) * Math.sqrt((d / l)));
} else if (h <= -1e-310) {
tmp = Math.sqrt((d / h)) * ((t_1 / Math.sqrt(-l)) * (1.0 - (h * ((0.125 / l) * Math.pow((D_m * (M / d)), 2.0)))));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * 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 = 1.0 - (0.5 * ((h / l) * math.pow(((M / 2.0) * (D_m / d)), 2.0))) t_1 = math.sqrt(-d) tmp = 0 if h <= -4.25e+127: tmp = t_0 * ((t_1 / math.sqrt(-h)) * math.sqrt((d / l))) elif h <= -1e-310: tmp = math.sqrt((d / h)) * ((t_1 / math.sqrt(-l)) * (1.0 - (h * ((0.125 / l) * math.pow((D_m * (M / d)), 2.0))))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * 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(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.0)))) t_1 = sqrt(Float64(-d)) tmp = 0.0 if (h <= -4.25e+127) tmp = Float64(t_0 * Float64(Float64(t_1 / sqrt(Float64(-h))) * sqrt(Float64(d / l)))); elseif (h <= -1e-310) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(t_1 / sqrt(Float64(-l))) * Float64(1.0 - Float64(h * Float64(Float64(0.125 / l) * (Float64(D_m * Float64(M / d)) ^ 2.0)))))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * 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 = 1.0 - (0.5 * ((h / l) * (((M / 2.0) * (D_m / d)) ^ 2.0)));
t_1 = sqrt(-d);
tmp = 0.0;
if (h <= -4.25e+127)
tmp = t_0 * ((t_1 / sqrt(-h)) * sqrt((d / l)));
elseif (h <= -1e-310)
tmp = sqrt((d / h)) * ((t_1 / sqrt(-l)) * (1.0 - (h * ((0.125 / l) * ((D_m * (M / d)) ^ 2.0)))));
else
tmp = (d / (sqrt(h) * sqrt(l))) * 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[(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]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[h, -4.25e+127], N[(t$95$0 * N[(N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -1e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$1 / N[Sqrt[(-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[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 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 := 1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\\
t_1 := \sqrt{-d}\\
\mathbf{if}\;h \leq -4.25 \cdot 10^{+127}:\\
\;\;\;\;t\_0 \cdot \left(\frac{t\_1}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{elif}\;h \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t\_1}{\sqrt{-\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}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot t\_0\\
\end{array}
\end{array}
if h < -4.2499999999999998e127Initial program 53.0%
Simplified55.4%
frac-2neg55.5%
sqrt-div82.8%
Applied egg-rr75.3%
if -4.2499999999999998e127 < h < -9.999999999999969e-311Initial program 68.5%
Simplified68.4%
Taylor expanded in h around -inf 43.2%
associate-*r*43.2%
neg-mul-143.2%
sub-neg43.2%
distribute-lft-in43.2%
Simplified66.5%
frac-2neg67.4%
sqrt-div83.1%
Applied egg-rr85.6%
if -9.999999999999969e-311 < h Initial program 71.0%
Simplified71.8%
pow171.8%
sqrt-unprod55.1%
Applied egg-rr55.1%
unpow155.1%
*-commutative55.1%
Simplified55.1%
frac-times41.4%
unpow241.4%
*-commutative41.4%
associate-/l/47.7%
sqrt-div56.3%
sqrt-div59.7%
sqrt-pow184.7%
metadata-eval84.7%
pow184.7%
Applied egg-rr84.7%
associate-/l/84.7%
Simplified84.7%
Final simplification83.6%
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 -1.8e-139)
(*
(sqrt (/ d h))
(*
(/ (sqrt (- d)) (sqrt (- l)))
(- 1.0 (* h (* (/ 0.125 l) (pow (* D_m (/ M d)) 2.0))))))
(if (<= d -7.2e-300)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ -1.0 (* 0.5 (/ (* h (pow (/ (* M (/ D_m d)) 2.0) 2.0)) l))))
(*
(/ d (* (sqrt h) (sqrt l)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D_m d)) 2.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 tmp;
if (d <= -1.8e-139) {
tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0 - (h * ((0.125 / l) * pow((D_m * (M / d)), 2.0)))));
} else if (d <= -7.2e-300) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h * pow(((M * (D_m / d)) / 2.0), 2.0)) / l)));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 - (0.5 * ((h / l) * pow(((M / 2.0) * (D_m / d)), 2.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) :: tmp
if (d <= (-1.8d-139)) then
tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0d0 - (h * ((0.125d0 / l) * ((d_m * (m / d)) ** 2.0d0)))))
else if (d <= (-7.2d-300)) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + (0.5d0 * ((h * (((m * (d_m / d)) / 2.0d0) ** 2.0d0)) / l)))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 - (0.5d0 * ((h / l) * (((m / 2.0d0) * (d_m / d)) ** 2.0d0))))
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 <= -1.8e-139) {
tmp = Math.sqrt((d / h)) * ((Math.sqrt(-d) / Math.sqrt(-l)) * (1.0 - (h * ((0.125 / l) * Math.pow((D_m * (M / d)), 2.0)))));
} else if (d <= -7.2e-300) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h * Math.pow(((M * (D_m / d)) / 2.0), 2.0)) / l)));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 - (0.5 * ((h / l) * Math.pow(((M / 2.0) * (D_m / d)), 2.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): tmp = 0 if d <= -1.8e-139: tmp = math.sqrt((d / h)) * ((math.sqrt(-d) / math.sqrt(-l)) * (1.0 - (h * ((0.125 / l) * math.pow((D_m * (M / d)), 2.0))))) elif d <= -7.2e-300: tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h * math.pow(((M * (D_m / d)) / 2.0), 2.0)) / l))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 - (0.5 * ((h / l) * math.pow(((M / 2.0) * (D_m / d)), 2.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) tmp = 0.0 if (d <= -1.8e-139) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * Float64(1.0 - Float64(h * Float64(Float64(0.125 / l) * (Float64(D_m * Float64(M / d)) ^ 2.0)))))); elseif (d <= -7.2e-300) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + Float64(0.5 * Float64(Float64(h * (Float64(Float64(M * Float64(D_m / d)) / 2.0) ^ 2.0)) / l)))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.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)
tmp = 0.0;
if (d <= -1.8e-139)
tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0 - (h * ((0.125 / l) * ((D_m * (M / d)) ^ 2.0)))));
elseif (d <= -7.2e-300)
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h * (((M * (D_m / d)) / 2.0) ^ 2.0)) / l)));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 - (0.5 * ((h / l) * (((M / 2.0) * (D_m / d)) ^ 2.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_] := If[LessEqual[d, -1.8e-139], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-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], If[LessEqual[d, -7.2e-300], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.5 * N[(N[(h * N[Power[N[(N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $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]]]
\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 -1.8 \cdot 10^{-139}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\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{elif}\;d \leq -7.2 \cdot 10^{-300}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + 0.5 \cdot \frac{h \cdot {\left(\frac{M \cdot \frac{D\_m}{d}}{2}\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if d < -1.80000000000000002e-139Initial program 77.2%
Simplified78.4%
Taylor expanded in h around -inf 47.8%
associate-*r*47.8%
neg-mul-147.8%
sub-neg47.8%
distribute-lft-in47.8%
Simplified77.5%
frac-2neg77.2%
sqrt-div85.3%
Applied egg-rr87.8%
if -1.80000000000000002e-139 < d < -7.20000000000000031e-300Initial program 35.5%
Simplified35.2%
pow135.2%
sqrt-unprod32.4%
Applied egg-rr32.4%
unpow132.4%
*-commutative32.4%
associate-*r/22.0%
associate-*l/9.0%
unpow29.0%
Simplified9.0%
associate-*r/9.1%
associate-*l/9.1%
Applied egg-rr9.1%
Taylor expanded in d around -inf 69.4%
if -7.20000000000000031e-300 < d Initial program 69.9%
Simplified70.7%
pow170.7%
sqrt-unprod54.3%
Applied egg-rr54.3%
unpow154.3%
*-commutative54.3%
Simplified54.3%
frac-times40.8%
unpow240.8%
*-commutative40.8%
associate-/l/47.0%
sqrt-div55.5%
sqrt-div58.8%
sqrt-pow183.4%
metadata-eval83.4%
pow183.4%
Applied egg-rr83.4%
associate-/l/83.4%
Simplified83.4%
Final simplification82.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 (<= d -1.5e-102)
(*
(sqrt (/ d h))
(* (- 1.0 (* h (* (/ 0.125 l) (pow (* D_m (/ M d)) 2.0)))) (sqrt (/ d l))))
(if (<= d -7.2e-300)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ -1.0 (* 0.5 (/ (* h (pow (/ (* M (/ D_m d)) 2.0) 2.0)) l))))
(*
(/ d (* (sqrt h) (sqrt l)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D_m d)) 2.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 tmp;
if (d <= -1.5e-102) {
tmp = sqrt((d / h)) * ((1.0 - (h * ((0.125 / l) * pow((D_m * (M / d)), 2.0)))) * sqrt((d / l)));
} else if (d <= -7.2e-300) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h * pow(((M * (D_m / d)) / 2.0), 2.0)) / l)));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 - (0.5 * ((h / l) * pow(((M / 2.0) * (D_m / d)), 2.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) :: tmp
if (d <= (-1.5d-102)) then
tmp = sqrt((d / h)) * ((1.0d0 - (h * ((0.125d0 / l) * ((d_m * (m / d)) ** 2.0d0)))) * sqrt((d / l)))
else if (d <= (-7.2d-300)) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + (0.5d0 * ((h * (((m * (d_m / d)) / 2.0d0) ** 2.0d0)) / l)))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 - (0.5d0 * ((h / l) * (((m / 2.0d0) * (d_m / d)) ** 2.0d0))))
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 <= -1.5e-102) {
tmp = Math.sqrt((d / h)) * ((1.0 - (h * ((0.125 / l) * Math.pow((D_m * (M / d)), 2.0)))) * Math.sqrt((d / l)));
} else if (d <= -7.2e-300) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h * Math.pow(((M * (D_m / d)) / 2.0), 2.0)) / l)));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 - (0.5 * ((h / l) * Math.pow(((M / 2.0) * (D_m / d)), 2.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): tmp = 0 if d <= -1.5e-102: tmp = math.sqrt((d / h)) * ((1.0 - (h * ((0.125 / l) * math.pow((D_m * (M / d)), 2.0)))) * math.sqrt((d / l))) elif d <= -7.2e-300: tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h * math.pow(((M * (D_m / d)) / 2.0), 2.0)) / l))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 - (0.5 * ((h / l) * math.pow(((M / 2.0) * (D_m / d)), 2.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) tmp = 0.0 if (d <= -1.5e-102) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(1.0 - Float64(h * Float64(Float64(0.125 / l) * (Float64(D_m * Float64(M / d)) ^ 2.0)))) * sqrt(Float64(d / l)))); elseif (d <= -7.2e-300) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + Float64(0.5 * Float64(Float64(h * (Float64(Float64(M * Float64(D_m / d)) / 2.0) ^ 2.0)) / l)))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.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)
tmp = 0.0;
if (d <= -1.5e-102)
tmp = sqrt((d / h)) * ((1.0 - (h * ((0.125 / l) * ((D_m * (M / d)) ^ 2.0)))) * sqrt((d / l)));
elseif (d <= -7.2e-300)
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h * (((M * (D_m / d)) / 2.0) ^ 2.0)) / l)));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 - (0.5 * ((h / l) * (((M / 2.0) * (D_m / d)) ^ 2.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_] := If[LessEqual[d, -1.5e-102], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(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] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -7.2e-300], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.5 * N[(N[(h * N[Power[N[(N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $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]]]
\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 -1.5 \cdot 10^{-102}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\left(1 - h \cdot \left(\frac{0.125}{\ell} \cdot {\left(D\_m \cdot \frac{M}{d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{elif}\;d \leq -7.2 \cdot 10^{-300}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + 0.5 \cdot \frac{h \cdot {\left(\frac{M \cdot \frac{D\_m}{d}}{2}\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if d < -1.5e-102Initial program 81.5%
Simplified82.8%
Taylor expanded in h around -inf 49.2%
associate-*r*49.2%
neg-mul-149.2%
sub-neg49.2%
distribute-lft-in49.2%
Simplified83.0%
if -1.5e-102 < d < -7.20000000000000031e-300Initial program 38.1%
Simplified37.9%
pow137.9%
sqrt-unprod35.7%
Applied egg-rr35.7%
unpow135.7%
*-commutative35.7%
associate-*r/25.7%
associate-*l/15.6%
unpow215.6%
Simplified15.6%
associate-*r/15.6%
associate-*l/15.6%
Applied egg-rr15.6%
Taylor expanded in d around -inf 68.4%
if -7.20000000000000031e-300 < d Initial program 69.9%
Simplified70.7%
pow170.7%
sqrt-unprod54.3%
Applied egg-rr54.3%
unpow154.3%
*-commutative54.3%
Simplified54.3%
frac-times40.8%
unpow240.8%
*-commutative40.8%
associate-/l/47.0%
sqrt-div55.5%
sqrt-div58.8%
sqrt-pow183.4%
metadata-eval83.4%
pow183.4%
Applied egg-rr83.4%
associate-/l/83.4%
Simplified83.4%
Final simplification80.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 (<= h -4.9e-232)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ -1.0 (* 0.5 (/ (* h (pow (/ (* M (/ D_m d)) 2.0) 2.0)) l))))
(if (<= h 2.1e-254)
(*
(sqrt (* (/ d h) (/ d l)))
(- 1.0 (* 0.5 (* (/ h l) (pow (/ D_m (* d (/ 2.0 M))) 2.0)))))
(*
d
(/
(fma h (* -0.5 (/ (pow (* M (/ (/ D_m 2.0) d)) 2.0) l)) 1.0)
(sqrt (* l 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 <= -4.9e-232) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h * pow(((M * (D_m / d)) / 2.0), 2.0)) / l)));
} else if (h <= 2.1e-254) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * ((h / l) * pow((D_m / (d * (2.0 / M))), 2.0))));
} else {
tmp = d * (fma(h, (-0.5 * (pow((M * ((D_m / 2.0) / d)), 2.0) / l)), 1.0) / sqrt((l * 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 <= -4.9e-232) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + Float64(0.5 * Float64(Float64(h * (Float64(Float64(M * Float64(D_m / d)) / 2.0) ^ 2.0)) / l)))); elseif (h <= 2.1e-254) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(D_m / Float64(d * Float64(2.0 / M))) ^ 2.0))))); else tmp = Float64(d * Float64(fma(h, Float64(-0.5 * Float64((Float64(M * Float64(Float64(D_m / 2.0) / d)) ^ 2.0) / l)), 1.0) / sqrt(Float64(l * h)))); end return 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, -4.9e-232], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.5 * N[(N[(h * N[Power[N[(N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.1e-254], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m / N[(d * N[(2.0 / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(h * N[(-0.5 * N[(N[Power[N[(M * N[(N[(D$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[N[(l * 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 -4.9 \cdot 10^{-232}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + 0.5 \cdot \frac{h \cdot {\left(\frac{M \cdot \frac{D\_m}{d}}{2}\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;h \leq 2.1 \cdot 10^{-254}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d \cdot \frac{2}{M}}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, -0.5 \cdot \frac{{\left(M \cdot \frac{\frac{D\_m}{2}}{d}\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if h < -4.9000000000000003e-232Initial program 61.5%
Simplified62.2%
pow162.2%
sqrt-unprod55.4%
Applied egg-rr55.4%
unpow155.4%
*-commutative55.4%
associate-*r/50.1%
associate-*l/43.1%
unpow243.1%
Simplified43.1%
associate-*r/42.3%
associate-*l/42.3%
Applied egg-rr42.3%
Taylor expanded in d around -inf 70.2%
if -4.9000000000000003e-232 < h < 2.09999999999999997e-254Initial program 76.1%
Simplified76.1%
pow176.1%
sqrt-unprod72.3%
Applied egg-rr72.3%
unpow172.3%
*-commutative72.3%
Simplified72.3%
clear-num72.2%
frac-times64.1%
*-un-lft-identity64.1%
Applied egg-rr64.1%
if 2.09999999999999997e-254 < h Initial program 70.9%
Simplified71.8%
pow171.8%
sqrt-unprod54.1%
Applied egg-rr54.1%
unpow154.1%
*-commutative54.1%
Simplified54.1%
Applied egg-rr72.7%
unpow172.7%
associate-*l/74.3%
associate-/l*74.3%
Simplified75.9%
Final simplification72.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 (<= h 1.5e-305)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ -1.0 (* 0.5 (/ (* h (pow (/ (* M (/ D_m d)) 2.0) 2.0)) l))))
(*
(/ d (* (sqrt h) (sqrt l)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D_m d)) 2.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 tmp;
if (h <= 1.5e-305) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h * pow(((M * (D_m / d)) / 2.0), 2.0)) / l)));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 - (0.5 * ((h / l) * pow(((M / 2.0) * (D_m / d)), 2.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) :: tmp
if (h <= 1.5d-305) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + (0.5d0 * ((h * (((m * (d_m / d)) / 2.0d0) ** 2.0d0)) / l)))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 - (0.5d0 * ((h / l) * (((m / 2.0d0) * (d_m / d)) ** 2.0d0))))
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 <= 1.5e-305) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h * Math.pow(((M * (D_m / d)) / 2.0), 2.0)) / l)));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 - (0.5 * ((h / l) * Math.pow(((M / 2.0) * (D_m / d)), 2.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): tmp = 0 if h <= 1.5e-305: tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h * math.pow(((M * (D_m / d)) / 2.0), 2.0)) / l))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 - (0.5 * ((h / l) * math.pow(((M / 2.0) * (D_m / d)), 2.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) tmp = 0.0 if (h <= 1.5e-305) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + Float64(0.5 * Float64(Float64(h * (Float64(Float64(M * Float64(D_m / d)) / 2.0) ^ 2.0)) / l)))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.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)
tmp = 0.0;
if (h <= 1.5e-305)
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h * (((M * (D_m / d)) / 2.0) ^ 2.0)) / l)));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 - (0.5 * ((h / l) * (((M / 2.0) * (D_m / d)) ^ 2.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_] := If[LessEqual[h, 1.5e-305], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.5 * N[(N[(h * N[Power[N[(N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $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]]
\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 1.5 \cdot 10^{-305}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + 0.5 \cdot \frac{h \cdot {\left(\frac{M \cdot \frac{D\_m}{d}}{2}\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if h < 1.5000000000000001e-305Initial program 63.1%
Simplified63.8%
pow163.8%
sqrt-unprod57.2%
Applied egg-rr57.2%
unpow157.2%
*-commutative57.2%
associate-*r/50.4%
associate-*l/43.6%
unpow243.6%
Simplified43.6%
associate-*r/42.9%
associate-*l/42.9%
Applied egg-rr42.9%
Taylor expanded in d around -inf 69.2%
if 1.5000000000000001e-305 < h Initial program 71.6%
Simplified72.3%
pow172.3%
sqrt-unprod55.6%
Applied egg-rr55.6%
unpow155.6%
*-commutative55.6%
Simplified55.6%
frac-times41.7%
unpow241.7%
*-commutative41.7%
associate-/l/48.1%
sqrt-div56.8%
sqrt-div60.2%
sqrt-pow185.4%
metadata-eval85.4%
pow185.4%
Applied egg-rr85.4%
associate-/l/85.4%
Simplified85.4%
Final simplification77.2%
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 h) (/ d l))))
(t_1 (- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D_m d)) 2.0))))))
(if (<= h -4.4e-232)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ -1.0 (* 0.5 (/ (* h (pow (/ (* M (/ D_m d)) 2.0) 2.0)) l))))
(if (<= h 2.6e-254)
(* t_0 (- 1.0 (* 0.5 (* (/ h l) (pow (/ D_m (* d (/ 2.0 M))) 2.0)))))
(if (<= h 6e+212) (* t_1 (/ d (sqrt (* l h)))) (* t_1 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 = sqrt(((d / h) * (d / l)));
double t_1 = 1.0 - (0.5 * ((h / l) * pow(((M / 2.0) * (D_m / d)), 2.0)));
double tmp;
if (h <= -4.4e-232) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h * pow(((M * (D_m / d)) / 2.0), 2.0)) / l)));
} else if (h <= 2.6e-254) {
tmp = t_0 * (1.0 - (0.5 * ((h / l) * pow((D_m / (d * (2.0 / M))), 2.0))));
} else if (h <= 6e+212) {
tmp = t_1 * (d / sqrt((l * h)));
} else {
tmp = t_1 * 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) :: t_1
real(8) :: tmp
t_0 = sqrt(((d / h) * (d / l)))
t_1 = 1.0d0 - (0.5d0 * ((h / l) * (((m / 2.0d0) * (d_m / d)) ** 2.0d0)))
if (h <= (-4.4d-232)) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + (0.5d0 * ((h * (((m * (d_m / d)) / 2.0d0) ** 2.0d0)) / l)))
else if (h <= 2.6d-254) then
tmp = t_0 * (1.0d0 - (0.5d0 * ((h / l) * ((d_m / (d * (2.0d0 / m))) ** 2.0d0))))
else if (h <= 6d+212) then
tmp = t_1 * (d / sqrt((l * h)))
else
tmp = t_1 * 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.sqrt(((d / h) * (d / l)));
double t_1 = 1.0 - (0.5 * ((h / l) * Math.pow(((M / 2.0) * (D_m / d)), 2.0)));
double tmp;
if (h <= -4.4e-232) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h * Math.pow(((M * (D_m / d)) / 2.0), 2.0)) / l)));
} else if (h <= 2.6e-254) {
tmp = t_0 * (1.0 - (0.5 * ((h / l) * Math.pow((D_m / (d * (2.0 / M))), 2.0))));
} else if (h <= 6e+212) {
tmp = t_1 * (d / Math.sqrt((l * h)));
} else {
tmp = t_1 * 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.sqrt(((d / h) * (d / l))) t_1 = 1.0 - (0.5 * ((h / l) * math.pow(((M / 2.0) * (D_m / d)), 2.0))) tmp = 0 if h <= -4.4e-232: tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h * math.pow(((M * (D_m / d)) / 2.0), 2.0)) / l))) elif h <= 2.6e-254: tmp = t_0 * (1.0 - (0.5 * ((h / l) * math.pow((D_m / (d * (2.0 / M))), 2.0)))) elif h <= 6e+212: tmp = t_1 * (d / math.sqrt((l * h))) else: tmp = t_1 * 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 = sqrt(Float64(Float64(d / h) * Float64(d / l))) t_1 = Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.0)))) tmp = 0.0 if (h <= -4.4e-232) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + Float64(0.5 * Float64(Float64(h * (Float64(Float64(M * Float64(D_m / d)) / 2.0) ^ 2.0)) / l)))); elseif (h <= 2.6e-254) tmp = Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(D_m / Float64(d * Float64(2.0 / M))) ^ 2.0))))); elseif (h <= 6e+212) tmp = Float64(t_1 * Float64(d / sqrt(Float64(l * h)))); else tmp = Float64(t_1 * 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 = sqrt(((d / h) * (d / l)));
t_1 = 1.0 - (0.5 * ((h / l) * (((M / 2.0) * (D_m / d)) ^ 2.0)));
tmp = 0.0;
if (h <= -4.4e-232)
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h * (((M * (D_m / d)) / 2.0) ^ 2.0)) / l)));
elseif (h <= 2.6e-254)
tmp = t_0 * (1.0 - (0.5 * ((h / l) * ((D_m / (d * (2.0 / M))) ^ 2.0))));
elseif (h <= 6e+212)
tmp = t_1 * (d / sqrt((l * h)));
else
tmp = t_1 * 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[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = 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]}, If[LessEqual[h, -4.4e-232], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.5 * N[(N[(h * N[Power[N[(N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.6e-254], N[(t$95$0 * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m / N[(d * N[(2.0 / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 6e+212], N[(t$95$1 * N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * 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 := \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
t_1 := 1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\\
\mathbf{if}\;h \leq -4.4 \cdot 10^{-232}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + 0.5 \cdot \frac{h \cdot {\left(\frac{M \cdot \frac{D\_m}{d}}{2}\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;h \leq 2.6 \cdot 10^{-254}:\\
\;\;\;\;t\_0 \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d \cdot \frac{2}{M}}\right)}^{2}\right)\right)\\
\mathbf{elif}\;h \leq 6 \cdot 10^{+212}:\\
\;\;\;\;t\_1 \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot t\_0\\
\end{array}
\end{array}
if h < -4.40000000000000004e-232Initial program 61.5%
Simplified62.2%
pow162.2%
sqrt-unprod55.4%
Applied egg-rr55.4%
unpow155.4%
*-commutative55.4%
associate-*r/50.1%
associate-*l/43.1%
unpow243.1%
Simplified43.1%
associate-*r/42.3%
associate-*l/42.3%
Applied egg-rr42.3%
Taylor expanded in d around -inf 70.2%
if -4.40000000000000004e-232 < h < 2.6e-254Initial program 76.1%
Simplified76.1%
pow176.1%
sqrt-unprod72.3%
Applied egg-rr72.3%
unpow172.3%
*-commutative72.3%
Simplified72.3%
clear-num72.2%
frac-times64.1%
*-un-lft-identity64.1%
Applied egg-rr64.1%
if 2.6e-254 < h < 6e212Initial program 72.5%
Simplified72.5%
pow172.5%
sqrt-unprod52.6%
Applied egg-rr52.6%
unpow152.6%
*-commutative52.6%
Simplified52.6%
frac-times44.9%
unpow244.9%
*-commutative44.9%
associate-/l/46.9%
*-un-lft-identity46.9%
associate-/l/44.9%
*-commutative44.9%
sqrt-div54.7%
sqrt-pow179.4%
metadata-eval79.4%
pow179.4%
Applied egg-rr79.4%
*-lft-identity79.4%
Simplified79.4%
if 6e212 < h Initial program 63.9%
Simplified68.5%
pow168.5%
sqrt-unprod61.0%
Applied egg-rr61.0%
unpow161.0%
*-commutative61.0%
Simplified61.0%
Final simplification72.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 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D_m d)) 2.0))))
(t_1 (- 1.0 t_0))
(t_2 (sqrt (* (/ d h) (/ d l)))))
(if (<= h -5e-158)
(* (* d (sqrt (/ 1.0 (* l h)))) (+ t_0 -1.0))
(if (<= h 6.5e-252)
(* t_2 (- 1.0 (* 0.5 (* (/ h l) (pow (/ D_m (* d (/ 2.0 M))) 2.0)))))
(if (<= h 1.2e+206) (* t_1 (/ d (sqrt (* l h)))) (* t_1 t_2))))))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 = 0.5 * ((h / l) * pow(((M / 2.0) * (D_m / d)), 2.0));
double t_1 = 1.0 - t_0;
double t_2 = sqrt(((d / h) * (d / l)));
double tmp;
if (h <= -5e-158) {
tmp = (d * sqrt((1.0 / (l * h)))) * (t_0 + -1.0);
} else if (h <= 6.5e-252) {
tmp = t_2 * (1.0 - (0.5 * ((h / l) * pow((D_m / (d * (2.0 / M))), 2.0))));
} else if (h <= 1.2e+206) {
tmp = t_1 * (d / sqrt((l * h)));
} else {
tmp = t_1 * t_2;
}
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) :: tmp
t_0 = 0.5d0 * ((h / l) * (((m / 2.0d0) * (d_m / d)) ** 2.0d0))
t_1 = 1.0d0 - t_0
t_2 = sqrt(((d / h) * (d / l)))
if (h <= (-5d-158)) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * (t_0 + (-1.0d0))
else if (h <= 6.5d-252) then
tmp = t_2 * (1.0d0 - (0.5d0 * ((h / l) * ((d_m / (d * (2.0d0 / m))) ** 2.0d0))))
else if (h <= 1.2d+206) then
tmp = t_1 * (d / sqrt((l * h)))
else
tmp = t_1 * t_2
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 = 0.5 * ((h / l) * Math.pow(((M / 2.0) * (D_m / d)), 2.0));
double t_1 = 1.0 - t_0;
double t_2 = Math.sqrt(((d / h) * (d / l)));
double tmp;
if (h <= -5e-158) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (t_0 + -1.0);
} else if (h <= 6.5e-252) {
tmp = t_2 * (1.0 - (0.5 * ((h / l) * Math.pow((D_m / (d * (2.0 / M))), 2.0))));
} else if (h <= 1.2e+206) {
tmp = t_1 * (d / Math.sqrt((l * h)));
} else {
tmp = t_1 * t_2;
}
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 = 0.5 * ((h / l) * math.pow(((M / 2.0) * (D_m / d)), 2.0)) t_1 = 1.0 - t_0 t_2 = math.sqrt(((d / h) * (d / l))) tmp = 0 if h <= -5e-158: tmp = (d * math.sqrt((1.0 / (l * h)))) * (t_0 + -1.0) elif h <= 6.5e-252: tmp = t_2 * (1.0 - (0.5 * ((h / l) * math.pow((D_m / (d * (2.0 / M))), 2.0)))) elif h <= 1.2e+206: tmp = t_1 * (d / math.sqrt((l * h))) else: tmp = t_1 * t_2 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(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.0))) t_1 = Float64(1.0 - t_0) t_2 = sqrt(Float64(Float64(d / h) * Float64(d / l))) tmp = 0.0 if (h <= -5e-158) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(t_0 + -1.0)); elseif (h <= 6.5e-252) tmp = Float64(t_2 * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(D_m / Float64(d * Float64(2.0 / M))) ^ 2.0))))); elseif (h <= 1.2e+206) tmp = Float64(t_1 * Float64(d / sqrt(Float64(l * h)))); else tmp = Float64(t_1 * t_2); 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 = 0.5 * ((h / l) * (((M / 2.0) * (D_m / d)) ^ 2.0));
t_1 = 1.0 - t_0;
t_2 = sqrt(((d / h) * (d / l)));
tmp = 0.0;
if (h <= -5e-158)
tmp = (d * sqrt((1.0 / (l * h)))) * (t_0 + -1.0);
elseif (h <= 6.5e-252)
tmp = t_2 * (1.0 - (0.5 * ((h / l) * ((D_m / (d * (2.0 / M))) ^ 2.0))));
elseif (h <= 1.2e+206)
tmp = t_1 * (d / sqrt((l * h)));
else
tmp = t_1 * t_2;
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[(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]}, Block[{t$95$1 = N[(1.0 - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -5e-158], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 6.5e-252], N[(t$95$2 * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m / N[(d * N[(2.0 / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 1.2e+206], N[(t$95$1 * N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * t$95$2), $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 := 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\\
t_1 := 1 - t\_0\\
t_2 := \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{if}\;h \leq -5 \cdot 10^{-158}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(t\_0 + -1\right)\\
\mathbf{elif}\;h \leq 6.5 \cdot 10^{-252}:\\
\;\;\;\;t\_2 \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d \cdot \frac{2}{M}}\right)}^{2}\right)\right)\\
\mathbf{elif}\;h \leq 1.2 \cdot 10^{+206}:\\
\;\;\;\;t\_1 \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot t\_2\\
\end{array}
\end{array}
if h < -4.99999999999999972e-158Initial program 62.2%
Simplified63.1%
pow163.1%
sqrt-unprod55.1%
Applied egg-rr55.1%
unpow155.1%
*-commutative55.1%
associate-*r/49.0%
associate-*l/41.8%
unpow241.8%
Simplified41.8%
Taylor expanded in d around -inf 68.1%
if -4.99999999999999972e-158 < h < 6.4999999999999998e-252Initial program 68.6%
Simplified68.5%
pow168.5%
sqrt-unprod66.3%
Applied egg-rr66.3%
unpow166.3%
*-commutative66.3%
Simplified66.3%
clear-num66.2%
frac-times61.4%
*-un-lft-identity61.4%
Applied egg-rr61.4%
if 6.4999999999999998e-252 < h < 1.2e206Initial program 72.5%
Simplified72.5%
pow172.5%
sqrt-unprod52.6%
Applied egg-rr52.6%
unpow152.6%
*-commutative52.6%
Simplified52.6%
frac-times44.9%
unpow244.9%
*-commutative44.9%
associate-/l/46.9%
*-un-lft-identity46.9%
associate-/l/44.9%
*-commutative44.9%
sqrt-div54.7%
sqrt-pow179.4%
metadata-eval79.4%
pow179.4%
Applied egg-rr79.4%
*-lft-identity79.4%
Simplified79.4%
if 1.2e206 < h Initial program 63.9%
Simplified68.5%
pow168.5%
sqrt-unprod61.0%
Applied egg-rr61.0%
unpow161.0%
*-commutative61.0%
Simplified61.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
(let* ((t_0 (- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D_m d)) 2.0)))))
(t_1 (sqrt (* (/ d h) (/ d l)))))
(if (<= h 8.8e-254)
(* t_1 (- 1.0 (* 0.5 (* (/ h l) (pow (/ D_m (* d (/ 2.0 M))) 2.0)))))
(if (<= h 3e+210) (* t_0 (/ d (sqrt (* l h)))) (* t_0 t_1)))))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 = 1.0 - (0.5 * ((h / l) * pow(((M / 2.0) * (D_m / d)), 2.0)));
double t_1 = sqrt(((d / h) * (d / l)));
double tmp;
if (h <= 8.8e-254) {
tmp = t_1 * (1.0 - (0.5 * ((h / l) * pow((D_m / (d * (2.0 / M))), 2.0))));
} else if (h <= 3e+210) {
tmp = t_0 * (d / sqrt((l * h)));
} else {
tmp = t_0 * t_1;
}
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 = 1.0d0 - (0.5d0 * ((h / l) * (((m / 2.0d0) * (d_m / d)) ** 2.0d0)))
t_1 = sqrt(((d / h) * (d / l)))
if (h <= 8.8d-254) then
tmp = t_1 * (1.0d0 - (0.5d0 * ((h / l) * ((d_m / (d * (2.0d0 / m))) ** 2.0d0))))
else if (h <= 3d+210) then
tmp = t_0 * (d / sqrt((l * h)))
else
tmp = t_0 * t_1
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 = 1.0 - (0.5 * ((h / l) * Math.pow(((M / 2.0) * (D_m / d)), 2.0)));
double t_1 = Math.sqrt(((d / h) * (d / l)));
double tmp;
if (h <= 8.8e-254) {
tmp = t_1 * (1.0 - (0.5 * ((h / l) * Math.pow((D_m / (d * (2.0 / M))), 2.0))));
} else if (h <= 3e+210) {
tmp = t_0 * (d / Math.sqrt((l * h)));
} else {
tmp = t_0 * t_1;
}
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 = 1.0 - (0.5 * ((h / l) * math.pow(((M / 2.0) * (D_m / d)), 2.0))) t_1 = math.sqrt(((d / h) * (d / l))) tmp = 0 if h <= 8.8e-254: tmp = t_1 * (1.0 - (0.5 * ((h / l) * math.pow((D_m / (d * (2.0 / M))), 2.0)))) elif h <= 3e+210: tmp = t_0 * (d / math.sqrt((l * h))) else: tmp = t_0 * t_1 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(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.0)))) t_1 = sqrt(Float64(Float64(d / h) * Float64(d / l))) tmp = 0.0 if (h <= 8.8e-254) tmp = Float64(t_1 * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(D_m / Float64(d * Float64(2.0 / M))) ^ 2.0))))); elseif (h <= 3e+210) tmp = Float64(t_0 * Float64(d / sqrt(Float64(l * h)))); else tmp = Float64(t_0 * t_1); 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 = 1.0 - (0.5 * ((h / l) * (((M / 2.0) * (D_m / d)) ^ 2.0)));
t_1 = sqrt(((d / h) * (d / l)));
tmp = 0.0;
if (h <= 8.8e-254)
tmp = t_1 * (1.0 - (0.5 * ((h / l) * ((D_m / (d * (2.0 / M))) ^ 2.0))));
elseif (h <= 3e+210)
tmp = t_0 * (d / sqrt((l * h)));
else
tmp = t_0 * t_1;
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[(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]}, Block[{t$95$1 = N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, 8.8e-254], N[(t$95$1 * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m / N[(d * N[(2.0 / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 3e+210], N[(t$95$0 * N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * t$95$1), $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 := 1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\\
t_1 := \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{if}\;h \leq 8.8 \cdot 10^{-254}:\\
\;\;\;\;t\_1 \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d \cdot \frac{2}{M}}\right)}^{2}\right)\right)\\
\mathbf{elif}\;h \leq 3 \cdot 10^{+210}:\\
\;\;\;\;t\_0 \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot t\_1\\
\end{array}
\end{array}
if h < 8.8000000000000004e-254Initial program 64.1%
Simplified64.7%
pow164.7%
sqrt-unprod58.4%
Applied egg-rr58.4%
unpow158.4%
*-commutative58.4%
Simplified58.4%
clear-num58.4%
frac-times57.7%
*-un-lft-identity57.7%
Applied egg-rr57.7%
if 8.8000000000000004e-254 < h < 3.00000000000000022e210Initial program 72.5%
Simplified72.5%
pow172.5%
sqrt-unprod52.6%
Applied egg-rr52.6%
unpow152.6%
*-commutative52.6%
Simplified52.6%
frac-times44.9%
unpow244.9%
*-commutative44.9%
associate-/l/46.9%
*-un-lft-identity46.9%
associate-/l/44.9%
*-commutative44.9%
sqrt-div54.7%
sqrt-pow179.4%
metadata-eval79.4%
pow179.4%
Applied egg-rr79.4%
*-lft-identity79.4%
Simplified79.4%
if 3.00000000000000022e210 < h Initial program 63.9%
Simplified68.5%
pow168.5%
sqrt-unprod61.0%
Applied egg-rr61.0%
unpow161.0%
*-commutative61.0%
Simplified61.0%
Final simplification66.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 (- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D_m d)) 2.0))))))
(if (<= l 7.8e-221)
(* t_0 (sqrt (* (/ d h) (/ d l))))
(if (<= l 1.7e+175)
(* t_0 (/ d (sqrt (* l 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 t_0 = 1.0 - (0.5 * ((h / l) * pow(((M / 2.0) * (D_m / d)), 2.0)));
double tmp;
if (l <= 7.8e-221) {
tmp = t_0 * sqrt(((d / h) * (d / l)));
} else if (l <= 1.7e+175) {
tmp = t_0 * (d / sqrt((l * 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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (0.5d0 * ((h / l) * (((m / 2.0d0) * (d_m / d)) ** 2.0d0)))
if (l <= 7.8d-221) then
tmp = t_0 * sqrt(((d / h) * (d / l)))
else if (l <= 1.7d+175) then
tmp = t_0 * (d / sqrt((l * 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 t_0 = 1.0 - (0.5 * ((h / l) * Math.pow(((M / 2.0) * (D_m / d)), 2.0)));
double tmp;
if (l <= 7.8e-221) {
tmp = t_0 * Math.sqrt(((d / h) * (d / l)));
} else if (l <= 1.7e+175) {
tmp = t_0 * (d / Math.sqrt((l * 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): t_0 = 1.0 - (0.5 * ((h / l) * math.pow(((M / 2.0) * (D_m / d)), 2.0))) tmp = 0 if l <= 7.8e-221: tmp = t_0 * math.sqrt(((d / h) * (d / l))) elif l <= 1.7e+175: tmp = t_0 * (d / math.sqrt((l * 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) t_0 = Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.0)))) tmp = 0.0 if (l <= 7.8e-221) tmp = Float64(t_0 * sqrt(Float64(Float64(d / h) * Float64(d / l)))); elseif (l <= 1.7e+175) tmp = Float64(t_0 * Float64(d / sqrt(Float64(l * 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)
t_0 = 1.0 - (0.5 * ((h / l) * (((M / 2.0) * (D_m / d)) ^ 2.0)));
tmp = 0.0;
if (l <= 7.8e-221)
tmp = t_0 * sqrt(((d / h) * (d / l)));
elseif (l <= 1.7e+175)
tmp = t_0 * (d / sqrt((l * 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_] := Block[{t$95$0 = 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]}, If[LessEqual[l, 7.8e-221], N[(t$95$0 * N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.7e+175], N[(t$95$0 * N[(d / N[Sqrt[N[(l * 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}
t_0 := 1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\\
\mathbf{if}\;\ell \leq 7.8 \cdot 10^{-221}:\\
\;\;\;\;t\_0 \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq 1.7 \cdot 10^{+175}:\\
\;\;\;\;t\_0 \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < 7.7999999999999997e-221Initial program 66.3%
Simplified66.9%
pow166.9%
sqrt-unprod60.4%
Applied egg-rr60.4%
unpow160.4%
*-commutative60.4%
Simplified60.4%
if 7.7999999999999997e-221 < l < 1.70000000000000014e175Initial program 71.1%
Simplified72.3%
pow172.3%
sqrt-unprod52.1%
Applied egg-rr52.1%
unpow152.1%
*-commutative52.1%
Simplified52.1%
frac-times42.5%
unpow242.5%
*-commutative42.5%
associate-/l/48.1%
*-un-lft-identity48.1%
associate-/l/42.5%
*-commutative42.5%
sqrt-div51.3%
sqrt-pow175.6%
metadata-eval75.6%
pow175.6%
Applied egg-rr75.6%
*-lft-identity75.6%
Simplified75.6%
if 1.70000000000000014e175 < l Initial program 59.4%
Simplified59.4%
Taylor expanded in d around inf 43.3%
*-commutative43.3%
Simplified43.3%
Taylor expanded in l around 0 43.3%
*-commutative43.3%
unpow-143.3%
metadata-eval43.3%
pow-sqr43.3%
rem-sqrt-square43.3%
rem-square-sqrt43.2%
fabs-sqr43.2%
rem-square-sqrt43.3%
Simplified43.3%
unpow-prod-down71.1%
Applied egg-rr71.1%
Final simplification66.6%
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 -3.05e+59)
(* (/ 1.0 (sqrt (/ l d))) (sqrt (/ d h)))
(if (<= d -4.7e-297)
(*
(sqrt (* (/ d h) (/ d l)))
(* -0.25 (* (pow (* D_m (/ M d)) 2.0) (* (/ h l) 0.5))))
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D_m d)) 2.0))))
(/ d (sqrt (* l 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 (d <= -3.05e+59) {
tmp = (1.0 / sqrt((l / d))) * sqrt((d / h));
} else if (d <= -4.7e-297) {
tmp = sqrt(((d / h) * (d / l))) * (-0.25 * (pow((D_m * (M / d)), 2.0) * ((h / l) * 0.5)));
} else {
tmp = (1.0 - (0.5 * ((h / l) * pow(((M / 2.0) * (D_m / d)), 2.0)))) * (d / sqrt((l * 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 (d <= (-3.05d+59)) then
tmp = (1.0d0 / sqrt((l / d))) * sqrt((d / h))
else if (d <= (-4.7d-297)) then
tmp = sqrt(((d / h) * (d / l))) * ((-0.25d0) * (((d_m * (m / d)) ** 2.0d0) * ((h / l) * 0.5d0)))
else
tmp = (1.0d0 - (0.5d0 * ((h / l) * (((m / 2.0d0) * (d_m / d)) ** 2.0d0)))) * (d / sqrt((l * 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 (d <= -3.05e+59) {
tmp = (1.0 / Math.sqrt((l / d))) * Math.sqrt((d / h));
} else if (d <= -4.7e-297) {
tmp = Math.sqrt(((d / h) * (d / l))) * (-0.25 * (Math.pow((D_m * (M / d)), 2.0) * ((h / l) * 0.5)));
} else {
tmp = (1.0 - (0.5 * ((h / l) * Math.pow(((M / 2.0) * (D_m / d)), 2.0)))) * (d / Math.sqrt((l * 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 d <= -3.05e+59: tmp = (1.0 / math.sqrt((l / d))) * math.sqrt((d / h)) elif d <= -4.7e-297: tmp = math.sqrt(((d / h) * (d / l))) * (-0.25 * (math.pow((D_m * (M / d)), 2.0) * ((h / l) * 0.5))) else: tmp = (1.0 - (0.5 * ((h / l) * math.pow(((M / 2.0) * (D_m / d)), 2.0)))) * (d / math.sqrt((l * 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 (d <= -3.05e+59) tmp = Float64(Float64(1.0 / sqrt(Float64(l / d))) * sqrt(Float64(d / h))); elseif (d <= -4.7e-297) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(-0.25 * Float64((Float64(D_m * Float64(M / d)) ^ 2.0) * Float64(Float64(h / l) * 0.5)))); else tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.0)))) * Float64(d / sqrt(Float64(l * 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 (d <= -3.05e+59)
tmp = (1.0 / sqrt((l / d))) * sqrt((d / h));
elseif (d <= -4.7e-297)
tmp = sqrt(((d / h) * (d / l))) * (-0.25 * (((D_m * (M / d)) ^ 2.0) * ((h / l) * 0.5)));
else
tmp = (1.0 - (0.5 * ((h / l) * (((M / 2.0) * (D_m / d)) ^ 2.0)))) * (d / sqrt((l * 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[d, -3.05e+59], N[(N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4.7e-297], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.25 * N[(N[Power[N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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[(d / N[Sqrt[N[(l * 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}\;d \leq -3.05 \cdot 10^{+59}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;d \leq -4.7 \cdot 10^{-297}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(-0.25 \cdot \left({\left(D\_m \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if d < -3.04999999999999986e59Initial program 79.3%
Simplified83.6%
Taylor expanded in M around 0 60.2%
*-rgt-identity60.2%
clear-num60.2%
sqrt-div61.5%
metadata-eval61.5%
Applied egg-rr61.5%
if -3.04999999999999986e59 < d < -4.69999999999999986e-297Initial program 56.9%
Simplified55.5%
pow155.5%
sqrt-unprod50.6%
Applied egg-rr50.6%
unpow150.6%
*-commutative50.6%
Simplified50.6%
add-sqr-sqrt50.6%
pow250.6%
*-commutative50.6%
sqrt-prod50.6%
sqrt-prod50.6%
sqrt-pow152.9%
metadata-eval52.9%
pow152.9%
div-inv52.9%
metadata-eval52.9%
Applied egg-rr52.9%
Taylor expanded in M around inf 26.1%
associate-/l*26.1%
times-frac27.4%
associate-*r*27.4%
unpow227.4%
unpow227.4%
unpow227.4%
times-frac34.0%
swap-sqr40.6%
associate-/l*40.7%
associate-/l*41.8%
unpow241.8%
associate-/l*40.6%
*-commutative40.6%
unpow240.6%
rem-square-sqrt40.7%
associate-*r/40.7%
*-commutative40.7%
Simplified40.7%
if -4.69999999999999986e-297 < d Initial program 69.4%
Simplified70.1%
pow170.1%
sqrt-unprod53.9%
Applied egg-rr53.9%
unpow153.9%
*-commutative53.9%
Simplified53.9%
frac-times40.4%
unpow240.4%
*-commutative40.4%
associate-/l/46.6%
*-un-lft-identity46.6%
associate-/l/40.4%
*-commutative40.4%
sqrt-div48.6%
sqrt-pow168.8%
metadata-eval68.8%
pow168.8%
Applied egg-rr68.8%
*-lft-identity68.8%
Simplified68.8%
Final simplification58.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 (<= D_m 2.3e+170)
(fabs (/ d (sqrt (* l h))))
(*
(sqrt (* (/ d h) (/ d l)))
(* -0.25 (* (pow (* D_m (/ M d)) 2.0) (* (/ h l) 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_m <= 2.3e+170) {
tmp = fabs((d / sqrt((l * h))));
} else {
tmp = sqrt(((d / h) * (d / l))) * (-0.25 * (pow((D_m * (M / d)), 2.0) * ((h / l) * 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_m <= 2.3d+170) then
tmp = abs((d / sqrt((l * h))))
else
tmp = sqrt(((d / h) * (d / l))) * ((-0.25d0) * (((d_m * (m / d)) ** 2.0d0) * ((h / l) * 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_m <= 2.3e+170) {
tmp = Math.abs((d / Math.sqrt((l * h))));
} else {
tmp = Math.sqrt(((d / h) * (d / l))) * (-0.25 * (Math.pow((D_m * (M / d)), 2.0) * ((h / l) * 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_m <= 2.3e+170: tmp = math.fabs((d / math.sqrt((l * h)))) else: tmp = math.sqrt(((d / h) * (d / l))) * (-0.25 * (math.pow((D_m * (M / d)), 2.0) * ((h / l) * 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_m <= 2.3e+170) tmp = abs(Float64(d / sqrt(Float64(l * h)))); else tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(-0.25 * Float64((Float64(D_m * Float64(M / d)) ^ 2.0) * Float64(Float64(h / l) * 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_m <= 2.3e+170)
tmp = abs((d / sqrt((l * h))));
else
tmp = sqrt(((d / h) * (d / l))) * (-0.25 * (((D_m * (M / d)) ^ 2.0) * ((h / l) * 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$95$m, 2.3e+170], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.25 * N[(N[Power[N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * 0.5), $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}\;D\_m \leq 2.3 \cdot 10^{+170}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(-0.25 \cdot \left({\left(D\_m \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if D < 2.3000000000000001e170Initial program 66.6%
Simplified67.5%
Taylor expanded in M around 0 36.4%
*-rgt-identity36.4%
*-commutative36.4%
sqrt-prod30.1%
add-sqr-sqrt30.1%
rem-sqrt-square30.1%
frac-times20.0%
sqrt-div24.2%
sqrt-unprod19.0%
add-sqr-sqrt36.5%
*-commutative36.5%
Applied egg-rr36.5%
if 2.3000000000000001e170 < D Initial program 71.5%
Simplified71.5%
pow171.5%
sqrt-unprod65.8%
Applied egg-rr65.8%
unpow165.8%
*-commutative65.8%
Simplified65.8%
add-sqr-sqrt65.8%
pow265.8%
*-commutative65.8%
sqrt-prod65.8%
sqrt-prod65.8%
sqrt-pow165.8%
metadata-eval65.8%
pow165.8%
div-inv65.8%
metadata-eval65.8%
Applied egg-rr65.8%
Taylor expanded in M around inf 40.1%
associate-/l*40.1%
times-frac40.1%
associate-*r*40.1%
unpow240.1%
unpow240.1%
unpow240.1%
times-frac48.7%
swap-sqr57.4%
associate-/l*57.3%
associate-/l*57.3%
unpow257.3%
associate-/l*57.4%
*-commutative57.4%
unpow257.4%
rem-square-sqrt57.4%
associate-*r/57.4%
*-commutative57.4%
Simplified57.4%
Final simplification39.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 (<= d -5.6e-19)
(* (/ 1.0 (sqrt (/ l d))) (sqrt (/ d h)))
(if (<= d -5e-310)
(* d (pow (+ -1.0 (fma l h 1.0)) -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 <= -5.6e-19) {
tmp = (1.0 / sqrt((l / d))) * sqrt((d / h));
} else if (d <= -5e-310) {
tmp = d * pow((-1.0 + fma(l, h, 1.0)), -0.5);
} else {
tmp = d * (pow(l, -0.5) * 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 <= -5.6e-19) tmp = Float64(Float64(1.0 / sqrt(Float64(l / d))) * sqrt(Float64(d / h))); elseif (d <= -5e-310) tmp = Float64(d * (Float64(-1.0 + fma(l, h, 1.0)) ^ -0.5)); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return 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, -5.6e-19], N[(N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Power[N[(-1.0 + N[(l * h + 1.0), $MachinePrecision]), $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 -5.6 \cdot 10^{-19}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(\ell, h, 1\right)\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -5.60000000000000005e-19Initial program 79.9%
Simplified83.2%
Taylor expanded in M around 0 52.3%
*-rgt-identity52.3%
clear-num52.3%
sqrt-div53.3%
metadata-eval53.3%
Applied egg-rr53.3%
if -5.60000000000000005e-19 < d < -4.999999999999985e-310Initial program 48.8%
Simplified47.1%
Taylor expanded in d around inf 16.6%
*-commutative16.6%
Simplified16.6%
Taylor expanded in l around 0 16.6%
*-commutative16.6%
unpow-116.6%
metadata-eval16.6%
pow-sqr16.6%
rem-sqrt-square16.6%
rem-square-sqrt16.6%
fabs-sqr16.6%
rem-square-sqrt16.6%
Simplified16.6%
expm1-log1p-u16.6%
expm1-undefine35.3%
Applied egg-rr35.3%
sub-neg35.3%
metadata-eval35.3%
+-commutative35.3%
log1p-undefine35.3%
rem-exp-log35.3%
+-commutative35.3%
fma-define35.3%
Simplified35.3%
if -4.999999999999985e-310 < d Initial program 71.0%
Simplified71.8%
Taylor expanded in d around inf 34.6%
*-commutative34.6%
Simplified34.6%
Taylor expanded in l around 0 34.6%
*-commutative34.6%
unpow-134.6%
metadata-eval34.6%
pow-sqr34.6%
rem-sqrt-square34.6%
rem-square-sqrt34.5%
fabs-sqr34.5%
rem-square-sqrt34.6%
Simplified34.6%
unpow-prod-down45.7%
Applied egg-rr45.7%
Final simplification44.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 (<= d -1.58e-18)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= d -5e-310)
(* d (pow (+ -1.0 (fma l h 1.0)) -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 <= -1.58e-18) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (d <= -5e-310) {
tmp = d * pow((-1.0 + fma(l, h, 1.0)), -0.5);
} else {
tmp = d * (pow(l, -0.5) * 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 <= -1.58e-18) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (d <= -5e-310) tmp = Float64(d * (Float64(-1.0 + fma(l, h, 1.0)) ^ -0.5)); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return 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, -1.58e-18], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Power[N[(-1.0 + N[(l * h + 1.0), $MachinePrecision]), $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 -1.58 \cdot 10^{-18}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(\ell, h, 1\right)\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -1.5800000000000001e-18Initial program 79.9%
Simplified83.2%
Taylor expanded in M around 0 52.3%
Taylor expanded in d around 0 52.3%
if -1.5800000000000001e-18 < d < -4.999999999999985e-310Initial program 48.8%
Simplified47.1%
Taylor expanded in d around inf 16.6%
*-commutative16.6%
Simplified16.6%
Taylor expanded in l around 0 16.6%
*-commutative16.6%
unpow-116.6%
metadata-eval16.6%
pow-sqr16.6%
rem-sqrt-square16.6%
rem-square-sqrt16.6%
fabs-sqr16.6%
rem-square-sqrt16.6%
Simplified16.6%
expm1-log1p-u16.6%
expm1-undefine35.3%
Applied egg-rr35.3%
sub-neg35.3%
metadata-eval35.3%
+-commutative35.3%
log1p-undefine35.3%
rem-exp-log35.3%
+-commutative35.3%
fma-define35.3%
Simplified35.3%
if -4.999999999999985e-310 < d Initial program 71.0%
Simplified71.8%
Taylor expanded in d around inf 34.6%
*-commutative34.6%
Simplified34.6%
Taylor expanded in l around 0 34.6%
*-commutative34.6%
unpow-134.6%
metadata-eval34.6%
pow-sqr34.6%
rem-sqrt-square34.6%
rem-square-sqrt34.5%
fabs-sqr34.5%
rem-square-sqrt34.6%
Simplified34.6%
unpow-prod-down45.7%
Applied egg-rr45.7%
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 -6.2e-215)
(* (- d) (sqrt (/ (/ 1.0 l) h)))
(if (<= l -4e-310)
(* d (pow (pow (* l h) 2.0) -0.25))
(* 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 <= -6.2e-215) {
tmp = -d * sqrt(((1.0 / l) / h));
} else if (l <= -4e-310) {
tmp = d * pow(pow((l * h), 2.0), -0.25);
} 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 <= (-6.2d-215)) then
tmp = -d * sqrt(((1.0d0 / l) / h))
else if (l <= (-4d-310)) then
tmp = d * (((l * h) ** 2.0d0) ** (-0.25d0))
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 <= -6.2e-215) {
tmp = -d * Math.sqrt(((1.0 / l) / h));
} else if (l <= -4e-310) {
tmp = d * Math.pow(Math.pow((l * h), 2.0), -0.25);
} 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 <= -6.2e-215: tmp = -d * math.sqrt(((1.0 / l) / h)) elif l <= -4e-310: tmp = d * math.pow(math.pow((l * h), 2.0), -0.25) 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 <= -6.2e-215) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h))); elseif (l <= -4e-310) tmp = Float64(d * ((Float64(l * h) ^ 2.0) ^ -0.25)); 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 <= -6.2e-215)
tmp = -d * sqrt(((1.0 / l) / h));
elseif (l <= -4e-310)
tmp = d * (((l * h) ^ 2.0) ^ -0.25);
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, -6.2e-215], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -4e-310], N[(d * N[Power[N[Power[N[(l * h), $MachinePrecision], 2.0], $MachinePrecision], -0.25], $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 -6.2 \cdot 10^{-215}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{elif}\;\ell \leq -4 \cdot 10^{-310}:\\
\;\;\;\;d \cdot {\left({\left(\ell \cdot h\right)}^{2}\right)}^{-0.25}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -6.19999999999999987e-215Initial program 62.1%
Simplified62.9%
Taylor expanded in d around inf 6.4%
*-commutative6.4%
Simplified6.4%
Taylor expanded in l around 0 6.4%
*-commutative6.4%
unpow-16.4%
metadata-eval6.4%
pow-sqr6.4%
rem-sqrt-square6.4%
rem-square-sqrt6.4%
fabs-sqr6.4%
rem-square-sqrt6.4%
Simplified6.4%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt36.5%
neg-mul-136.5%
Simplified36.5%
if -6.19999999999999987e-215 < l < -3.999999999999988e-310Initial program 72.7%
Simplified72.7%
Taylor expanded in d around inf 40.4%
*-commutative40.4%
Simplified40.4%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt6.8%
associate-*r*6.8%
*-commutative6.8%
neg-mul-16.8%
distribute-lft-neg-in6.8%
distribute-rgt-neg-in6.8%
*-commutative6.8%
unpow-16.8%
metadata-eval6.8%
pow-sqr6.8%
rem-sqrt-square6.8%
rem-square-sqrt6.8%
fabs-sqr6.8%
rem-square-sqrt6.8%
Simplified6.8%
add-sqr-sqrt0.0%
sqrt-unprod40.4%
sqr-neg40.4%
sqrt-unprod40.4%
add-sqr-sqrt40.4%
sqr-pow40.4%
pow-prod-down51.1%
pow251.1%
*-commutative51.1%
metadata-eval51.1%
Applied egg-rr51.1%
if -3.999999999999988e-310 < l Initial program 71.0%
Simplified71.8%
Taylor expanded in d around inf 34.6%
*-commutative34.6%
Simplified34.6%
Taylor expanded in l around 0 34.6%
*-commutative34.6%
unpow-134.6%
metadata-eval34.6%
pow-sqr34.6%
rem-sqrt-square34.6%
rem-square-sqrt34.5%
fabs-sqr34.5%
rem-square-sqrt34.6%
Simplified34.6%
unpow-prod-down45.7%
Applied egg-rr45.7%
Final simplification42.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 -2.7e-215)
(* (- d) (sqrt (/ (/ 1.0 l) h)))
(if (<= l 7.5e-288)
(* d (sqrt (/ (/ 1.0 h) 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 <= -2.7e-215) {
tmp = -d * sqrt(((1.0 / l) / h));
} else if (l <= 7.5e-288) {
tmp = d * sqrt(((1.0 / h) / 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 <= (-2.7d-215)) then
tmp = -d * sqrt(((1.0d0 / l) / h))
else if (l <= 7.5d-288) then
tmp = d * sqrt(((1.0d0 / h) / 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 <= -2.7e-215) {
tmp = -d * Math.sqrt(((1.0 / l) / h));
} else if (l <= 7.5e-288) {
tmp = d * Math.sqrt(((1.0 / h) / 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 <= -2.7e-215: tmp = -d * math.sqrt(((1.0 / l) / h)) elif l <= 7.5e-288: tmp = d * math.sqrt(((1.0 / h) / 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 <= -2.7e-215) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h))); elseif (l <= 7.5e-288) tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / 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 <= -2.7e-215)
tmp = -d * sqrt(((1.0 / l) / h));
elseif (l <= 7.5e-288)
tmp = d * sqrt(((1.0 / h) / 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, -2.7e-215], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.5e-288], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $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 -2.7 \cdot 10^{-215}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{elif}\;\ell \leq 7.5 \cdot 10^{-288}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -2.70000000000000018e-215Initial program 62.1%
Simplified62.9%
Taylor expanded in d around inf 6.4%
*-commutative6.4%
Simplified6.4%
Taylor expanded in l around 0 6.4%
*-commutative6.4%
unpow-16.4%
metadata-eval6.4%
pow-sqr6.4%
rem-sqrt-square6.4%
rem-square-sqrt6.4%
fabs-sqr6.4%
rem-square-sqrt6.4%
Simplified6.4%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt36.5%
neg-mul-136.5%
Simplified36.5%
if -2.70000000000000018e-215 < l < 7.4999999999999998e-288Initial program 71.8%
Simplified71.8%
Taylor expanded in d around inf 44.1%
associate-/r*44.1%
Simplified44.1%
if 7.4999999999999998e-288 < l Initial program 71.1%
Simplified71.9%
Taylor expanded in d around inf 33.9%
*-commutative33.9%
Simplified33.9%
Taylor expanded in l around 0 33.9%
*-commutative33.9%
unpow-133.9%
metadata-eval33.9%
pow-sqr33.9%
rem-sqrt-square33.9%
rem-square-sqrt33.8%
fabs-sqr33.8%
rem-square-sqrt33.9%
Simplified33.9%
unpow-prod-down45.2%
Applied egg-rr45.2%
Final simplification41.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 (<= l -5.6e-215) (* (- d) (sqrt (/ (/ 1.0 l) h))) (* d (sqrt (/ (/ 1.0 h) l)))))
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.6e-215) {
tmp = -d * sqrt(((1.0 / l) / h));
} else {
tmp = d * sqrt(((1.0 / h) / l));
}
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.6d-215)) then
tmp = -d * sqrt(((1.0d0 / l) / h))
else
tmp = d * sqrt(((1.0d0 / h) / l))
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.6e-215) {
tmp = -d * Math.sqrt(((1.0 / l) / h));
} else {
tmp = d * Math.sqrt(((1.0 / h) / l));
}
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.6e-215: tmp = -d * math.sqrt(((1.0 / l) / h)) else: tmp = d * math.sqrt(((1.0 / h) / l)) 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.6e-215) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); 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.6e-215)
tmp = -d * sqrt(((1.0 / l) / h));
else
tmp = d * sqrt(((1.0 / h) / l));
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.6e-215], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $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.6 \cdot 10^{-215}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if l < -5.59999999999999972e-215Initial program 62.1%
Simplified62.9%
Taylor expanded in d around inf 6.4%
*-commutative6.4%
Simplified6.4%
Taylor expanded in l around 0 6.4%
*-commutative6.4%
unpow-16.4%
metadata-eval6.4%
pow-sqr6.4%
rem-sqrt-square6.4%
rem-square-sqrt6.4%
fabs-sqr6.4%
rem-square-sqrt6.4%
Simplified6.4%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt36.5%
neg-mul-136.5%
Simplified36.5%
if -5.59999999999999972e-215 < l Initial program 71.2%
Simplified71.9%
Taylor expanded in d around inf 35.3%
associate-/r*37.1%
Simplified37.1%
Final simplification36.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 (let* ((t_0 (sqrt (/ (/ 1.0 h) l)))) (if (<= l -5.2e-215) (* 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 = sqrt(((1.0 / h) / l));
double tmp;
if (l <= -5.2e-215) {
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 = sqrt(((1.0d0 / h) / l))
if (l <= (-5.2d-215)) 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.sqrt(((1.0 / h) / l));
double tmp;
if (l <= -5.2e-215) {
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.sqrt(((1.0 / h) / l)) tmp = 0 if l <= -5.2e-215: 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 = sqrt(Float64(Float64(1.0 / h) / l)) tmp = 0.0 if (l <= -5.2e-215) tmp = Float64(d * Float64(-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 = sqrt(((1.0 / h) / l));
tmp = 0.0;
if (l <= -5.2e-215)
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[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -5.2e-215], 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 := \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{if}\;\ell \leq -5.2 \cdot 10^{-215}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
\end{array}
if l < -5.2e-215Initial program 62.1%
Simplified62.9%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt36.5%
neg-mul-136.5%
Simplified36.5%
if -5.2e-215 < l Initial program 71.2%
Simplified71.9%
Taylor expanded in d around inf 35.3%
associate-/r*37.1%
Simplified37.1%
Final simplification36.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 (<= l -2.8e-215) (* (- d) (pow (* l h) -0.5)) (* d (sqrt (/ (/ 1.0 h) l)))))
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 <= -2.8e-215) {
tmp = -d * pow((l * h), -0.5);
} else {
tmp = d * sqrt(((1.0 / h) / l));
}
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 <= (-2.8d-215)) then
tmp = -d * ((l * h) ** (-0.5d0))
else
tmp = d * sqrt(((1.0d0 / h) / l))
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 <= -2.8e-215) {
tmp = -d * Math.pow((l * h), -0.5);
} else {
tmp = d * Math.sqrt(((1.0 / h) / l));
}
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 <= -2.8e-215: tmp = -d * math.pow((l * h), -0.5) else: tmp = d * math.sqrt(((1.0 / h) / l)) 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 <= -2.8e-215) tmp = Float64(Float64(-d) * (Float64(l * h) ^ -0.5)); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); 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 <= -2.8e-215)
tmp = -d * ((l * h) ^ -0.5);
else
tmp = d * sqrt(((1.0 / h) / l));
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, -2.8e-215], N[((-d) * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $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 -2.8 \cdot 10^{-215}:\\
\;\;\;\;\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if l < -2.79999999999999986e-215Initial program 62.1%
Simplified62.9%
Taylor expanded in d around inf 6.4%
*-commutative6.4%
Simplified6.4%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt35.7%
associate-*r*35.7%
*-commutative35.7%
neg-mul-135.7%
distribute-lft-neg-in35.7%
distribute-rgt-neg-in35.7%
*-commutative35.7%
unpow-135.7%
metadata-eval35.7%
pow-sqr35.7%
rem-sqrt-square35.7%
rem-square-sqrt35.6%
fabs-sqr35.6%
rem-square-sqrt35.7%
Simplified35.7%
if -2.79999999999999986e-215 < l Initial program 71.2%
Simplified71.9%
Taylor expanded in d around inf 35.3%
associate-/r*37.1%
Simplified37.1%
Final simplification36.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 -5.2e-215) (* (- d) (pow (* l h) -0.5)) (/ d (sqrt (* l 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 (l <= -5.2e-215) {
tmp = -d * pow((l * h), -0.5);
} else {
tmp = d / sqrt((l * 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 (l <= (-5.2d-215)) then
tmp = -d * ((l * h) ** (-0.5d0))
else
tmp = d / sqrt((l * 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 (l <= -5.2e-215) {
tmp = -d * Math.pow((l * h), -0.5);
} else {
tmp = d / Math.sqrt((l * 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 l <= -5.2e-215: tmp = -d * math.pow((l * h), -0.5) else: tmp = d / math.sqrt((l * 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 (l <= -5.2e-215) tmp = Float64(Float64(-d) * (Float64(l * h) ^ -0.5)); else tmp = Float64(d / sqrt(Float64(l * 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 (l <= -5.2e-215)
tmp = -d * ((l * h) ^ -0.5);
else
tmp = d / sqrt((l * 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[l, -5.2e-215], N[((-d) * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d / N[Sqrt[N[(l * h), $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^{-215}:\\
\;\;\;\;\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if l < -5.2e-215Initial program 62.1%
Simplified62.9%
Taylor expanded in d around inf 6.4%
*-commutative6.4%
Simplified6.4%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt35.7%
associate-*r*35.7%
*-commutative35.7%
neg-mul-135.7%
distribute-lft-neg-in35.7%
distribute-rgt-neg-in35.7%
*-commutative35.7%
unpow-135.7%
metadata-eval35.7%
pow-sqr35.7%
rem-sqrt-square35.7%
rem-square-sqrt35.6%
fabs-sqr35.6%
rem-square-sqrt35.7%
Simplified35.7%
if -5.2e-215 < l Initial program 71.2%
Simplified71.9%
Taylor expanded in M around 0 32.6%
sqrt-div36.8%
*-rgt-identity36.8%
sqrt-div39.9%
frac-times39.8%
add-sqr-sqrt40.0%
sqrt-prod35.4%
Applied egg-rr35.4%
Final simplification35.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 (/ d (sqrt (* l 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) {
return d / sqrt((l * h));
}
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 / sqrt((l * h))
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.sqrt((l * h));
}
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.sqrt((l * h))
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 / sqrt(Float64(l * h))) 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 / sqrt((l * h));
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[Sqrt[N[(l * h), $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])\\
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 67.3%
Simplified68.1%
Taylor expanded in M around 0 33.1%
sqrt-div21.0%
*-rgt-identity21.0%
sqrt-div22.7%
frac-times22.7%
add-sqr-sqrt22.8%
sqrt-prod22.9%
Applied egg-rr22.9%
Final simplification22.9%
herbie shell --seed 2024131
(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)))))