
(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 13 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 (+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M 2.0) d)) 2.0) -0.5))))
(t_1 (sqrt (/ d l)))
(t_2 (sqrt (- d))))
(if (<= l -1.75e-284)
(* (/ t_2 (sqrt (- l))) (* (/ t_2 (sqrt (- h))) t_0))
(if (<= l 1.8e-176)
(*
(* (sqrt (/ d h)) t_1)
(- 1.0 (* 0.5 (/ (* h (pow (/ D_m (* d (/ 2.0 M))) 2.0)) l))))
(* t_1 (* t_0 (/ (sqrt d) (sqrt h))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = 1.0 + ((h / l) * (pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5));
double t_1 = sqrt((d / l));
double t_2 = sqrt(-d);
double tmp;
if (l <= -1.75e-284) {
tmp = (t_2 / sqrt(-l)) * ((t_2 / sqrt(-h)) * t_0);
} else if (l <= 1.8e-176) {
tmp = (sqrt((d / h)) * t_1) * (1.0 - (0.5 * ((h * pow((D_m / (d * (2.0 / M))), 2.0)) / l)));
} else {
tmp = t_1 * (t_0 * (sqrt(d) / sqrt(h)));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = 1.0d0 + ((h / l) * (((d_m * ((m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))
t_1 = sqrt((d / l))
t_2 = sqrt(-d)
if (l <= (-1.75d-284)) then
tmp = (t_2 / sqrt(-l)) * ((t_2 / sqrt(-h)) * t_0)
else if (l <= 1.8d-176) then
tmp = (sqrt((d / h)) * t_1) * (1.0d0 - (0.5d0 * ((h * ((d_m / (d * (2.0d0 / m))) ** 2.0d0)) / l)))
else
tmp = t_1 * (t_0 * (sqrt(d) / sqrt(h)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = 1.0 + ((h / l) * (Math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5));
double t_1 = Math.sqrt((d / l));
double t_2 = Math.sqrt(-d);
double tmp;
if (l <= -1.75e-284) {
tmp = (t_2 / Math.sqrt(-l)) * ((t_2 / Math.sqrt(-h)) * t_0);
} else if (l <= 1.8e-176) {
tmp = (Math.sqrt((d / h)) * t_1) * (1.0 - (0.5 * ((h * Math.pow((D_m / (d * (2.0 / M))), 2.0)) / l)));
} else {
tmp = t_1 * (t_0 * (Math.sqrt(d) / Math.sqrt(h)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = 1.0 + ((h / l) * (math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5)) t_1 = math.sqrt((d / l)) t_2 = math.sqrt(-d) tmp = 0 if l <= -1.75e-284: tmp = (t_2 / math.sqrt(-l)) * ((t_2 / math.sqrt(-h)) * t_0) elif l <= 1.8e-176: tmp = (math.sqrt((d / h)) * t_1) * (1.0 - (0.5 * ((h * math.pow((D_m / (d * (2.0 / M))), 2.0)) / l))) else: tmp = t_1 * (t_0 * (math.sqrt(d) / math.sqrt(h))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D_m * Float64(Float64(M / 2.0) / d)) ^ 2.0) * -0.5))) t_1 = sqrt(Float64(d / l)) t_2 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -1.75e-284) tmp = Float64(Float64(t_2 / sqrt(Float64(-l))) * Float64(Float64(t_2 / sqrt(Float64(-h))) * t_0)); elseif (l <= 1.8e-176) tmp = Float64(Float64(sqrt(Float64(d / h)) * t_1) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(D_m / Float64(d * Float64(2.0 / M))) ^ 2.0)) / l)))); else tmp = Float64(t_1 * Float64(t_0 * Float64(sqrt(d) / sqrt(h)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = 1.0 + ((h / l) * (((D_m * ((M / 2.0) / d)) ^ 2.0) * -0.5));
t_1 = sqrt((d / l));
t_2 = sqrt(-d);
tmp = 0.0;
if (l <= -1.75e-284)
tmp = (t_2 / sqrt(-l)) * ((t_2 / sqrt(-h)) * t_0);
elseif (l <= 1.8e-176)
tmp = (sqrt((d / h)) * t_1) * (1.0 - (0.5 * ((h * ((D_m / (d * (2.0 / M))) ^ 2.0)) / l)));
else
tmp = t_1 * (t_0 * (sqrt(d) / sqrt(h)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = 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]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -1.75e-284], N[(N[(t$95$2 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$2 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.8e-176], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(D$95$m / N[(d * N[(2.0 / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := 1 + \frac{h}{\ell} \cdot \left({\left(D\_m \cdot \frac{\frac{M}{2}}{d}\right)}^{2} \cdot -0.5\right)\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -1.75 \cdot 10^{-284}:\\
\;\;\;\;\frac{t\_2}{\sqrt{-\ell}} \cdot \left(\frac{t\_2}{\sqrt{-h}} \cdot t\_0\right)\\
\mathbf{elif}\;\ell \leq 1.8 \cdot 10^{-176}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot t\_1\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D\_m}{d \cdot \frac{2}{M}}\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(t\_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\end{array}
\end{array}
if l < -1.74999999999999988e-284Initial program 65.0%
Simplified63.3%
frac-2neg63.3%
sqrt-div68.1%
Applied egg-rr68.1%
frac-2neg68.1%
sqrt-div81.8%
Applied egg-rr81.8%
if -1.74999999999999988e-284 < l < 1.8000000000000001e-176Initial program 65.8%
Simplified69.1%
associate-*r/86.7%
frac-times83.4%
*-commutative83.4%
*-un-lft-identity83.4%
times-frac86.6%
*-commutative86.6%
associate-/l/86.6%
times-frac83.4%
*-un-lft-identity83.4%
associate-*r/86.6%
clear-num86.7%
un-div-inv86.8%
div-inv86.8%
clear-num86.8%
Applied egg-rr86.8%
if 1.8000000000000001e-176 < l Initial program 68.6%
Simplified67.7%
sqrt-div83.0%
div-inv82.9%
Applied egg-rr82.9%
associate-*r/83.0%
*-rgt-identity83.0%
Simplified83.0%
Final simplification82.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 l)))
(t_1
(*
(* (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)))))))
(if (<= t_1 -2e-118)
(*
(sqrt (/ d h))
(* t_0 (* h (* -0.125 (/ (pow (/ (* D_m M) d) 2.0) l)))))
(if (<= t_1 0.0)
(* d (sqrt (/ 1.0 (* l h))))
(if (<= t_1 INFINITY)
(*
(* t_0 (/ 1.0 (sqrt (/ h d))))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D_m d)) 2.0)))))
(*
(/ (sqrt (- d)) (sqrt (- h)))
(* t_0 (* h (* -0.125 (/ (pow (* M (/ D_m d)) 2.0) 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 t_0 = sqrt((d / l));
double t_1 = (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))));
double tmp;
if (t_1 <= -2e-118) {
tmp = sqrt((d / h)) * (t_0 * (h * (-0.125 * (pow(((D_m * M) / d), 2.0) / l))));
} else if (t_1 <= 0.0) {
tmp = d * sqrt((1.0 / (l * h)));
} else if (t_1 <= ((double) INFINITY)) {
tmp = (t_0 * (1.0 / sqrt((h / d)))) * (1.0 - (0.5 * ((h / l) * pow(((M / 2.0) * (D_m / d)), 2.0))));
} else {
tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * (h * (-0.125 * (pow((M * (D_m / d)), 2.0) / l))));
}
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 / l));
double t_1 = (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))));
double tmp;
if (t_1 <= -2e-118) {
tmp = Math.sqrt((d / h)) * (t_0 * (h * (-0.125 * (Math.pow(((D_m * M) / d), 2.0) / l))));
} else if (t_1 <= 0.0) {
tmp = d * Math.sqrt((1.0 / (l * h)));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (t_0 * (1.0 / Math.sqrt((h / d)))) * (1.0 - (0.5 * ((h / l) * Math.pow(((M / 2.0) * (D_m / d)), 2.0))));
} else {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * (t_0 * (h * (-0.125 * (Math.pow((M * (D_m / d)), 2.0) / 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): t_0 = math.sqrt((d / l)) t_1 = (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)))) tmp = 0 if t_1 <= -2e-118: tmp = math.sqrt((d / h)) * (t_0 * (h * (-0.125 * (math.pow(((D_m * M) / d), 2.0) / l)))) elif t_1 <= 0.0: tmp = d * math.sqrt((1.0 / (l * h))) elif t_1 <= math.inf: tmp = (t_0 * (1.0 / math.sqrt((h / d)))) * (1.0 - (0.5 * ((h / l) * math.pow(((M / 2.0) * (D_m / d)), 2.0)))) else: tmp = (math.sqrt(-d) / math.sqrt(-h)) * (t_0 * (h * (-0.125 * (math.pow((M * (D_m / d)), 2.0) / 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) t_0 = sqrt(Float64(d / l)) t_1 = 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))))) tmp = 0.0 if (t_1 <= -2e-118) tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * Float64(h * Float64(-0.125 * Float64((Float64(Float64(D_m * M) / d) ^ 2.0) / l))))); elseif (t_1 <= 0.0) tmp = Float64(d * sqrt(Float64(1.0 / Float64(l * h)))); elseif (t_1 <= Inf) tmp = Float64(Float64(t_0 * Float64(1.0 / sqrt(Float64(h / d)))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.0))))); else tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(t_0 * Float64(h * Float64(-0.125 * Float64((Float64(M * Float64(D_m / d)) ^ 2.0) / 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)
t_0 = sqrt((d / l));
t_1 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((D_m * M) / (d * 2.0)) ^ 2.0))));
tmp = 0.0;
if (t_1 <= -2e-118)
tmp = sqrt((d / h)) * (t_0 * (h * (-0.125 * ((((D_m * M) / d) ^ 2.0) / l))));
elseif (t_1 <= 0.0)
tmp = d * sqrt((1.0 / (l * h)));
elseif (t_1 <= Inf)
tmp = (t_0 * (1.0 / sqrt((h / d)))) * (1.0 - (0.5 * ((h / l) * (((M / 2.0) * (D_m / d)) ^ 2.0))));
else
tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * (h * (-0.125 * (((M * (D_m / d)) ^ 2.0) / 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_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -2e-118], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(h * N[(-0.125 * N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(t$95$0 * N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(h * N[(-0.125 * N[(N[Power[N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $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{\frac{d}{\ell}}\\
t_1 := \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)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-118}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t\_0 \cdot \left(h \cdot \left(-0.125 \cdot \frac{{\left(\frac{D\_m \cdot M}{d}\right)}^{2}}{\ell}\right)\right)\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\left(t\_0 \cdot \frac{1}{\sqrt{\frac{h}{d}}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(t\_0 \cdot \left(h \cdot \left(-0.125 \cdot \frac{{\left(M \cdot \frac{D\_m}{d}\right)}^{2}}{\ell}\right)\right)\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.99999999999999997e-118Initial program 79.1%
Simplified77.1%
Taylor expanded in M around inf 51.2%
Simplified79.0%
associate-*r/82.0%
Applied egg-rr82.0%
if -1.99999999999999997e-118 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 27.3%
Simplified19.7%
associate-*r/19.1%
clear-num19.1%
frac-times26.4%
*-commutative26.4%
*-un-lft-identity26.4%
times-frac25.8%
*-commutative25.8%
associate-/l/25.8%
times-frac26.4%
*-un-lft-identity26.4%
associate-*r/25.8%
clear-num25.8%
un-div-inv25.8%
div-inv25.8%
clear-num25.8%
Applied egg-rr25.8%
associate-/r/25.8%
*-commutative25.8%
associate-*r/25.8%
Simplified25.8%
Taylor expanded in d around inf 63.2%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 80.5%
Simplified81.4%
clear-num81.4%
sqrt-div83.7%
metadata-eval83.7%
Applied egg-rr83.7%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Simplified0.0%
Taylor expanded in M around inf 0.2%
Simplified0.8%
frac-2neg0.2%
sqrt-div32.7%
Applied egg-rr29.8%
Final simplification74.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 (sqrt (/ d l)))
(t_1
(*
(* (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)))))))
(if (<= t_1 -2e-118)
(*
(sqrt (/ d h))
(* t_0 (* h (* -0.125 (/ (pow (/ (* D_m M) d) 2.0) l)))))
(if (<= t_1 0.0)
(* d (sqrt (/ 1.0 (* l h))))
(*
(- 1.0 (* 0.5 (* (/ 1.0 l) (* h (pow (/ D_m (/ (* d 2.0) M)) 2.0)))))
(* t_0 (/ 1.0 (sqrt (/ h d)))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt((d / l));
double t_1 = (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))));
double tmp;
if (t_1 <= -2e-118) {
tmp = sqrt((d / h)) * (t_0 * (h * (-0.125 * (pow(((D_m * M) / d), 2.0) / l))));
} else if (t_1 <= 0.0) {
tmp = d * sqrt((1.0 / (l * h)));
} else {
tmp = (1.0 - (0.5 * ((1.0 / l) * (h * pow((D_m / ((d * 2.0) / M)), 2.0))))) * (t_0 * (1.0 / sqrt((h / d))));
}
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 / l))
t_1 = (((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((h / l) * (0.5d0 * (((d_m * m) / (d * 2.0d0)) ** 2.0d0))))
if (t_1 <= (-2d-118)) then
tmp = sqrt((d / h)) * (t_0 * (h * ((-0.125d0) * ((((d_m * m) / d) ** 2.0d0) / l))))
else if (t_1 <= 0.0d0) then
tmp = d * sqrt((1.0d0 / (l * h)))
else
tmp = (1.0d0 - (0.5d0 * ((1.0d0 / l) * (h * ((d_m / ((d * 2.0d0) / m)) ** 2.0d0))))) * (t_0 * (1.0d0 / sqrt((h / d))))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.sqrt((d / l));
double t_1 = (Math.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))));
double tmp;
if (t_1 <= -2e-118) {
tmp = Math.sqrt((d / h)) * (t_0 * (h * (-0.125 * (Math.pow(((D_m * M) / d), 2.0) / l))));
} else if (t_1 <= 0.0) {
tmp = d * Math.sqrt((1.0 / (l * h)));
} else {
tmp = (1.0 - (0.5 * ((1.0 / l) * (h * Math.pow((D_m / ((d * 2.0) / M)), 2.0))))) * (t_0 * (1.0 / Math.sqrt((h / d))));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.sqrt((d / l)) t_1 = (math.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)))) tmp = 0 if t_1 <= -2e-118: tmp = math.sqrt((d / h)) * (t_0 * (h * (-0.125 * (math.pow(((D_m * M) / d), 2.0) / l)))) elif t_1 <= 0.0: tmp = d * math.sqrt((1.0 / (l * h))) else: tmp = (1.0 - (0.5 * ((1.0 / l) * (h * math.pow((D_m / ((d * 2.0) / M)), 2.0))))) * (t_0 * (1.0 / math.sqrt((h / d)))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(d / l)) t_1 = Float64(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))))) tmp = 0.0 if (t_1 <= -2e-118) tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * Float64(h * Float64(-0.125 * Float64((Float64(Float64(D_m * M) / d) ^ 2.0) / l))))); elseif (t_1 <= 0.0) tmp = Float64(d * sqrt(Float64(1.0 / Float64(l * h)))); else tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(1.0 / l) * Float64(h * (Float64(D_m / Float64(Float64(d * 2.0) / M)) ^ 2.0))))) * Float64(t_0 * Float64(1.0 / sqrt(Float64(h / d))))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = sqrt((d / l));
t_1 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((D_m * M) / (d * 2.0)) ^ 2.0))));
tmp = 0.0;
if (t_1 <= -2e-118)
tmp = sqrt((d / h)) * (t_0 * (h * (-0.125 * ((((D_m * M) / d) ^ 2.0) / l))));
elseif (t_1 <= 0.0)
tmp = d * sqrt((1.0 / (l * h)));
else
tmp = (1.0 - (0.5 * ((1.0 / l) * (h * ((D_m / ((d * 2.0) / M)) ^ 2.0))))) * (t_0 * (1.0 / sqrt((h / d))));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(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]}, If[LessEqual[t$95$1, -2e-118], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(h * N[(-0.125 * N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(N[(1.0 / l), $MachinePrecision] * N[(h * N[Power[N[(D$95$m / N[(N[(d * 2.0), $MachinePrecision] / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 / N[Sqrt[N[(h / d), $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{\frac{d}{\ell}}\\
t_1 := \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)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-118}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t\_0 \cdot \left(h \cdot \left(-0.125 \cdot \frac{{\left(\frac{D\_m \cdot M}{d}\right)}^{2}}{\ell}\right)\right)\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{1}{\ell} \cdot \left(h \cdot {\left(\frac{D\_m}{\frac{d \cdot 2}{M}}\right)}^{2}\right)\right)\right) \cdot \left(t\_0 \cdot \frac{1}{\sqrt{\frac{h}{d}}}\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.99999999999999997e-118Initial program 79.1%
Simplified77.1%
Taylor expanded in M around inf 51.2%
Simplified79.0%
associate-*r/82.0%
Applied egg-rr82.0%
if -1.99999999999999997e-118 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 27.3%
Simplified19.7%
associate-*r/19.1%
clear-num19.1%
frac-times26.4%
*-commutative26.4%
*-un-lft-identity26.4%
times-frac25.8%
*-commutative25.8%
associate-/l/25.8%
times-frac26.4%
*-un-lft-identity26.4%
associate-*r/25.8%
clear-num25.8%
un-div-inv25.8%
div-inv25.8%
clear-num25.8%
Applied egg-rr25.8%
associate-/r/25.8%
*-commutative25.8%
associate-*r/25.8%
Simplified25.8%
Taylor expanded in d around inf 63.2%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 61.8%
Simplified62.4%
associate-*r/65.5%
clear-num65.5%
frac-times64.9%
*-commutative64.9%
*-un-lft-identity64.9%
times-frac65.5%
*-commutative65.5%
associate-/l/65.5%
times-frac64.9%
*-un-lft-identity64.9%
associate-*r/65.5%
clear-num65.5%
un-div-inv65.5%
div-inv65.5%
clear-num65.5%
Applied egg-rr65.5%
associate-/r/65.5%
*-commutative65.5%
associate-*r/65.5%
Simplified65.5%
clear-num65.5%
sqrt-div67.3%
metadata-eval67.3%
Applied egg-rr67.3%
Final simplification72.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
(let* ((t_0 (sqrt (/ d l)))
(t_1 (+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M 2.0) d)) 2.0) -0.5))))
(t_2 (sqrt (- d))))
(if (<= d -3.45e+246)
(*
(/ t_2 (sqrt (- l)))
(*
(sqrt (/ d h))
(+ 1.0 (* h (/ (* -0.5 (pow (* D_m (/ (* M 0.5) d)) 2.0)) l)))))
(if (<= d -5e-311)
(* (* (/ t_2 (sqrt (- h))) t_1) t_0)
(* t_0 (* t_1 (/ (sqrt d) (sqrt h))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt((d / l));
double t_1 = 1.0 + ((h / l) * (pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5));
double t_2 = sqrt(-d);
double tmp;
if (d <= -3.45e+246) {
tmp = (t_2 / sqrt(-l)) * (sqrt((d / h)) * (1.0 + (h * ((-0.5 * pow((D_m * ((M * 0.5) / d)), 2.0)) / l))));
} else if (d <= -5e-311) {
tmp = ((t_2 / sqrt(-h)) * t_1) * t_0;
} else {
tmp = t_0 * (t_1 * (sqrt(d) / sqrt(h)));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = 1.0d0 + ((h / l) * (((d_m * ((m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))
t_2 = sqrt(-d)
if (d <= (-3.45d+246)) then
tmp = (t_2 / sqrt(-l)) * (sqrt((d / h)) * (1.0d0 + (h * (((-0.5d0) * ((d_m * ((m * 0.5d0) / d)) ** 2.0d0)) / l))))
else if (d <= (-5d-311)) then
tmp = ((t_2 / sqrt(-h)) * t_1) * t_0
else
tmp = t_0 * (t_1 * (sqrt(d) / sqrt(h)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.sqrt((d / l));
double t_1 = 1.0 + ((h / l) * (Math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5));
double t_2 = Math.sqrt(-d);
double tmp;
if (d <= -3.45e+246) {
tmp = (t_2 / Math.sqrt(-l)) * (Math.sqrt((d / h)) * (1.0 + (h * ((-0.5 * Math.pow((D_m * ((M * 0.5) / d)), 2.0)) / l))));
} else if (d <= -5e-311) {
tmp = ((t_2 / Math.sqrt(-h)) * t_1) * t_0;
} else {
tmp = t_0 * (t_1 * (Math.sqrt(d) / Math.sqrt(h)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.sqrt((d / l)) t_1 = 1.0 + ((h / l) * (math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5)) t_2 = math.sqrt(-d) tmp = 0 if d <= -3.45e+246: tmp = (t_2 / math.sqrt(-l)) * (math.sqrt((d / h)) * (1.0 + (h * ((-0.5 * math.pow((D_m * ((M * 0.5) / d)), 2.0)) / l)))) elif d <= -5e-311: tmp = ((t_2 / math.sqrt(-h)) * t_1) * t_0 else: tmp = t_0 * (t_1 * (math.sqrt(d) / math.sqrt(h))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(d / l)) t_1 = Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D_m * Float64(Float64(M / 2.0) / d)) ^ 2.0) * -0.5))) t_2 = sqrt(Float64(-d)) tmp = 0.0 if (d <= -3.45e+246) tmp = Float64(Float64(t_2 / sqrt(Float64(-l))) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(D_m * Float64(Float64(M * 0.5) / d)) ^ 2.0)) / l))))); elseif (d <= -5e-311) tmp = Float64(Float64(Float64(t_2 / sqrt(Float64(-h))) * t_1) * t_0); else tmp = Float64(t_0 * Float64(t_1 * Float64(sqrt(d) / sqrt(h)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = sqrt((d / l));
t_1 = 1.0 + ((h / l) * (((D_m * ((M / 2.0) / d)) ^ 2.0) * -0.5));
t_2 = sqrt(-d);
tmp = 0.0;
if (d <= -3.45e+246)
tmp = (t_2 / sqrt(-l)) * (sqrt((d / h)) * (1.0 + (h * ((-0.5 * ((D_m * ((M * 0.5) / d)) ^ 2.0)) / l))));
elseif (d <= -5e-311)
tmp = ((t_2 / sqrt(-h)) * t_1) * t_0;
else
tmp = t_0 * (t_1 * (sqrt(d) / sqrt(h)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D$95$m * N[(N[(M / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[d, -3.45e+246], N[(N[(t$95$2 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(D$95$m * N[(N[(M * 0.5), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-311], N[(N[(N[(t$95$2 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision], N[(t$95$0 * N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := 1 + \frac{h}{\ell} \cdot \left({\left(D\_m \cdot \frac{\frac{M}{2}}{d}\right)}^{2} \cdot -0.5\right)\\
t_2 := \sqrt{-d}\\
\mathbf{if}\;d \leq -3.45 \cdot 10^{+246}:\\
\;\;\;\;\frac{t\_2}{\sqrt{-\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + h \cdot \frac{-0.5 \cdot {\left(D\_m \cdot \frac{M \cdot 0.5}{d}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\left(\frac{t\_2}{\sqrt{-h}} \cdot t\_1\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(t\_1 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\end{array}
\end{array}
if d < -3.45e246Initial program 69.1%
Simplified69.1%
frac-2neg69.1%
sqrt-div78.8%
Applied egg-rr78.8%
Applied egg-rr0.0%
prod-exp0.0%
*-commutative0.0%
exp-to-pow5.3%
rem-exp-log78.8%
associate-/l*78.8%
associate-*r*78.8%
metadata-eval78.8%
distribute-rgt-neg-in78.8%
*-commutative78.8%
associate-/l*99.8%
distribute-lft-neg-in99.8%
distribute-lft-neg-in99.8%
*-commutative99.8%
associate-/l*99.8%
Simplified99.8%
if -3.45e246 < d < -5.00000000000023e-311Initial program 63.6%
Simplified61.8%
frac-2neg65.4%
sqrt-div81.2%
Applied egg-rr74.7%
if -5.00000000000023e-311 < d Initial program 68.6%
Simplified68.6%
sqrt-div81.7%
div-inv81.6%
Applied egg-rr81.6%
associate-*r/81.7%
*-rgt-identity81.7%
Simplified81.7%
Final simplification80.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 l))))
(if (<= h -1.08e+248)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(* t_0 (* h (* -0.125 (/ (pow (* M (/ D_m d)) 2.0) l)))))
(if (<= h -5e-311)
(*
(- 1.0 (* 0.5 (* (/ 1.0 l) (* h (pow (/ D_m (/ (* d 2.0) M)) 2.0)))))
(* t_0 (/ 1.0 (sqrt (/ h d)))))
(*
t_0
(*
(+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M 2.0) d)) 2.0) -0.5)))
(/ (sqrt d) (sqrt h))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt((d / l));
double tmp;
if (h <= -1.08e+248) {
tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * (h * (-0.125 * (pow((M * (D_m / d)), 2.0) / l))));
} else if (h <= -5e-311) {
tmp = (1.0 - (0.5 * ((1.0 / l) * (h * pow((D_m / ((d * 2.0) / M)), 2.0))))) * (t_0 * (1.0 / sqrt((h / d))));
} else {
tmp = t_0 * ((1.0 + ((h / l) * (pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5))) * (sqrt(d) / sqrt(h)));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / l))
if (h <= (-1.08d+248)) then
tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * (h * ((-0.125d0) * (((m * (d_m / d)) ** 2.0d0) / l))))
else if (h <= (-5d-311)) then
tmp = (1.0d0 - (0.5d0 * ((1.0d0 / l) * (h * ((d_m / ((d * 2.0d0) / m)) ** 2.0d0))))) * (t_0 * (1.0d0 / sqrt((h / d))))
else
tmp = t_0 * ((1.0d0 + ((h / l) * (((d_m * ((m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))) * (sqrt(d) / sqrt(h)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.sqrt((d / l));
double tmp;
if (h <= -1.08e+248) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * (t_0 * (h * (-0.125 * (Math.pow((M * (D_m / d)), 2.0) / l))));
} else if (h <= -5e-311) {
tmp = (1.0 - (0.5 * ((1.0 / l) * (h * Math.pow((D_m / ((d * 2.0) / M)), 2.0))))) * (t_0 * (1.0 / Math.sqrt((h / d))));
} else {
tmp = t_0 * ((1.0 + ((h / l) * (Math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5))) * (Math.sqrt(d) / Math.sqrt(h)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.sqrt((d / l)) tmp = 0 if h <= -1.08e+248: tmp = (math.sqrt(-d) / math.sqrt(-h)) * (t_0 * (h * (-0.125 * (math.pow((M * (D_m / d)), 2.0) / l)))) elif h <= -5e-311: tmp = (1.0 - (0.5 * ((1.0 / l) * (h * math.pow((D_m / ((d * 2.0) / M)), 2.0))))) * (t_0 * (1.0 / math.sqrt((h / d)))) else: tmp = t_0 * ((1.0 + ((h / l) * (math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5))) * (math.sqrt(d) / math.sqrt(h))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (h <= -1.08e+248) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(t_0 * Float64(h * Float64(-0.125 * Float64((Float64(M * Float64(D_m / d)) ^ 2.0) / l))))); elseif (h <= -5e-311) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(1.0 / l) * Float64(h * (Float64(D_m / Float64(Float64(d * 2.0) / M)) ^ 2.0))))) * Float64(t_0 * Float64(1.0 / sqrt(Float64(h / d))))); else tmp = Float64(t_0 * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D_m * Float64(Float64(M / 2.0) / d)) ^ 2.0) * -0.5))) * Float64(sqrt(d) / sqrt(h)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = sqrt((d / l));
tmp = 0.0;
if (h <= -1.08e+248)
tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * (h * (-0.125 * (((M * (D_m / d)) ^ 2.0) / l))));
elseif (h <= -5e-311)
tmp = (1.0 - (0.5 * ((1.0 / l) * (h * ((D_m / ((d * 2.0) / M)) ^ 2.0))))) * (t_0 * (1.0 / sqrt((h / d))));
else
tmp = t_0 * ((1.0 + ((h / l) * (((D_m * ((M / 2.0) / d)) ^ 2.0) * -0.5))) * (sqrt(d) / sqrt(h)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -1.08e+248], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(h * N[(-0.125 * N[(N[Power[N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-311], N[(N[(1.0 - N[(0.5 * N[(N[(1.0 / l), $MachinePrecision] * N[(h * N[Power[N[(D$95$m / N[(N[(d * 2.0), $MachinePrecision] / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D$95$m * N[(N[(M / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;h \leq -1.08 \cdot 10^{+248}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(t\_0 \cdot \left(h \cdot \left(-0.125 \cdot \frac{{\left(M \cdot \frac{D\_m}{d}\right)}^{2}}{\ell}\right)\right)\right)\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{1}{\ell} \cdot \left(h \cdot {\left(\frac{D\_m}{\frac{d \cdot 2}{M}}\right)}^{2}\right)\right)\right) \cdot \left(t\_0 \cdot \frac{1}{\sqrt{\frac{h}{d}}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left({\left(D\_m \cdot \frac{\frac{M}{2}}{d}\right)}^{2} \cdot -0.5\right)\right) \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\end{array}
\end{array}
if h < -1.08e248Initial program 8.6%
Simplified8.6%
Taylor expanded in M around inf 0.8%
Simplified9.4%
frac-2neg8.6%
sqrt-div62.0%
Applied egg-rr55.0%
if -1.08e248 < h < -5.00000000000023e-311Initial program 71.1%
Simplified71.0%
associate-*r/72.9%
clear-num72.9%
frac-times73.8%
*-commutative73.8%
*-un-lft-identity73.8%
times-frac72.9%
*-commutative72.9%
associate-/l/72.9%
times-frac73.8%
*-un-lft-identity73.8%
associate-*r/72.9%
clear-num72.9%
un-div-inv72.9%
div-inv72.9%
clear-num72.9%
Applied egg-rr72.9%
associate-/r/72.9%
*-commutative72.9%
associate-*r/72.9%
Simplified72.9%
clear-num72.9%
sqrt-div73.9%
metadata-eval73.9%
Applied egg-rr73.9%
if -5.00000000000023e-311 < h Initial program 68.6%
Simplified68.6%
sqrt-div81.7%
div-inv81.6%
Applied egg-rr81.6%
associate-*r/81.7%
*-rgt-identity81.7%
Simplified81.7%
Final simplification77.0%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M 2.0) d)) 2.0) -0.5))))
(t_1 (sqrt (/ d l))))
(if (<= l -1.15e-292)
(* (* (/ (sqrt (- d)) (sqrt (- h))) t_0) t_1)
(if (<= l 7.8e-177)
(*
(* (sqrt (/ d h)) t_1)
(- 1.0 (* 0.5 (/ (* h (pow (/ D_m (* d (/ 2.0 M))) 2.0)) l))))
(* t_1 (* t_0 (/ (sqrt d) (sqrt h))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = 1.0 + ((h / l) * (pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5));
double t_1 = sqrt((d / l));
double tmp;
if (l <= -1.15e-292) {
tmp = ((sqrt(-d) / sqrt(-h)) * t_0) * t_1;
} else if (l <= 7.8e-177) {
tmp = (sqrt((d / h)) * t_1) * (1.0 - (0.5 * ((h * pow((D_m / (d * (2.0 / M))), 2.0)) / l)));
} else {
tmp = t_1 * (t_0 * (sqrt(d) / sqrt(h)));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + ((h / l) * (((d_m * ((m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))
t_1 = sqrt((d / l))
if (l <= (-1.15d-292)) then
tmp = ((sqrt(-d) / sqrt(-h)) * t_0) * t_1
else if (l <= 7.8d-177) then
tmp = (sqrt((d / h)) * t_1) * (1.0d0 - (0.5d0 * ((h * ((d_m / (d * (2.0d0 / m))) ** 2.0d0)) / l)))
else
tmp = t_1 * (t_0 * (sqrt(d) / sqrt(h)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = 1.0 + ((h / l) * (Math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5));
double t_1 = Math.sqrt((d / l));
double tmp;
if (l <= -1.15e-292) {
tmp = ((Math.sqrt(-d) / Math.sqrt(-h)) * t_0) * t_1;
} else if (l <= 7.8e-177) {
tmp = (Math.sqrt((d / h)) * t_1) * (1.0 - (0.5 * ((h * Math.pow((D_m / (d * (2.0 / M))), 2.0)) / l)));
} else {
tmp = t_1 * (t_0 * (Math.sqrt(d) / Math.sqrt(h)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = 1.0 + ((h / l) * (math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5)) t_1 = math.sqrt((d / l)) tmp = 0 if l <= -1.15e-292: tmp = ((math.sqrt(-d) / math.sqrt(-h)) * t_0) * t_1 elif l <= 7.8e-177: tmp = (math.sqrt((d / h)) * t_1) * (1.0 - (0.5 * ((h * math.pow((D_m / (d * (2.0 / M))), 2.0)) / l))) else: tmp = t_1 * (t_0 * (math.sqrt(d) / math.sqrt(h))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D_m * Float64(Float64(M / 2.0) / d)) ^ 2.0) * -0.5))) t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -1.15e-292) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0) * t_1); elseif (l <= 7.8e-177) tmp = Float64(Float64(sqrt(Float64(d / h)) * t_1) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(D_m / Float64(d * Float64(2.0 / M))) ^ 2.0)) / l)))); else tmp = Float64(t_1 * Float64(t_0 * Float64(sqrt(d) / sqrt(h)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = 1.0 + ((h / l) * (((D_m * ((M / 2.0) / d)) ^ 2.0) * -0.5));
t_1 = sqrt((d / l));
tmp = 0.0;
if (l <= -1.15e-292)
tmp = ((sqrt(-d) / sqrt(-h)) * t_0) * t_1;
elseif (l <= 7.8e-177)
tmp = (sqrt((d / h)) * t_1) * (1.0 - (0.5 * ((h * ((D_m / (d * (2.0 / M))) ^ 2.0)) / l)));
else
tmp = t_1 * (t_0 * (sqrt(d) / sqrt(h)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = 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]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.15e-292], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[l, 7.8e-177], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(D$95$m / N[(d * N[(2.0 / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := 1 + \frac{h}{\ell} \cdot \left({\left(D\_m \cdot \frac{\frac{M}{2}}{d}\right)}^{2} \cdot -0.5\right)\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -1.15 \cdot 10^{-292}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_0\right) \cdot t\_1\\
\mathbf{elif}\;\ell \leq 7.8 \cdot 10^{-177}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot t\_1\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D\_m}{d \cdot \frac{2}{M}}\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(t\_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\end{array}
\end{array}
if l < -1.1499999999999999e-292Initial program 65.0%
Simplified63.3%
frac-2neg68.1%
sqrt-div81.8%
Applied egg-rr74.6%
if -1.1499999999999999e-292 < l < 7.80000000000000028e-177Initial program 65.8%
Simplified69.1%
associate-*r/86.7%
frac-times83.4%
*-commutative83.4%
*-un-lft-identity83.4%
times-frac86.6%
*-commutative86.6%
associate-/l/86.6%
times-frac83.4%
*-un-lft-identity83.4%
associate-*r/86.6%
clear-num86.7%
un-div-inv86.8%
div-inv86.8%
clear-num86.8%
Applied egg-rr86.8%
if 7.80000000000000028e-177 < l Initial program 68.6%
Simplified67.7%
sqrt-div83.0%
div-inv82.9%
Applied egg-rr82.9%
associate-*r/83.0%
*-rgt-identity83.0%
Simplified83.0%
Final simplification79.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
(let* ((t_0 (sqrt (/ d l))))
(if (<= l -5e-311)
(*
(* (/ (sqrt (- d)) (sqrt (- h))) t_0)
(- 1.0 (* 0.5 (* (/ 1.0 l) (* h (pow (/ D_m (/ (* d 2.0) M)) 2.0))))))
(*
t_0
(*
(+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M 2.0) d)) 2.0) -0.5)))
(/ (sqrt d) (sqrt h)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt((d / l));
double tmp;
if (l <= -5e-311) {
tmp = ((sqrt(-d) / sqrt(-h)) * t_0) * (1.0 - (0.5 * ((1.0 / l) * (h * pow((D_m / ((d * 2.0) / M)), 2.0)))));
} else {
tmp = t_0 * ((1.0 + ((h / l) * (pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5))) * (sqrt(d) / sqrt(h)));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / l))
if (l <= (-5d-311)) then
tmp = ((sqrt(-d) / sqrt(-h)) * t_0) * (1.0d0 - (0.5d0 * ((1.0d0 / l) * (h * ((d_m / ((d * 2.0d0) / m)) ** 2.0d0)))))
else
tmp = t_0 * ((1.0d0 + ((h / l) * (((d_m * ((m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))) * (sqrt(d) / sqrt(h)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.sqrt((d / l));
double tmp;
if (l <= -5e-311) {
tmp = ((Math.sqrt(-d) / Math.sqrt(-h)) * t_0) * (1.0 - (0.5 * ((1.0 / l) * (h * Math.pow((D_m / ((d * 2.0) / M)), 2.0)))));
} else {
tmp = t_0 * ((1.0 + ((h / l) * (Math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5))) * (Math.sqrt(d) / Math.sqrt(h)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.sqrt((d / l)) tmp = 0 if l <= -5e-311: tmp = ((math.sqrt(-d) / math.sqrt(-h)) * t_0) * (1.0 - (0.5 * ((1.0 / l) * (h * math.pow((D_m / ((d * 2.0) / M)), 2.0))))) else: tmp = t_0 * ((1.0 + ((h / l) * (math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5))) * (math.sqrt(d) / math.sqrt(h))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -5e-311) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0) * Float64(1.0 - Float64(0.5 * Float64(Float64(1.0 / l) * Float64(h * (Float64(D_m / Float64(Float64(d * 2.0) / M)) ^ 2.0)))))); else tmp = Float64(t_0 * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D_m * Float64(Float64(M / 2.0) / d)) ^ 2.0) * -0.5))) * Float64(sqrt(d) / sqrt(h)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = sqrt((d / l));
tmp = 0.0;
if (l <= -5e-311)
tmp = ((sqrt(-d) / sqrt(-h)) * t_0) * (1.0 - (0.5 * ((1.0 / l) * (h * ((D_m / ((d * 2.0) / M)) ^ 2.0)))));
else
tmp = t_0 * ((1.0 + ((h / l) * (((D_m * ((M / 2.0) / d)) ^ 2.0) * -0.5))) * (sqrt(d) / sqrt(h)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -5e-311], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(1.0 / l), $MachinePrecision] * N[(h * N[Power[N[(D$95$m / N[(N[(d * 2.0), $MachinePrecision] / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D$95$m * N[(N[(M / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_0\right) \cdot \left(1 - 0.5 \cdot \left(\frac{1}{\ell} \cdot \left(h \cdot {\left(\frac{D\_m}{\frac{d \cdot 2}{M}}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left({\left(D\_m \cdot \frac{\frac{M}{2}}{d}\right)}^{2} \cdot -0.5\right)\right) \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\end{array}
\end{array}
if l < -5.00000000000023e-311Initial program 64.5%
Simplified64.4%
associate-*r/67.0%
clear-num67.0%
frac-times67.8%
*-commutative67.8%
*-un-lft-identity67.8%
times-frac67.0%
*-commutative67.0%
associate-/l/67.0%
times-frac67.8%
*-un-lft-identity67.8%
associate-*r/67.0%
clear-num67.0%
un-div-inv67.0%
div-inv66.9%
clear-num66.9%
Applied egg-rr66.9%
associate-/r/66.9%
*-commutative66.9%
associate-*r/67.0%
Simplified67.0%
frac-2neg67.5%
sqrt-div80.8%
Applied egg-rr77.8%
if -5.00000000000023e-311 < l Initial program 68.6%
Simplified68.6%
sqrt-div81.7%
div-inv81.6%
Applied egg-rr81.6%
associate-*r/81.7%
*-rgt-identity81.7%
Simplified81.7%
Final simplification79.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 (or (<= h 5.8e-289) (not (<= h 1.35e-190)))
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(- 1.0 (* 0.5 (/ (* h (pow (/ D_m (* d (/ 2.0 M))) 2.0)) l))))
(* d (sqrt (/ (/ 1.0 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 <= 5.8e-289) || !(h <= 1.35e-190)) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.5 * ((h * pow((D_m / (d * (2.0 / M))), 2.0)) / l)));
} else {
tmp = d * sqrt(((1.0 / 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 ((h <= 5.8d-289) .or. (.not. (h <= 1.35d-190))) then
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0d0 - (0.5d0 * ((h * ((d_m / (d * (2.0d0 / m))) ** 2.0d0)) / l)))
else
tmp = d * sqrt(((1.0d0 / 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 ((h <= 5.8e-289) || !(h <= 1.35e-190)) {
tmp = (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - (0.5 * ((h * Math.pow((D_m / (d * (2.0 / M))), 2.0)) / l)));
} else {
tmp = d * Math.sqrt(((1.0 / 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 (h <= 5.8e-289) or not (h <= 1.35e-190): tmp = (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - (0.5 * ((h * math.pow((D_m / (d * (2.0 / M))), 2.0)) / l))) else: tmp = d * math.sqrt(((1.0 / 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 <= 5.8e-289) || !(h <= 1.35e-190)) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(D_m / Float64(d * Float64(2.0 / M))) ^ 2.0)) / l)))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / 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 ((h <= 5.8e-289) || ~((h <= 1.35e-190)))
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.5 * ((h * ((D_m / (d * (2.0 / M))) ^ 2.0)) / l)));
else
tmp = d * sqrt(((1.0 / 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[Or[LessEqual[h, 5.8e-289], N[Not[LessEqual[h, 1.35e-190]], $MachinePrecision]], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(D$95$m / N[(d * N[(2.0 / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / 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}\;h \leq 5.8 \cdot 10^{-289} \lor \neg \left(h \leq 1.35 \cdot 10^{-190}\right):\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D\_m}{d \cdot \frac{2}{M}}\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\end{array}
\end{array}
if h < 5.80000000000000012e-289 or 1.35e-190 < h Initial program 68.6%
Simplified68.1%
associate-*r/70.2%
frac-times71.0%
*-commutative71.0%
*-un-lft-identity71.0%
times-frac71.0%
*-commutative71.0%
associate-/l/71.0%
times-frac71.0%
*-un-lft-identity71.0%
associate-*r/71.0%
clear-num71.0%
un-div-inv71.0%
div-inv71.0%
clear-num71.0%
Applied egg-rr71.0%
if 5.80000000000000012e-289 < h < 1.35e-190Initial program 49.2%
Simplified45.5%
associate-*r/45.5%
clear-num45.5%
frac-times49.2%
*-commutative49.2%
*-un-lft-identity49.2%
times-frac49.2%
*-commutative49.2%
associate-/l/49.2%
times-frac49.2%
*-un-lft-identity49.2%
associate-*r/49.2%
clear-num49.2%
un-div-inv49.2%
div-inv49.2%
clear-num49.2%
Applied egg-rr49.2%
associate-/r/49.2%
*-commutative49.2%
associate-*r/49.2%
Simplified49.2%
Taylor expanded in d around inf 81.1%
*-commutative81.1%
associate-/r*81.1%
Simplified81.1%
Final simplification72.0%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= d -5.4e+244)
(* d (- (sqrt (/ 1.0 (* l h)))))
(if (<= d 7e+183)
(*
(sqrt (/ d l))
(*
(+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M 2.0) d)) 2.0) -0.5)))
(sqrt (/ d h))))
(* d (sqrt (/ (/ 1.0 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 <= -5.4e+244) {
tmp = d * -sqrt((1.0 / (l * h)));
} else if (d <= 7e+183) {
tmp = sqrt((d / l)) * ((1.0 + ((h / l) * (pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5))) * sqrt((d / h)));
} else {
tmp = d * sqrt(((1.0 / 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 <= (-5.4d+244)) then
tmp = d * -sqrt((1.0d0 / (l * h)))
else if (d <= 7d+183) then
tmp = sqrt((d / l)) * ((1.0d0 + ((h / l) * (((d_m * ((m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))) * sqrt((d / h)))
else
tmp = d * sqrt(((1.0d0 / 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 <= -5.4e+244) {
tmp = d * -Math.sqrt((1.0 / (l * h)));
} else if (d <= 7e+183) {
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 = d * Math.sqrt(((1.0 / 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 <= -5.4e+244: tmp = d * -math.sqrt((1.0 / (l * h))) elif d <= 7e+183: 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 = d * math.sqrt(((1.0 / 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 <= -5.4e+244) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(l * h))))); elseif (d <= 7e+183) 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(d * sqrt(Float64(Float64(1.0 / 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 <= -5.4e+244)
tmp = d * -sqrt((1.0 / (l * h)));
elseif (d <= 7e+183)
tmp = sqrt((d / l)) * ((1.0 + ((h / l) * (((D_m * ((M / 2.0) / d)) ^ 2.0) * -0.5))) * sqrt((d / h)));
else
tmp = d * sqrt(((1.0 / 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, -5.4e+244], N[(d * (-N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, 7e+183], 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[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / 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}\;d \leq -5.4 \cdot 10^{+244}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\
\mathbf{elif}\;d \leq 7 \cdot 10^{+183}:\\
\;\;\;\;\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}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\end{array}
\end{array}
if d < -5.39999999999999995e244Initial program 65.9%
Simplified65.9%
associate-*r/76.4%
clear-num76.4%
frac-times76.4%
*-commutative76.4%
*-un-lft-identity76.4%
times-frac76.4%
*-commutative76.4%
associate-/l/76.4%
times-frac76.4%
*-un-lft-identity76.4%
associate-*r/76.4%
clear-num76.4%
un-div-inv76.4%
div-inv76.4%
clear-num76.4%
Applied egg-rr76.4%
associate-/r/76.4%
*-commutative76.4%
associate-*r/76.4%
Simplified76.4%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt90.0%
neg-mul-190.0%
Simplified90.0%
if -5.39999999999999995e244 < d < 6.99999999999999974e183Initial program 67.4%
Simplified66.4%
if 6.99999999999999974e183 < d Initial program 59.6%
Simplified59.6%
associate-*r/60.2%
clear-num60.2%
frac-times60.2%
*-commutative60.2%
*-un-lft-identity60.2%
times-frac60.2%
*-commutative60.2%
associate-/l/60.2%
times-frac60.2%
*-un-lft-identity60.2%
associate-*r/60.2%
clear-num60.2%
un-div-inv60.2%
div-inv60.2%
clear-num60.2%
Applied egg-rr60.2%
associate-/r/60.2%
*-commutative60.2%
associate-*r/60.2%
Simplified60.2%
Taylor expanded in d around inf 85.7%
*-commutative85.7%
associate-/r*85.9%
Simplified85.9%
Final simplification69.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 (<= (* D_m M) 4e-277)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (/ (* -0.5 (* h (pow (* D_m (/ M (* d 2.0))) 2.0))) 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 ((D_m * M) <= 4e-277) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + ((-0.5 * (h * pow((D_m * (M / (d * 2.0))), 2.0))) / 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 ((d_m * m) <= 4d-277) then
tmp = sqrt((d / h)) * sqrt((d / l))
else
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + (((-0.5d0) * (h * ((d_m * (m / (d * 2.0d0))) ** 2.0d0))) / 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 ((D_m * M) <= 4e-277) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + ((-0.5 * (h * Math.pow((D_m * (M / (d * 2.0))), 2.0))) / 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 (D_m * M) <= 4e-277: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) else: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + ((-0.5 * (h * math.pow((D_m * (M / (d * 2.0))), 2.0))) / 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 (Float64(D_m * M) <= 4e-277) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(Float64(-0.5 * Float64(h * (Float64(D_m * Float64(M / Float64(d * 2.0))) ^ 2.0))) / 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 ((D_m * M) <= 4e-277)
tmp = sqrt((d / h)) * sqrt((d / l));
else
tmp = sqrt(((d / h) * (d / l))) * (1.0 + ((-0.5 * (h * ((D_m * (M / (d * 2.0))) ^ 2.0))) / 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[N[(D$95$m * M), $MachinePrecision], 4e-277], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(-0.5 * N[(h * N[Power[N[(D$95$m * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $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}\;D\_m \cdot M \leq 4 \cdot 10^{-277}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \frac{-0.5 \cdot \left(h \cdot {\left(D\_m \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)}{\ell}\right)\\
\end{array}
\end{array}
if (*.f64 M D) < 3.99999999999999988e-277Initial program 62.5%
Simplified61.9%
Taylor expanded in M around 0 41.7%
if 3.99999999999999988e-277 < (*.f64 M D) Initial program 73.3%
Simplified72.3%
associate-*r/72.5%
clear-num72.5%
frac-times73.5%
*-commutative73.5%
*-un-lft-identity73.5%
times-frac73.4%
*-commutative73.4%
associate-/l/73.4%
times-frac73.5%
*-un-lft-identity73.5%
associate-*r/73.4%
clear-num73.4%
un-div-inv73.4%
div-inv73.4%
clear-num73.4%
Applied egg-rr73.4%
associate-/r/73.4%
*-commutative73.4%
associate-*r/73.4%
Simplified73.4%
pow173.4%
sqrt-unprod67.7%
cancel-sign-sub-inv67.7%
metadata-eval67.7%
associate-*l/67.7%
*-un-lft-identity67.7%
associate-/r/66.7%
Applied egg-rr66.7%
Simplified67.7%
Final simplification51.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 -3.1e-299) (* d (- (sqrt (/ 1.0 (* l h))))) (* d (sqrt (/ (/ 1.0 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 <= -3.1e-299) {
tmp = d * -sqrt((1.0 / (l * h)));
} else {
tmp = d * sqrt(((1.0 / 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 <= (-3.1d-299)) then
tmp = d * -sqrt((1.0d0 / (l * h)))
else
tmp = d * sqrt(((1.0d0 / 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 <= -3.1e-299) {
tmp = d * -Math.sqrt((1.0 / (l * h)));
} else {
tmp = d * Math.sqrt(((1.0 / 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 <= -3.1e-299: tmp = d * -math.sqrt((1.0 / (l * h))) else: tmp = d * math.sqrt(((1.0 / 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 <= -3.1e-299) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(l * h))))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / 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 <= -3.1e-299)
tmp = d * -sqrt((1.0 / (l * h)));
else
tmp = d * sqrt(((1.0 / 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, -3.1e-299], N[(d * (-N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / 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 -3.1 \cdot 10^{-299}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\end{array}
\end{array}
if l < -3.1e-299Initial program 64.2%
Simplified64.2%
associate-*r/66.7%
clear-num66.7%
frac-times67.5%
*-commutative67.5%
*-un-lft-identity67.5%
times-frac66.7%
*-commutative66.7%
associate-/l/66.7%
times-frac67.5%
*-un-lft-identity67.5%
associate-*r/66.7%
clear-num66.7%
un-div-inv66.7%
div-inv66.7%
clear-num66.7%
Applied egg-rr66.7%
associate-/r/66.7%
*-commutative66.7%
associate-*r/66.7%
Simplified66.7%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt44.2%
neg-mul-144.2%
Simplified44.2%
if -3.1e-299 < l Initial program 68.8%
Simplified67.4%
associate-*r/68.6%
clear-num68.6%
frac-times70.0%
*-commutative70.0%
*-un-lft-identity70.0%
times-frac70.7%
*-commutative70.7%
associate-/l/70.7%
times-frac70.0%
*-un-lft-identity70.0%
associate-*r/70.7%
clear-num70.7%
un-div-inv70.7%
div-inv70.7%
clear-num70.7%
Applied egg-rr70.7%
associate-/r/70.7%
*-commutative70.7%
associate-*r/70.7%
Simplified70.7%
Taylor expanded in d around inf 47.0%
*-commutative47.0%
associate-/r*47.1%
Simplified47.1%
Final simplification45.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 (* d (sqrt (/ 1.0 (* 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((1.0 / (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((1.0d0 / (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((1.0 / (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((1.0 / (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(1.0 / 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((1.0 / (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[(1.0 / 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])\\
\\
d \cdot \sqrt{\frac{1}{\ell \cdot h}}
\end{array}
Initial program 66.6%
Simplified65.8%
associate-*r/67.7%
clear-num67.7%
frac-times68.8%
*-commutative68.8%
*-un-lft-identity68.8%
times-frac68.8%
*-commutative68.8%
associate-/l/68.8%
times-frac68.8%
*-un-lft-identity68.8%
associate-*r/68.8%
clear-num68.8%
un-div-inv68.8%
div-inv68.8%
clear-num68.8%
Applied egg-rr68.8%
associate-/r/68.8%
*-commutative68.8%
associate-*r/68.8%
Simplified68.8%
Taylor expanded in d around inf 27.8%
Final simplification27.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 (* d (sqrt (/ (/ 1.0 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(((1.0 / 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(((1.0d0 / 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(((1.0 / 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(((1.0 / 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(Float64(1.0 / 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(((1.0 / 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[(N[(1.0 / l), $MachinePrecision] / 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])\\
\\
d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}
\end{array}
Initial program 66.6%
Simplified65.8%
associate-*r/67.7%
clear-num67.7%
frac-times68.8%
*-commutative68.8%
*-un-lft-identity68.8%
times-frac68.8%
*-commutative68.8%
associate-/l/68.8%
times-frac68.8%
*-un-lft-identity68.8%
associate-*r/68.8%
clear-num68.8%
un-div-inv68.8%
div-inv68.8%
clear-num68.8%
Applied egg-rr68.8%
associate-/r/68.8%
*-commutative68.8%
associate-*r/68.8%
Simplified68.8%
Taylor expanded in d around inf 27.8%
*-commutative27.8%
associate-/r*27.8%
Simplified27.8%
Final simplification27.8%
herbie shell --seed 2024081
(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)))))