
(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 20 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
(if (<= d -2.2e-113)
(*
(* (sqrt (/ d h)) (/ (sqrt (- d)) (sqrt (- l))))
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D_m d) (* M 0.5)) 2.0)) l))))
(if (<= d -1.06e-306)
(*
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(fma -0.5 (pow (* (* (* M D_m) (/ 0.5 d)) (sqrt (/ h l))) 2.0) 1.0))
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* M (* (/ D_m d) 0.5)) 2.0))))
(/ d (* (sqrt h) (sqrt l)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= -2.2e-113) {
tmp = (sqrt((d / h)) * (sqrt(-d) / sqrt(-l))) * (1.0 - (0.5 * ((h * pow(((D_m / d) * (M * 0.5)), 2.0)) / l)));
} else if (d <= -1.06e-306) {
tmp = (-d * sqrt(((1.0 / h) / l))) * fma(-0.5, pow((((M * D_m) * (0.5 / d)) * sqrt((h / l))), 2.0), 1.0);
} else {
tmp = (1.0 - (0.5 * ((h / l) * pow((M * ((D_m / d) * 0.5)), 2.0)))) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (d <= -2.2e-113) tmp = Float64(Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D_m / d) * Float64(M * 0.5)) ^ 2.0)) / l)))); elseif (d <= -1.06e-306) tmp = Float64(Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))) * fma(-0.5, (Float64(Float64(Float64(M * D_m) * Float64(0.5 / d)) * sqrt(Float64(h / l))) ^ 2.0), 1.0)); else tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(M * Float64(Float64(D_m / d) * 0.5)) ^ 2.0)))) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[d, -2.2e-113], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.06e-306], N[(N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(N[(M * D$95$m), $MachinePrecision] * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.2 \cdot 10^{-113}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D_m}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;d \leq -1.06 \cdot 10^{-306}:\\
\;\;\;\;\left(\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\right) \cdot \mathsf{fma}\left(-0.5, {\left(\left(\left(M \cdot D_m\right) \cdot \frac{0.5}{d}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(\frac{D_m}{d} \cdot 0.5\right)\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -2.20000000000000004e-113Initial program 72.2%
Simplified72.2%
associate-*r/77.4%
Applied egg-rr77.4%
frac-2neg77.4%
sqrt-div83.5%
Applied egg-rr83.5%
if -2.20000000000000004e-113 < d < -1.06e-306Initial program 43.3%
Simplified43.2%
associate-*r/43.4%
Applied egg-rr43.4%
expm1-log1p-u20.7%
expm1-udef11.0%
Applied egg-rr10.8%
expm1-def16.1%
expm1-log1p31.4%
+-commutative31.4%
fma-def31.4%
associate-*r/31.4%
associate-*l/31.3%
*-commutative31.3%
associate-*r/31.3%
*-commutative31.3%
associate-/l*31.4%
associate-*r/31.3%
Simplified31.3%
add-sqr-sqrt31.3%
pow231.3%
sqrt-prod31.3%
unpow231.3%
sqrt-prod21.7%
add-sqr-sqrt34.8%
associate-*r*34.9%
Applied egg-rr34.9%
Taylor expanded in d around -inf 67.1%
mul-1-neg67.1%
*-commutative67.1%
distribute-rgt-neg-in67.1%
associate-/r*67.1%
Simplified67.1%
if -1.06e-306 < d Initial program 59.8%
Simplified59.2%
Applied egg-rr31.1%
expm1-def46.7%
expm1-log1p77.9%
associate-*l*77.9%
*-commutative77.9%
associate-*l*77.9%
Simplified77.9%
Final simplification77.3%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= h -5e-310)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(*
(sqrt (/ d l))
(+ 1.0 (* (/ h l) (* (pow (* (/ M 2.0) (/ D_m d)) 2.0) -0.5)))))
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* M (* (/ D_m d) 0.5)) 2.0))))
(/ d (* (sqrt h) (sqrt l))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (h <= -5e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0 + ((h / l) * (pow(((M / 2.0) * (D_m / d)), 2.0) * -0.5))));
} else {
tmp = (1.0 - (0.5 * ((h / l) * pow((M * ((D_m / d) * 0.5)), 2.0)))) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: tmp
if (h <= (-5d-310)) then
tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0d0 + ((h / l) * ((((m / 2.0d0) * (d_m / d)) ** 2.0d0) * (-0.5d0)))))
else
tmp = (1.0d0 - (0.5d0 * ((h / l) * ((m * ((d_m / d) * 0.5d0)) ** 2.0d0)))) * (d / (sqrt(h) * sqrt(l)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (h <= -5e-310) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * (Math.sqrt((d / l)) * (1.0 + ((h / l) * (Math.pow(((M / 2.0) * (D_m / d)), 2.0) * -0.5))));
} else {
tmp = (1.0 - (0.5 * ((h / l) * Math.pow((M * ((D_m / d) * 0.5)), 2.0)))) * (d / (Math.sqrt(h) * Math.sqrt(l)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if h <= -5e-310: tmp = (math.sqrt(-d) / math.sqrt(-h)) * (math.sqrt((d / l)) * (1.0 + ((h / l) * (math.pow(((M / 2.0) * (D_m / d)), 2.0) * -0.5)))) else: tmp = (1.0 - (0.5 * ((h / l) * math.pow((M * ((D_m / d) * 0.5)), 2.0)))) * (d / (math.sqrt(h) * math.sqrt(l))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (h <= -5e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.0) * -0.5))))); else tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(M * Float64(Float64(D_m / d) * 0.5)) ^ 2.0)))) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (h <= -5e-310)
tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0 + ((h / l) * ((((M / 2.0) * (D_m / d)) ^ 2.0) * -0.5))));
else
tmp = (1.0 - (0.5 * ((h / l) * ((M * ((D_m / d) * 0.5)) ^ 2.0)))) * (d / (sqrt(h) * sqrt(l)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[h, -5e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D_m}{d}\right)}^{2} \cdot -0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(\frac{D_m}{d} \cdot 0.5\right)\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 59.7%
Simplified59.7%
frac-2neg36.1%
sqrt-div44.0%
Applied egg-rr73.9%
if -4.999999999999985e-310 < h Initial program 60.3%
Simplified59.6%
Applied egg-rr31.4%
expm1-def47.1%
expm1-log1p78.5%
associate-*l*78.5%
*-commutative78.5%
associate-*l*78.5%
Simplified78.5%
Final simplification76.1%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= h -5e-310)
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m 2.0) (/ M d)) 2.0))))
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l))))
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* M (* (/ D_m d) 0.5)) 2.0))))
(/ d (* (sqrt h) (sqrt l))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (h <= -5e-310) {
tmp = (1.0 - (0.5 * ((h / l) * pow(((D_m / 2.0) * (M / d)), 2.0)))) * ((sqrt(-d) / sqrt(-h)) * sqrt((d / l)));
} else {
tmp = (1.0 - (0.5 * ((h / l) * pow((M * ((D_m / d) * 0.5)), 2.0)))) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: tmp
if (h <= (-5d-310)) then
tmp = (1.0d0 - (0.5d0 * ((h / l) * (((d_m / 2.0d0) * (m / d)) ** 2.0d0)))) * ((sqrt(-d) / sqrt(-h)) * sqrt((d / l)))
else
tmp = (1.0d0 - (0.5d0 * ((h / l) * ((m * ((d_m / d) * 0.5d0)) ** 2.0d0)))) * (d / (sqrt(h) * sqrt(l)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (h <= -5e-310) {
tmp = (1.0 - (0.5 * ((h / l) * Math.pow(((D_m / 2.0) * (M / d)), 2.0)))) * ((Math.sqrt(-d) / Math.sqrt(-h)) * Math.sqrt((d / l)));
} else {
tmp = (1.0 - (0.5 * ((h / l) * Math.pow((M * ((D_m / d) * 0.5)), 2.0)))) * (d / (Math.sqrt(h) * Math.sqrt(l)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if h <= -5e-310: tmp = (1.0 - (0.5 * ((h / l) * math.pow(((D_m / 2.0) * (M / d)), 2.0)))) * ((math.sqrt(-d) / math.sqrt(-h)) * math.sqrt((d / l))) else: tmp = (1.0 - (0.5 * ((h / l) * math.pow((M * ((D_m / d) * 0.5)), 2.0)))) * (d / (math.sqrt(h) * math.sqrt(l))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (h <= -5e-310) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / 2.0) * Float64(M / d)) ^ 2.0)))) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l)))); else tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(M * Float64(Float64(D_m / d) * 0.5)) ^ 2.0)))) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (h <= -5e-310)
tmp = (1.0 - (0.5 * ((h / l) * (((D_m / 2.0) * (M / d)) ^ 2.0)))) * ((sqrt(-d) / sqrt(-h)) * sqrt((d / l)));
else
tmp = (1.0 - (0.5 * ((h / l) * ((M * ((D_m / d) * 0.5)) ^ 2.0)))) * (d / (sqrt(h) * sqrt(l)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[h, -5e-310], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / 2.0), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D_m}{2} \cdot \frac{M}{d}\right)}^{2}\right)\right) \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(\frac{D_m}{d} \cdot 0.5\right)\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 59.7%
Simplified59.7%
frac-2neg36.1%
sqrt-div44.0%
Applied egg-rr72.8%
if -4.999999999999985e-310 < h Initial program 60.3%
Simplified59.6%
Applied egg-rr31.4%
expm1-def47.1%
expm1-log1p78.5%
associate-*l*78.5%
*-commutative78.5%
associate-*l*78.5%
Simplified78.5%
Final simplification75.6%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= h -2.9e+195)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D_m d) (* M 0.5)) 2.0)) l)))
(* (sqrt (/ d l)) (sqrt (/ d h))))
(if (<= h -5e-310)
(*
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(fma -0.5 (pow (* (* (* M D_m) (/ 0.5 d)) (sqrt (/ h l))) 2.0) 1.0))
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* M (* (/ D_m d) 0.5)) 2.0))))
(/ d (* (sqrt h) (sqrt l)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (h <= -2.9e+195) {
tmp = (1.0 - (0.5 * ((h * pow(((D_m / d) * (M * 0.5)), 2.0)) / l))) * (sqrt((d / l)) * sqrt((d / h)));
} else if (h <= -5e-310) {
tmp = (-d * sqrt(((1.0 / h) / l))) * fma(-0.5, pow((((M * D_m) * (0.5 / d)) * sqrt((h / l))), 2.0), 1.0);
} else {
tmp = (1.0 - (0.5 * ((h / l) * pow((M * ((D_m / d) * 0.5)), 2.0)))) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (h <= -2.9e+195) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D_m / d) * Float64(M * 0.5)) ^ 2.0)) / l))) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)))); elseif (h <= -5e-310) tmp = Float64(Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))) * fma(-0.5, (Float64(Float64(Float64(M * D_m) * Float64(0.5 / d)) * sqrt(Float64(h / l))) ^ 2.0), 1.0)); else tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(M * Float64(Float64(D_m / d) * 0.5)) ^ 2.0)))) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[h, -2.9e+195], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-310], N[(N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(N[(M * D$95$m), $MachinePrecision] * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -2.9 \cdot 10^{+195}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D_m}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\right) \cdot \mathsf{fma}\left(-0.5, {\left(\left(\left(M \cdot D_m\right) \cdot \frac{0.5}{d}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(\frac{D_m}{d} \cdot 0.5\right)\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -2.89999999999999992e195Initial program 50.3%
Simplified50.2%
associate-*r/59.0%
Applied egg-rr59.0%
if -2.89999999999999992e195 < h < -4.999999999999985e-310Initial program 63.0%
Simplified63.1%
associate-*r/64.1%
Applied egg-rr64.1%
expm1-log1p-u36.7%
expm1-udef25.4%
Applied egg-rr20.0%
expm1-def27.9%
expm1-log1p49.6%
+-commutative49.6%
fma-def49.6%
associate-*r/49.6%
associate-*l/49.6%
*-commutative49.6%
associate-*r/49.6%
*-commutative49.6%
associate-/l*50.7%
associate-*r/49.6%
Simplified49.6%
add-sqr-sqrt49.6%
pow249.6%
sqrt-prod49.6%
unpow249.6%
sqrt-prod32.4%
add-sqr-sqrt52.6%
associate-*r*53.5%
Applied egg-rr53.5%
Taylor expanded in d around -inf 77.9%
mul-1-neg77.9%
*-commutative77.9%
distribute-rgt-neg-in77.9%
associate-/r*77.9%
Simplified77.9%
if -4.999999999999985e-310 < h Initial program 60.3%
Simplified59.6%
Applied egg-rr31.4%
expm1-def47.1%
expm1-log1p78.5%
associate-*l*78.5%
*-commutative78.5%
associate-*l*78.5%
Simplified78.5%
Final simplification75.7%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= h -5.8e+224)
(*
(sqrt (/ (* d (/ d h)) l))
(+ 1.0 (* -0.5 (* h (/ (pow (/ (* D_m 0.5) (/ d M)) 2.0) l)))))
(if (<= h -5e-310)
(*
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(fma -0.5 (* (/ h l) (pow (* D_m (* M (/ 0.5 d))) 2.0)) 1.0))
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* M (* (/ D_m d) 0.5)) 2.0))))
(/ d (* (sqrt h) (sqrt l)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (h <= -5.8e+224) {
tmp = sqrt(((d * (d / h)) / l)) * (1.0 + (-0.5 * (h * (pow(((D_m * 0.5) / (d / M)), 2.0) / l))));
} else if (h <= -5e-310) {
tmp = (-d * sqrt(((1.0 / h) / l))) * fma(-0.5, ((h / l) * pow((D_m * (M * (0.5 / d))), 2.0)), 1.0);
} else {
tmp = (1.0 - (0.5 * ((h / l) * pow((M * ((D_m / d) * 0.5)), 2.0)))) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (h <= -5.8e+224) tmp = Float64(sqrt(Float64(Float64(d * Float64(d / h)) / l)) * Float64(1.0 + Float64(-0.5 * Float64(h * Float64((Float64(Float64(D_m * 0.5) / Float64(d / M)) ^ 2.0) / l))))); elseif (h <= -5e-310) tmp = Float64(Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))) * fma(-0.5, Float64(Float64(h / l) * (Float64(D_m * Float64(M * Float64(0.5 / d))) ^ 2.0)), 1.0)); else tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(M * Float64(Float64(D_m / d) * 0.5)) ^ 2.0)))) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[h, -5.8e+224], N[(N[Sqrt[N[(N[(d * N[(d / h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(h * N[(N[Power[N[(N[(D$95$m * 0.5), $MachinePrecision] / N[(d / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-310], N[(N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -5.8 \cdot 10^{+224}:\\
\;\;\;\;\sqrt{\frac{d \cdot \frac{d}{h}}{\ell}} \cdot \left(1 + -0.5 \cdot \left(h \cdot \frac{{\left(\frac{D_m \cdot 0.5}{\frac{d}{M}}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\right) \cdot \mathsf{fma}\left(-0.5, \frac{h}{\ell} \cdot {\left(D_m \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(\frac{D_m}{d} \cdot 0.5\right)\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -5.79999999999999978e224Initial program 50.5%
Simplified50.4%
associate-*r/63.7%
Applied egg-rr63.8%
expm1-log1p-u35.9%
expm1-udef18.5%
Applied egg-rr9.6%
Simplified59.3%
if -5.79999999999999978e224 < h < -4.999999999999985e-310Initial program 61.6%
Simplified61.6%
associate-*r/62.6%
Applied egg-rr62.6%
expm1-log1p-u35.4%
expm1-udef23.6%
Applied egg-rr18.8%
expm1-def27.6%
expm1-log1p48.7%
+-commutative48.7%
fma-def48.7%
associate-*r/48.7%
associate-*l/48.7%
*-commutative48.7%
associate-*r/48.7%
*-commutative48.7%
associate-/l*49.7%
associate-*r/48.7%
Simplified48.7%
Taylor expanded in d around -inf 71.5%
mul-1-neg74.2%
*-commutative74.2%
distribute-rgt-neg-in74.2%
associate-/r*74.2%
Simplified71.5%
if -4.999999999999985e-310 < h Initial program 60.3%
Simplified59.6%
Applied egg-rr31.4%
expm1-def47.1%
expm1-log1p78.5%
associate-*l*78.5%
*-commutative78.5%
associate-*l*78.5%
Simplified78.5%
Final simplification73.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 (pow (* D_m (* M (/ 0.5 d))) 2.0)))
(if (<= d -1.4e-110)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) (- 1.0 (* 0.5 (/ (* h t_0) l))))
(if (<= d -1.06e-306)
(* (* (- d) (sqrt (/ (/ 1.0 h) l))) (fma -0.5 (* (/ h l) t_0) 1.0))
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* M (* (/ D_m d) 0.5)) 2.0))))
(/ d (* (sqrt h) (sqrt l))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = pow((D_m * (M * (0.5 / d))), 2.0);
double tmp;
if (d <= -1.4e-110) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * ((h * t_0) / l)));
} else if (d <= -1.06e-306) {
tmp = (-d * sqrt(((1.0 / h) / l))) * fma(-0.5, ((h / l) * t_0), 1.0);
} else {
tmp = (1.0 - (0.5 * ((h / l) * pow((M * ((D_m / d) * 0.5)), 2.0)))) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(D_m * Float64(M * Float64(0.5 / d))) ^ 2.0 tmp = 0.0 if (d <= -1.4e-110) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * t_0) / l)))); elseif (d <= -1.06e-306) tmp = Float64(Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))) * fma(-0.5, Float64(Float64(h / l) * t_0), 1.0)); else tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(M * Float64(Float64(D_m / d) * 0.5)) ^ 2.0)))) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Power[N[(D$95$m * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[d, -1.4e-110], 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 * t$95$0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.06e-306], N[(N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-0.5 * N[(N[(h / l), $MachinePrecision] * t$95$0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := {\left(D_m \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}\\
\mathbf{if}\;d \leq -1.4 \cdot 10^{-110}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot t_0}{\ell}\right)\\
\mathbf{elif}\;d \leq -1.06 \cdot 10^{-306}:\\
\;\;\;\;\left(\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\right) \cdot \mathsf{fma}\left(-0.5, \frac{h}{\ell} \cdot t_0, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(\frac{D_m}{d} \cdot 0.5\right)\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.4e-110Initial program 72.2%
Simplified72.2%
associate-*r/77.4%
Applied egg-rr77.4%
Taylor expanded in M around 0 77.4%
associate-*r/77.4%
*-commutative77.4%
associate-*r/77.4%
associate-*l/77.4%
associate-*r/77.4%
associate-*r*77.4%
Simplified77.4%
if -1.4e-110 < d < -1.06e-306Initial program 43.3%
Simplified43.2%
associate-*r/43.4%
Applied egg-rr43.4%
expm1-log1p-u20.7%
expm1-udef11.0%
Applied egg-rr10.8%
expm1-def16.1%
expm1-log1p31.4%
+-commutative31.4%
fma-def31.4%
associate-*r/31.4%
associate-*l/31.3%
*-commutative31.3%
associate-*r/31.3%
*-commutative31.3%
associate-/l*31.4%
associate-*r/31.3%
Simplified31.3%
Taylor expanded in d around -inf 65.2%
mul-1-neg67.1%
*-commutative67.1%
distribute-rgt-neg-in67.1%
associate-/r*67.1%
Simplified65.2%
if -1.06e-306 < d Initial program 59.8%
Simplified59.2%
Applied egg-rr31.1%
expm1-def46.7%
expm1-log1p77.9%
associate-*l*77.9%
*-commutative77.9%
associate-*l*77.9%
Simplified77.9%
Final simplification75.0%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= d -2.8e-111)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D_m d) (* M 0.5)) 2.0)) l)))
(* (sqrt (/ d l)) (sqrt (/ d h))))
(if (<= d -1.06e-306)
(*
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(fma -0.5 (* (/ h l) (pow (* D_m (* M (/ 0.5 d))) 2.0)) 1.0))
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* M (* (/ D_m d) 0.5)) 2.0))))
(/ d (* (sqrt h) (sqrt l)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= -2.8e-111) {
tmp = (1.0 - (0.5 * ((h * pow(((D_m / d) * (M * 0.5)), 2.0)) / l))) * (sqrt((d / l)) * sqrt((d / h)));
} else if (d <= -1.06e-306) {
tmp = (-d * sqrt(((1.0 / h) / l))) * fma(-0.5, ((h / l) * pow((D_m * (M * (0.5 / d))), 2.0)), 1.0);
} else {
tmp = (1.0 - (0.5 * ((h / l) * pow((M * ((D_m / d) * 0.5)), 2.0)))) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (d <= -2.8e-111) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D_m / d) * Float64(M * 0.5)) ^ 2.0)) / l))) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)))); elseif (d <= -1.06e-306) tmp = Float64(Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))) * fma(-0.5, Float64(Float64(h / l) * (Float64(D_m * Float64(M * Float64(0.5 / d))) ^ 2.0)), 1.0)); else tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(M * Float64(Float64(D_m / d) * 0.5)) ^ 2.0)))) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[d, -2.8e-111], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.06e-306], N[(N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.8 \cdot 10^{-111}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D_m}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{elif}\;d \leq -1.06 \cdot 10^{-306}:\\
\;\;\;\;\left(\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\right) \cdot \mathsf{fma}\left(-0.5, \frac{h}{\ell} \cdot {\left(D_m \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(\frac{D_m}{d} \cdot 0.5\right)\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -2.79999999999999995e-111Initial program 72.2%
Simplified72.2%
associate-*r/77.4%
Applied egg-rr77.4%
if -2.79999999999999995e-111 < d < -1.06e-306Initial program 43.3%
Simplified43.2%
associate-*r/43.4%
Applied egg-rr43.4%
expm1-log1p-u20.7%
expm1-udef11.0%
Applied egg-rr10.8%
expm1-def16.1%
expm1-log1p31.4%
+-commutative31.4%
fma-def31.4%
associate-*r/31.4%
associate-*l/31.3%
*-commutative31.3%
associate-*r/31.3%
*-commutative31.3%
associate-/l*31.4%
associate-*r/31.3%
Simplified31.3%
Taylor expanded in d around -inf 65.2%
mul-1-neg67.1%
*-commutative67.1%
distribute-rgt-neg-in67.1%
associate-/r*67.1%
Simplified65.2%
if -1.06e-306 < d Initial program 59.8%
Simplified59.2%
Applied egg-rr31.1%
expm1-def46.7%
expm1-log1p77.9%
associate-*l*77.9%
*-commutative77.9%
associate-*l*77.9%
Simplified77.9%
Final simplification75.0%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= l -1.16e+14)
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
(if (<= l 6.5e-200)
(*
(sqrt (* (/ d l) (/ d h)))
(fma -0.5 (* h (/ (pow (/ M (/ (/ d D_m) 0.5)) 2.0) l)) 1.0))
(if (<= l 6.2e+132)
(*
(/ d (sqrt (* h l)))
(+ 1.0 (* -0.125 (* (/ h l) (pow (* M (/ D_m d)) 2.0)))))
(/ d (* (sqrt h) (sqrt l)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -1.16e+14) {
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l));
} else if (l <= 6.5e-200) {
tmp = sqrt(((d / l) * (d / h))) * fma(-0.5, (h * (pow((M / ((d / D_m) / 0.5)), 2.0) / l)), 1.0);
} else if (l <= 6.2e+132) {
tmp = (d / sqrt((h * l))) * (1.0 + (-0.125 * ((h / l) * pow((M * (D_m / d)), 2.0))));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= -1.16e+14) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))); elseif (l <= 6.5e-200) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * fma(-0.5, Float64(h * Float64((Float64(M / Float64(Float64(d / D_m) / 0.5)) ^ 2.0) / l)), 1.0)); elseif (l <= 6.2e+132) tmp = Float64(Float64(d / sqrt(Float64(h * l))) * Float64(1.0 + Float64(-0.125 * Float64(Float64(h / l) * (Float64(M * Float64(D_m / d)) ^ 2.0))))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -1.16e+14], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.5e-200], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.5 * N[(h * N[(N[Power[N[(M / N[(N[(d / D$95$m), $MachinePrecision] / 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.2e+132], N[(N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.16 \cdot 10^{+14}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq 6.5 \cdot 10^{-200}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \mathsf{fma}\left(-0.5, h \cdot \frac{{\left(\frac{M}{\frac{\frac{d}{D_m}}{0.5}}\right)}^{2}}{\ell}, 1\right)\\
\mathbf{elif}\;\ell \leq 6.2 \cdot 10^{+132}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + -0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \frac{D_m}{d}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.16e14Initial program 51.7%
Simplified51.7%
Taylor expanded in h around 0 39.7%
frac-2neg39.7%
sqrt-div53.3%
Applied egg-rr53.3%
if -1.16e14 < l < 6.5000000000000002e-200Initial program 68.4%
Simplified66.3%
associate-*r/71.9%
Applied egg-rr72.9%
expm1-log1p-u30.2%
expm1-udef24.3%
Applied egg-rr19.0%
expm1-def22.1%
expm1-log1p60.3%
+-commutative60.3%
fma-def60.3%
associate-/r/65.0%
*-commutative65.0%
associate-*r/66.0%
associate-/l*64.9%
*-commutative64.9%
associate-/l*64.9%
Simplified64.9%
if 6.5000000000000002e-200 < l < 6.1999999999999995e132Initial program 71.1%
Simplified72.9%
associate-*r/76.2%
Applied egg-rr74.5%
add-cbrt-cube67.9%
add-sqr-sqrt67.7%
cbrt-prod74.3%
Applied egg-rr74.3%
Applied egg-rr68.8%
*-rgt-identity68.8%
distribute-lft-out82.6%
*-commutative82.6%
associate-*l*82.6%
associate-*r*82.6%
metadata-eval82.6%
Simplified82.6%
if 6.1999999999999995e132 < l Initial program 38.4%
Simplified38.6%
Taylor expanded in h around 0 41.5%
*-rgt-identity41.5%
sqrt-prod39.3%
expm1-log1p-u37.4%
expm1-udef22.7%
frac-times13.0%
sqrt-div13.0%
sqrt-unprod28.6%
add-sqr-sqrt28.6%
Applied egg-rr28.6%
expm1-def43.5%
expm1-log1p46.5%
Simplified46.5%
*-commutative46.5%
sqrt-prod64.9%
Applied egg-rr64.9%
Final simplification65.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 -1900000000000.0)
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
(if (<= l 6.5e-200)
(*
(sqrt (* (/ d l) (/ d h)))
(fma -0.5 (/ (* h (pow (* (* M D_m) (/ 0.5 d)) 2.0)) l) 1.0))
(if (<= l 1.6e+137)
(*
(/ d (sqrt (* h l)))
(+ 1.0 (* -0.125 (* (/ h l) (pow (* M (/ D_m d)) 2.0)))))
(/ d (* (sqrt h) (sqrt l)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -1900000000000.0) {
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l));
} else if (l <= 6.5e-200) {
tmp = sqrt(((d / l) * (d / h))) * fma(-0.5, ((h * pow(((M * D_m) * (0.5 / d)), 2.0)) / l), 1.0);
} else if (l <= 1.6e+137) {
tmp = (d / sqrt((h * l))) * (1.0 + (-0.125 * ((h / l) * pow((M * (D_m / d)), 2.0))));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= -1900000000000.0) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))); elseif (l <= 6.5e-200) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * fma(-0.5, Float64(Float64(h * (Float64(Float64(M * D_m) * Float64(0.5 / d)) ^ 2.0)) / l), 1.0)); elseif (l <= 1.6e+137) tmp = Float64(Float64(d / sqrt(Float64(h * l))) * Float64(1.0 + Float64(-0.125 * Float64(Float64(h / l) * (Float64(M * Float64(D_m / d)) ^ 2.0))))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -1900000000000.0], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.5e-200], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.5 * N[(N[(h * N[Power[N[(N[(M * D$95$m), $MachinePrecision] * N[(0.5 / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.6e+137], N[(N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1900000000000:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq 6.5 \cdot 10^{-200}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \mathsf{fma}\left(-0.5, \frac{h \cdot {\left(\left(M \cdot D_m\right) \cdot \frac{0.5}{d}\right)}^{2}}{\ell}, 1\right)\\
\mathbf{elif}\;\ell \leq 1.6 \cdot 10^{+137}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + -0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \frac{D_m}{d}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.9e12Initial program 51.7%
Simplified51.7%
Taylor expanded in h around 0 39.7%
frac-2neg39.7%
sqrt-div53.3%
Applied egg-rr53.3%
if -1.9e12 < l < 6.5000000000000002e-200Initial program 68.4%
Simplified66.3%
associate-*r/71.9%
Applied egg-rr72.9%
expm1-log1p-u30.2%
expm1-udef24.3%
Applied egg-rr19.0%
expm1-def22.1%
expm1-log1p60.3%
+-commutative60.3%
fma-def60.3%
associate-*r/61.4%
associate-*l/59.2%
*-commutative59.2%
associate-*r/59.2%
*-commutative59.2%
associate-/l*64.8%
associate-*r/59.2%
Simplified59.2%
associate-*r/64.8%
associate-*r*67.0%
Applied egg-rr67.0%
if 6.5000000000000002e-200 < l < 1.60000000000000009e137Initial program 71.1%
Simplified72.9%
associate-*r/76.2%
Applied egg-rr74.5%
add-cbrt-cube67.9%
add-sqr-sqrt67.7%
cbrt-prod74.3%
Applied egg-rr74.3%
Applied egg-rr68.8%
*-rgt-identity68.8%
distribute-lft-out82.6%
*-commutative82.6%
associate-*l*82.6%
associate-*r*82.6%
metadata-eval82.6%
Simplified82.6%
if 1.60000000000000009e137 < l Initial program 38.4%
Simplified38.6%
Taylor expanded in h around 0 41.5%
*-rgt-identity41.5%
sqrt-prod39.3%
expm1-log1p-u37.4%
expm1-udef22.7%
frac-times13.0%
sqrt-div13.0%
sqrt-unprod28.6%
add-sqr-sqrt28.6%
Applied egg-rr28.6%
expm1-def43.5%
expm1-log1p46.5%
Simplified46.5%
*-commutative46.5%
sqrt-prod64.9%
Applied egg-rr64.9%
Final simplification66.6%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= l -3.2e+14)
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
(if (<= l 2.7e-304)
(*
(sqrt (* (/ d l) (/ d h)))
(fma -0.5 (/ (* h (pow (* (* M D_m) (/ 0.5 d)) 2.0)) l) 1.0))
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* M (* (/ D_m d) 0.5)) 2.0))))
(/ d (* (sqrt h) (sqrt l)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -3.2e+14) {
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l));
} else if (l <= 2.7e-304) {
tmp = sqrt(((d / l) * (d / h))) * fma(-0.5, ((h * pow(((M * D_m) * (0.5 / d)), 2.0)) / l), 1.0);
} else {
tmp = (1.0 - (0.5 * ((h / l) * pow((M * ((D_m / d) * 0.5)), 2.0)))) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= -3.2e+14) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))); elseif (l <= 2.7e-304) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * fma(-0.5, Float64(Float64(h * (Float64(Float64(M * D_m) * Float64(0.5 / d)) ^ 2.0)) / l), 1.0)); else tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(M * Float64(Float64(D_m / d) * 0.5)) ^ 2.0)))) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -3.2e+14], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.7e-304], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.5 * N[(N[(h * N[Power[N[(N[(M * D$95$m), $MachinePrecision] * N[(0.5 / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.2 \cdot 10^{+14}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq 2.7 \cdot 10^{-304}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \mathsf{fma}\left(-0.5, \frac{h \cdot {\left(\left(M \cdot D_m\right) \cdot \frac{0.5}{d}\right)}^{2}}{\ell}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(\frac{D_m}{d} \cdot 0.5\right)\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -3.2e14Initial program 51.7%
Simplified51.7%
Taylor expanded in h around 0 39.7%
frac-2neg39.7%
sqrt-div53.3%
Applied egg-rr53.3%
if -3.2e14 < l < 2.7000000000000001e-304Initial program 68.3%
Simplified68.4%
associate-*r/74.5%
Applied egg-rr74.5%
expm1-log1p-u32.5%
expm1-udef25.8%
Applied egg-rr18.6%
expm1-def22.9%
expm1-log1p58.6%
+-commutative58.6%
fma-def58.6%
associate-*r/58.7%
associate-*l/58.6%
*-commutative58.6%
associate-*r/58.6%
*-commutative58.6%
associate-/l*64.8%
associate-*r/58.6%
Simplified58.6%
associate-*r/64.8%
associate-*r*64.8%
Applied egg-rr64.8%
if 2.7000000000000001e-304 < l Initial program 60.1%
Simplified59.5%
Applied egg-rr31.3%
expm1-def47.4%
expm1-log1p78.8%
associate-*l*78.8%
*-commutative78.8%
associate-*l*78.8%
Simplified78.8%
Final simplification68.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 (sqrt (* h l))))
(if (<= l -1e+196)
(* (sqrt (/ d h)) (/ (sqrt (- d)) (sqrt (- l))))
(if (<= l -5.5e+58)
(/ d (- t_0))
(if (<= l 5.5e-303)
(*
(sqrt (/ (* d (/ d h)) l))
(+ 1.0 (* -0.5 (* h (/ (pow (/ (* D_m 0.5) (/ d M)) 2.0) l)))))
(if (<= l 2.4e+132)
(*
(/ d t_0)
(+ 1.0 (* -0.125 (* (/ h l) (pow (* M (/ D_m d)) 2.0)))))
(/ d (* (sqrt h) (sqrt l)))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt((h * l));
double tmp;
if (l <= -1e+196) {
tmp = sqrt((d / h)) * (sqrt(-d) / sqrt(-l));
} else if (l <= -5.5e+58) {
tmp = d / -t_0;
} else if (l <= 5.5e-303) {
tmp = sqrt(((d * (d / h)) / l)) * (1.0 + (-0.5 * (h * (pow(((D_m * 0.5) / (d / M)), 2.0) / l))));
} else if (l <= 2.4e+132) {
tmp = (d / t_0) * (1.0 + (-0.125 * ((h / l) * pow((M * (D_m / d)), 2.0))));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((h * l))
if (l <= (-1d+196)) then
tmp = sqrt((d / h)) * (sqrt(-d) / sqrt(-l))
else if (l <= (-5.5d+58)) then
tmp = d / -t_0
else if (l <= 5.5d-303) then
tmp = sqrt(((d * (d / h)) / l)) * (1.0d0 + ((-0.5d0) * (h * ((((d_m * 0.5d0) / (d / m)) ** 2.0d0) / l))))
else if (l <= 2.4d+132) then
tmp = (d / t_0) * (1.0d0 + ((-0.125d0) * ((h / l) * ((m * (d_m / d)) ** 2.0d0))))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.sqrt((h * l));
double tmp;
if (l <= -1e+196) {
tmp = Math.sqrt((d / h)) * (Math.sqrt(-d) / Math.sqrt(-l));
} else if (l <= -5.5e+58) {
tmp = d / -t_0;
} else if (l <= 5.5e-303) {
tmp = Math.sqrt(((d * (d / h)) / l)) * (1.0 + (-0.5 * (h * (Math.pow(((D_m * 0.5) / (d / M)), 2.0) / l))));
} else if (l <= 2.4e+132) {
tmp = (d / t_0) * (1.0 + (-0.125 * ((h / l) * Math.pow((M * (D_m / d)), 2.0))));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.sqrt((h * l)) tmp = 0 if l <= -1e+196: tmp = math.sqrt((d / h)) * (math.sqrt(-d) / math.sqrt(-l)) elif l <= -5.5e+58: tmp = d / -t_0 elif l <= 5.5e-303: tmp = math.sqrt(((d * (d / h)) / l)) * (1.0 + (-0.5 * (h * (math.pow(((D_m * 0.5) / (d / M)), 2.0) / l)))) elif l <= 2.4e+132: tmp = (d / t_0) * (1.0 + (-0.125 * ((h / l) * math.pow((M * (D_m / d)), 2.0)))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(h * l)) tmp = 0.0 if (l <= -1e+196) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))); elseif (l <= -5.5e+58) tmp = Float64(d / Float64(-t_0)); elseif (l <= 5.5e-303) tmp = Float64(sqrt(Float64(Float64(d * Float64(d / h)) / l)) * Float64(1.0 + Float64(-0.5 * Float64(h * Float64((Float64(Float64(D_m * 0.5) / Float64(d / M)) ^ 2.0) / l))))); elseif (l <= 2.4e+132) tmp = Float64(Float64(d / t_0) * Float64(1.0 + Float64(-0.125 * Float64(Float64(h / l) * (Float64(M * Float64(D_m / d)) ^ 2.0))))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = sqrt((h * l));
tmp = 0.0;
if (l <= -1e+196)
tmp = sqrt((d / h)) * (sqrt(-d) / sqrt(-l));
elseif (l <= -5.5e+58)
tmp = d / -t_0;
elseif (l <= 5.5e-303)
tmp = sqrt(((d * (d / h)) / l)) * (1.0 + (-0.5 * (h * ((((D_m * 0.5) / (d / M)) ^ 2.0) / l))));
elseif (l <= 2.4e+132)
tmp = (d / t_0) * (1.0 + (-0.125 * ((h / l) * ((M * (D_m / d)) ^ 2.0))));
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1e+196], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5.5e+58], N[(d / (-t$95$0)), $MachinePrecision], If[LessEqual[l, 5.5e-303], N[(N[Sqrt[N[(N[(d * N[(d / h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(h * N[(N[Power[N[(N[(D$95$m * 0.5), $MachinePrecision] / N[(d / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.4e+132], N[(N[(d / t$95$0), $MachinePrecision] * N[(1.0 + N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{+196}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\\
\mathbf{elif}\;\ell \leq -5.5 \cdot 10^{+58}:\\
\;\;\;\;\frac{d}{-t_0}\\
\mathbf{elif}\;\ell \leq 5.5 \cdot 10^{-303}:\\
\;\;\;\;\sqrt{\frac{d \cdot \frac{d}{h}}{\ell}} \cdot \left(1 + -0.5 \cdot \left(h \cdot \frac{{\left(\frac{D_m \cdot 0.5}{\frac{d}{M}}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{elif}\;\ell \leq 2.4 \cdot 10^{+132}:\\
\;\;\;\;\frac{d}{t_0} \cdot \left(1 + -0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \frac{D_m}{d}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -9.9999999999999995e195Initial program 56.6%
Simplified56.6%
Taylor expanded in h around 0 52.1%
frac-2neg56.8%
sqrt-div75.7%
Applied egg-rr65.8%
if -9.9999999999999995e195 < l < -5.4999999999999999e58Initial program 44.8%
Simplified44.7%
add-sqr-sqrt44.7%
pow244.7%
Applied egg-rr47.7%
associate-*r/50.4%
associate-*l*50.4%
*-commutative50.4%
associate-*l/47.6%
*-commutative47.6%
associate-*l*47.6%
associate-*l*47.6%
metadata-eval47.6%
associate-/r/47.6%
associate-/l*47.5%
associate-/r/47.6%
*-commutative47.6%
associate-/r*47.6%
metadata-eval47.6%
Simplified47.6%
clear-num47.6%
sqrt-div47.6%
metadata-eval47.6%
Applied egg-rr47.6%
Taylor expanded in d around -inf 53.8%
mul-1-neg53.8%
unpow-153.8%
metadata-eval53.8%
pow-sqr53.8%
rem-sqrt-square53.8%
rem-cube-cbrt53.1%
sqr-pow52.9%
fabs-sqr52.9%
sqr-pow53.1%
rem-cube-cbrt53.8%
*-commutative53.8%
Simplified53.8%
if -5.4999999999999999e58 < l < 5.50000000000000018e-303Initial program 67.4%
Simplified67.4%
associate-*r/72.5%
Applied egg-rr72.5%
expm1-log1p-u32.2%
expm1-udef23.1%
Applied egg-rr16.0%
Simplified56.0%
if 5.50000000000000018e-303 < l < 2.4000000000000001e132Initial program 70.4%
Simplified69.3%
associate-*r/72.9%
Applied egg-rr72.8%
add-cbrt-cube65.8%
add-sqr-sqrt65.7%
cbrt-prod72.6%
Applied egg-rr72.6%
Applied egg-rr57.7%
*-rgt-identity57.7%
distribute-lft-out78.4%
*-commutative78.4%
associate-*l*78.4%
associate-*r*78.4%
metadata-eval78.4%
Simplified78.4%
if 2.4000000000000001e132 < l Initial program 38.4%
Simplified38.6%
Taylor expanded in h around 0 41.5%
*-rgt-identity41.5%
sqrt-prod39.3%
expm1-log1p-u37.4%
expm1-udef22.7%
frac-times13.0%
sqrt-div13.0%
sqrt-unprod28.6%
add-sqr-sqrt28.6%
Applied egg-rr28.6%
expm1-def43.5%
expm1-log1p46.5%
Simplified46.5%
*-commutative46.5%
sqrt-prod64.9%
Applied egg-rr64.9%
Final simplification65.1%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= l -2.1e+15)
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
(if (<= l 1.3e-300)
(*
(sqrt (/ (* d (/ d h)) l))
(+ 1.0 (* -0.5 (* h (/ (pow (/ (* D_m 0.5) (/ d M)) 2.0) l)))))
(if (<= l 4.2e+130)
(*
(/ d (sqrt (* h l)))
(+ 1.0 (* -0.125 (* (/ h l) (pow (* M (/ D_m d)) 2.0)))))
(/ d (* (sqrt h) (sqrt l)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -2.1e+15) {
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l));
} else if (l <= 1.3e-300) {
tmp = sqrt(((d * (d / h)) / l)) * (1.0 + (-0.5 * (h * (pow(((D_m * 0.5) / (d / M)), 2.0) / l))));
} else if (l <= 4.2e+130) {
tmp = (d / sqrt((h * l))) * (1.0 + (-0.125 * ((h / l) * pow((M * (D_m / d)), 2.0))));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-2.1d+15)) then
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l))
else if (l <= 1.3d-300) then
tmp = sqrt(((d * (d / h)) / l)) * (1.0d0 + ((-0.5d0) * (h * ((((d_m * 0.5d0) / (d / m)) ** 2.0d0) / l))))
else if (l <= 4.2d+130) then
tmp = (d / sqrt((h * l))) * (1.0d0 + ((-0.125d0) * ((h / l) * ((m * (d_m / d)) ** 2.0d0))))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -2.1e+15) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * Math.sqrt((d / l));
} else if (l <= 1.3e-300) {
tmp = Math.sqrt(((d * (d / h)) / l)) * (1.0 + (-0.5 * (h * (Math.pow(((D_m * 0.5) / (d / M)), 2.0) / l))));
} else if (l <= 4.2e+130) {
tmp = (d / Math.sqrt((h * l))) * (1.0 + (-0.125 * ((h / l) * Math.pow((M * (D_m / d)), 2.0))));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if l <= -2.1e+15: tmp = (math.sqrt(-d) / math.sqrt(-h)) * math.sqrt((d / l)) elif l <= 1.3e-300: tmp = math.sqrt(((d * (d / h)) / l)) * (1.0 + (-0.5 * (h * (math.pow(((D_m * 0.5) / (d / M)), 2.0) / l)))) elif l <= 4.2e+130: tmp = (d / math.sqrt((h * l))) * (1.0 + (-0.125 * ((h / l) * math.pow((M * (D_m / d)), 2.0)))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= -2.1e+15) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))); elseif (l <= 1.3e-300) tmp = Float64(sqrt(Float64(Float64(d * Float64(d / h)) / l)) * Float64(1.0 + Float64(-0.5 * Float64(h * Float64((Float64(Float64(D_m * 0.5) / Float64(d / M)) ^ 2.0) / l))))); elseif (l <= 4.2e+130) tmp = Float64(Float64(d / sqrt(Float64(h * l))) * Float64(1.0 + Float64(-0.125 * Float64(Float64(h / l) * (Float64(M * Float64(D_m / d)) ^ 2.0))))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= -2.1e+15)
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l));
elseif (l <= 1.3e-300)
tmp = sqrt(((d * (d / h)) / l)) * (1.0 + (-0.5 * (h * ((((D_m * 0.5) / (d / M)) ^ 2.0) / l))));
elseif (l <= 4.2e+130)
tmp = (d / sqrt((h * l))) * (1.0 + (-0.125 * ((h / l) * ((M * (D_m / d)) ^ 2.0))));
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -2.1e+15], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.3e-300], N[(N[Sqrt[N[(N[(d * N[(d / h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(h * N[(N[Power[N[(N[(D$95$m * 0.5), $MachinePrecision] / N[(d / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.2e+130], N[(N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.1 \cdot 10^{+15}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq 1.3 \cdot 10^{-300}:\\
\;\;\;\;\sqrt{\frac{d \cdot \frac{d}{h}}{\ell}} \cdot \left(1 + -0.5 \cdot \left(h \cdot \frac{{\left(\frac{D_m \cdot 0.5}{\frac{d}{M}}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{elif}\;\ell \leq 4.2 \cdot 10^{+130}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + -0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \frac{D_m}{d}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.1e15Initial program 51.7%
Simplified51.7%
Taylor expanded in h around 0 39.7%
frac-2neg39.7%
sqrt-div53.3%
Applied egg-rr53.3%
if -2.1e15 < l < 1.29999999999999998e-300Initial program 68.3%
Simplified68.4%
associate-*r/74.5%
Applied egg-rr74.5%
expm1-log1p-u32.5%
expm1-udef25.8%
Applied egg-rr18.6%
Simplified60.3%
if 1.29999999999999998e-300 < l < 4.19999999999999981e130Initial program 70.4%
Simplified69.3%
associate-*r/72.9%
Applied egg-rr72.8%
add-cbrt-cube65.8%
add-sqr-sqrt65.7%
cbrt-prod72.6%
Applied egg-rr72.6%
Applied egg-rr57.7%
*-rgt-identity57.7%
distribute-lft-out78.4%
*-commutative78.4%
associate-*l*78.4%
associate-*r*78.4%
metadata-eval78.4%
Simplified78.4%
if 4.19999999999999981e130 < l Initial program 38.4%
Simplified38.6%
Taylor expanded in h around 0 41.5%
*-rgt-identity41.5%
sqrt-prod39.3%
expm1-log1p-u37.4%
expm1-udef22.7%
frac-times13.0%
sqrt-div13.0%
sqrt-unprod28.6%
add-sqr-sqrt28.6%
Applied egg-rr28.6%
expm1-def43.5%
expm1-log1p46.5%
Simplified46.5%
*-commutative46.5%
sqrt-prod64.9%
Applied egg-rr64.9%
Final simplification65.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 (sqrt (* h l))))
(if (<= l -4.8e+58)
(/ d (- t_0))
(if (<= l 5.4e-305)
(*
(sqrt (/ (* d (/ d h)) l))
(+ 1.0 (* -0.5 (* h (/ (pow (/ (* D_m 0.5) (/ d M)) 2.0) l)))))
(if (<= l 4.6e+127)
(* (/ d t_0) (+ 1.0 (* -0.125 (* (/ h l) (pow (* M (/ D_m d)) 2.0)))))
(/ d (* (sqrt h) (sqrt l))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt((h * l));
double tmp;
if (l <= -4.8e+58) {
tmp = d / -t_0;
} else if (l <= 5.4e-305) {
tmp = sqrt(((d * (d / h)) / l)) * (1.0 + (-0.5 * (h * (pow(((D_m * 0.5) / (d / M)), 2.0) / l))));
} else if (l <= 4.6e+127) {
tmp = (d / t_0) * (1.0 + (-0.125 * ((h / l) * pow((M * (D_m / d)), 2.0))));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((h * l))
if (l <= (-4.8d+58)) then
tmp = d / -t_0
else if (l <= 5.4d-305) then
tmp = sqrt(((d * (d / h)) / l)) * (1.0d0 + ((-0.5d0) * (h * ((((d_m * 0.5d0) / (d / m)) ** 2.0d0) / l))))
else if (l <= 4.6d+127) then
tmp = (d / t_0) * (1.0d0 + ((-0.125d0) * ((h / l) * ((m * (d_m / d)) ** 2.0d0))))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.sqrt((h * l));
double tmp;
if (l <= -4.8e+58) {
tmp = d / -t_0;
} else if (l <= 5.4e-305) {
tmp = Math.sqrt(((d * (d / h)) / l)) * (1.0 + (-0.5 * (h * (Math.pow(((D_m * 0.5) / (d / M)), 2.0) / l))));
} else if (l <= 4.6e+127) {
tmp = (d / t_0) * (1.0 + (-0.125 * ((h / l) * Math.pow((M * (D_m / d)), 2.0))));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.sqrt((h * l)) tmp = 0 if l <= -4.8e+58: tmp = d / -t_0 elif l <= 5.4e-305: tmp = math.sqrt(((d * (d / h)) / l)) * (1.0 + (-0.5 * (h * (math.pow(((D_m * 0.5) / (d / M)), 2.0) / l)))) elif l <= 4.6e+127: tmp = (d / t_0) * (1.0 + (-0.125 * ((h / l) * math.pow((M * (D_m / d)), 2.0)))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(h * l)) tmp = 0.0 if (l <= -4.8e+58) tmp = Float64(d / Float64(-t_0)); elseif (l <= 5.4e-305) tmp = Float64(sqrt(Float64(Float64(d * Float64(d / h)) / l)) * Float64(1.0 + Float64(-0.5 * Float64(h * Float64((Float64(Float64(D_m * 0.5) / Float64(d / M)) ^ 2.0) / l))))); elseif (l <= 4.6e+127) tmp = Float64(Float64(d / t_0) * Float64(1.0 + Float64(-0.125 * Float64(Float64(h / l) * (Float64(M * Float64(D_m / d)) ^ 2.0))))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = sqrt((h * l));
tmp = 0.0;
if (l <= -4.8e+58)
tmp = d / -t_0;
elseif (l <= 5.4e-305)
tmp = sqrt(((d * (d / h)) / l)) * (1.0 + (-0.5 * (h * ((((D_m * 0.5) / (d / M)) ^ 2.0) / l))));
elseif (l <= 4.6e+127)
tmp = (d / t_0) * (1.0 + (-0.125 * ((h / l) * ((M * (D_m / d)) ^ 2.0))));
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -4.8e+58], N[(d / (-t$95$0)), $MachinePrecision], If[LessEqual[l, 5.4e-305], N[(N[Sqrt[N[(N[(d * N[(d / h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(h * N[(N[Power[N[(N[(D$95$m * 0.5), $MachinePrecision] / N[(d / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.6e+127], N[(N[(d / t$95$0), $MachinePrecision] * N[(1.0 + N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
\mathbf{if}\;\ell \leq -4.8 \cdot 10^{+58}:\\
\;\;\;\;\frac{d}{-t_0}\\
\mathbf{elif}\;\ell \leq 5.4 \cdot 10^{-305}:\\
\;\;\;\;\sqrt{\frac{d \cdot \frac{d}{h}}{\ell}} \cdot \left(1 + -0.5 \cdot \left(h \cdot \frac{{\left(\frac{D_m \cdot 0.5}{\frac{d}{M}}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+127}:\\
\;\;\;\;\frac{d}{t_0} \cdot \left(1 + -0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \frac{D_m}{d}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.8e58Initial program 49.1%
Simplified49.1%
add-sqr-sqrt49.1%
pow249.1%
Applied egg-rr51.0%
associate-*r/52.7%
associate-*l*52.7%
*-commutative52.7%
associate-*l/50.9%
*-commutative50.9%
associate-*l*50.9%
associate-*l*51.0%
metadata-eval51.0%
associate-/r/51.0%
associate-/l*50.9%
associate-/r/51.0%
*-commutative51.0%
associate-/r*51.0%
metadata-eval51.0%
Simplified51.0%
clear-num51.0%
sqrt-div50.9%
metadata-eval50.9%
Applied egg-rr50.9%
Taylor expanded in d around -inf 47.7%
mul-1-neg47.7%
unpow-147.7%
metadata-eval47.7%
pow-sqr47.7%
rem-sqrt-square47.7%
rem-cube-cbrt47.1%
sqr-pow47.0%
fabs-sqr47.0%
sqr-pow47.1%
rem-cube-cbrt47.7%
*-commutative47.7%
Simplified47.7%
if -4.8e58 < l < 5.3999999999999998e-305Initial program 67.4%
Simplified67.4%
associate-*r/72.5%
Applied egg-rr72.5%
expm1-log1p-u32.2%
expm1-udef23.1%
Applied egg-rr16.0%
Simplified56.0%
if 5.3999999999999998e-305 < l < 4.6000000000000003e127Initial program 70.4%
Simplified69.3%
associate-*r/72.9%
Applied egg-rr72.8%
add-cbrt-cube65.8%
add-sqr-sqrt65.7%
cbrt-prod72.6%
Applied egg-rr72.6%
Applied egg-rr57.7%
*-rgt-identity57.7%
distribute-lft-out78.4%
*-commutative78.4%
associate-*l*78.4%
associate-*r*78.4%
metadata-eval78.4%
Simplified78.4%
if 4.6000000000000003e127 < l Initial program 38.4%
Simplified38.6%
Taylor expanded in h around 0 41.5%
*-rgt-identity41.5%
sqrt-prod39.3%
expm1-log1p-u37.4%
expm1-udef22.7%
frac-times13.0%
sqrt-div13.0%
sqrt-unprod28.6%
add-sqr-sqrt28.6%
Applied egg-rr28.6%
expm1-def43.5%
expm1-log1p46.5%
Simplified46.5%
*-commutative46.5%
sqrt-prod64.9%
Applied egg-rr64.9%
Final simplification62.8%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (sqrt (* h l))))
(if (<= l -2e-310)
(/ d (- t_0))
(if (<= l 5.8e+130)
(* (/ d t_0) (+ 1.0 (* -0.125 (* (/ h l) (pow (* M (/ D_m d)) 2.0)))))
(/ d (* (sqrt h) (sqrt l)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt((h * l));
double tmp;
if (l <= -2e-310) {
tmp = d / -t_0;
} else if (l <= 5.8e+130) {
tmp = (d / t_0) * (1.0 + (-0.125 * ((h / l) * pow((M * (D_m / d)), 2.0))));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((h * l))
if (l <= (-2d-310)) then
tmp = d / -t_0
else if (l <= 5.8d+130) then
tmp = (d / t_0) * (1.0d0 + ((-0.125d0) * ((h / l) * ((m * (d_m / d)) ** 2.0d0))))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.sqrt((h * l));
double tmp;
if (l <= -2e-310) {
tmp = d / -t_0;
} else if (l <= 5.8e+130) {
tmp = (d / t_0) * (1.0 + (-0.125 * ((h / l) * Math.pow((M * (D_m / d)), 2.0))));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.sqrt((h * l)) tmp = 0 if l <= -2e-310: tmp = d / -t_0 elif l <= 5.8e+130: tmp = (d / t_0) * (1.0 + (-0.125 * ((h / l) * math.pow((M * (D_m / d)), 2.0)))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(h * l)) tmp = 0.0 if (l <= -2e-310) tmp = Float64(d / Float64(-t_0)); elseif (l <= 5.8e+130) tmp = Float64(Float64(d / t_0) * Float64(1.0 + Float64(-0.125 * Float64(Float64(h / l) * (Float64(M * Float64(D_m / d)) ^ 2.0))))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = sqrt((h * l));
tmp = 0.0;
if (l <= -2e-310)
tmp = d / -t_0;
elseif (l <= 5.8e+130)
tmp = (d / t_0) * (1.0 + (-0.125 * ((h / l) * ((M * (D_m / d)) ^ 2.0))));
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -2e-310], N[(d / (-t$95$0)), $MachinePrecision], If[LessEqual[l, 5.8e+130], N[(N[(d / t$95$0), $MachinePrecision] * N[(1.0 + N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
\mathbf{if}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{-t_0}\\
\mathbf{elif}\;\ell \leq 5.8 \cdot 10^{+130}:\\
\;\;\;\;\frac{d}{t_0} \cdot \left(1 + -0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \frac{D_m}{d}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.999999999999994e-310Initial program 59.7%
Simplified59.7%
add-sqr-sqrt59.7%
pow259.7%
Applied egg-rr61.3%
associate-*r/62.6%
associate-*l*62.6%
*-commutative62.6%
associate-*l/61.9%
*-commutative61.9%
associate-*l*61.9%
associate-*l*61.2%
metadata-eval61.2%
associate-/r/61.2%
associate-/l*61.2%
associate-/r/61.2%
*-commutative61.2%
associate-/r*61.2%
metadata-eval61.2%
Simplified61.2%
clear-num61.2%
sqrt-div61.2%
metadata-eval61.2%
Applied egg-rr61.2%
Taylor expanded in d around -inf 38.9%
mul-1-neg38.9%
unpow-138.9%
metadata-eval38.9%
pow-sqr38.9%
rem-sqrt-square38.9%
rem-cube-cbrt38.5%
sqr-pow38.4%
fabs-sqr38.4%
sqr-pow38.5%
rem-cube-cbrt38.9%
*-commutative38.9%
Simplified38.9%
if -1.999999999999994e-310 < l < 5.7999999999999998e130Initial program 70.2%
Simplified69.2%
associate-*r/72.7%
Applied egg-rr72.6%
add-cbrt-cube64.7%
add-sqr-sqrt64.6%
cbrt-prod72.5%
Applied egg-rr72.5%
Applied egg-rr56.8%
*-rgt-identity56.8%
distribute-lft-out78.0%
*-commutative78.0%
associate-*l*78.0%
associate-*r*78.0%
metadata-eval78.0%
Simplified78.0%
if 5.7999999999999998e130 < l Initial program 38.4%
Simplified38.6%
Taylor expanded in h around 0 41.5%
*-rgt-identity41.5%
sqrt-prod39.3%
expm1-log1p-u37.4%
expm1-udef22.7%
frac-times13.0%
sqrt-div13.0%
sqrt-unprod28.6%
add-sqr-sqrt28.6%
Applied egg-rr28.6%
expm1-def43.5%
expm1-log1p46.5%
Simplified46.5%
*-commutative46.5%
sqrt-prod64.9%
Applied egg-rr64.9%
Final simplification56.0%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (if (<= h -2.8e+212) (sqrt (/ (/ d h) (/ l d))) (if (<= h 9.5e-303) (/ d (- (sqrt (* h l)))) (/ d (* (sqrt h) (sqrt l))))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (h <= -2.8e+212) {
tmp = sqrt(((d / h) / (l / d)));
} else if (h <= 9.5e-303) {
tmp = d / -sqrt((h * l));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: tmp
if (h <= (-2.8d+212)) then
tmp = sqrt(((d / h) / (l / d)))
else if (h <= 9.5d-303) then
tmp = d / -sqrt((h * l))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (h <= -2.8e+212) {
tmp = Math.sqrt(((d / h) / (l / d)));
} else if (h <= 9.5e-303) {
tmp = d / -Math.sqrt((h * l));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if h <= -2.8e+212: tmp = math.sqrt(((d / h) / (l / d))) elif h <= 9.5e-303: tmp = d / -math.sqrt((h * l)) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (h <= -2.8e+212) tmp = sqrt(Float64(Float64(d / h) / Float64(l / d))); elseif (h <= 9.5e-303) tmp = Float64(d / Float64(-sqrt(Float64(h * l)))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (h <= -2.8e+212)
tmp = sqrt(((d / h) / (l / d)));
elseif (h <= 9.5e-303)
tmp = d / -sqrt((h * l));
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[h, -2.8e+212], N[Sqrt[N[(N[(d / h), $MachinePrecision] / N[(l / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[h, 9.5e-303], N[(d / (-N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -2.8 \cdot 10^{+212}:\\
\;\;\;\;\sqrt{\frac{\frac{d}{h}}{\frac{\ell}{d}}}\\
\mathbf{elif}\;h \leq 9.5 \cdot 10^{-303}:\\
\;\;\;\;\frac{d}{-\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -2.79999999999999997e212Initial program 48.7%
Simplified48.5%
Taylor expanded in h around 0 35.5%
*-rgt-identity35.5%
sqrt-prod35.5%
expm1-log1p-u34.9%
expm1-udef15.2%
frac-times11.4%
sqrt-div11.4%
sqrt-unprod0.0%
add-sqr-sqrt5.4%
Applied egg-rr5.4%
expm1-def5.4%
expm1-log1p6.1%
Simplified6.1%
add-sqr-sqrt0.0%
sqrt-unprod15.0%
sqrt-div15.0%
frac-times35.5%
sqrt-prod35.5%
clear-num35.5%
sqrt-div37.8%
metadata-eval37.8%
un-div-inv37.8%
sqrt-undiv37.8%
Applied egg-rr37.8%
if -2.79999999999999997e212 < h < 9.4999999999999999e-303Initial program 63.2%
Simplified63.3%
add-sqr-sqrt63.3%
pow263.3%
Applied egg-rr65.2%
associate-*r/66.9%
associate-*l*66.9%
*-commutative66.9%
associate-*l/66.1%
*-commutative66.1%
associate-*l*66.1%
associate-*l*65.2%
metadata-eval65.2%
associate-/r/65.2%
associate-/l*65.1%
associate-/r/65.1%
*-commutative65.1%
associate-/r*65.1%
metadata-eval65.1%
Simplified65.1%
clear-num65.1%
sqrt-div65.2%
metadata-eval65.2%
Applied egg-rr65.2%
Taylor expanded in d around -inf 44.9%
mul-1-neg44.9%
unpow-144.9%
metadata-eval44.9%
pow-sqr45.0%
rem-sqrt-square45.0%
rem-cube-cbrt44.5%
sqr-pow44.5%
fabs-sqr44.5%
sqr-pow44.5%
rem-cube-cbrt45.0%
*-commutative45.0%
Simplified45.0%
if 9.4999999999999999e-303 < h Initial program 60.0%
Simplified59.9%
Taylor expanded in h around 0 38.8%
*-rgt-identity38.8%
sqrt-prod32.8%
expm1-log1p-u31.8%
expm1-udef21.1%
frac-times16.6%
sqrt-div20.7%
sqrt-unprod31.0%
add-sqr-sqrt31.0%
Applied egg-rr31.0%
expm1-def42.5%
expm1-log1p44.9%
Simplified44.9%
*-commutative44.9%
sqrt-prod52.8%
Applied egg-rr52.8%
Final simplification48.0%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= h -1.7e+214)
(sqrt (/ (/ d h) (/ l d)))
(if (<= h 9.5e-303)
(/ d (- (sqrt (* h l))))
(* d (sqrt (* (/ 1.0 h) (/ 1.0 l)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (h <= -1.7e+214) {
tmp = sqrt(((d / h) / (l / d)));
} else if (h <= 9.5e-303) {
tmp = d / -sqrt((h * l));
} else {
tmp = d * sqrt(((1.0 / h) * (1.0 / l)));
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: tmp
if (h <= (-1.7d+214)) then
tmp = sqrt(((d / h) / (l / d)))
else if (h <= 9.5d-303) then
tmp = d / -sqrt((h * l))
else
tmp = d * sqrt(((1.0d0 / h) * (1.0d0 / l)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (h <= -1.7e+214) {
tmp = Math.sqrt(((d / h) / (l / d)));
} else if (h <= 9.5e-303) {
tmp = d / -Math.sqrt((h * l));
} else {
tmp = d * Math.sqrt(((1.0 / h) * (1.0 / l)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if h <= -1.7e+214: tmp = math.sqrt(((d / h) / (l / d))) elif h <= 9.5e-303: tmp = d / -math.sqrt((h * l)) else: tmp = d * math.sqrt(((1.0 / h) * (1.0 / l))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (h <= -1.7e+214) tmp = sqrt(Float64(Float64(d / h) / Float64(l / d))); elseif (h <= 9.5e-303) tmp = Float64(d / Float64(-sqrt(Float64(h * l)))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) * Float64(1.0 / l)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (h <= -1.7e+214)
tmp = sqrt(((d / h) / (l / d)));
elseif (h <= 9.5e-303)
tmp = d / -sqrt((h * l));
else
tmp = d * sqrt(((1.0 / h) * (1.0 / l)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[h, -1.7e+214], N[Sqrt[N[(N[(d / h), $MachinePrecision] / N[(l / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[h, 9.5e-303], N[(d / (-N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] * N[(1.0 / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1.7 \cdot 10^{+214}:\\
\;\;\;\;\sqrt{\frac{\frac{d}{h}}{\frac{\ell}{d}}}\\
\mathbf{elif}\;h \leq 9.5 \cdot 10^{-303}:\\
\;\;\;\;\frac{d}{-\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{h} \cdot \frac{1}{\ell}}\\
\end{array}
\end{array}
if h < -1.6999999999999999e214Initial program 48.7%
Simplified48.5%
Taylor expanded in h around 0 35.5%
*-rgt-identity35.5%
sqrt-prod35.5%
expm1-log1p-u34.9%
expm1-udef15.2%
frac-times11.4%
sqrt-div11.4%
sqrt-unprod0.0%
add-sqr-sqrt5.4%
Applied egg-rr5.4%
expm1-def5.4%
expm1-log1p6.1%
Simplified6.1%
add-sqr-sqrt0.0%
sqrt-unprod15.0%
sqrt-div15.0%
frac-times35.5%
sqrt-prod35.5%
clear-num35.5%
sqrt-div37.8%
metadata-eval37.8%
un-div-inv37.8%
sqrt-undiv37.8%
Applied egg-rr37.8%
if -1.6999999999999999e214 < h < 9.4999999999999999e-303Initial program 63.2%
Simplified63.3%
add-sqr-sqrt63.3%
pow263.3%
Applied egg-rr65.2%
associate-*r/66.9%
associate-*l*66.9%
*-commutative66.9%
associate-*l/66.1%
*-commutative66.1%
associate-*l*66.1%
associate-*l*65.2%
metadata-eval65.2%
associate-/r/65.2%
associate-/l*65.1%
associate-/r/65.1%
*-commutative65.1%
associate-/r*65.1%
metadata-eval65.1%
Simplified65.1%
clear-num65.1%
sqrt-div65.2%
metadata-eval65.2%
Applied egg-rr65.2%
Taylor expanded in d around -inf 44.9%
mul-1-neg44.9%
unpow-144.9%
metadata-eval44.9%
pow-sqr45.0%
rem-sqrt-square45.0%
rem-cube-cbrt44.5%
sqr-pow44.5%
fabs-sqr44.5%
sqr-pow44.5%
rem-cube-cbrt45.0%
*-commutative45.0%
Simplified45.0%
if 9.4999999999999999e-303 < h Initial program 60.0%
Simplified59.3%
Taylor expanded in d around inf 44.8%
inv-pow44.8%
*-commutative44.8%
unpow-prod-down45.2%
inv-pow45.2%
inv-pow45.2%
Applied egg-rr45.2%
Final simplification44.3%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= h -8e+212)
(sqrt (/ (/ d h) (/ l d)))
(if (<= h 1.05e-302)
(/ d (- (sqrt (* h l))))
(* d (sqrt (/ (/ 1.0 h) l))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (h <= -8e+212) {
tmp = sqrt(((d / h) / (l / d)));
} else if (h <= 1.05e-302) {
tmp = d / -sqrt((h * l));
} else {
tmp = d * sqrt(((1.0 / h) / l));
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: tmp
if (h <= (-8d+212)) then
tmp = sqrt(((d / h) / (l / d)))
else if (h <= 1.05d-302) then
tmp = d / -sqrt((h * l))
else
tmp = d * sqrt(((1.0d0 / h) / l))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (h <= -8e+212) {
tmp = Math.sqrt(((d / h) / (l / d)));
} else if (h <= 1.05e-302) {
tmp = d / -Math.sqrt((h * l));
} else {
tmp = d * Math.sqrt(((1.0 / h) / l));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if h <= -8e+212: tmp = math.sqrt(((d / h) / (l / d))) elif h <= 1.05e-302: tmp = d / -math.sqrt((h * l)) else: tmp = d * math.sqrt(((1.0 / h) / l)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (h <= -8e+212) tmp = sqrt(Float64(Float64(d / h) / Float64(l / d))); elseif (h <= 1.05e-302) tmp = Float64(d / Float64(-sqrt(Float64(h * l)))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (h <= -8e+212)
tmp = sqrt(((d / h) / (l / d)));
elseif (h <= 1.05e-302)
tmp = d / -sqrt((h * l));
else
tmp = d * sqrt(((1.0 / h) / l));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[h, -8e+212], N[Sqrt[N[(N[(d / h), $MachinePrecision] / N[(l / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[h, 1.05e-302], N[(d / (-N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -8 \cdot 10^{+212}:\\
\;\;\;\;\sqrt{\frac{\frac{d}{h}}{\frac{\ell}{d}}}\\
\mathbf{elif}\;h \leq 1.05 \cdot 10^{-302}:\\
\;\;\;\;\frac{d}{-\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if h < -7.9999999999999993e212Initial program 48.7%
Simplified48.5%
Taylor expanded in h around 0 35.5%
*-rgt-identity35.5%
sqrt-prod35.5%
expm1-log1p-u34.9%
expm1-udef15.2%
frac-times11.4%
sqrt-div11.4%
sqrt-unprod0.0%
add-sqr-sqrt5.4%
Applied egg-rr5.4%
expm1-def5.4%
expm1-log1p6.1%
Simplified6.1%
add-sqr-sqrt0.0%
sqrt-unprod15.0%
sqrt-div15.0%
frac-times35.5%
sqrt-prod35.5%
clear-num35.5%
sqrt-div37.8%
metadata-eval37.8%
un-div-inv37.8%
sqrt-undiv37.8%
Applied egg-rr37.8%
if -7.9999999999999993e212 < h < 1.05000000000000006e-302Initial program 63.2%
Simplified63.3%
add-sqr-sqrt63.3%
pow263.3%
Applied egg-rr65.2%
associate-*r/66.9%
associate-*l*66.9%
*-commutative66.9%
associate-*l/66.1%
*-commutative66.1%
associate-*l*66.1%
associate-*l*65.2%
metadata-eval65.2%
associate-/r/65.2%
associate-/l*65.1%
associate-/r/65.1%
*-commutative65.1%
associate-/r*65.1%
metadata-eval65.1%
Simplified65.1%
clear-num65.1%
sqrt-div65.2%
metadata-eval65.2%
Applied egg-rr65.2%
Taylor expanded in d around -inf 44.9%
mul-1-neg44.9%
unpow-144.9%
metadata-eval44.9%
pow-sqr45.0%
rem-sqrt-square45.0%
rem-cube-cbrt44.5%
sqr-pow44.5%
fabs-sqr44.5%
sqr-pow44.5%
rem-cube-cbrt45.0%
*-commutative45.0%
Simplified45.0%
if 1.05000000000000006e-302 < h Initial program 60.0%
Simplified59.3%
Taylor expanded in d around inf 44.8%
associate-/r*45.1%
Simplified45.1%
Final simplification44.3%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (sqrt (* h l))))
(if (<= h -1.65e+213)
(sqrt (/ (/ d h) (/ l d)))
(if (<= h 9.5e-303) (/ 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((h * l));
double tmp;
if (h <= -1.65e+213) {
tmp = sqrt(((d / h) / (l / d)));
} else if (h <= 9.5e-303) {
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((h * l))
if (h <= (-1.65d+213)) then
tmp = sqrt(((d / h) / (l / d)))
else if (h <= 9.5d-303) 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((h * l));
double tmp;
if (h <= -1.65e+213) {
tmp = Math.sqrt(((d / h) / (l / d)));
} else if (h <= 9.5e-303) {
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((h * l)) tmp = 0 if h <= -1.65e+213: tmp = math.sqrt(((d / h) / (l / d))) elif h <= 9.5e-303: 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(h * l)) tmp = 0.0 if (h <= -1.65e+213) tmp = sqrt(Float64(Float64(d / h) / Float64(l / d))); elseif (h <= 9.5e-303) tmp = Float64(d / Float64(-t_0)); else tmp = Float64(d / t_0); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = sqrt((h * l));
tmp = 0.0;
if (h <= -1.65e+213)
tmp = sqrt(((d / h) / (l / d)));
elseif (h <= 9.5e-303)
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[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -1.65e+213], N[Sqrt[N[(N[(d / h), $MachinePrecision] / N[(l / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[h, 9.5e-303], 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{h \cdot \ell}\\
\mathbf{if}\;h \leq -1.65 \cdot 10^{+213}:\\
\;\;\;\;\sqrt{\frac{\frac{d}{h}}{\frac{\ell}{d}}}\\
\mathbf{elif}\;h \leq 9.5 \cdot 10^{-303}:\\
\;\;\;\;\frac{d}{-t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t_0}\\
\end{array}
\end{array}
if h < -1.6500000000000001e213Initial program 48.7%
Simplified48.5%
Taylor expanded in h around 0 35.5%
*-rgt-identity35.5%
sqrt-prod35.5%
expm1-log1p-u34.9%
expm1-udef15.2%
frac-times11.4%
sqrt-div11.4%
sqrt-unprod0.0%
add-sqr-sqrt5.4%
Applied egg-rr5.4%
expm1-def5.4%
expm1-log1p6.1%
Simplified6.1%
add-sqr-sqrt0.0%
sqrt-unprod15.0%
sqrt-div15.0%
frac-times35.5%
sqrt-prod35.5%
clear-num35.5%
sqrt-div37.8%
metadata-eval37.8%
un-div-inv37.8%
sqrt-undiv37.8%
Applied egg-rr37.8%
if -1.6500000000000001e213 < h < 9.4999999999999999e-303Initial program 63.2%
Simplified63.3%
add-sqr-sqrt63.3%
pow263.3%
Applied egg-rr65.2%
associate-*r/66.9%
associate-*l*66.9%
*-commutative66.9%
associate-*l/66.1%
*-commutative66.1%
associate-*l*66.1%
associate-*l*65.2%
metadata-eval65.2%
associate-/r/65.2%
associate-/l*65.1%
associate-/r/65.1%
*-commutative65.1%
associate-/r*65.1%
metadata-eval65.1%
Simplified65.1%
clear-num65.1%
sqrt-div65.2%
metadata-eval65.2%
Applied egg-rr65.2%
Taylor expanded in d around -inf 44.9%
mul-1-neg44.9%
unpow-144.9%
metadata-eval44.9%
pow-sqr45.0%
rem-sqrt-square45.0%
rem-cube-cbrt44.5%
sqr-pow44.5%
fabs-sqr44.5%
sqr-pow44.5%
rem-cube-cbrt45.0%
*-commutative45.0%
Simplified45.0%
if 9.4999999999999999e-303 < h Initial program 60.0%
Simplified59.9%
Taylor expanded in h around 0 38.8%
*-rgt-identity38.8%
sqrt-prod32.8%
expm1-log1p-u31.8%
expm1-udef21.1%
frac-times16.6%
sqrt-div20.7%
sqrt-unprod31.0%
add-sqr-sqrt31.0%
Applied egg-rr31.0%
expm1-def42.5%
expm1-log1p44.9%
Simplified44.9%
Final simplification44.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 (sqrt (* h l)))) (if (<= d 5.3e-241) (/ 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((h * l));
double tmp;
if (d <= 5.3e-241) {
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((h * l))
if (d <= 5.3d-241) 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((h * l));
double tmp;
if (d <= 5.3e-241) {
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((h * l)) tmp = 0 if d <= 5.3e-241: 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(h * l)) tmp = 0.0 if (d <= 5.3e-241) tmp = Float64(d / Float64(-t_0)); else tmp = Float64(d / t_0); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = sqrt((h * l));
tmp = 0.0;
if (d <= 5.3e-241)
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[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, 5.3e-241], 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{h \cdot \ell}\\
\mathbf{if}\;d \leq 5.3 \cdot 10^{-241}:\\
\;\;\;\;\frac{d}{-t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t_0}\\
\end{array}
\end{array}
if d < 5.2999999999999998e-241Initial program 56.6%
Simplified56.6%
add-sqr-sqrt56.6%
pow256.6%
Applied egg-rr58.0%
associate-*r/59.3%
associate-*l*59.3%
*-commutative59.3%
associate-*l/58.6%
*-commutative58.6%
associate-*l*58.6%
associate-*l*58.0%
metadata-eval58.0%
associate-/r/58.0%
associate-/l*57.9%
associate-/r/58.0%
*-commutative58.0%
associate-/r*58.0%
metadata-eval58.0%
Simplified58.0%
clear-num58.0%
sqrt-div58.0%
metadata-eval58.0%
Applied egg-rr58.0%
Taylor expanded in d around -inf 37.5%
mul-1-neg37.5%
unpow-137.5%
metadata-eval37.5%
pow-sqr37.5%
rem-sqrt-square36.8%
rem-cube-cbrt36.4%
sqr-pow36.4%
fabs-sqr36.4%
sqr-pow36.4%
rem-cube-cbrt36.8%
*-commutative36.8%
Simplified36.8%
if 5.2999999999999998e-241 < d Initial program 64.3%
Simplified64.2%
Taylor expanded in h around 0 42.0%
*-rgt-identity42.0%
sqrt-prod35.5%
expm1-log1p-u34.4%
expm1-udef22.7%
frac-times17.8%
sqrt-div22.3%
sqrt-unprod33.5%
add-sqr-sqrt33.5%
Applied egg-rr33.5%
expm1-def46.0%
expm1-log1p48.6%
Simplified48.6%
Final simplification42.1%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (/ d (sqrt (* 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((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((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((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((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(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((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[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Initial program 60.0%
Simplified60.0%
Taylor expanded in h around 0 37.3%
*-rgt-identity37.3%
sqrt-prod31.5%
expm1-log1p-u30.7%
expm1-udef20.1%
frac-times16.4%
sqrt-div19.8%
sqrt-unprod15.0%
add-sqr-sqrt17.4%
Applied egg-rr17.4%
expm1-def23.1%
expm1-log1p26.5%
Simplified26.5%
Final simplification26.5%
herbie shell --seed 2023314
(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)))))