
(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 19 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))))
(if (<= h -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)))))
(*
(fma h (* -0.5 (/ (pow (* 0.5 (* D_m (/ M d))) 2.0) l)) 1.0)
(/ (/ d (sqrt h)) (sqrt 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);
double tmp;
if (h <= -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 {
tmp = fma(h, (-0.5 * (pow((0.5 * (D_m * (M / d))), 2.0) / l)), 1.0) * ((d / sqrt(h)) / sqrt(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)) tmp = 0.0 if (h <= -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))))); else tmp = Float64(fma(h, Float64(-0.5 * Float64((Float64(0.5 * Float64(D_m * Float64(M / d))) ^ 2.0) / l)), 1.0) * Float64(Float64(d / sqrt(h)) / sqrt(l))); 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]}, If[LessEqual[h, -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], N[(N[(h * N[(-0.5 * N[(N[Power[N[(0.5 * N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[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}
t_0 := \sqrt{-d}\\
\mathbf{if}\;h \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{else}:\\
\;\;\;\;\mathsf{fma}\left(h, -0.5 \cdot \frac{{\left(0.5 \cdot \left(D\_m \cdot \frac{M}{d}\right)\right)}^{2}}{\ell}, 1\right) \cdot \frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 64.4%
Simplified64.6%
frac-2neg64.6%
sqrt-div76.9%
Applied egg-rr76.9%
frac-2neg76.9%
sqrt-div82.6%
Applied egg-rr82.6%
if -4.999999999999985e-310 < h Initial program 68.4%
Simplified68.3%
sub-neg68.3%
distribute-rgt-in55.5%
*-un-lft-identity55.5%
sqrt-div56.1%
sqrt-div63.3%
frac-times63.3%
add-sqr-sqrt63.3%
Applied egg-rr75.5%
distribute-rgt1-in84.7%
Simplified85.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 (* (/ M d) (/ D_m 2.0)))
(t_1 (sqrt (/ d l)))
(t_2 (sqrt (/ d h))))
(if (<= h -2.75e-185)
(* t_1 (* (+ 1.0 (/ (* (* h -0.5) (pow t_0 2.0)) l)) t_2))
(if (<= h -3e-269)
(* d (- (pow (* h l) -0.5)))
(if (<= h 3.9e-304)
(* (* t_1 t_2) (- 1.0 (* 0.5 (pow (* t_0 (sqrt (/ h l))) 2.0))))
(*
(fma h (* -0.5 (/ (pow (* 0.5 (* D_m (/ M d))) 2.0) l)) 1.0)
(/ (/ d (sqrt h)) (sqrt 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 = (M / d) * (D_m / 2.0);
double t_1 = sqrt((d / l));
double t_2 = sqrt((d / h));
double tmp;
if (h <= -2.75e-185) {
tmp = t_1 * ((1.0 + (((h * -0.5) * pow(t_0, 2.0)) / l)) * t_2);
} else if (h <= -3e-269) {
tmp = d * -pow((h * l), -0.5);
} else if (h <= 3.9e-304) {
tmp = (t_1 * t_2) * (1.0 - (0.5 * pow((t_0 * sqrt((h / l))), 2.0)));
} else {
tmp = fma(h, (-0.5 * (pow((0.5 * (D_m * (M / d))), 2.0) / l)), 1.0) * ((d / sqrt(h)) / sqrt(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 = Float64(Float64(M / d) * Float64(D_m / 2.0)) t_1 = sqrt(Float64(d / l)) t_2 = sqrt(Float64(d / h)) tmp = 0.0 if (h <= -2.75e-185) tmp = Float64(t_1 * Float64(Float64(1.0 + Float64(Float64(Float64(h * -0.5) * (t_0 ^ 2.0)) / l)) * t_2)); elseif (h <= -3e-269) tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5))); elseif (h <= 3.9e-304) tmp = Float64(Float64(t_1 * t_2) * Float64(1.0 - Float64(0.5 * (Float64(t_0 * sqrt(Float64(h / l))) ^ 2.0)))); else tmp = Float64(fma(h, Float64(-0.5 * Float64((Float64(0.5 * Float64(D_m * Float64(M / d))) ^ 2.0) / l)), 1.0) * Float64(Float64(d / sqrt(h)) / sqrt(l))); 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[(N[(M / d), $MachinePrecision] * N[(D$95$m / 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -2.75e-185], N[(t$95$1 * N[(N[(1.0 + N[(N[(N[(h * -0.5), $MachinePrecision] * N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -3e-269], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[h, 3.9e-304], N[(N[(t$95$1 * t$95$2), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(t$95$0 * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(h * N[(-0.5 * N[(N[Power[N[(0.5 * N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[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}
t_0 := \frac{M}{d} \cdot \frac{D\_m}{2}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;h \leq -2.75 \cdot 10^{-185}:\\
\;\;\;\;t\_1 \cdot \left(\left(1 + \frac{\left(h \cdot -0.5\right) \cdot {t\_0}^{2}}{\ell}\right) \cdot t\_2\right)\\
\mathbf{elif}\;h \leq -3 \cdot 10^{-269}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{elif}\;h \leq 3.9 \cdot 10^{-304}:\\
\;\;\;\;\left(t\_1 \cdot t\_2\right) \cdot \left(1 - 0.5 \cdot {\left(t\_0 \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(h, -0.5 \cdot \frac{{\left(0.5 \cdot \left(D\_m \cdot \frac{M}{d}\right)\right)}^{2}}{\ell}, 1\right) \cdot \frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if h < -2.7499999999999999e-185Initial program 69.7%
Simplified69.9%
associate-*l/73.3%
*-commutative73.3%
associate-*r/73.1%
*-un-lft-identity73.1%
times-frac73.3%
associate-/l/73.3%
*-commutative73.3%
times-frac73.1%
*-commutative73.1%
*-un-lft-identity73.1%
frac-times72.2%
associate-*r*72.2%
frac-times73.1%
*-commutative73.1%
times-frac73.3%
Applied egg-rr73.3%
if -2.7499999999999999e-185 < h < -2.9999999999999999e-269Initial program 38.0%
Simplified38.5%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt68.5%
neg-mul-168.5%
Simplified68.5%
*-un-lft-identity68.5%
pow1/268.5%
inv-pow68.5%
pow-pow68.5%
metadata-eval68.5%
Applied egg-rr68.5%
*-lft-identity68.5%
Simplified68.5%
if -2.9999999999999999e-269 < h < 3.89999999999999975e-304Initial program 66.8%
Simplified66.8%
add-sqr-sqrt66.8%
pow266.8%
sqrt-prod66.8%
sqrt-pow180.2%
metadata-eval80.2%
pow180.2%
frac-times80.2%
*-commutative80.2%
times-frac80.2%
Applied egg-rr80.2%
if 3.89999999999999975e-304 < h Initial program 68.9%
Simplified68.8%
sub-neg68.8%
distribute-rgt-in55.9%
*-un-lft-identity55.9%
sqrt-div56.5%
sqrt-div63.8%
frac-times63.7%
add-sqr-sqrt63.8%
Applied egg-rr76.1%
distribute-rgt1-in85.3%
Simplified86.3%
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
(let* ((t_0 (+ 1.0 (/ (* (* h -0.5) (pow (* (/ M d) (/ D_m 2.0)) 2.0)) l)))
(t_1 (sqrt (- d))))
(if (<= d -9e-223)
(* (sqrt (/ d l)) (* (/ t_1 (sqrt (- h))) t_0))
(if (<= d -1.4e-296)
(* (/ t_1 (sqrt (- l))) (* t_0 (sqrt (/ d h))))
(*
(fma h (* -0.5 (/ (pow (* 0.5 (* D_m (/ M d))) 2.0) l)) 1.0)
(/ (/ d (sqrt h)) (sqrt 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 = 1.0 + (((h * -0.5) * pow(((M / d) * (D_m / 2.0)), 2.0)) / l);
double t_1 = sqrt(-d);
double tmp;
if (d <= -9e-223) {
tmp = sqrt((d / l)) * ((t_1 / sqrt(-h)) * t_0);
} else if (d <= -1.4e-296) {
tmp = (t_1 / sqrt(-l)) * (t_0 * sqrt((d / h)));
} else {
tmp = fma(h, (-0.5 * (pow((0.5 * (D_m * (M / d))), 2.0) / l)), 1.0) * ((d / sqrt(h)) / sqrt(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 = Float64(1.0 + Float64(Float64(Float64(h * -0.5) * (Float64(Float64(M / d) * Float64(D_m / 2.0)) ^ 2.0)) / l)) t_1 = sqrt(Float64(-d)) tmp = 0.0 if (d <= -9e-223) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(t_1 / sqrt(Float64(-h))) * t_0)); elseif (d <= -1.4e-296) tmp = Float64(Float64(t_1 / sqrt(Float64(-l))) * Float64(t_0 * sqrt(Float64(d / h)))); else tmp = Float64(fma(h, Float64(-0.5 * Float64((Float64(0.5 * Float64(D_m * Float64(M / d))) ^ 2.0) / l)), 1.0) * Float64(Float64(d / sqrt(h)) / sqrt(l))); 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[(1.0 + N[(N[(N[(h * -0.5), $MachinePrecision] * N[Power[N[(N[(M / d), $MachinePrecision] * N[(D$95$m / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[d, -9e-223], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.4e-296], N[(N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(h * N[(-0.5 * N[(N[Power[N[(0.5 * N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[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}
t_0 := 1 + \frac{\left(h \cdot -0.5\right) \cdot {\left(\frac{M}{d} \cdot \frac{D\_m}{2}\right)}^{2}}{\ell}\\
t_1 := \sqrt{-d}\\
\mathbf{if}\;d \leq -9 \cdot 10^{-223}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\frac{t\_1}{\sqrt{-h}} \cdot t\_0\right)\\
\mathbf{elif}\;d \leq -1.4 \cdot 10^{-296}:\\
\;\;\;\;\frac{t\_1}{\sqrt{-\ell}} \cdot \left(t\_0 \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(h, -0.5 \cdot \frac{{\left(0.5 \cdot \left(D\_m \cdot \frac{M}{d}\right)\right)}^{2}}{\ell}, 1\right) \cdot \frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -8.99999999999999935e-223Initial program 71.5%
Simplified71.7%
associate-*l/74.5%
*-commutative74.5%
associate-*r/74.3%
*-un-lft-identity74.3%
times-frac74.5%
associate-/l/74.5%
*-commutative74.5%
times-frac74.3%
*-commutative74.3%
*-un-lft-identity74.3%
frac-times73.6%
associate-*r*73.6%
frac-times74.3%
*-commutative74.3%
times-frac74.5%
Applied egg-rr74.5%
frac-2neg71.7%
sqrt-div85.9%
Applied egg-rr88.8%
if -8.99999999999999935e-223 < d < -1.4e-296Initial program 23.0%
Simplified23.0%
associate-*l/23.0%
*-commutative23.0%
associate-*r/23.0%
*-un-lft-identity23.0%
times-frac23.0%
associate-/l/23.0%
*-commutative23.0%
times-frac23.0%
*-commutative23.0%
*-un-lft-identity23.0%
frac-times23.0%
associate-*r*23.0%
frac-times23.0%
*-commutative23.0%
times-frac23.0%
Applied egg-rr23.0%
frac-2neg23.5%
sqrt-div52.1%
Applied egg-rr52.5%
if -1.4e-296 < d Initial program 66.9%
Simplified66.8%
sub-neg66.8%
distribute-rgt-in54.2%
*-un-lft-identity54.2%
sqrt-div54.9%
sqrt-div61.9%
frac-times61.8%
add-sqr-sqrt61.9%
Applied egg-rr73.9%
distribute-rgt1-in82.8%
Simplified83.7%
Final simplification84.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 (<= h -5e-310)
(*
(sqrt (/ d l))
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (/ (* (* h -0.5) (pow (* (/ M d) (/ D_m 2.0)) 2.0)) l))))
(*
(fma h (* -0.5 (/ (pow (* 0.5 (* D_m (/ M d))) 2.0) l)) 1.0)
(/ (/ d (sqrt h)) (sqrt 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 (h <= -5e-310) {
tmp = sqrt((d / l)) * ((sqrt(-d) / sqrt(-h)) * (1.0 + (((h * -0.5) * pow(((M / d) * (D_m / 2.0)), 2.0)) / l)));
} else {
tmp = fma(h, (-0.5 * (pow((0.5 * (D_m * (M / d))), 2.0) / l)), 1.0) * ((d / sqrt(h)) / sqrt(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 (h <= -5e-310) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(Float64(h * -0.5) * (Float64(Float64(M / d) * Float64(D_m / 2.0)) ^ 2.0)) / l)))); else tmp = Float64(fma(h, Float64(-0.5 * Float64((Float64(0.5 * Float64(D_m * Float64(M / d))) ^ 2.0) / l)), 1.0) * Float64(Float64(d / sqrt(h)) / sqrt(l))); 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, -5e-310], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h * -0.5), $MachinePrecision] * N[Power[N[(N[(M / d), $MachinePrecision] * N[(D$95$m / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(h * N[(-0.5 * N[(N[Power[N[(0.5 * N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[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}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(1 + \frac{\left(h \cdot -0.5\right) \cdot {\left(\frac{M}{d} \cdot \frac{D\_m}{2}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(h, -0.5 \cdot \frac{{\left(0.5 \cdot \left(D\_m \cdot \frac{M}{d}\right)\right)}^{2}}{\ell}, 1\right) \cdot \frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 64.4%
Simplified64.6%
associate-*l/67.0%
*-commutative67.0%
associate-*r/66.8%
*-un-lft-identity66.8%
times-frac67.0%
associate-/l/67.0%
*-commutative67.0%
times-frac66.8%
*-commutative66.8%
*-un-lft-identity66.8%
frac-times66.2%
associate-*r*66.2%
frac-times66.8%
*-commutative66.8%
times-frac67.0%
Applied egg-rr67.0%
frac-2neg64.6%
sqrt-div76.9%
Applied egg-rr79.3%
if -4.999999999999985e-310 < h Initial program 68.4%
Simplified68.3%
sub-neg68.3%
distribute-rgt-in55.5%
*-un-lft-identity55.5%
sqrt-div56.1%
sqrt-div63.3%
frac-times63.3%
add-sqr-sqrt63.3%
Applied egg-rr75.5%
distribute-rgt1-in84.7%
Simplified85.6%
Final simplification82.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 (<= h -5e-310)
(*
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M 2.0) d)) 2.0) -0.5))))
(sqrt (/ d l)))
(*
(fma h (* -0.5 (/ (pow (* 0.5 (* D_m (/ M d))) 2.0) l)) 1.0)
(/ (/ d (sqrt h)) (sqrt 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 (h <= -5e-310) {
tmp = ((sqrt(-d) / sqrt(-h)) * (1.0 + ((h / l) * (pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5)))) * sqrt((d / l));
} else {
tmp = fma(h, (-0.5 * (pow((0.5 * (D_m * (M / d))), 2.0) / l)), 1.0) * ((d / sqrt(h)) / sqrt(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 (h <= -5e-310) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D_m * Float64(Float64(M / 2.0) / d)) ^ 2.0) * -0.5)))) * sqrt(Float64(d / l))); else tmp = Float64(fma(h, Float64(-0.5 * Float64((Float64(0.5 * Float64(D_m * Float64(M / d))) ^ 2.0) / l)), 1.0) * Float64(Float64(d / sqrt(h)) / sqrt(l))); 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, -5e-310], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D$95$m * N[(N[(M / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(h * N[(-0.5 * N[(N[Power[N[(0.5 * N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[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}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(D\_m \cdot \frac{\frac{M}{2}}{d}\right)}^{2} \cdot -0.5\right)\right)\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(h, -0.5 \cdot \frac{{\left(0.5 \cdot \left(D\_m \cdot \frac{M}{d}\right)\right)}^{2}}{\ell}, 1\right) \cdot \frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 64.4%
Simplified64.6%
frac-2neg64.6%
sqrt-div76.9%
Applied egg-rr76.9%
if -4.999999999999985e-310 < h Initial program 68.4%
Simplified68.3%
sub-neg68.3%
distribute-rgt-in55.5%
*-un-lft-identity55.5%
sqrt-div56.1%
sqrt-div63.3%
frac-times63.3%
add-sqr-sqrt63.3%
Applied egg-rr75.5%
distribute-rgt1-in84.7%
Simplified85.6%
Final simplification81.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 3.4e-277)
(*
(sqrt (/ d l))
(*
(+ 1.0 (/ (* (* h -0.5) (pow (* (/ M d) (/ D_m 2.0)) 2.0)) l))
(sqrt (/ d h))))
(*
(fma h (* -0.5 (/ (pow (* 0.5 (* D_m (/ M d))) 2.0) l)) 1.0)
(/ (/ d (sqrt h)) (sqrt 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 <= 3.4e-277) {
tmp = sqrt((d / l)) * ((1.0 + (((h * -0.5) * pow(((M / d) * (D_m / 2.0)), 2.0)) / l)) * sqrt((d / h)));
} else {
tmp = fma(h, (-0.5 * (pow((0.5 * (D_m * (M / d))), 2.0) / l)), 1.0) * ((d / sqrt(h)) / sqrt(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 <= 3.4e-277) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(1.0 + Float64(Float64(Float64(h * -0.5) * (Float64(Float64(M / d) * Float64(D_m / 2.0)) ^ 2.0)) / l)) * sqrt(Float64(d / h)))); else tmp = Float64(fma(h, Float64(-0.5 * Float64((Float64(0.5 * Float64(D_m * Float64(M / d))) ^ 2.0) / l)), 1.0) * Float64(Float64(d / sqrt(h)) / sqrt(l))); 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[l, 3.4e-277], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 + N[(N[(N[(h * -0.5), $MachinePrecision] * N[Power[N[(N[(M / d), $MachinePrecision] * N[(D$95$m / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(h * N[(-0.5 * N[(N[Power[N[(0.5 * N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[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 3.4 \cdot 10^{-277}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\left(1 + \frac{\left(h \cdot -0.5\right) \cdot {\left(\frac{M}{d} \cdot \frac{D\_m}{2}\right)}^{2}}{\ell}\right) \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(h, -0.5 \cdot \frac{{\left(0.5 \cdot \left(D\_m \cdot \frac{M}{d}\right)\right)}^{2}}{\ell}, 1\right) \cdot \frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < 3.39999999999999982e-277Initial program 65.5%
Simplified66.4%
associate-*l/68.7%
*-commutative68.7%
associate-*r/67.8%
*-un-lft-identity67.8%
times-frac68.7%
associate-/l/68.7%
*-commutative68.7%
times-frac67.8%
*-commutative67.8%
*-un-lft-identity67.8%
frac-times68.0%
associate-*r*68.0%
frac-times67.8%
*-commutative67.8%
times-frac68.7%
Applied egg-rr68.7%
if 3.39999999999999982e-277 < l Initial program 67.4%
Simplified66.5%
sub-neg66.5%
distribute-rgt-in56.2%
*-un-lft-identity56.2%
sqrt-div56.9%
sqrt-div62.9%
frac-times62.8%
add-sqr-sqrt62.9%
Applied egg-rr75.8%
distribute-rgt1-in83.9%
Simplified84.8%
Final simplification76.5%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= l 1.05e-276)
(*
(sqrt (/ d l))
(*
(+ 1.0 (/ (* (* h -0.5) (pow (* (/ M d) (/ D_m 2.0)) 2.0)) l))
(sqrt (/ d h))))
(*
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D_m (/ M (* d 2.0))) 2.0)))
(/ d (* (sqrt h) (sqrt 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 <= 1.05e-276) {
tmp = sqrt((d / l)) * ((1.0 + (((h * -0.5) * pow(((M / d) * (D_m / 2.0)), 2.0)) / l)) * sqrt((d / h)));
} else {
tmp = (1.0 + (((h / l) * -0.5) * pow((D_m * (M / (d * 2.0))), 2.0))) * (d / (sqrt(h) * sqrt(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 <= 1.05d-276) then
tmp = sqrt((d / l)) * ((1.0d0 + (((h * (-0.5d0)) * (((m / d) * (d_m / 2.0d0)) ** 2.0d0)) / l)) * sqrt((d / h)))
else
tmp = (1.0d0 + (((h / l) * (-0.5d0)) * ((d_m * (m / (d * 2.0d0))) ** 2.0d0))) * (d / (sqrt(h) * sqrt(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 <= 1.05e-276) {
tmp = Math.sqrt((d / l)) * ((1.0 + (((h * -0.5) * Math.pow(((M / d) * (D_m / 2.0)), 2.0)) / l)) * Math.sqrt((d / h)));
} else {
tmp = (1.0 + (((h / l) * -0.5) * Math.pow((D_m * (M / (d * 2.0))), 2.0))) * (d / (Math.sqrt(h) * Math.sqrt(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 <= 1.05e-276: tmp = math.sqrt((d / l)) * ((1.0 + (((h * -0.5) * math.pow(((M / d) * (D_m / 2.0)), 2.0)) / l)) * math.sqrt((d / h))) else: tmp = (1.0 + (((h / l) * -0.5) * math.pow((D_m * (M / (d * 2.0))), 2.0))) * (d / (math.sqrt(h) * math.sqrt(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 <= 1.05e-276) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(1.0 + Float64(Float64(Float64(h * -0.5) * (Float64(Float64(M / d) * Float64(D_m / 2.0)) ^ 2.0)) / l)) * sqrt(Float64(d / h)))); else tmp = Float64(Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(M / Float64(d * 2.0))) ^ 2.0))) * Float64(d / Float64(sqrt(h) * sqrt(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 <= 1.05e-276)
tmp = sqrt((d / l)) * ((1.0 + (((h * -0.5) * (((M / d) * (D_m / 2.0)) ^ 2.0)) / l)) * sqrt((d / h)));
else
tmp = (1.0 + (((h / l) * -0.5) * ((D_m * (M / (d * 2.0))) ^ 2.0))) * (d / (sqrt(h) * sqrt(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, 1.05e-276], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 + N[(N[(N[(h * -0.5), $MachinePrecision] * N[Power[N[(N[(M / d), $MachinePrecision] * N[(D$95$m / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $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}\;\ell \leq 1.05 \cdot 10^{-276}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\left(1 + \frac{\left(h \cdot -0.5\right) \cdot {\left(\frac{M}{d} \cdot \frac{D\_m}{2}\right)}^{2}}{\ell}\right) \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{M}{d \cdot 2}\right)}^{2}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < 1.05e-276Initial program 65.5%
Simplified66.4%
associate-*l/68.7%
*-commutative68.7%
associate-*r/67.8%
*-un-lft-identity67.8%
times-frac68.7%
associate-/l/68.7%
*-commutative68.7%
times-frac67.8%
*-commutative67.8%
*-un-lft-identity67.8%
frac-times68.0%
associate-*r*68.0%
frac-times67.8%
*-commutative67.8%
times-frac68.7%
Applied egg-rr68.7%
if 1.05e-276 < l Initial program 67.4%
Simplified66.5%
sub-neg66.5%
distribute-rgt-in56.2%
*-un-lft-identity56.2%
sqrt-div56.9%
sqrt-div62.9%
frac-times62.8%
add-sqr-sqrt62.9%
Applied egg-rr75.8%
distribute-rgt1-in83.9%
+-commutative83.9%
associate-*r*83.9%
times-frac84.7%
*-commutative84.7%
associate-/l*83.9%
Simplified83.9%
Final simplification76.1%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= l 3.5e-277)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (/ (* -0.5 (pow (* (/ M d) (/ D_m 2.0)) 2.0)) (/ l h)))))
(*
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D_m (/ M (* d 2.0))) 2.0)))
(/ d (* (sqrt h) (sqrt 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 <= 3.5e-277) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((-0.5 * pow(((M / d) * (D_m / 2.0)), 2.0)) / (l / h))));
} else {
tmp = (1.0 + (((h / l) * -0.5) * pow((D_m * (M / (d * 2.0))), 2.0))) * (d / (sqrt(h) * sqrt(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 <= 3.5d-277) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + (((-0.5d0) * (((m / d) * (d_m / 2.0d0)) ** 2.0d0)) / (l / h))))
else
tmp = (1.0d0 + (((h / l) * (-0.5d0)) * ((d_m * (m / (d * 2.0d0))) ** 2.0d0))) * (d / (sqrt(h) * sqrt(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 <= 3.5e-277) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((-0.5 * Math.pow(((M / d) * (D_m / 2.0)), 2.0)) / (l / h))));
} else {
tmp = (1.0 + (((h / l) * -0.5) * Math.pow((D_m * (M / (d * 2.0))), 2.0))) * (d / (Math.sqrt(h) * Math.sqrt(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 <= 3.5e-277: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((-0.5 * math.pow(((M / d) * (D_m / 2.0)), 2.0)) / (l / h)))) else: tmp = (1.0 + (((h / l) * -0.5) * math.pow((D_m * (M / (d * 2.0))), 2.0))) * (d / (math.sqrt(h) * math.sqrt(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 <= 3.5e-277) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(-0.5 * (Float64(Float64(M / d) * Float64(D_m / 2.0)) ^ 2.0)) / Float64(l / h))))); else tmp = Float64(Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(M / Float64(d * 2.0))) ^ 2.0))) * Float64(d / Float64(sqrt(h) * sqrt(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 <= 3.5e-277)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((-0.5 * (((M / d) * (D_m / 2.0)) ^ 2.0)) / (l / h))));
else
tmp = (1.0 + (((h / l) * -0.5) * ((D_m * (M / (d * 2.0))) ^ 2.0))) * (d / (sqrt(h) * sqrt(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, 3.5e-277], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(-0.5 * N[Power[N[(N[(M / d), $MachinePrecision] * N[(D$95$m / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $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}\;\ell \leq 3.5 \cdot 10^{-277}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{-0.5 \cdot {\left(\frac{M}{d} \cdot \frac{D\_m}{2}\right)}^{2}}{\frac{\ell}{h}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{M}{d \cdot 2}\right)}^{2}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < 3.49999999999999983e-277Initial program 65.5%
Simplified66.4%
*-commutative66.4%
clear-num66.4%
un-div-inv67.9%
*-commutative67.9%
associate-*r/67.0%
*-un-lft-identity67.0%
times-frac67.9%
associate-/l/67.9%
*-commutative67.9%
times-frac67.0%
*-un-lft-identity67.0%
times-frac67.9%
Applied egg-rr67.9%
if 3.49999999999999983e-277 < l Initial program 67.4%
Simplified66.5%
sub-neg66.5%
distribute-rgt-in56.2%
*-un-lft-identity56.2%
sqrt-div56.9%
sqrt-div62.9%
frac-times62.8%
add-sqr-sqrt62.9%
Applied egg-rr75.8%
distribute-rgt1-in83.9%
+-commutative83.9%
associate-*r*83.9%
times-frac84.7%
*-commutative84.7%
associate-/l*83.9%
Simplified83.9%
Final simplification75.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 2.6e-276)
(*
(sqrt (/ d l))
(*
(+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M 2.0) d)) 2.0) -0.5)))
(sqrt (/ d h))))
(*
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D_m (/ M (* d 2.0))) 2.0)))
(/ d (* (sqrt h) (sqrt 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.6e-276) {
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 + (((h / l) * -0.5) * pow((D_m * (M / (d * 2.0))), 2.0))) * (d / (sqrt(h) * sqrt(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.6d-276) 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 + (((h / l) * (-0.5d0)) * ((d_m * (m / (d * 2.0d0))) ** 2.0d0))) * (d / (sqrt(h) * sqrt(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.6e-276) {
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 + (((h / l) * -0.5) * Math.pow((D_m * (M / (d * 2.0))), 2.0))) * (d / (Math.sqrt(h) * Math.sqrt(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.6e-276: 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 + (((h / l) * -0.5) * math.pow((D_m * (M / (d * 2.0))), 2.0))) * (d / (math.sqrt(h) * math.sqrt(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.6e-276) 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(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(M / Float64(d * 2.0))) ^ 2.0))) * Float64(d / Float64(sqrt(h) * sqrt(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.6e-276)
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 + (((h / l) * -0.5) * ((D_m * (M / (d * 2.0))) ^ 2.0))) * (d / (sqrt(h) * sqrt(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.6e-276], 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[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $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}\;\ell \leq 2.6 \cdot 10^{-276}:\\
\;\;\;\;\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 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{M}{d \cdot 2}\right)}^{2}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < 2.59999999999999984e-276Initial program 65.5%
Simplified66.4%
if 2.59999999999999984e-276 < l Initial program 67.4%
Simplified66.5%
sub-neg66.5%
distribute-rgt-in56.2%
*-un-lft-identity56.2%
sqrt-div56.9%
sqrt-div62.9%
frac-times62.8%
add-sqr-sqrt62.9%
Applied egg-rr75.8%
distribute-rgt1-in83.9%
+-commutative83.9%
associate-*r*83.9%
times-frac84.7%
*-commutative84.7%
associate-/l*83.9%
Simplified83.9%
Final simplification74.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 2.4e-302)
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(*
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D_m (/ M (* d 2.0))) 2.0)))
(/ d (* (sqrt h) (sqrt 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 <= 2.4e-302) {
tmp = -d * sqrt(((1.0 / h) / l));
} else {
tmp = (1.0 + (((h / l) * -0.5) * pow((D_m * (M / (d * 2.0))), 2.0))) * (d / (sqrt(h) * sqrt(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 <= 2.4d-302) then
tmp = -d * sqrt(((1.0d0 / h) / l))
else
tmp = (1.0d0 + (((h / l) * (-0.5d0)) * ((d_m * (m / (d * 2.0d0))) ** 2.0d0))) * (d / (sqrt(h) * sqrt(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 <= 2.4e-302) {
tmp = -d * Math.sqrt(((1.0 / h) / l));
} else {
tmp = (1.0 + (((h / l) * -0.5) * Math.pow((D_m * (M / (d * 2.0))), 2.0))) * (d / (Math.sqrt(h) * Math.sqrt(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 <= 2.4e-302: tmp = -d * math.sqrt(((1.0 / h) / l)) else: tmp = (1.0 + (((h / l) * -0.5) * math.pow((D_m * (M / (d * 2.0))), 2.0))) * (d / (math.sqrt(h) * math.sqrt(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 (d <= 2.4e-302) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); else tmp = Float64(Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(M / Float64(d * 2.0))) ^ 2.0))) * Float64(d / Float64(sqrt(h) * sqrt(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 <= 2.4e-302)
tmp = -d * sqrt(((1.0 / h) / l));
else
tmp = (1.0 + (((h / l) * -0.5) * ((D_m * (M / (d * 2.0))) ^ 2.0))) * (d / (sqrt(h) * sqrt(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[d, 2.4e-302], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $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 2.4 \cdot 10^{-302}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{M}{d \cdot 2}\right)}^{2}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < 2.40000000000000022e-302Initial program 63.8%
Simplified63.3%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt39.1%
neg-mul-139.1%
Simplified39.1%
*-un-lft-identity39.1%
Applied egg-rr39.1%
*-lft-identity39.1%
associate-/r*40.9%
Simplified40.9%
if 2.40000000000000022e-302 < d Initial program 68.9%
Simplified68.8%
sub-neg68.8%
distribute-rgt-in55.9%
*-un-lft-identity55.9%
sqrt-div56.6%
sqrt-div63.8%
frac-times63.8%
add-sqr-sqrt63.8%
Applied egg-rr76.1%
distribute-rgt1-in85.4%
+-commutative85.4%
associate-*r*85.4%
times-frac85.4%
*-commutative85.4%
associate-/l*85.4%
Simplified85.4%
Final simplification63.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 -5e-310)
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(if (<= l 3.85e-171)
(* (- d) (sqrt (log (exp (/ 1.0 (* h 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 (l <= -5e-310) {
tmp = -d * sqrt(((1.0 / h) / l));
} else if (l <= 3.85e-171) {
tmp = -d * sqrt(log(exp((1.0 / (h * 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 (l <= (-5d-310)) then
tmp = -d * sqrt(((1.0d0 / h) / l))
else if (l <= 3.85d-171) then
tmp = -d * sqrt(log(exp((1.0d0 / (h * 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 (l <= -5e-310) {
tmp = -d * Math.sqrt(((1.0 / h) / l));
} else if (l <= 3.85e-171) {
tmp = -d * Math.sqrt(Math.log(Math.exp((1.0 / (h * 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 l <= -5e-310: tmp = -d * math.sqrt(((1.0 / h) / l)) elif l <= 3.85e-171: tmp = -d * math.sqrt(math.log(math.exp((1.0 / (h * 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 (l <= -5e-310) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); elseif (l <= 3.85e-171) tmp = Float64(Float64(-d) * sqrt(log(exp(Float64(1.0 / Float64(h * 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 (l <= -5e-310)
tmp = -d * sqrt(((1.0 / h) / l));
elseif (l <= 3.85e-171)
tmp = -d * sqrt(log(exp((1.0 / (h * 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[LessEqual[l, -5e-310], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.85e-171], N[((-d) * N[Sqrt[N[Log[N[Exp[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $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 -5 \cdot 10^{-310}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{elif}\;\ell \leq 3.85 \cdot 10^{-171}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\log \left(e^{\frac{1}{h \cdot \ell}}\right)}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 64.4%
Simplified63.8%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt39.4%
neg-mul-139.4%
Simplified39.4%
*-un-lft-identity39.4%
Applied egg-rr39.4%
*-lft-identity39.4%
associate-/r*41.2%
Simplified41.2%
if -4.999999999999985e-310 < l < 3.8499999999999998e-171Initial program 74.2%
Simplified77.9%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt28.8%
neg-mul-128.8%
Simplified28.8%
add-log-exp58.6%
Applied egg-rr58.6%
if 3.8499999999999998e-171 < l Initial program 66.9%
Simplified65.9%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt6.2%
neg-mul-16.2%
Simplified6.2%
Taylor expanded in h around -inf 0.0%
associate-*r*0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt52.1%
associate-*r*52.1%
metadata-eval52.1%
Simplified52.1%
Final simplification47.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 -5e-310)
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(if (<= l 7.4e-185)
(* (- d) (log (exp (pow (* h l) -0.5))))
(* 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 <= -5e-310) {
tmp = -d * sqrt(((1.0 / h) / l));
} else if (l <= 7.4e-185) {
tmp = -d * log(exp(pow((h * l), -0.5)));
} 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 <= (-5d-310)) then
tmp = -d * sqrt(((1.0d0 / h) / l))
else if (l <= 7.4d-185) then
tmp = -d * log(exp(((h * l) ** (-0.5d0))))
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 <= -5e-310) {
tmp = -d * Math.sqrt(((1.0 / h) / l));
} else if (l <= 7.4e-185) {
tmp = -d * Math.log(Math.exp(Math.pow((h * l), -0.5)));
} 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 <= -5e-310: tmp = -d * math.sqrt(((1.0 / h) / l)) elif l <= 7.4e-185: tmp = -d * math.log(math.exp(math.pow((h * l), -0.5))) 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 <= -5e-310) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); elseif (l <= 7.4e-185) tmp = Float64(Float64(-d) * log(exp((Float64(h * l) ^ -0.5)))); 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 <= -5e-310)
tmp = -d * sqrt(((1.0 / h) / l));
elseif (l <= 7.4e-185)
tmp = -d * log(exp(((h * l) ^ -0.5)));
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, -5e-310], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.4e-185], N[((-d) * N[Log[N[Exp[N[Power[N[(h * l), $MachinePrecision], -0.5], $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 -5 \cdot 10^{-310}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{elif}\;\ell \leq 7.4 \cdot 10^{-185}:\\
\;\;\;\;\left(-d\right) \cdot \log \left(e^{{\left(h \cdot \ell\right)}^{-0.5}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 64.4%
Simplified63.8%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt39.4%
neg-mul-139.4%
Simplified39.4%
*-un-lft-identity39.4%
Applied egg-rr39.4%
*-lft-identity39.4%
associate-/r*41.2%
Simplified41.2%
if -4.999999999999985e-310 < l < 7.4e-185Initial program 76.3%
Simplified80.3%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt31.0%
neg-mul-131.0%
Simplified31.0%
add-log-exp59.3%
pow1/259.3%
inv-pow59.3%
pow-pow59.3%
metadata-eval59.3%
Applied egg-rr59.3%
if 7.4e-185 < l Initial program 66.6%
Simplified65.6%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt6.1%
neg-mul-16.1%
Simplified6.1%
Taylor expanded in h around -inf 0.0%
associate-*r*0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt52.1%
associate-*r*52.1%
metadata-eval52.1%
Simplified52.1%
Final simplification47.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 -5e-310)
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(if (<= l 4.3e-184)
(log1p (expm1 (* d (- (pow (* h l) -0.5)))))
(* 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 <= -5e-310) {
tmp = -d * sqrt(((1.0 / h) / l));
} else if (l <= 4.3e-184) {
tmp = log1p(expm1((d * -pow((h * l), -0.5))));
} else {
tmp = d * sqrt(((1.0 / l) / h));
}
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 tmp;
if (l <= -5e-310) {
tmp = -d * Math.sqrt(((1.0 / h) / l));
} else if (l <= 4.3e-184) {
tmp = Math.log1p(Math.expm1((d * -Math.pow((h * l), -0.5))));
} 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 <= -5e-310: tmp = -d * math.sqrt(((1.0 / h) / l)) elif l <= 4.3e-184: tmp = math.log1p(math.expm1((d * -math.pow((h * l), -0.5)))) 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 <= -5e-310) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); elseif (l <= 4.3e-184) tmp = log1p(expm1(Float64(d * Float64(-(Float64(h * l) ^ -0.5))))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / 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[l, -5e-310], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.3e-184], N[Log[1 + N[(Exp[N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision]] - 1), $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 -5 \cdot 10^{-310}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{elif}\;\ell \leq 4.3 \cdot 10^{-184}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 64.4%
Simplified63.8%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt39.4%
neg-mul-139.4%
Simplified39.4%
*-un-lft-identity39.4%
Applied egg-rr39.4%
*-lft-identity39.4%
associate-/r*41.2%
Simplified41.2%
if -4.999999999999985e-310 < l < 4.30000000000000007e-184Initial program 76.3%
Simplified80.3%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt31.0%
neg-mul-131.0%
Simplified31.0%
log1p-expm1-u51.0%
pow1/251.0%
inv-pow51.0%
pow-pow51.0%
metadata-eval51.0%
Applied egg-rr51.0%
if 4.30000000000000007e-184 < l Initial program 66.6%
Simplified65.6%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt6.1%
neg-mul-16.1%
Simplified6.1%
Taylor expanded in h around -inf 0.0%
associate-*r*0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt52.1%
associate-*r*52.1%
metadata-eval52.1%
Simplified52.1%
Final simplification46.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 1.8e-191) (* (- d) (sqrt (/ (/ 1.0 h) 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 (l <= 1.8e-191) {
tmp = -d * sqrt(((1.0 / h) / 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 (l <= 1.8d-191) then
tmp = -d * sqrt(((1.0d0 / h) / 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 (l <= 1.8e-191) {
tmp = -d * Math.sqrt(((1.0 / h) / 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 l <= 1.8e-191: tmp = -d * math.sqrt(((1.0 / h) / 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 (l <= 1.8e-191) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / 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 (l <= 1.8e-191)
tmp = -d * sqrt(((1.0 / h) / 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[LessEqual[l, 1.8e-191], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $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 1.8 \cdot 10^{-191}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\end{array}
\end{array}
if l < 1.8000000000000001e-191Initial program 66.3%
Simplified66.4%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt38.1%
neg-mul-138.1%
Simplified38.1%
*-un-lft-identity38.1%
Applied egg-rr38.1%
*-lft-identity38.1%
associate-/r*39.6%
Simplified39.6%
if 1.8000000000000001e-191 < l Initial program 66.6%
Simplified65.6%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt6.1%
neg-mul-16.1%
Simplified6.1%
Taylor expanded in h around -inf 0.0%
associate-*r*0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt52.1%
associate-*r*52.1%
metadata-eval52.1%
Simplified52.1%
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 (<= l 9.5e-188) (* (- d) (sqrt (/ (/ 1.0 h) l))) (* 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 <= 9.5e-188) {
tmp = -d * sqrt(((1.0 / h) / l));
} 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 <= 9.5d-188) then
tmp = -d * sqrt(((1.0d0 / h) / l))
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 <= 9.5e-188) {
tmp = -d * Math.sqrt(((1.0 / h) / l));
} 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 <= 9.5e-188: tmp = -d * math.sqrt(((1.0 / h) / l)) 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 <= 9.5e-188) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); else tmp = Float64(d * sqrt(Float64(1.0 / Float64(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 <= 9.5e-188)
tmp = -d * sqrt(((1.0 / h) / l));
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, 9.5e-188], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $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}\;\ell \leq 9.5 \cdot 10^{-188}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\end{array}
\end{array}
if l < 9.50000000000000063e-188Initial program 66.3%
Simplified66.4%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt38.1%
neg-mul-138.1%
Simplified38.1%
*-un-lft-identity38.1%
Applied egg-rr38.1%
*-lft-identity38.1%
associate-/r*39.6%
Simplified39.6%
if 9.50000000000000063e-188 < l Initial program 66.6%
Simplified65.6%
Taylor expanded in d around inf 51.6%
Final simplification44.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 (/ 1.0 (* h l))))) (if (<= l 1.85e-188) (* (- 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 <= 1.85e-188) {
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 <= 1.85d-188) 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 <= 1.85e-188) {
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 <= 1.85e-188: 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(1.0 / Float64(h * l))) tmp = 0.0 if (l <= 1.85e-188) tmp = Float64(Float64(-d) * t_0); else tmp = Float64(d * t_0); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = sqrt((1.0 / (h * l)));
tmp = 0.0;
if (l <= 1.85e-188)
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[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, 1.85e-188], 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{1}{h \cdot \ell}}\\
\mathbf{if}\;\ell \leq 1.85 \cdot 10^{-188}:\\
\;\;\;\;\left(-d\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
\end{array}
if l < 1.84999999999999986e-188Initial program 66.3%
Simplified66.4%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt38.1%
neg-mul-138.1%
Simplified38.1%
if 1.84999999999999986e-188 < l Initial program 66.6%
Simplified65.6%
Taylor expanded in d around inf 51.6%
Final simplification43.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.8e-195) (* d (- (pow (* h l) -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 <= 6.8e-195) {
tmp = d * -pow((h * l), -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 <= 6.8d-195) then
tmp = d * -((h * l) ** (-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 <= 6.8e-195) {
tmp = d * -Math.pow((h * l), -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 <= 6.8e-195: tmp = d * -math.pow((h * l), -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 <= 6.8e-195) tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5))); else tmp = Float64(d * sqrt(Float64(1.0 / Float64(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 <= 6.8e-195)
tmp = d * -((h * l) ^ -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, 6.8e-195], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $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}\;\ell \leq 6.8 \cdot 10^{-195}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\end{array}
\end{array}
if l < 6.80000000000000003e-195Initial program 66.3%
Simplified66.4%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt38.1%
neg-mul-138.1%
Simplified38.1%
*-un-lft-identity38.1%
pow1/238.1%
inv-pow38.1%
pow-pow38.1%
metadata-eval38.1%
Applied egg-rr38.1%
*-lft-identity38.1%
Simplified38.1%
if 6.80000000000000003e-195 < l Initial program 66.6%
Simplified65.6%
Taylor expanded in d around inf 51.6%
Final simplification43.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 (* 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) {
return d * sqrt((1.0 / (h * l)));
}
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 / (h * l)))
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 / (h * l)));
}
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 / (h * l)))
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(h * l)))) 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 / (h * l)));
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[(h * l), $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}{h \cdot \ell}}
\end{array}
Initial program 66.4%
Simplified66.1%
Taylor expanded in d around inf 28.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 (* d (pow (* 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) {
return d * pow((h * l), -0.5);
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
code = d * ((h * l) ** (-0.5d0))
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
return d * Math.pow((h * l), -0.5);
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): return d * math.pow((h * l), -0.5)
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) return Float64(d * (Float64(h * l) ^ -0.5)) end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp = code(d, h, l, M, D_m)
tmp = d * ((h * l) ^ -0.5);
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
d \cdot {\left(h \cdot \ell\right)}^{-0.5}
\end{array}
Initial program 66.4%
Simplified66.1%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt24.7%
neg-mul-124.7%
Simplified24.7%
Taylor expanded in h around -inf 0.0%
associate-*r*0.0%
mul-1-neg0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt28.6%
neg-mul-128.6%
remove-double-neg28.6%
unpow-128.6%
metadata-eval28.6%
pow-sqr28.6%
rem-sqrt-square28.6%
rem-square-sqrt28.5%
fabs-sqr28.5%
rem-square-sqrt28.6%
Simplified28.6%
herbie shell --seed 2024106
(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)))))