
(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 17 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 (* D_m (* 0.5 (/ M d)))))
(if (<= h -1.5e+118)
(*
(sqrt (/ d l))
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M 2.0) d)) 2.0) -0.5)))))
(if (<= h -5e-310)
(*
(* d (pow (* h l) -0.5))
(+ (* 0.5 (pow (* t_0 (sqrt (/ h l))) 2.0)) -1.0))
(*
d
(*
(- 1.0 (* h (* (pow t_0 2.0) (/ 0.5 l))))
(* (pow l -0.5) (pow h -0.5))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = D_m * (0.5 * (M / d));
double tmp;
if (h <= -1.5e+118) {
tmp = sqrt((d / l)) * ((sqrt(-d) / sqrt(-h)) * (1.0 + ((h / l) * (pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5))));
} else if (h <= -5e-310) {
tmp = (d * pow((h * l), -0.5)) * ((0.5 * pow((t_0 * sqrt((h / l))), 2.0)) + -1.0);
} else {
tmp = d * ((1.0 - (h * (pow(t_0, 2.0) * (0.5 / l)))) * (pow(l, -0.5) * pow(h, -0.5)));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = d_m * (0.5d0 * (m / d))
if (h <= (-1.5d+118)) then
tmp = sqrt((d / l)) * ((sqrt(-d) / sqrt(-h)) * (1.0d0 + ((h / l) * (((d_m * ((m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))))
else if (h <= (-5d-310)) then
tmp = (d * ((h * l) ** (-0.5d0))) * ((0.5d0 * ((t_0 * sqrt((h / l))) ** 2.0d0)) + (-1.0d0))
else
tmp = d * ((1.0d0 - (h * ((t_0 ** 2.0d0) * (0.5d0 / l)))) * ((l ** (-0.5d0)) * (h ** (-0.5d0))))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = D_m * (0.5 * (M / d));
double tmp;
if (h <= -1.5e+118) {
tmp = Math.sqrt((d / l)) * ((Math.sqrt(-d) / Math.sqrt(-h)) * (1.0 + ((h / l) * (Math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5))));
} else if (h <= -5e-310) {
tmp = (d * Math.pow((h * l), -0.5)) * ((0.5 * Math.pow((t_0 * Math.sqrt((h / l))), 2.0)) + -1.0);
} else {
tmp = d * ((1.0 - (h * (Math.pow(t_0, 2.0) * (0.5 / l)))) * (Math.pow(l, -0.5) * Math.pow(h, -0.5)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = D_m * (0.5 * (M / d)) tmp = 0 if h <= -1.5e+118: tmp = math.sqrt((d / l)) * ((math.sqrt(-d) / math.sqrt(-h)) * (1.0 + ((h / l) * (math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5)))) elif h <= -5e-310: tmp = (d * math.pow((h * l), -0.5)) * ((0.5 * math.pow((t_0 * math.sqrt((h / l))), 2.0)) + -1.0) else: tmp = d * ((1.0 - (h * (math.pow(t_0, 2.0) * (0.5 / l)))) * (math.pow(l, -0.5) * math.pow(h, -0.5))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(D_m * Float64(0.5 * Float64(M / d))) tmp = 0.0 if (h <= -1.5e+118) tmp = Float64(sqrt(Float64(d / l)) * 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))))); elseif (h <= -5e-310) tmp = Float64(Float64(d * (Float64(h * l) ^ -0.5)) * Float64(Float64(0.5 * (Float64(t_0 * sqrt(Float64(h / l))) ^ 2.0)) + -1.0)); else tmp = Float64(d * Float64(Float64(1.0 - Float64(h * Float64((t_0 ^ 2.0) * Float64(0.5 / l)))) * Float64((l ^ -0.5) * (h ^ -0.5)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = D_m * (0.5 * (M / d));
tmp = 0.0;
if (h <= -1.5e+118)
tmp = sqrt((d / l)) * ((sqrt(-d) / sqrt(-h)) * (1.0 + ((h / l) * (((D_m * ((M / 2.0) / d)) ^ 2.0) * -0.5))));
elseif (h <= -5e-310)
tmp = (d * ((h * l) ^ -0.5)) * ((0.5 * ((t_0 * sqrt((h / l))) ^ 2.0)) + -1.0);
else
tmp = d * ((1.0 - (h * ((t_0 ^ 2.0) * (0.5 / l)))) * ((l ^ -0.5) * (h ^ -0.5)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(D$95$m * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1.5e+118], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * 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]), $MachinePrecision], If[LessEqual[h, -5e-310], N[(N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[Power[N[(t$95$0 * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(1.0 - N[(h * N[(N[Power[t$95$0, 2.0], $MachinePrecision] * N[(0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \left(0.5 \cdot \frac{M}{d}\right)\\
\mathbf{if}\;h \leq -1.5 \cdot 10^{+118}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \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)\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right) \cdot \left(0.5 \cdot {\left(t\_0 \cdot \sqrt{\frac{h}{\ell}}\right)}^{2} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left(\left(1 - h \cdot \left({t\_0}^{2} \cdot \frac{0.5}{\ell}\right)\right) \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\right)\\
\end{array}
\end{array}
if h < -1.5e118Initial program 45.1%
Simplified45.1%
frac-2neg45.1%
sqrt-div68.8%
Applied egg-rr68.8%
if -1.5e118 < h < -4.999999999999985e-310Initial program 57.1%
Simplified56.1%
add-sqr-sqrt56.1%
pow256.1%
sqrt-prod56.1%
sqrt-pow159.2%
frac-times61.3%
associate-/r*61.3%
metadata-eval61.3%
pow161.3%
div-inv61.3%
*-commutative61.3%
associate-*r*61.3%
div-inv61.3%
associate-*r/60.2%
associate-/l/60.2%
*-un-lft-identity60.2%
*-commutative60.2%
times-frac60.2%
metadata-eval60.2%
Applied egg-rr60.2%
Taylor expanded in d around 0 1.7%
associate-/r*1.7%
Simplified1.7%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt79.3%
mul-1-neg79.3%
rem-exp-log76.6%
exp-neg76.6%
unpow1/276.6%
exp-prod76.6%
distribute-lft-neg-out76.6%
distribute-rgt-neg-in76.6%
metadata-eval76.6%
exp-to-pow79.3%
Simplified79.3%
if -4.999999999999985e-310 < h Initial program 65.2%
Simplified64.7%
Taylor expanded in d around 0 69.5%
pow169.5%
associate-*l*70.4%
pow1/270.4%
inv-pow70.4%
pow-pow70.4%
metadata-eval70.4%
associate-*r*70.4%
div-inv70.4%
metadata-eval70.4%
Applied egg-rr70.4%
Simplified80.2%
*-commutative80.2%
unpow-prod-down92.2%
Applied egg-rr92.2%
Final simplification83.4%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* h (* (pow (* D_m (* 0.5 (/ M d))) 2.0) (/ 0.5 l)))))
(if (<= l -1.75e+248)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(+ 1.0 (* -0.5 (pow (* (* D_m (sqrt (/ h l))) (* M (/ 0.5 d))) 2.0))))
(if (<= l -1e-311)
(* d (* (sqrt (/ 1.0 (* h l))) (+ t_0 -1.0)))
(* d (* (- 1.0 t_0) (* (pow l -0.5) (pow h -0.5))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = h * (pow((D_m * (0.5 * (M / d))), 2.0) * (0.5 / l));
double tmp;
if (l <= -1.75e+248) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 + (-0.5 * pow(((D_m * sqrt((h / l))) * (M * (0.5 / d))), 2.0)));
} else if (l <= -1e-311) {
tmp = d * (sqrt((1.0 / (h * l))) * (t_0 + -1.0));
} else {
tmp = d * ((1.0 - t_0) * (pow(l, -0.5) * pow(h, -0.5)));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = h * (((d_m * (0.5d0 * (m / d))) ** 2.0d0) * (0.5d0 / l))
if (l <= (-1.75d+248)) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 + ((-0.5d0) * (((d_m * sqrt((h / l))) * (m * (0.5d0 / d))) ** 2.0d0)))
else if (l <= (-1d-311)) then
tmp = d * (sqrt((1.0d0 / (h * l))) * (t_0 + (-1.0d0)))
else
tmp = d * ((1.0d0 - t_0) * ((l ** (-0.5d0)) * (h ** (-0.5d0))))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = h * (Math.pow((D_m * (0.5 * (M / d))), 2.0) * (0.5 / l));
double tmp;
if (l <= -1.75e+248) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 + (-0.5 * Math.pow(((D_m * Math.sqrt((h / l))) * (M * (0.5 / d))), 2.0)));
} else if (l <= -1e-311) {
tmp = d * (Math.sqrt((1.0 / (h * l))) * (t_0 + -1.0));
} else {
tmp = d * ((1.0 - t_0) * (Math.pow(l, -0.5) * Math.pow(h, -0.5)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = h * (math.pow((D_m * (0.5 * (M / d))), 2.0) * (0.5 / l)) tmp = 0 if l <= -1.75e+248: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 + (-0.5 * math.pow(((D_m * math.sqrt((h / l))) * (M * (0.5 / d))), 2.0))) elif l <= -1e-311: tmp = d * (math.sqrt((1.0 / (h * l))) * (t_0 + -1.0)) else: tmp = d * ((1.0 - t_0) * (math.pow(l, -0.5) * math.pow(h, -0.5))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(h * Float64((Float64(D_m * Float64(0.5 * Float64(M / d))) ^ 2.0) * Float64(0.5 / l))) tmp = 0.0 if (l <= -1.75e+248) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 + Float64(-0.5 * (Float64(Float64(D_m * sqrt(Float64(h / l))) * Float64(M * Float64(0.5 / d))) ^ 2.0)))); elseif (l <= -1e-311) tmp = Float64(d * Float64(sqrt(Float64(1.0 / Float64(h * l))) * Float64(t_0 + -1.0))); else tmp = Float64(d * Float64(Float64(1.0 - t_0) * Float64((l ^ -0.5) * (h ^ -0.5)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = h * (((D_m * (0.5 * (M / d))) ^ 2.0) * (0.5 / l));
tmp = 0.0;
if (l <= -1.75e+248)
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 + (-0.5 * (((D_m * sqrt((h / l))) * (M * (0.5 / d))) ^ 2.0)));
elseif (l <= -1e-311)
tmp = d * (sqrt((1.0 / (h * l))) * (t_0 + -1.0));
else
tmp = d * ((1.0 - t_0) * ((l ^ -0.5) * (h ^ -0.5)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(h * N[(N[Power[N[(D$95$m * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.75e+248], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[Power[N[(N[(D$95$m * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-311], N[(d * N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(1.0 - t$95$0), $MachinePrecision] * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := h \cdot \left({\left(D\_m \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \frac{0.5}{\ell}\right)\\
\mathbf{if}\;\ell \leq -1.75 \cdot 10^{+248}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 + -0.5 \cdot {\left(\left(D\_m \cdot \sqrt{\frac{h}{\ell}}\right) \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}\right)\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-311}:\\
\;\;\;\;d \cdot \left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(t\_0 + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left(\left(1 - t\_0\right) \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\right)\\
\end{array}
\end{array}
if l < -1.75000000000000011e248Initial program 54.7%
Simplified54.7%
add-sqr-sqrt54.7%
pow254.7%
sqrt-prod54.7%
sqrt-pow166.5%
frac-times60.5%
associate-/r*60.5%
metadata-eval60.5%
pow160.5%
div-inv60.5%
*-commutative60.5%
associate-*r*60.5%
div-inv60.5%
associate-*r/66.3%
associate-/l/66.3%
*-un-lft-identity66.3%
*-commutative66.3%
times-frac66.3%
metadata-eval66.3%
Applied egg-rr66.3%
Taylor expanded in D around 0 60.5%
associate-*r*60.5%
associate-/l*66.3%
associate-*r*66.3%
*-commutative66.3%
associate-*r*66.3%
associate-/l*66.3%
associate-*l*66.3%
*-commutative66.3%
*-commutative66.3%
associate-/l*66.3%
Simplified66.3%
cancel-sign-sub-inv66.3%
metadata-eval66.3%
associate-*r*66.4%
Applied egg-rr66.4%
if -1.75000000000000011e248 < l < -9.99999999999948e-312Initial program 53.2%
Simplified52.4%
Taylor expanded in d around 0 2.3%
pow12.3%
associate-*l*2.3%
pow1/22.3%
inv-pow2.3%
pow-pow2.3%
metadata-eval2.3%
associate-*r*2.3%
div-inv2.3%
metadata-eval2.3%
Applied egg-rr2.3%
Simplified3.1%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt74.1%
mul-1-neg74.1%
Simplified74.1%
if -9.99999999999948e-312 < l Initial program 65.2%
Simplified64.7%
Taylor expanded in d around 0 69.5%
pow169.5%
associate-*l*70.4%
pow1/270.4%
inv-pow70.4%
pow-pow70.4%
metadata-eval70.4%
associate-*r*70.4%
div-inv70.4%
metadata-eval70.4%
Applied egg-rr70.4%
Simplified80.2%
*-commutative80.2%
unpow-prod-down92.2%
Applied egg-rr92.2%
Final simplification81.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 (* D_m (* 0.5 (/ M d)))) (t_1 (* h (* (pow t_0 2.0) (/ 0.5 l)))))
(if (<= h -2.95e+273)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D_m d)) 2.0)))))
(if (<= h -1.25e+35)
(* d (* (sqrt (/ 1.0 (* h l))) (+ t_1 -1.0)))
(if (<= h -5e-310)
(*
(* d (pow (* h l) -0.5))
(+ (* 0.5 (pow (* t_0 (sqrt (/ h l))) 2.0)) -1.0))
(* d (* (- 1.0 t_1) (* (pow l -0.5) (pow h -0.5)))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = D_m * (0.5 * (M / d));
double t_1 = h * (pow(t_0, 2.0) * (0.5 / l));
double tmp;
if (h <= -2.95e+273) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * ((h / l) * pow(((M / 2.0) * (D_m / d)), 2.0))));
} else if (h <= -1.25e+35) {
tmp = d * (sqrt((1.0 / (h * l))) * (t_1 + -1.0));
} else if (h <= -5e-310) {
tmp = (d * pow((h * l), -0.5)) * ((0.5 * pow((t_0 * sqrt((h / l))), 2.0)) + -1.0);
} else {
tmp = d * ((1.0 - t_1) * (pow(l, -0.5) * pow(h, -0.5)));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d_m * (0.5d0 * (m / d))
t_1 = h * ((t_0 ** 2.0d0) * (0.5d0 / l))
if (h <= (-2.95d+273)) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - (0.5d0 * ((h / l) * (((m / 2.0d0) * (d_m / d)) ** 2.0d0))))
else if (h <= (-1.25d+35)) then
tmp = d * (sqrt((1.0d0 / (h * l))) * (t_1 + (-1.0d0)))
else if (h <= (-5d-310)) then
tmp = (d * ((h * l) ** (-0.5d0))) * ((0.5d0 * ((t_0 * sqrt((h / l))) ** 2.0d0)) + (-1.0d0))
else
tmp = d * ((1.0d0 - t_1) * ((l ** (-0.5d0)) * (h ** (-0.5d0))))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = D_m * (0.5 * (M / d));
double t_1 = h * (Math.pow(t_0, 2.0) * (0.5 / l));
double tmp;
if (h <= -2.95e+273) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - (0.5 * ((h / l) * Math.pow(((M / 2.0) * (D_m / d)), 2.0))));
} else if (h <= -1.25e+35) {
tmp = d * (Math.sqrt((1.0 / (h * l))) * (t_1 + -1.0));
} else if (h <= -5e-310) {
tmp = (d * Math.pow((h * l), -0.5)) * ((0.5 * Math.pow((t_0 * Math.sqrt((h / l))), 2.0)) + -1.0);
} else {
tmp = d * ((1.0 - t_1) * (Math.pow(l, -0.5) * Math.pow(h, -0.5)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = D_m * (0.5 * (M / d)) t_1 = h * (math.pow(t_0, 2.0) * (0.5 / l)) tmp = 0 if h <= -2.95e+273: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - (0.5 * ((h / l) * math.pow(((M / 2.0) * (D_m / d)), 2.0)))) elif h <= -1.25e+35: tmp = d * (math.sqrt((1.0 / (h * l))) * (t_1 + -1.0)) elif h <= -5e-310: tmp = (d * math.pow((h * l), -0.5)) * ((0.5 * math.pow((t_0 * math.sqrt((h / l))), 2.0)) + -1.0) else: tmp = d * ((1.0 - t_1) * (math.pow(l, -0.5) * math.pow(h, -0.5))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(D_m * Float64(0.5 * Float64(M / d))) t_1 = Float64(h * Float64((t_0 ^ 2.0) * Float64(0.5 / l))) tmp = 0.0 if (h <= -2.95e+273) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.0))))); elseif (h <= -1.25e+35) tmp = Float64(d * Float64(sqrt(Float64(1.0 / Float64(h * l))) * Float64(t_1 + -1.0))); elseif (h <= -5e-310) tmp = Float64(Float64(d * (Float64(h * l) ^ -0.5)) * Float64(Float64(0.5 * (Float64(t_0 * sqrt(Float64(h / l))) ^ 2.0)) + -1.0)); else tmp = Float64(d * Float64(Float64(1.0 - t_1) * Float64((l ^ -0.5) * (h ^ -0.5)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = D_m * (0.5 * (M / d));
t_1 = h * ((t_0 ^ 2.0) * (0.5 / l));
tmp = 0.0;
if (h <= -2.95e+273)
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * ((h / l) * (((M / 2.0) * (D_m / d)) ^ 2.0))));
elseif (h <= -1.25e+35)
tmp = d * (sqrt((1.0 / (h * l))) * (t_1 + -1.0));
elseif (h <= -5e-310)
tmp = (d * ((h * l) ^ -0.5)) * ((0.5 * ((t_0 * sqrt((h / l))) ^ 2.0)) + -1.0);
else
tmp = d * ((1.0 - t_1) * ((l ^ -0.5) * (h ^ -0.5)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(D$95$m * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(h * N[(N[Power[t$95$0, 2.0], $MachinePrecision] * N[(0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -2.95e+273], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -1.25e+35], N[(d * N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-310], N[(N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[Power[N[(t$95$0 * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(1.0 - t$95$1), $MachinePrecision] * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \left(0.5 \cdot \frac{M}{d}\right)\\
t_1 := h \cdot \left({t\_0}^{2} \cdot \frac{0.5}{\ell}\right)\\
\mathbf{if}\;h \leq -2.95 \cdot 10^{+273}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right)\\
\mathbf{elif}\;h \leq -1.25 \cdot 10^{+35}:\\
\;\;\;\;d \cdot \left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(t\_1 + -1\right)\right)\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right) \cdot \left(0.5 \cdot {\left(t\_0 \cdot \sqrt{\frac{h}{\ell}}\right)}^{2} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left(\left(1 - t\_1\right) \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\right)\\
\end{array}
\end{array}
if h < -2.94999999999999989e273Initial program 66.8%
Simplified66.8%
if -2.94999999999999989e273 < h < -1.25000000000000005e35Initial program 40.0%
Simplified40.0%
Taylor expanded in d around 0 7.2%
pow17.2%
associate-*l*7.2%
pow1/27.2%
inv-pow7.2%
pow-pow7.2%
metadata-eval7.2%
associate-*r*7.2%
div-inv7.2%
metadata-eval7.2%
Applied egg-rr7.2%
Simplified8.9%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt68.3%
mul-1-neg68.3%
Simplified68.3%
if -1.25000000000000005e35 < h < -4.999999999999985e-310Initial program 63.5%
Simplified62.0%
add-sqr-sqrt62.0%
pow262.0%
sqrt-prod62.0%
sqrt-pow165.1%
frac-times68.0%
associate-/r*68.0%
metadata-eval68.0%
pow168.0%
div-inv68.0%
*-commutative68.0%
associate-*r*68.0%
div-inv68.0%
associate-*r/66.4%
associate-/l/66.4%
*-un-lft-identity66.4%
*-commutative66.4%
times-frac66.4%
metadata-eval66.4%
Applied egg-rr66.4%
Taylor expanded in d around 0 0.6%
associate-/r*0.6%
Simplified0.6%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt82.4%
mul-1-neg82.4%
rem-exp-log79.8%
exp-neg79.8%
unpow1/279.8%
exp-prod79.8%
distribute-lft-neg-out79.8%
distribute-rgt-neg-in79.8%
metadata-eval79.8%
exp-to-pow82.5%
Simplified82.5%
if -4.999999999999985e-310 < h Initial program 65.2%
Simplified64.7%
Taylor expanded in d around 0 69.5%
pow169.5%
associate-*l*70.4%
pow1/270.4%
inv-pow70.4%
pow-pow70.4%
metadata-eval70.4%
associate-*r*70.4%
div-inv70.4%
metadata-eval70.4%
Applied egg-rr70.4%
Simplified80.2%
*-commutative80.2%
unpow-prod-down92.2%
Applied egg-rr92.2%
Final simplification83.0%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* D_m (* 0.5 (/ M d)))) (t_1 (* h (* (pow t_0 2.0) (/ 0.5 l)))))
(if (<= h -2.6e+274)
(*
(sqrt (/ d l))
(*
(+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M 2.0) d)) 2.0) -0.5)))
(sqrt (/ d h))))
(if (<= h -6.4e+35)
(* d (* (sqrt (/ 1.0 (* h l))) (+ t_1 -1.0)))
(if (<= h -5e-310)
(*
(* d (pow (* h l) -0.5))
(+ (* 0.5 (pow (* t_0 (sqrt (/ h l))) 2.0)) -1.0))
(* d (* (- 1.0 t_1) (* (pow l -0.5) (pow h -0.5)))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = D_m * (0.5 * (M / d));
double t_1 = h * (pow(t_0, 2.0) * (0.5 / l));
double tmp;
if (h <= -2.6e+274) {
tmp = sqrt((d / l)) * ((1.0 + ((h / l) * (pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5))) * sqrt((d / h)));
} else if (h <= -6.4e+35) {
tmp = d * (sqrt((1.0 / (h * l))) * (t_1 + -1.0));
} else if (h <= -5e-310) {
tmp = (d * pow((h * l), -0.5)) * ((0.5 * pow((t_0 * sqrt((h / l))), 2.0)) + -1.0);
} else {
tmp = d * ((1.0 - t_1) * (pow(l, -0.5) * pow(h, -0.5)));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d_m * (0.5d0 * (m / d))
t_1 = h * ((t_0 ** 2.0d0) * (0.5d0 / l))
if (h <= (-2.6d+274)) then
tmp = sqrt((d / l)) * ((1.0d0 + ((h / l) * (((d_m * ((m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))) * sqrt((d / h)))
else if (h <= (-6.4d+35)) then
tmp = d * (sqrt((1.0d0 / (h * l))) * (t_1 + (-1.0d0)))
else if (h <= (-5d-310)) then
tmp = (d * ((h * l) ** (-0.5d0))) * ((0.5d0 * ((t_0 * sqrt((h / l))) ** 2.0d0)) + (-1.0d0))
else
tmp = d * ((1.0d0 - t_1) * ((l ** (-0.5d0)) * (h ** (-0.5d0))))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = D_m * (0.5 * (M / d));
double t_1 = h * (Math.pow(t_0, 2.0) * (0.5 / l));
double tmp;
if (h <= -2.6e+274) {
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 if (h <= -6.4e+35) {
tmp = d * (Math.sqrt((1.0 / (h * l))) * (t_1 + -1.0));
} else if (h <= -5e-310) {
tmp = (d * Math.pow((h * l), -0.5)) * ((0.5 * Math.pow((t_0 * Math.sqrt((h / l))), 2.0)) + -1.0);
} else {
tmp = d * ((1.0 - t_1) * (Math.pow(l, -0.5) * Math.pow(h, -0.5)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = D_m * (0.5 * (M / d)) t_1 = h * (math.pow(t_0, 2.0) * (0.5 / l)) tmp = 0 if h <= -2.6e+274: 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))) elif h <= -6.4e+35: tmp = d * (math.sqrt((1.0 / (h * l))) * (t_1 + -1.0)) elif h <= -5e-310: tmp = (d * math.pow((h * l), -0.5)) * ((0.5 * math.pow((t_0 * math.sqrt((h / l))), 2.0)) + -1.0) else: tmp = d * ((1.0 - t_1) * (math.pow(l, -0.5) * math.pow(h, -0.5))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(D_m * Float64(0.5 * Float64(M / d))) t_1 = Float64(h * Float64((t_0 ^ 2.0) * Float64(0.5 / l))) tmp = 0.0 if (h <= -2.6e+274) 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)))); elseif (h <= -6.4e+35) tmp = Float64(d * Float64(sqrt(Float64(1.0 / Float64(h * l))) * Float64(t_1 + -1.0))); elseif (h <= -5e-310) tmp = Float64(Float64(d * (Float64(h * l) ^ -0.5)) * Float64(Float64(0.5 * (Float64(t_0 * sqrt(Float64(h / l))) ^ 2.0)) + -1.0)); else tmp = Float64(d * Float64(Float64(1.0 - t_1) * Float64((l ^ -0.5) * (h ^ -0.5)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = D_m * (0.5 * (M / d));
t_1 = h * ((t_0 ^ 2.0) * (0.5 / l));
tmp = 0.0;
if (h <= -2.6e+274)
tmp = sqrt((d / l)) * ((1.0 + ((h / l) * (((D_m * ((M / 2.0) / d)) ^ 2.0) * -0.5))) * sqrt((d / h)));
elseif (h <= -6.4e+35)
tmp = d * (sqrt((1.0 / (h * l))) * (t_1 + -1.0));
elseif (h <= -5e-310)
tmp = (d * ((h * l) ^ -0.5)) * ((0.5 * ((t_0 * sqrt((h / l))) ^ 2.0)) + -1.0);
else
tmp = d * ((1.0 - t_1) * ((l ^ -0.5) * (h ^ -0.5)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(D$95$m * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(h * N[(N[Power[t$95$0, 2.0], $MachinePrecision] * N[(0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -2.6e+274], 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], If[LessEqual[h, -6.4e+35], N[(d * N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-310], N[(N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[Power[N[(t$95$0 * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(1.0 - t$95$1), $MachinePrecision] * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \left(0.5 \cdot \frac{M}{d}\right)\\
t_1 := h \cdot \left({t\_0}^{2} \cdot \frac{0.5}{\ell}\right)\\
\mathbf{if}\;h \leq -2.6 \cdot 10^{+274}:\\
\;\;\;\;\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{elif}\;h \leq -6.4 \cdot 10^{+35}:\\
\;\;\;\;d \cdot \left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(t\_1 + -1\right)\right)\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right) \cdot \left(0.5 \cdot {\left(t\_0 \cdot \sqrt{\frac{h}{\ell}}\right)}^{2} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left(\left(1 - t\_1\right) \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\right)\\
\end{array}
\end{array}
if h < -2.5999999999999998e274Initial program 66.8%
Simplified66.7%
if -2.5999999999999998e274 < h < -6.39999999999999965e35Initial program 40.0%
Simplified40.0%
Taylor expanded in d around 0 7.2%
pow17.2%
associate-*l*7.2%
pow1/27.2%
inv-pow7.2%
pow-pow7.2%
metadata-eval7.2%
associate-*r*7.2%
div-inv7.2%
metadata-eval7.2%
Applied egg-rr7.2%
Simplified8.9%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt68.3%
mul-1-neg68.3%
Simplified68.3%
if -6.39999999999999965e35 < h < -4.999999999999985e-310Initial program 63.5%
Simplified62.0%
add-sqr-sqrt62.0%
pow262.0%
sqrt-prod62.0%
sqrt-pow165.1%
frac-times68.0%
associate-/r*68.0%
metadata-eval68.0%
pow168.0%
div-inv68.0%
*-commutative68.0%
associate-*r*68.0%
div-inv68.0%
associate-*r/66.4%
associate-/l/66.4%
*-un-lft-identity66.4%
*-commutative66.4%
times-frac66.4%
metadata-eval66.4%
Applied egg-rr66.4%
Taylor expanded in d around 0 0.6%
associate-/r*0.6%
Simplified0.6%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt82.4%
mul-1-neg82.4%
rem-exp-log79.8%
exp-neg79.8%
unpow1/279.8%
exp-prod79.8%
distribute-lft-neg-out79.8%
distribute-rgt-neg-in79.8%
metadata-eval79.8%
exp-to-pow82.5%
Simplified82.5%
if -4.999999999999985e-310 < h Initial program 65.2%
Simplified64.7%
Taylor expanded in d around 0 69.5%
pow169.5%
associate-*l*70.4%
pow1/270.4%
inv-pow70.4%
pow-pow70.4%
metadata-eval70.4%
associate-*r*70.4%
div-inv70.4%
metadata-eval70.4%
Applied egg-rr70.4%
Simplified80.2%
*-commutative80.2%
unpow-prod-down92.2%
Applied egg-rr92.2%
Final simplification83.0%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* h (* (pow (* D_m (* 0.5 (/ M d))) 2.0) (/ 0.5 l)))))
(if (<= h -1.52e+274)
(*
(sqrt (/ d l))
(*
(+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M 2.0) d)) 2.0) -0.5)))
(sqrt (/ d h))))
(if (<= h -5e-310)
(* d (* (sqrt (/ 1.0 (* h l))) (+ t_0 -1.0)))
(* d (* (- 1.0 t_0) (* (pow l -0.5) (pow h -0.5))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = h * (pow((D_m * (0.5 * (M / d))), 2.0) * (0.5 / l));
double tmp;
if (h <= -1.52e+274) {
tmp = sqrt((d / l)) * ((1.0 + ((h / l) * (pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5))) * sqrt((d / h)));
} else if (h <= -5e-310) {
tmp = d * (sqrt((1.0 / (h * l))) * (t_0 + -1.0));
} else {
tmp = d * ((1.0 - t_0) * (pow(l, -0.5) * pow(h, -0.5)));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = h * (((d_m * (0.5d0 * (m / d))) ** 2.0d0) * (0.5d0 / l))
if (h <= (-1.52d+274)) then
tmp = sqrt((d / l)) * ((1.0d0 + ((h / l) * (((d_m * ((m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))) * sqrt((d / h)))
else if (h <= (-5d-310)) then
tmp = d * (sqrt((1.0d0 / (h * l))) * (t_0 + (-1.0d0)))
else
tmp = d * ((1.0d0 - t_0) * ((l ** (-0.5d0)) * (h ** (-0.5d0))))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = h * (Math.pow((D_m * (0.5 * (M / d))), 2.0) * (0.5 / l));
double tmp;
if (h <= -1.52e+274) {
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 if (h <= -5e-310) {
tmp = d * (Math.sqrt((1.0 / (h * l))) * (t_0 + -1.0));
} else {
tmp = d * ((1.0 - t_0) * (Math.pow(l, -0.5) * Math.pow(h, -0.5)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = h * (math.pow((D_m * (0.5 * (M / d))), 2.0) * (0.5 / l)) tmp = 0 if h <= -1.52e+274: 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))) elif h <= -5e-310: tmp = d * (math.sqrt((1.0 / (h * l))) * (t_0 + -1.0)) else: tmp = d * ((1.0 - t_0) * (math.pow(l, -0.5) * math.pow(h, -0.5))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(h * Float64((Float64(D_m * Float64(0.5 * Float64(M / d))) ^ 2.0) * Float64(0.5 / l))) tmp = 0.0 if (h <= -1.52e+274) 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)))); elseif (h <= -5e-310) tmp = Float64(d * Float64(sqrt(Float64(1.0 / Float64(h * l))) * Float64(t_0 + -1.0))); else tmp = Float64(d * Float64(Float64(1.0 - t_0) * Float64((l ^ -0.5) * (h ^ -0.5)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = h * (((D_m * (0.5 * (M / d))) ^ 2.0) * (0.5 / l));
tmp = 0.0;
if (h <= -1.52e+274)
tmp = sqrt((d / l)) * ((1.0 + ((h / l) * (((D_m * ((M / 2.0) / d)) ^ 2.0) * -0.5))) * sqrt((d / h)));
elseif (h <= -5e-310)
tmp = d * (sqrt((1.0 / (h * l))) * (t_0 + -1.0));
else
tmp = d * ((1.0 - t_0) * ((l ^ -0.5) * (h ^ -0.5)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(h * N[(N[Power[N[(D$95$m * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1.52e+274], 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], If[LessEqual[h, -5e-310], N[(d * N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(1.0 - t$95$0), $MachinePrecision] * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := h \cdot \left({\left(D\_m \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \frac{0.5}{\ell}\right)\\
\mathbf{if}\;h \leq -1.52 \cdot 10^{+274}:\\
\;\;\;\;\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{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(t\_0 + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left(\left(1 - t\_0\right) \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\right)\\
\end{array}
\end{array}
if h < -1.52e274Initial program 66.8%
Simplified66.7%
if -1.52e274 < h < -4.999999999999985e-310Initial program 52.4%
Simplified51.7%
Taylor expanded in d around 0 3.7%
pow13.7%
associate-*l*3.7%
pow1/23.7%
inv-pow3.7%
pow-pow3.7%
metadata-eval3.7%
associate-*r*3.7%
div-inv3.7%
metadata-eval3.7%
Applied egg-rr3.7%
Simplified4.6%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt73.3%
mul-1-neg73.3%
Simplified73.3%
if -4.999999999999985e-310 < h Initial program 65.2%
Simplified64.7%
Taylor expanded in d around 0 69.5%
pow169.5%
associate-*l*70.4%
pow1/270.4%
inv-pow70.4%
pow-pow70.4%
metadata-eval70.4%
associate-*r*70.4%
div-inv70.4%
metadata-eval70.4%
Applied egg-rr70.4%
Simplified80.2%
*-commutative80.2%
unpow-prod-down92.2%
Applied egg-rr92.2%
Final simplification81.7%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (pow (* D_m (* 0.5 (/ M d))) 2.0)))
(if (<= l -1e-307)
(* d (* (sqrt (/ 1.0 (* h l))) (+ (* h (* t_0 (/ 0.5 l))) -1.0)))
(if (<= l 1.3e+49)
(*
d
(*
(pow (* h l) -0.5)
(+ 1.0 (* -0.5 (/ (* h (pow (* M (/ 0.5 (/ d D_m))) 2.0)) l)))))
(* (/ d (* (sqrt l) (sqrt h))) (- 1.0 (* 0.5 (/ t_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 t_0 = pow((D_m * (0.5 * (M / d))), 2.0);
double tmp;
if (l <= -1e-307) {
tmp = d * (sqrt((1.0 / (h * l))) * ((h * (t_0 * (0.5 / l))) + -1.0));
} else if (l <= 1.3e+49) {
tmp = d * (pow((h * l), -0.5) * (1.0 + (-0.5 * ((h * pow((M * (0.5 / (d / D_m))), 2.0)) / l))));
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - (0.5 * (t_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) :: t_0
real(8) :: tmp
t_0 = (d_m * (0.5d0 * (m / d))) ** 2.0d0
if (l <= (-1d-307)) then
tmp = d * (sqrt((1.0d0 / (h * l))) * ((h * (t_0 * (0.5d0 / l))) + (-1.0d0)))
else if (l <= 1.3d+49) then
tmp = d * (((h * l) ** (-0.5d0)) * (1.0d0 + ((-0.5d0) * ((h * ((m * (0.5d0 / (d / d_m))) ** 2.0d0)) / l))))
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 - (0.5d0 * (t_0 / (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 t_0 = Math.pow((D_m * (0.5 * (M / d))), 2.0);
double tmp;
if (l <= -1e-307) {
tmp = d * (Math.sqrt((1.0 / (h * l))) * ((h * (t_0 * (0.5 / l))) + -1.0));
} else if (l <= 1.3e+49) {
tmp = d * (Math.pow((h * l), -0.5) * (1.0 + (-0.5 * ((h * Math.pow((M * (0.5 / (d / D_m))), 2.0)) / l))));
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 - (0.5 * (t_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): t_0 = math.pow((D_m * (0.5 * (M / d))), 2.0) tmp = 0 if l <= -1e-307: tmp = d * (math.sqrt((1.0 / (h * l))) * ((h * (t_0 * (0.5 / l))) + -1.0)) elif l <= 1.3e+49: tmp = d * (math.pow((h * l), -0.5) * (1.0 + (-0.5 * ((h * math.pow((M * (0.5 / (d / D_m))), 2.0)) / l)))) else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 - (0.5 * (t_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) t_0 = Float64(D_m * Float64(0.5 * Float64(M / d))) ^ 2.0 tmp = 0.0 if (l <= -1e-307) tmp = Float64(d * Float64(sqrt(Float64(1.0 / Float64(h * l))) * Float64(Float64(h * Float64(t_0 * Float64(0.5 / l))) + -1.0))); elseif (l <= 1.3e+49) tmp = Float64(d * Float64((Float64(h * l) ^ -0.5) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h * (Float64(M * Float64(0.5 / Float64(d / D_m))) ^ 2.0)) / l))))); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 - Float64(0.5 * Float64(t_0 / Float64(l / h))))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = (D_m * (0.5 * (M / d))) ^ 2.0;
tmp = 0.0;
if (l <= -1e-307)
tmp = d * (sqrt((1.0 / (h * l))) * ((h * (t_0 * (0.5 / l))) + -1.0));
elseif (l <= 1.3e+49)
tmp = d * (((h * l) ^ -0.5) * (1.0 + (-0.5 * ((h * ((M * (0.5 / (d / D_m))) ^ 2.0)) / l))));
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - (0.5 * (t_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_] := Block[{t$95$0 = N[Power[N[(D$95$m * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[l, -1e-307], N[(d * N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(h * N[(t$95$0 * N[(0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.3e+49], N[(d * N[(N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h * N[Power[N[(M * N[(0.5 / N[(d / D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(t$95$0 / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := {\left(D\_m \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-307}:\\
\;\;\;\;d \cdot \left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(h \cdot \left(t\_0 \cdot \frac{0.5}{\ell}\right) + -1\right)\right)\\
\mathbf{elif}\;\ell \leq 1.3 \cdot 10^{+49}:\\
\;\;\;\;d \cdot \left({\left(h \cdot \ell\right)}^{-0.5} \cdot \left(1 + -0.5 \cdot \frac{h \cdot {\left(M \cdot \frac{0.5}{\frac{d}{D\_m}}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 - 0.5 \cdot \frac{t\_0}{\frac{\ell}{h}}\right)\\
\end{array}
\end{array}
if l < -9.99999999999999909e-308Initial program 53.8%
Simplified53.0%
Taylor expanded in d around 0 3.7%
pow13.7%
associate-*l*3.7%
pow1/23.7%
inv-pow3.7%
pow-pow3.7%
metadata-eval3.7%
associate-*r*3.7%
div-inv3.7%
metadata-eval3.7%
Applied egg-rr3.7%
Simplified3.8%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt70.0%
mul-1-neg70.0%
Simplified70.0%
if -9.99999999999999909e-308 < l < 1.29999999999999994e49Initial program 71.9%
Simplified69.7%
add-sqr-sqrt69.7%
pow269.7%
sqrt-prod69.7%
sqrt-pow171.0%
frac-times73.2%
associate-/r*73.2%
metadata-eval73.2%
pow173.2%
div-inv73.2%
*-commutative73.2%
associate-*r*73.2%
div-inv73.2%
associate-*r/71.9%
associate-/l/71.9%
*-un-lft-identity71.9%
*-commutative71.9%
times-frac71.9%
metadata-eval71.9%
Applied egg-rr71.9%
Taylor expanded in d around 0 78.9%
associate-/r*78.9%
Simplified78.9%
pow178.9%
Applied egg-rr78.9%
unpow178.9%
*-commutative78.9%
associate-*r/78.9%
*-commutative78.9%
associate-/l*78.0%
associate-*l/78.0%
associate-*r/88.8%
associate-/r/88.8%
Simplified88.8%
if 1.29999999999999994e49 < l Initial program 52.4%
Simplified54.7%
clear-num52.5%
un-div-inv52.5%
Applied egg-rr54.7%
*-commutative54.7%
sqrt-div63.0%
sqrt-div76.9%
frac-times77.0%
add-sqr-sqrt77.2%
Applied egg-rr77.2%
Final simplification76.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 -1e-307)
(*
d
(*
(sqrt (/ 1.0 (* h l)))
(+ (* h (* (pow (* D_m (* 0.5 (/ M d))) 2.0) (/ 0.5 l))) -1.0)))
(if (<= l 4.8e+16)
(*
d
(*
(pow (* h l) -0.5)
(+ 1.0 (* -0.5 (/ (* h (pow (* M (/ 0.5 (/ d D_m))) 2.0)) l)))))
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D_m d)) 2.0))))
(/ d (* (sqrt l) (sqrt h)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -1e-307) {
tmp = d * (sqrt((1.0 / (h * l))) * ((h * (pow((D_m * (0.5 * (M / d))), 2.0) * (0.5 / l))) + -1.0));
} else if (l <= 4.8e+16) {
tmp = d * (pow((h * l), -0.5) * (1.0 + (-0.5 * ((h * pow((M * (0.5 / (d / D_m))), 2.0)) / l))));
} else {
tmp = (1.0 - (0.5 * ((h / l) * pow(((M / 2.0) * (D_m / d)), 2.0)))) * (d / (sqrt(l) * sqrt(h)));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-1d-307)) then
tmp = d * (sqrt((1.0d0 / (h * l))) * ((h * (((d_m * (0.5d0 * (m / d))) ** 2.0d0) * (0.5d0 / l))) + (-1.0d0)))
else if (l <= 4.8d+16) then
tmp = d * (((h * l) ** (-0.5d0)) * (1.0d0 + ((-0.5d0) * ((h * ((m * (0.5d0 / (d / d_m))) ** 2.0d0)) / l))))
else
tmp = (1.0d0 - (0.5d0 * ((h / l) * (((m / 2.0d0) * (d_m / d)) ** 2.0d0)))) * (d / (sqrt(l) * sqrt(h)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -1e-307) {
tmp = d * (Math.sqrt((1.0 / (h * l))) * ((h * (Math.pow((D_m * (0.5 * (M / d))), 2.0) * (0.5 / l))) + -1.0));
} else if (l <= 4.8e+16) {
tmp = d * (Math.pow((h * l), -0.5) * (1.0 + (-0.5 * ((h * Math.pow((M * (0.5 / (d / D_m))), 2.0)) / l))));
} else {
tmp = (1.0 - (0.5 * ((h / l) * Math.pow(((M / 2.0) * (D_m / d)), 2.0)))) * (d / (Math.sqrt(l) * Math.sqrt(h)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if l <= -1e-307: tmp = d * (math.sqrt((1.0 / (h * l))) * ((h * (math.pow((D_m * (0.5 * (M / d))), 2.0) * (0.5 / l))) + -1.0)) elif l <= 4.8e+16: tmp = d * (math.pow((h * l), -0.5) * (1.0 + (-0.5 * ((h * math.pow((M * (0.5 / (d / D_m))), 2.0)) / l)))) else: tmp = (1.0 - (0.5 * ((h / l) * math.pow(((M / 2.0) * (D_m / d)), 2.0)))) * (d / (math.sqrt(l) * math.sqrt(h))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= -1e-307) tmp = Float64(d * Float64(sqrt(Float64(1.0 / Float64(h * l))) * Float64(Float64(h * Float64((Float64(D_m * Float64(0.5 * Float64(M / d))) ^ 2.0) * Float64(0.5 / l))) + -1.0))); elseif (l <= 4.8e+16) tmp = Float64(d * Float64((Float64(h * l) ^ -0.5) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h * (Float64(M * Float64(0.5 / Float64(d / D_m))) ^ 2.0)) / l))))); else tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.0)))) * Float64(d / Float64(sqrt(l) * sqrt(h)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= -1e-307)
tmp = d * (sqrt((1.0 / (h * l))) * ((h * (((D_m * (0.5 * (M / d))) ^ 2.0) * (0.5 / l))) + -1.0));
elseif (l <= 4.8e+16)
tmp = d * (((h * l) ^ -0.5) * (1.0 + (-0.5 * ((h * ((M * (0.5 / (d / D_m))) ^ 2.0)) / l))));
else
tmp = (1.0 - (0.5 * ((h / l) * (((M / 2.0) * (D_m / d)) ^ 2.0)))) * (d / (sqrt(l) * sqrt(h)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -1e-307], N[(d * N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(h * N[(N[Power[N[(D$95$m * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.8e+16], N[(d * N[(N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h * N[Power[N[(M * N[(0.5 / N[(d / D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1 \cdot 10^{-307}:\\
\;\;\;\;d \cdot \left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(h \cdot \left({\left(D\_m \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \frac{0.5}{\ell}\right) + -1\right)\right)\\
\mathbf{elif}\;\ell \leq 4.8 \cdot 10^{+16}:\\
\;\;\;\;d \cdot \left({\left(h \cdot \ell\right)}^{-0.5} \cdot \left(1 + -0.5 \cdot \frac{h \cdot {\left(M \cdot \frac{0.5}{\frac{d}{D\_m}}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -9.99999999999999909e-308Initial program 53.8%
Simplified53.0%
Taylor expanded in d around 0 3.7%
pow13.7%
associate-*l*3.7%
pow1/23.7%
inv-pow3.7%
pow-pow3.7%
metadata-eval3.7%
associate-*r*3.7%
div-inv3.7%
metadata-eval3.7%
Applied egg-rr3.7%
Simplified3.8%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt70.0%
mul-1-neg70.0%
Simplified70.0%
if -9.99999999999999909e-308 < l < 4.8e16Initial program 68.5%
Simplified66.8%
add-sqr-sqrt66.9%
pow266.9%
sqrt-prod66.8%
sqrt-pow168.4%
frac-times70.1%
associate-/r*70.1%
metadata-eval70.1%
pow170.1%
div-inv70.1%
*-commutative70.1%
associate-*r*70.1%
div-inv70.1%
associate-*r/68.6%
associate-/l/68.6%
*-un-lft-identity68.6%
*-commutative68.6%
times-frac68.6%
metadata-eval68.6%
Applied egg-rr68.6%
Taylor expanded in d around 0 75.3%
associate-/r*75.3%
Simplified75.3%
pow175.3%
Applied egg-rr75.3%
unpow175.3%
*-commutative75.3%
associate-*r/75.3%
*-commutative75.3%
associate-/l*75.1%
associate-*l/75.1%
associate-*r/87.7%
associate-/r/87.7%
Simplified87.7%
if 4.8e16 < l Initial program 60.1%
Simplified61.0%
*-commutative62.0%
sqrt-div68.5%
sqrt-div81.3%
frac-times81.6%
add-sqr-sqrt81.7%
Applied egg-rr80.8%
Final simplification76.7%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* h (* (pow (* D_m (* 0.5 (/ M d))) 2.0) (/ 0.5 l)))))
(if (<= l -1e-311)
(* d (* (sqrt (/ 1.0 (* h l))) (+ t_0 -1.0)))
(* d (* (- 1.0 t_0) (* (pow l -0.5) (pow h -0.5)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = h * (pow((D_m * (0.5 * (M / d))), 2.0) * (0.5 / l));
double tmp;
if (l <= -1e-311) {
tmp = d * (sqrt((1.0 / (h * l))) * (t_0 + -1.0));
} else {
tmp = d * ((1.0 - t_0) * (pow(l, -0.5) * pow(h, -0.5)));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = h * (((d_m * (0.5d0 * (m / d))) ** 2.0d0) * (0.5d0 / l))
if (l <= (-1d-311)) then
tmp = d * (sqrt((1.0d0 / (h * l))) * (t_0 + (-1.0d0)))
else
tmp = d * ((1.0d0 - t_0) * ((l ** (-0.5d0)) * (h ** (-0.5d0))))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = h * (Math.pow((D_m * (0.5 * (M / d))), 2.0) * (0.5 / l));
double tmp;
if (l <= -1e-311) {
tmp = d * (Math.sqrt((1.0 / (h * l))) * (t_0 + -1.0));
} else {
tmp = d * ((1.0 - t_0) * (Math.pow(l, -0.5) * Math.pow(h, -0.5)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = h * (math.pow((D_m * (0.5 * (M / d))), 2.0) * (0.5 / l)) tmp = 0 if l <= -1e-311: tmp = d * (math.sqrt((1.0 / (h * l))) * (t_0 + -1.0)) else: tmp = d * ((1.0 - t_0) * (math.pow(l, -0.5) * math.pow(h, -0.5))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(h * Float64((Float64(D_m * Float64(0.5 * Float64(M / d))) ^ 2.0) * Float64(0.5 / l))) tmp = 0.0 if (l <= -1e-311) tmp = Float64(d * Float64(sqrt(Float64(1.0 / Float64(h * l))) * Float64(t_0 + -1.0))); else tmp = Float64(d * Float64(Float64(1.0 - t_0) * Float64((l ^ -0.5) * (h ^ -0.5)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = h * (((D_m * (0.5 * (M / d))) ^ 2.0) * (0.5 / l));
tmp = 0.0;
if (l <= -1e-311)
tmp = d * (sqrt((1.0 / (h * l))) * (t_0 + -1.0));
else
tmp = d * ((1.0 - t_0) * ((l ^ -0.5) * (h ^ -0.5)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(h * N[(N[Power[N[(D$95$m * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1e-311], N[(d * N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(1.0 - t$95$0), $MachinePrecision] * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := h \cdot \left({\left(D\_m \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \frac{0.5}{\ell}\right)\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-311}:\\
\;\;\;\;d \cdot \left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(t\_0 + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left(\left(1 - t\_0\right) \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\right)\\
\end{array}
\end{array}
if l < -9.99999999999948e-312Initial program 53.4%
Simplified52.7%
Taylor expanded in d around 0 3.7%
pow13.7%
associate-*l*3.7%
pow1/23.7%
inv-pow3.7%
pow-pow3.7%
metadata-eval3.7%
associate-*r*3.7%
div-inv3.7%
metadata-eval3.7%
Applied egg-rr3.7%
Simplified4.5%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt69.5%
mul-1-neg69.5%
Simplified69.5%
if -9.99999999999948e-312 < l Initial program 65.2%
Simplified64.7%
Taylor expanded in d around 0 69.5%
pow169.5%
associate-*l*70.4%
pow1/270.4%
inv-pow70.4%
pow-pow70.4%
metadata-eval70.4%
associate-*r*70.4%
div-inv70.4%
metadata-eval70.4%
Applied egg-rr70.4%
Simplified80.2%
*-commutative80.2%
unpow-prod-down92.2%
Applied egg-rr92.2%
Final simplification79.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 (- 1.0 (* h (* (pow (* D_m (* 0.5 (/ M d))) 2.0) (/ 0.5 l))))))
(if (<= l -1.15e-75)
(* (- d) (sqrt (/ (/ 1.0 l) h)))
(if (<= l -4.7e-300)
(* t_0 (sqrt (* (/ d l) (/ d h))))
(* d (* t_0 (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 t_0 = 1.0 - (h * (pow((D_m * (0.5 * (M / d))), 2.0) * (0.5 / l)));
double tmp;
if (l <= -1.15e-75) {
tmp = -d * sqrt(((1.0 / l) / h));
} else if (l <= -4.7e-300) {
tmp = t_0 * sqrt(((d / l) * (d / h)));
} else {
tmp = d * (t_0 * 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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (h * (((d_m * (0.5d0 * (m / d))) ** 2.0d0) * (0.5d0 / l)))
if (l <= (-1.15d-75)) then
tmp = -d * sqrt(((1.0d0 / l) / h))
else if (l <= (-4.7d-300)) then
tmp = t_0 * sqrt(((d / l) * (d / h)))
else
tmp = d * (t_0 * 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 t_0 = 1.0 - (h * (Math.pow((D_m * (0.5 * (M / d))), 2.0) * (0.5 / l)));
double tmp;
if (l <= -1.15e-75) {
tmp = -d * Math.sqrt(((1.0 / l) / h));
} else if (l <= -4.7e-300) {
tmp = t_0 * Math.sqrt(((d / l) * (d / h)));
} else {
tmp = d * (t_0 * 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): t_0 = 1.0 - (h * (math.pow((D_m * (0.5 * (M / d))), 2.0) * (0.5 / l))) tmp = 0 if l <= -1.15e-75: tmp = -d * math.sqrt(((1.0 / l) / h)) elif l <= -4.7e-300: tmp = t_0 * math.sqrt(((d / l) * (d / h))) else: tmp = d * (t_0 * 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) t_0 = Float64(1.0 - Float64(h * Float64((Float64(D_m * Float64(0.5 * Float64(M / d))) ^ 2.0) * Float64(0.5 / l)))) tmp = 0.0 if (l <= -1.15e-75) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h))); elseif (l <= -4.7e-300) tmp = Float64(t_0 * sqrt(Float64(Float64(d / l) * Float64(d / h)))); else tmp = Float64(d * Float64(t_0 * 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)
t_0 = 1.0 - (h * (((D_m * (0.5 * (M / d))) ^ 2.0) * (0.5 / l)));
tmp = 0.0;
if (l <= -1.15e-75)
tmp = -d * sqrt(((1.0 / l) / h));
elseif (l <= -4.7e-300)
tmp = t_0 * sqrt(((d / l) * (d / h)));
else
tmp = d * (t_0 * 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_] := Block[{t$95$0 = N[(1.0 - N[(h * N[(N[Power[N[(D$95$m * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.15e-75], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -4.7e-300], N[(t$95$0 * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(t$95$0 * N[Sqrt[N[(1.0 / N[(h * 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 := 1 - h \cdot \left({\left(D\_m \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \frac{0.5}{\ell}\right)\\
\mathbf{if}\;\ell \leq -1.15 \cdot 10^{-75}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{elif}\;\ell \leq -4.7 \cdot 10^{-300}:\\
\;\;\;\;t\_0 \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left(t\_0 \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)\\
\end{array}
\end{array}
if l < -1.15e-75Initial program 49.0%
Simplified47.8%
add-sqr-sqrt47.8%
pow247.8%
sqrt-prod47.8%
sqrt-pow152.4%
frac-times53.6%
associate-/r*53.6%
metadata-eval53.6%
pow153.6%
div-inv53.6%
*-commutative53.6%
associate-*r*53.6%
div-inv53.6%
associate-*r/53.5%
associate-/l/53.5%
*-un-lft-identity53.5%
*-commutative53.5%
times-frac53.5%
metadata-eval53.5%
Applied egg-rr53.5%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt48.8%
mul-1-neg48.8%
*-commutative48.8%
associate-/r*49.5%
Simplified49.5%
if -1.15e-75 < l < -4.7e-300Initial program 64.8%
Simplified64.8%
add-sqr-sqrt64.8%
pow264.8%
sqrt-prod64.8%
sqrt-pow164.8%
frac-times64.8%
associate-/r*64.8%
metadata-eval64.8%
pow164.8%
div-inv64.8%
*-commutative64.8%
associate-*r*64.8%
div-inv64.8%
associate-*r/64.8%
associate-/l/64.8%
*-un-lft-identity64.8%
*-commutative64.8%
times-frac64.8%
metadata-eval64.8%
Applied egg-rr64.8%
cancel-sign-sub-inv64.8%
unpow-prod-down64.8%
pow264.8%
add-sqr-sqrt64.8%
clear-num64.9%
div-inv66.2%
cancel-sign-sub-inv66.2%
pow166.2%
Applied egg-rr61.7%
Simplified64.1%
if -4.7e-300 < l Initial program 63.5%
Simplified63.0%
Taylor expanded in d around 0 67.8%
pow167.8%
associate-*l*68.6%
pow1/268.6%
inv-pow68.6%
pow-pow68.6%
metadata-eval68.6%
associate-*r*68.6%
div-inv68.6%
metadata-eval68.6%
Applied egg-rr68.6%
Simplified79.1%
Taylor expanded in h around 0 79.1%
Final simplification66.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
(let* ((t_0 (* h (* (pow (* D_m (* 0.5 (/ M d))) 2.0) (/ 0.5 l))))
(t_1 (sqrt (/ 1.0 (* h l)))))
(if (<= l -1e-307) (* d (* t_1 (+ t_0 -1.0))) (* d (* (- 1.0 t_0) t_1)))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = h * (pow((D_m * (0.5 * (M / d))), 2.0) * (0.5 / l));
double t_1 = sqrt((1.0 / (h * l)));
double tmp;
if (l <= -1e-307) {
tmp = d * (t_1 * (t_0 + -1.0));
} else {
tmp = d * ((1.0 - t_0) * t_1);
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = h * (((d_m * (0.5d0 * (m / d))) ** 2.0d0) * (0.5d0 / l))
t_1 = sqrt((1.0d0 / (h * l)))
if (l <= (-1d-307)) then
tmp = d * (t_1 * (t_0 + (-1.0d0)))
else
tmp = d * ((1.0d0 - t_0) * t_1)
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = h * (Math.pow((D_m * (0.5 * (M / d))), 2.0) * (0.5 / l));
double t_1 = Math.sqrt((1.0 / (h * l)));
double tmp;
if (l <= -1e-307) {
tmp = d * (t_1 * (t_0 + -1.0));
} else {
tmp = d * ((1.0 - t_0) * t_1);
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = h * (math.pow((D_m * (0.5 * (M / d))), 2.0) * (0.5 / l)) t_1 = math.sqrt((1.0 / (h * l))) tmp = 0 if l <= -1e-307: tmp = d * (t_1 * (t_0 + -1.0)) else: tmp = d * ((1.0 - t_0) * t_1) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(h * Float64((Float64(D_m * Float64(0.5 * Float64(M / d))) ^ 2.0) * Float64(0.5 / l))) t_1 = sqrt(Float64(1.0 / Float64(h * l))) tmp = 0.0 if (l <= -1e-307) tmp = Float64(d * Float64(t_1 * Float64(t_0 + -1.0))); else tmp = Float64(d * Float64(Float64(1.0 - t_0) * t_1)); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = h * (((D_m * (0.5 * (M / d))) ^ 2.0) * (0.5 / l));
t_1 = sqrt((1.0 / (h * l)));
tmp = 0.0;
if (l <= -1e-307)
tmp = d * (t_1 * (t_0 + -1.0));
else
tmp = d * ((1.0 - t_0) * t_1);
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(h * N[(N[Power[N[(D$95$m * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1e-307], N[(d * N[(t$95$1 * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(1.0 - t$95$0), $MachinePrecision] * t$95$1), $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 := h \cdot \left({\left(D\_m \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \frac{0.5}{\ell}\right)\\
t_1 := \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-307}:\\
\;\;\;\;d \cdot \left(t\_1 \cdot \left(t\_0 + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left(\left(1 - t\_0\right) \cdot t\_1\right)\\
\end{array}
\end{array}
if l < -9.99999999999999909e-308Initial program 53.8%
Simplified53.0%
Taylor expanded in d around 0 3.7%
pow13.7%
associate-*l*3.7%
pow1/23.7%
inv-pow3.7%
pow-pow3.7%
metadata-eval3.7%
associate-*r*3.7%
div-inv3.7%
metadata-eval3.7%
Applied egg-rr3.7%
Simplified3.8%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt70.0%
mul-1-neg70.0%
Simplified70.0%
if -9.99999999999999909e-308 < l Initial program 64.6%
Simplified64.1%
Taylor expanded in d around 0 68.9%
pow168.9%
associate-*l*69.8%
pow1/269.8%
inv-pow69.8%
pow-pow69.8%
metadata-eval69.8%
associate-*r*69.8%
div-inv69.8%
metadata-eval69.8%
Applied egg-rr69.8%
Simplified80.4%
Taylor expanded in h around 0 80.4%
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
(if (<= l -4.7e-300)
(* (- d) (sqrt (/ (/ 1.0 l) h)))
(*
d
(*
(- 1.0 (* h (* (pow (* D_m (* 0.5 (/ M d))) 2.0) (/ 0.5 l))))
(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 <= -4.7e-300) {
tmp = -d * sqrt(((1.0 / l) / h));
} else {
tmp = d * ((1.0 - (h * (pow((D_m * (0.5 * (M / d))), 2.0) * (0.5 / l)))) * 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 <= (-4.7d-300)) then
tmp = -d * sqrt(((1.0d0 / l) / h))
else
tmp = d * ((1.0d0 - (h * (((d_m * (0.5d0 * (m / d))) ** 2.0d0) * (0.5d0 / l)))) * 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 <= -4.7e-300) {
tmp = -d * Math.sqrt(((1.0 / l) / h));
} else {
tmp = d * ((1.0 - (h * (Math.pow((D_m * (0.5 * (M / d))), 2.0) * (0.5 / l)))) * 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 <= -4.7e-300: tmp = -d * math.sqrt(((1.0 / l) / h)) else: tmp = d * ((1.0 - (h * (math.pow((D_m * (0.5 * (M / d))), 2.0) * (0.5 / l)))) * 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 <= -4.7e-300) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h))); else tmp = Float64(d * Float64(Float64(1.0 - Float64(h * Float64((Float64(D_m * Float64(0.5 * Float64(M / d))) ^ 2.0) * Float64(0.5 / l)))) * 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 <= -4.7e-300)
tmp = -d * sqrt(((1.0 / l) / h));
else
tmp = d * ((1.0 - (h * (((D_m * (0.5 * (M / d))) ^ 2.0) * (0.5 / l)))) * 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, -4.7e-300], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(1.0 - N[(h * N[(N[Power[N[(D$95$m * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(h * 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}
\mathbf{if}\;\ell \leq -4.7 \cdot 10^{-300}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left(\left(1 - h \cdot \left({\left(D\_m \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \frac{0.5}{\ell}\right)\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)\\
\end{array}
\end{array}
if l < -4.7e-300Initial program 54.6%
Simplified53.8%
add-sqr-sqrt53.8%
pow253.8%
sqrt-prod53.8%
sqrt-pow156.8%
frac-times57.6%
associate-/r*57.6%
metadata-eval57.6%
pow157.6%
div-inv57.6%
*-commutative57.6%
associate-*r*57.6%
div-inv57.6%
associate-*r/57.5%
associate-/l/57.5%
*-un-lft-identity57.5%
*-commutative57.5%
times-frac57.5%
metadata-eval57.5%
Applied egg-rr57.5%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt45.0%
mul-1-neg45.0%
*-commutative45.0%
associate-/r*45.5%
Simplified45.5%
if -4.7e-300 < l Initial program 63.5%
Simplified63.0%
Taylor expanded in d around 0 67.8%
pow167.8%
associate-*l*68.6%
pow1/268.6%
inv-pow68.6%
pow-pow68.6%
metadata-eval68.6%
associate-*r*68.6%
div-inv68.6%
metadata-eval68.6%
Applied egg-rr68.6%
Simplified79.1%
Taylor expanded in h around 0 79.1%
Final simplification61.3%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* D_m (/ (* M 0.5) d))))
(if (<= l -4.7e-300)
(* (- d) (sqrt (/ (/ 1.0 l) h)))
(* d (* (pow (* h l) -0.5) (- 1.0 (* h (* (/ 0.5 l) (* t_0 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 = D_m * ((M * 0.5) / d);
double tmp;
if (l <= -4.7e-300) {
tmp = -d * sqrt(((1.0 / l) / h));
} else {
tmp = d * (pow((h * l), -0.5) * (1.0 - (h * ((0.5 / l) * (t_0 * 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 = d_m * ((m * 0.5d0) / d)
if (l <= (-4.7d-300)) then
tmp = -d * sqrt(((1.0d0 / l) / h))
else
tmp = d * (((h * l) ** (-0.5d0)) * (1.0d0 - (h * ((0.5d0 / l) * (t_0 * 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 = D_m * ((M * 0.5) / d);
double tmp;
if (l <= -4.7e-300) {
tmp = -d * Math.sqrt(((1.0 / l) / h));
} else {
tmp = d * (Math.pow((h * l), -0.5) * (1.0 - (h * ((0.5 / l) * (t_0 * 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 = D_m * ((M * 0.5) / d) tmp = 0 if l <= -4.7e-300: tmp = -d * math.sqrt(((1.0 / l) / h)) else: tmp = d * (math.pow((h * l), -0.5) * (1.0 - (h * ((0.5 / l) * (t_0 * t_0))))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(D_m * Float64(Float64(M * 0.5) / d)) tmp = 0.0 if (l <= -4.7e-300) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h))); else tmp = Float64(d * Float64((Float64(h * l) ^ -0.5) * Float64(1.0 - Float64(h * Float64(Float64(0.5 / l) * Float64(t_0 * 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 = D_m * ((M * 0.5) / d);
tmp = 0.0;
if (l <= -4.7e-300)
tmp = -d * sqrt(((1.0 / l) / h));
else
tmp = d * (((h * l) ^ -0.5) * (1.0 - (h * ((0.5 / l) * (t_0 * 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[(D$95$m * N[(N[(M * 0.5), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -4.7e-300], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision] * N[(1.0 - N[(h * N[(N[(0.5 / l), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $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 := D\_m \cdot \frac{M \cdot 0.5}{d}\\
\mathbf{if}\;\ell \leq -4.7 \cdot 10^{-300}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\left(h \cdot \ell\right)}^{-0.5} \cdot \left(1 - h \cdot \left(\frac{0.5}{\ell} \cdot \left(t\_0 \cdot t\_0\right)\right)\right)\right)\\
\end{array}
\end{array}
if l < -4.7e-300Initial program 54.6%
Simplified53.8%
add-sqr-sqrt53.8%
pow253.8%
sqrt-prod53.8%
sqrt-pow156.8%
frac-times57.6%
associate-/r*57.6%
metadata-eval57.6%
pow157.6%
div-inv57.6%
*-commutative57.6%
associate-*r*57.6%
div-inv57.6%
associate-*r/57.5%
associate-/l/57.5%
*-un-lft-identity57.5%
*-commutative57.5%
times-frac57.5%
metadata-eval57.5%
Applied egg-rr57.5%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt45.0%
mul-1-neg45.0%
*-commutative45.0%
associate-/r*45.5%
Simplified45.5%
if -4.7e-300 < l Initial program 63.5%
Simplified63.0%
Taylor expanded in d around 0 67.8%
pow167.8%
associate-*l*68.6%
pow1/268.6%
inv-pow68.6%
pow-pow68.6%
metadata-eval68.6%
associate-*r*68.6%
div-inv68.6%
metadata-eval68.6%
Applied egg-rr68.6%
Simplified79.1%
unpow279.1%
associate-*r/79.1%
associate-*r/79.1%
Applied egg-rr79.1%
Final simplification61.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 (/ (/ 1.0 l) h)))) (if (<= l -4.8e-229) (* (- 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 / l) / h));
double tmp;
if (l <= -4.8e-229) {
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 / l) / h))
if (l <= (-4.8d-229)) 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 / l) / h));
double tmp;
if (l <= -4.8e-229) {
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 / l) / h)) tmp = 0 if l <= -4.8e-229: tmp = -d * t_0 else: tmp = d * t_0 return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(Float64(1.0 / l) / h)) tmp = 0.0 if (l <= -4.8e-229) 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 / l) / h));
tmp = 0.0;
if (l <= -4.8e-229)
tmp = -d * t_0;
else
tmp = d * t_0;
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -4.8e-229], N[((-d) * t$95$0), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{if}\;\ell \leq -4.8 \cdot 10^{-229}:\\
\;\;\;\;\left(-d\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
\end{array}
if l < -4.8e-229Initial program 51.4%
Simplified50.5%
add-sqr-sqrt50.5%
pow250.5%
sqrt-prod50.5%
sqrt-pow153.8%
frac-times54.7%
associate-/r*54.7%
metadata-eval54.7%
pow154.7%
div-inv54.7%
*-commutative54.7%
associate-*r*54.7%
div-inv54.7%
associate-*r/54.6%
associate-/l/54.6%
*-un-lft-identity54.6%
*-commutative54.6%
times-frac54.6%
metadata-eval54.6%
Applied egg-rr54.6%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt47.3%
mul-1-neg47.3%
*-commutative47.3%
associate-/r*47.8%
Simplified47.8%
if -4.8e-229 < l Initial program 65.6%
Simplified65.2%
add-sqr-sqrt65.2%
pow265.2%
sqrt-prod65.2%
sqrt-pow166.7%
frac-times67.1%
associate-/r*67.1%
metadata-eval67.1%
pow167.1%
div-inv67.1%
*-commutative67.1%
associate-*r*67.1%
div-inv67.1%
associate-*r/67.9%
associate-/l/67.9%
*-un-lft-identity67.9%
*-commutative67.9%
times-frac67.9%
metadata-eval67.9%
Applied egg-rr67.9%
Taylor expanded in d around inf 41.8%
*-commutative41.8%
associate-/r*42.1%
Simplified42.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 -4.6e-229) (* 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 <= -4.6e-229) {
tmp = d * -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 <= (-4.6d-229)) then
tmp = d * -((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 <= -4.6e-229) {
tmp = 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 <= -4.6e-229: tmp = 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 <= -4.6e-229) tmp = 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 = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= -4.6e-229)
tmp = d * -((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, -4.6e-229], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $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 -4.6 \cdot 10^{-229}:\\
\;\;\;\;d \cdot \left(-{\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.59999999999999992e-229Initial program 51.4%
Simplified50.5%
add-sqr-sqrt50.5%
pow250.5%
sqrt-prod50.5%
sqrt-pow153.8%
frac-times54.7%
associate-/r*54.7%
metadata-eval54.7%
pow154.7%
div-inv54.7%
*-commutative54.7%
associate-*r*54.7%
div-inv54.7%
associate-*r/54.6%
associate-/l/54.6%
*-un-lft-identity54.6%
*-commutative54.6%
times-frac54.6%
metadata-eval54.6%
Applied egg-rr54.6%
Taylor expanded in D around 0 54.7%
associate-*r*54.7%
associate-/l*54.6%
associate-*r*54.6%
*-commutative54.6%
associate-*r*54.6%
associate-/l*54.6%
associate-*l*54.6%
*-commutative54.6%
*-commutative54.6%
associate-/l*54.6%
Simplified54.6%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
rem-exp-log0.0%
exp-neg0.0%
unpow1/20.0%
exp-prod0.0%
distribute-lft-neg-out0.0%
distribute-rgt-neg-in0.0%
metadata-eval0.0%
exp-to-pow0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt47.4%
mul-1-neg47.4%
Simplified47.4%
if -4.59999999999999992e-229 < l Initial program 65.6%
Simplified65.2%
add-sqr-sqrt65.2%
pow265.2%
sqrt-prod65.2%
sqrt-pow166.7%
frac-times67.1%
associate-/r*67.1%
metadata-eval67.1%
pow167.1%
div-inv67.1%
*-commutative67.1%
associate-*r*67.1%
div-inv67.1%
associate-*r/67.9%
associate-/l/67.9%
*-un-lft-identity67.9%
*-commutative67.9%
times-frac67.9%
metadata-eval67.9%
Applied egg-rr67.9%
Taylor expanded in d around inf 41.8%
*-commutative41.8%
associate-/r*42.1%
Simplified42.1%
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 (* 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 58.8%
Simplified58.1%
add-sqr-sqrt58.1%
pow258.1%
sqrt-prod58.1%
sqrt-pow160.5%
frac-times61.1%
associate-/r*61.1%
metadata-eval61.1%
pow161.1%
div-inv61.1%
*-commutative61.1%
associate-*r*61.1%
div-inv61.1%
associate-*r/61.5%
associate-/l/61.5%
*-un-lft-identity61.5%
*-commutative61.5%
times-frac61.5%
metadata-eval61.5%
Applied egg-rr61.5%
Taylor expanded in d around inf 25.2%
*-commutative25.2%
associate-/r*25.3%
Simplified25.3%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (* d (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 58.8%
Simplified58.1%
add-sqr-sqrt58.1%
pow258.1%
sqrt-prod58.1%
sqrt-pow160.5%
frac-times61.1%
associate-/r*61.1%
metadata-eval61.1%
pow161.1%
div-inv61.1%
*-commutative61.1%
associate-*r*61.1%
div-inv61.1%
associate-*r/61.5%
associate-/l/61.5%
*-un-lft-identity61.5%
*-commutative61.5%
times-frac61.5%
metadata-eval61.5%
Applied egg-rr61.5%
Taylor expanded in d around inf 25.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 (* 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 58.8%
Simplified58.1%
add-sqr-sqrt58.1%
pow258.1%
sqrt-prod58.1%
sqrt-pow160.5%
frac-times61.1%
associate-/r*61.1%
metadata-eval61.1%
pow161.1%
div-inv61.1%
*-commutative61.1%
associate-*r*61.1%
div-inv61.1%
associate-*r/61.5%
associate-/l/61.5%
*-un-lft-identity61.5%
*-commutative61.5%
times-frac61.5%
metadata-eval61.5%
Applied egg-rr61.5%
Taylor expanded in D around 0 61.1%
associate-*r*61.1%
associate-/l*61.5%
associate-*r*61.5%
*-commutative61.5%
associate-*r*61.5%
associate-/l*61.5%
associate-*l*61.1%
*-commutative61.1%
*-commutative61.1%
associate-/l*61.1%
Simplified61.1%
Taylor expanded in d around inf 25.2%
rem-exp-log24.2%
exp-neg24.2%
unpow1/224.2%
exp-prod24.2%
distribute-lft-neg-out24.2%
distribute-rgt-neg-in24.2%
metadata-eval24.2%
exp-to-pow25.1%
Simplified25.1%
herbie shell --seed 2024166
(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)))))