
(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
(let* ((t_0 (sqrt (- d))))
(if (<= d -2.7e+29)
(*
(sqrt (/ d l))
(*
(/ t_0 (sqrt (- h)))
(+ 1.0 (* (/ h l) (* (pow (/ (/ D_m d) (/ 2.0 M)) 2.0) -0.5)))))
(if (<= d -4e-310)
(*
(/ t_0 (sqrt (- l)))
(*
(sqrt (/ d h))
(+
1.0
(* -0.5 (pow (* (* D_m (* M (/ 0.5 d))) (sqrt (/ h l))) 2.0)))))
(*
d
(/
(fma h (* -0.5 (/ (pow (* M (/ (/ D_m d) 2.0)) 2.0) l)) 1.0)
(* (sqrt l) (sqrt h))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt(-d);
double tmp;
if (d <= -2.7e+29) {
tmp = sqrt((d / l)) * ((t_0 / sqrt(-h)) * (1.0 + ((h / l) * (pow(((D_m / d) / (2.0 / M)), 2.0) * -0.5))));
} else if (d <= -4e-310) {
tmp = (t_0 / sqrt(-l)) * (sqrt((d / h)) * (1.0 + (-0.5 * pow(((D_m * (M * (0.5 / d))) * sqrt((h / l))), 2.0))));
} else {
tmp = d * (fma(h, (-0.5 * (pow((M * ((D_m / d) / 2.0)), 2.0) / l)), 1.0) / (sqrt(l) * sqrt(h)));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(-d)) tmp = 0.0 if (d <= -2.7e+29) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(D_m / d) / Float64(2.0 / M)) ^ 2.0) * -0.5))))); elseif (d <= -4e-310) tmp = Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(-0.5 * (Float64(Float64(D_m * Float64(M * Float64(0.5 / d))) * sqrt(Float64(h / l))) ^ 2.0))))); else tmp = Float64(d * Float64(fma(h, Float64(-0.5 * Float64((Float64(M * Float64(Float64(D_m / d) / 2.0)) ^ 2.0) / l)), 1.0) / Float64(sqrt(l) * sqrt(h)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[d, -2.7e+29], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(D$95$m / d), $MachinePrecision] / N[(2.0 / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[Power[N[(N[(D$95$m * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(h * N[(-0.5 * N[(N[Power[N[(M * N[(N[(D$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;d \leq -2.7 \cdot 10^{+29}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\frac{t\_0}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{\frac{D\_m}{d}}{\frac{2}{M}}\right)}^{2} \cdot -0.5\right)\right)\right)\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + -0.5 \cdot {\left(\left(D\_m \cdot \left(M \cdot \frac{0.5}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, -0.5 \cdot \frac{{\left(M \cdot \frac{\frac{D\_m}{d}}{2}\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -2.7e29Initial program 80.2%
Simplified78.7%
associate-*r/80.3%
*-un-lft-identity80.3%
times-frac78.7%
associate-/l/78.7%
*-commutative78.7%
times-frac80.3%
*-un-lft-identity80.3%
*-commutative80.3%
frac-times80.3%
clear-num80.2%
un-div-inv80.2%
Applied egg-rr80.2%
frac-2neg80.2%
sqrt-div90.3%
Applied egg-rr90.3%
if -2.7e29 < d < -3.999999999999988e-310Initial program 66.1%
Simplified64.8%
*-commutative64.8%
clear-num64.8%
un-div-inv66.2%
*-commutative66.2%
associate-*r/67.4%
*-un-lft-identity67.4%
times-frac66.2%
associate-/l/66.2%
*-commutative66.2%
times-frac67.4%
*-commutative67.4%
*-un-lft-identity67.4%
associate-/l*66.1%
*-un-lft-identity66.1%
times-frac66.1%
metadata-eval66.1%
Applied egg-rr66.1%
associate-/l*66.1%
associate-*r*66.1%
associate-/l*67.4%
*-commutative67.4%
associate-*r*67.4%
associate-/l*67.4%
Simplified67.4%
add-sqr-sqrt67.4%
pow267.4%
div-inv66.0%
clear-num66.0%
sqrt-prod66.0%
sqrt-pow167.6%
metadata-eval67.6%
pow167.6%
associate-*l*66.3%
Applied egg-rr66.3%
frac-2neg66.3%
sqrt-div76.3%
Applied egg-rr76.3%
if -3.999999999999988e-310 < d Initial program 66.1%
Simplified66.1%
Applied egg-rr72.8%
distribute-rgt1-in81.4%
+-commutative81.4%
associate-*r/82.4%
*-commutative82.4%
associate-/l*84.0%
Simplified87.5%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (sqrt (- d))))
(if (<= d -6.8e+30)
(*
(sqrt (/ d l))
(*
(/ t_0 (sqrt (- h)))
(+ 1.0 (* (/ h l) (* (pow (/ (/ D_m d) (/ 2.0 M)) 2.0) -0.5)))))
(if (<= d -4e-310)
(*
(/ t_0 (sqrt (- l)))
(*
(sqrt (/ d h))
(+ 1.0 (* -0.5 (/ (pow (* (/ 0.5 d) (* D_m M)) 2.0) (/ l h))))))
(*
d
(/
(fma h (* -0.5 (/ (pow (* M (/ (/ D_m d) 2.0)) 2.0) l)) 1.0)
(* (sqrt l) (sqrt h))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt(-d);
double tmp;
if (d <= -6.8e+30) {
tmp = sqrt((d / l)) * ((t_0 / sqrt(-h)) * (1.0 + ((h / l) * (pow(((D_m / d) / (2.0 / M)), 2.0) * -0.5))));
} else if (d <= -4e-310) {
tmp = (t_0 / sqrt(-l)) * (sqrt((d / h)) * (1.0 + (-0.5 * (pow(((0.5 / d) * (D_m * M)), 2.0) / (l / h)))));
} else {
tmp = d * (fma(h, (-0.5 * (pow((M * ((D_m / d) / 2.0)), 2.0) / l)), 1.0) / (sqrt(l) * sqrt(h)));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(-d)) tmp = 0.0 if (d <= -6.8e+30) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(D_m / d) / Float64(2.0 / M)) ^ 2.0) * -0.5))))); elseif (d <= -4e-310) tmp = Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(-0.5 * Float64((Float64(Float64(0.5 / d) * Float64(D_m * M)) ^ 2.0) / Float64(l / h)))))); else tmp = Float64(d * Float64(fma(h, Float64(-0.5 * Float64((Float64(M * Float64(Float64(D_m / d) / 2.0)) ^ 2.0) / l)), 1.0) / Float64(sqrt(l) * sqrt(h)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[d, -6.8e+30], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(D$95$m / d), $MachinePrecision] / N[(2.0 / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[Power[N[(N[(0.5 / d), $MachinePrecision] * N[(D$95$m * M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(h * N[(-0.5 * N[(N[Power[N[(M * N[(N[(D$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;d \leq -6.8 \cdot 10^{+30}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\frac{t\_0}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{\frac{D\_m}{d}}{\frac{2}{M}}\right)}^{2} \cdot -0.5\right)\right)\right)\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + -0.5 \cdot \frac{{\left(\frac{0.5}{d} \cdot \left(D\_m \cdot M\right)\right)}^{2}}{\frac{\ell}{h}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, -0.5 \cdot \frac{{\left(M \cdot \frac{\frac{D\_m}{d}}{2}\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -6.8000000000000005e30Initial program 79.3%
Simplified77.6%
associate-*r/79.3%
*-un-lft-identity79.3%
times-frac77.6%
associate-/l/77.6%
*-commutative77.6%
times-frac79.3%
*-un-lft-identity79.3%
*-commutative79.3%
frac-times79.3%
clear-num79.3%
un-div-inv79.3%
Applied egg-rr79.3%
frac-2neg79.3%
sqrt-div89.9%
Applied egg-rr89.9%
if -6.8000000000000005e30 < d < -3.999999999999988e-310Initial program 67.4%
Simplified66.2%
*-commutative66.2%
clear-num66.1%
un-div-inv67.5%
*-commutative67.5%
associate-*r/68.6%
*-un-lft-identity68.6%
times-frac67.5%
associate-/l/67.5%
*-commutative67.5%
times-frac68.6%
*-commutative68.6%
*-un-lft-identity68.6%
associate-/l*67.4%
*-un-lft-identity67.4%
times-frac67.4%
metadata-eval67.4%
Applied egg-rr67.4%
associate-/l*67.4%
associate-*r*67.4%
associate-/l*68.6%
*-commutative68.6%
associate-*r*68.6%
associate-/l*68.7%
Simplified68.7%
frac-2neg67.5%
sqrt-div77.2%
Applied egg-rr78.3%
if -3.999999999999988e-310 < d Initial program 66.1%
Simplified66.1%
Applied egg-rr72.8%
distribute-rgt1-in81.4%
+-commutative81.4%
associate-*r/82.4%
*-commutative82.4%
associate-/l*84.0%
Simplified87.5%
Final simplification85.3%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= d -2.65e-233)
(*
(sqrt (/ d l))
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (* (/ h l) (* -0.5 (pow (* D_m (/ (/ M 2.0) d)) 2.0))))))
(if (<= d -4e-310)
(/ d (sqrt 0.0))
(*
d
(/
(fma h (* -0.5 (/ (pow (* M (/ (/ D_m d) 2.0)) 2.0) l)) 1.0)
(* (sqrt l) (sqrt h)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= -2.65e-233) {
tmp = sqrt((d / l)) * ((sqrt(-d) / sqrt(-h)) * (1.0 + ((h / l) * (-0.5 * pow((D_m * ((M / 2.0) / d)), 2.0)))));
} else if (d <= -4e-310) {
tmp = d / sqrt(0.0);
} else {
tmp = d * (fma(h, (-0.5 * (pow((M * ((D_m / d) / 2.0)), 2.0) / l)), 1.0) / (sqrt(l) * sqrt(h)));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (d <= -2.65e-233) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D_m * Float64(Float64(M / 2.0) / d)) ^ 2.0)))))); elseif (d <= -4e-310) tmp = Float64(d / sqrt(0.0)); else tmp = Float64(d * Float64(fma(h, Float64(-0.5 * Float64((Float64(M * Float64(Float64(D_m / d) / 2.0)) ^ 2.0) / l)), 1.0) / Float64(sqrt(l) * sqrt(h)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[d, -2.65e-233], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(N[(M / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(d / N[Sqrt[0.0], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(h * N[(-0.5 * N[(N[Power[N[(M * N[(N[(D$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.65 \cdot 10^{-233}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D\_m \cdot \frac{\frac{M}{2}}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt{0}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, -0.5 \cdot \frac{{\left(M \cdot \frac{\frac{D\_m}{d}}{2}\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -2.64999999999999986e-233Initial program 79.7%
Simplified78.1%
frac-2neg78.9%
sqrt-div84.4%
Applied egg-rr83.6%
if -2.64999999999999986e-233 < d < -3.999999999999988e-310Initial program 27.5%
Simplified27.2%
Taylor expanded in d around inf 24.8%
*-commutative24.8%
Simplified24.8%
pow124.8%
metadata-eval24.8%
sqrt-pow13.0%
sqrt-prod3.0%
div-inv3.0%
sqrt-div3.0%
sqrt-pow119.6%
metadata-eval19.6%
pow119.6%
*-commutative19.6%
Applied egg-rr19.6%
expm1-log1p-u19.6%
expm1-undefine40.0%
*-commutative40.0%
Applied egg-rr40.0%
log1p-undefine40.0%
rem-exp-log40.0%
associate-+r-40.0%
*-commutative40.0%
fma-neg40.0%
metadata-eval40.0%
Simplified40.0%
Taylor expanded in h around 0 58.9%
if -3.999999999999988e-310 < d Initial program 66.1%
Simplified66.1%
Applied egg-rr72.8%
distribute-rgt1-in81.4%
+-commutative81.4%
associate-*r/82.4%
*-commutative82.4%
associate-/l*84.0%
Simplified87.5%
Final simplification83.6%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (/ (pow (* M (/ (/ D_m d) 2.0)) 2.0) l)))
(if (<= d -5.8e-231)
(* (sqrt (/ d l)) (* (sqrt (/ d h)) (+ 1.0 (* -0.5 (* h t_0)))))
(if (<= d -4e-310)
(/ d (sqrt 0.0))
(* d (/ (fma h (* -0.5 t_0) 1.0) (* (sqrt l) (sqrt h))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = pow((M * ((D_m / d) / 2.0)), 2.0) / l;
double tmp;
if (d <= -5.8e-231) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (-0.5 * (h * t_0))));
} else if (d <= -4e-310) {
tmp = d / sqrt(0.0);
} else {
tmp = d * (fma(h, (-0.5 * t_0), 1.0) / (sqrt(l) * sqrt(h)));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64((Float64(M * Float64(Float64(D_m / d) / 2.0)) ^ 2.0) / l) tmp = 0.0 if (d <= -5.8e-231) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(-0.5 * Float64(h * t_0))))); elseif (d <= -4e-310) tmp = Float64(d / sqrt(0.0)); else tmp = Float64(d * Float64(fma(h, Float64(-0.5 * t_0), 1.0) / Float64(sqrt(l) * sqrt(h)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[Power[N[(M * N[(N[(D$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]}, If[LessEqual[d, -5.8e-231], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(h * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(d / N[Sqrt[0.0], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(h * N[(-0.5 * t$95$0), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{{\left(M \cdot \frac{\frac{D\_m}{d}}{2}\right)}^{2}}{\ell}\\
\mathbf{if}\;d \leq -5.8 \cdot 10^{-231}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(h \cdot t\_0\right)\right)\right)\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt{0}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, -0.5 \cdot t\_0, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -5.8000000000000001e-231Initial program 79.7%
Simplified78.1%
*-commutative78.1%
clear-num78.1%
un-div-inv79.0%
*-commutative79.0%
associate-*r/80.6%
*-un-lft-identity80.6%
times-frac79.0%
associate-/l/79.0%
*-commutative79.0%
times-frac80.6%
*-commutative80.6%
*-un-lft-identity80.6%
associate-/l*79.8%
*-un-lft-identity79.8%
times-frac79.8%
metadata-eval79.8%
Applied egg-rr79.8%
associate-/r/83.2%
associate-*l/81.5%
associate-/l*79.0%
associate-*l*79.0%
*-commutative79.0%
associate-*l/81.5%
associate-/l*83.2%
associate-*r*83.2%
*-commutative83.2%
metadata-eval83.2%
associate-/l*83.2%
*-rgt-identity83.2%
associate-*r/83.2%
*-commutative83.2%
associate-/l*83.2%
Simplified83.2%
if -5.8000000000000001e-231 < d < -3.999999999999988e-310Initial program 27.5%
Simplified27.2%
Taylor expanded in d around inf 24.8%
*-commutative24.8%
Simplified24.8%
pow124.8%
metadata-eval24.8%
sqrt-pow13.0%
sqrt-prod3.0%
div-inv3.0%
sqrt-div3.0%
sqrt-pow119.6%
metadata-eval19.6%
pow119.6%
*-commutative19.6%
Applied egg-rr19.6%
expm1-log1p-u19.6%
expm1-undefine40.0%
*-commutative40.0%
Applied egg-rr40.0%
log1p-undefine40.0%
rem-exp-log40.0%
associate-+r-40.0%
*-commutative40.0%
fma-neg40.0%
metadata-eval40.0%
Simplified40.0%
Taylor expanded in h around 0 58.9%
if -3.999999999999988e-310 < d Initial program 66.1%
Simplified66.1%
Applied egg-rr72.8%
distribute-rgt1-in81.4%
+-commutative81.4%
associate-*r/82.4%
*-commutative82.4%
associate-/l*84.0%
Simplified87.5%
Final simplification83.4%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= l -42000.0)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ -1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0)))))
(if (<= l 8e-272)
(*
(sqrt (* (/ d l) (/ d h)))
(fma (* h (/ (pow (* (/ 0.5 d) (* D_m M)) 2.0) l)) -0.5 1.0))
(if (<= l 8.2e+192)
(*
d
(/
(fma (/ h l) (* -0.5 (pow (* 0.5 (* D_m (/ M d))) 2.0)) 1.0)
(sqrt (* l h))))
(* d (/ (sqrt (/ 1.0 l)) (sqrt h)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -42000.0) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0))));
} else if (l <= 8e-272) {
tmp = sqrt(((d / l) * (d / h))) * fma((h * (pow(((0.5 / d) * (D_m * M)), 2.0) / l)), -0.5, 1.0);
} else if (l <= 8.2e+192) {
tmp = d * (fma((h / l), (-0.5 * pow((0.5 * (D_m * (M / d))), 2.0)), 1.0) / sqrt((l * h)));
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= -42000.0) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0))))); elseif (l <= 8e-272) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * fma(Float64(h * Float64((Float64(Float64(0.5 / d) * Float64(D_m * M)) ^ 2.0) / l)), -0.5, 1.0)); elseif (l <= 8.2e+192) tmp = Float64(d * Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(0.5 * Float64(D_m * Float64(M / d))) ^ 2.0)), 1.0) / sqrt(Float64(l * h)))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -42000.0], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8e-272], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(h * N[(N[Power[N[(N[(0.5 / d), $MachinePrecision] * N[(D$95$m * M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8.2e+192], N[(d * N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(0.5 * N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -42000:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right)\\
\mathbf{elif}\;\ell \leq 8 \cdot 10^{-272}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \mathsf{fma}\left(h \cdot \frac{{\left(\frac{0.5}{d} \cdot \left(D\_m \cdot M\right)\right)}^{2}}{\ell}, -0.5, 1\right)\\
\mathbf{elif}\;\ell \leq 8.2 \cdot 10^{+192}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(0.5 \cdot \left(D\_m \cdot \frac{M}{d}\right)\right)}^{2}, 1\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -42000Initial program 61.4%
Simplified59.9%
sqrt-unprod43.0%
pow1/243.0%
frac-times32.3%
pow232.3%
Applied egg-rr32.3%
unpow1/232.3%
*-commutative32.3%
Simplified32.3%
Taylor expanded in d around -inf 64.1%
if -42000 < l < 7.99999999999999944e-272Initial program 82.3%
Simplified79.8%
*-commutative79.8%
clear-num79.8%
un-div-inv81.1%
*-commutative81.1%
associate-*r/83.6%
*-un-lft-identity83.6%
times-frac81.1%
associate-/l/81.1%
*-commutative81.1%
times-frac83.6%
*-commutative83.6%
*-un-lft-identity83.6%
associate-/l*83.7%
*-un-lft-identity83.7%
times-frac83.7%
metadata-eval83.7%
Applied egg-rr83.7%
associate-/l*83.7%
associate-*r*83.7%
associate-/l*83.6%
*-commutative83.6%
associate-*r*83.6%
associate-/l*83.6%
Simplified83.6%
pow183.6%
associate-*r*83.6%
pow1/283.6%
pow1/283.6%
pow-prod-down78.8%
+-commutative78.8%
*-commutative78.8%
fma-define78.8%
div-inv77.5%
associate-*l*75.0%
clear-num75.0%
Applied egg-rr75.0%
unpow175.0%
unpow1/275.0%
associate-*r/81.3%
*-commutative81.3%
associate-*r/81.3%
associate-*r*83.9%
Simplified83.9%
if 7.99999999999999944e-272 < l < 8.20000000000000006e192Initial program 71.3%
Simplified71.3%
sqrt-unprod59.3%
pow1/259.3%
frac-times51.6%
pow251.6%
Applied egg-rr51.6%
unpow1/251.6%
*-commutative51.6%
Simplified51.6%
pow151.6%
Applied egg-rr76.3%
unpow176.3%
associate-*l/75.5%
associate-/l*77.4%
+-commutative77.4%
associate-*r*77.4%
*-commutative77.4%
fma-define77.4%
*-commutative77.4%
associate-*r*77.4%
associate-*l/77.4%
*-commutative77.4%
associate-/l*76.4%
Simplified76.4%
if 8.20000000000000006e192 < l Initial program 38.1%
Simplified38.1%
Taylor expanded in d around inf 37.1%
*-commutative37.1%
Simplified37.1%
associate-/r*41.6%
sqrt-div65.4%
Applied egg-rr65.4%
Final simplification74.8%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= d -1.15e-227)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (* -0.5 (* h (/ (pow (* M (/ (/ D_m d) 2.0)) 2.0) l))))))
(if (<= d -4e-310)
(/ d (sqrt 0.0))
(*
(/ d (* (sqrt l) (sqrt h)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= -1.15e-227) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (-0.5 * (h * (pow((M * ((D_m / d) / 2.0)), 2.0) / l)))));
} else if (d <= -4e-310) {
tmp = d / sqrt(0.0);
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - (0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0))));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: tmp
if (d <= (-1.15d-227)) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((-0.5d0) * (h * (((m * ((d_m / d) / 2.0d0)) ** 2.0d0) / l)))))
else if (d <= (-4d-310)) then
tmp = d / sqrt(0.0d0)
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 - (0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0))))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= -1.15e-227) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + (-0.5 * (h * (Math.pow((M * ((D_m / d) / 2.0)), 2.0) / l)))));
} else if (d <= -4e-310) {
tmp = d / Math.sqrt(0.0);
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 - (0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.0))));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if d <= -1.15e-227: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + (-0.5 * (h * (math.pow((M * ((D_m / d) / 2.0)), 2.0) / l))))) elif d <= -4e-310: tmp = d / math.sqrt(0.0) else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 - (0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.0)))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (d <= -1.15e-227) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(-0.5 * Float64(h * Float64((Float64(M * Float64(Float64(D_m / d) / 2.0)) ^ 2.0) / l)))))); elseif (d <= -4e-310) tmp = Float64(d / sqrt(0.0)); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0))))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (d <= -1.15e-227)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (-0.5 * (h * (((M * ((D_m / d) / 2.0)) ^ 2.0) / l)))));
elseif (d <= -4e-310)
tmp = d / sqrt(0.0);
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - (0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.0))));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[d, -1.15e-227], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(h * N[(N[Power[N[(M * N[(N[(D$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(d / N[Sqrt[0.0], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.15 \cdot 10^{-227}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \frac{\frac{D\_m}{d}}{2}\right)}^{2}}{\ell}\right)\right)\right)\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt{0}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if d < -1.15000000000000006e-227Initial program 79.7%
Simplified78.1%
*-commutative78.1%
clear-num78.1%
un-div-inv79.0%
*-commutative79.0%
associate-*r/80.6%
*-un-lft-identity80.6%
times-frac79.0%
associate-/l/79.0%
*-commutative79.0%
times-frac80.6%
*-commutative80.6%
*-un-lft-identity80.6%
associate-/l*79.8%
*-un-lft-identity79.8%
times-frac79.8%
metadata-eval79.8%
Applied egg-rr79.8%
associate-/r/83.2%
associate-*l/81.5%
associate-/l*79.0%
associate-*l*79.0%
*-commutative79.0%
associate-*l/81.5%
associate-/l*83.2%
associate-*r*83.2%
*-commutative83.2%
metadata-eval83.2%
associate-/l*83.2%
*-rgt-identity83.2%
associate-*r/83.2%
*-commutative83.2%
associate-/l*83.2%
Simplified83.2%
if -1.15000000000000006e-227 < d < -3.999999999999988e-310Initial program 27.5%
Simplified27.2%
Taylor expanded in d around inf 24.8%
*-commutative24.8%
Simplified24.8%
pow124.8%
metadata-eval24.8%
sqrt-pow13.0%
sqrt-prod3.0%
div-inv3.0%
sqrt-div3.0%
sqrt-pow119.6%
metadata-eval19.6%
pow119.6%
*-commutative19.6%
Applied egg-rr19.6%
expm1-log1p-u19.6%
expm1-undefine40.0%
*-commutative40.0%
Applied egg-rr40.0%
log1p-undefine40.0%
rem-exp-log40.0%
associate-+r-40.0%
*-commutative40.0%
fma-neg40.0%
metadata-eval40.0%
Simplified40.0%
Taylor expanded in h around 0 58.9%
if -3.999999999999988e-310 < d Initial program 66.1%
Simplified66.1%
*-commutative66.1%
sqrt-div72.2%
sqrt-div81.2%
frac-times81.2%
add-sqr-sqrt81.4%
Applied egg-rr81.4%
Final simplification80.5%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0)))))
(if (<= l -42000.0)
(* (* d (sqrt (/ 1.0 (* l h)))) (+ -1.0 t_0))
(if (<= l 4.8e-305)
(*
(sqrt (* (/ d l) (/ d h)))
(fma (* h (/ (pow (* (/ 0.5 d) (* D_m M)) 2.0) l)) -0.5 1.0))
(* (/ d (* (sqrt l) (sqrt h))) (- 1.0 t_0))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = 0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0));
double tmp;
if (l <= -42000.0) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + t_0);
} else if (l <= 4.8e-305) {
tmp = sqrt(((d / l) * (d / h))) * fma((h * (pow(((0.5 / d) * (D_m * M)), 2.0) / l)), -0.5, 1.0);
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - t_0);
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0))) tmp = 0.0 if (l <= -42000.0) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + t_0)); elseif (l <= 4.8e-305) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * fma(Float64(h * Float64((Float64(Float64(0.5 / d) * Float64(D_m * M)) ^ 2.0) / l)), -0.5, 1.0)); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 - t_0)); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -42000.0], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.8e-305], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(h * N[(N[Power[N[(N[(0.5 / d), $MachinePrecision] * N[(D$95$m * M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - t$95$0), $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 := 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\\
\mathbf{if}\;\ell \leq -42000:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + t\_0\right)\\
\mathbf{elif}\;\ell \leq 4.8 \cdot 10^{-305}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \mathsf{fma}\left(h \cdot \frac{{\left(\frac{0.5}{d} \cdot \left(D\_m \cdot M\right)\right)}^{2}}{\ell}, -0.5, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 - t\_0\right)\\
\end{array}
\end{array}
if l < -42000Initial program 61.4%
Simplified59.9%
sqrt-unprod43.0%
pow1/243.0%
frac-times32.3%
pow232.3%
Applied egg-rr32.3%
unpow1/232.3%
*-commutative32.3%
Simplified32.3%
Taylor expanded in d around -inf 64.1%
if -42000 < l < 4.80000000000000039e-305Initial program 81.9%
Simplified80.6%
*-commutative80.6%
clear-num80.6%
un-div-inv81.9%
*-commutative81.9%
associate-*r/83.2%
*-un-lft-identity83.2%
times-frac81.9%
associate-/l/81.9%
*-commutative81.9%
times-frac83.2%
*-commutative83.2%
*-un-lft-identity83.2%
associate-/l*83.2%
*-un-lft-identity83.2%
times-frac83.2%
metadata-eval83.2%
Applied egg-rr83.2%
associate-/l*83.2%
associate-*r*83.2%
associate-/l*83.2%
*-commutative83.2%
associate-*r*83.2%
associate-/l*83.2%
Simplified83.2%
pow183.2%
associate-*r*83.2%
pow1/283.2%
pow1/283.2%
pow-prod-down79.5%
+-commutative79.5%
*-commutative79.5%
fma-define79.5%
div-inv78.2%
associate-*l*76.9%
clear-num76.9%
Applied egg-rr76.9%
unpow176.9%
unpow1/276.9%
associate-*r/83.4%
*-commutative83.4%
associate-*r/83.4%
associate-*r*84.8%
Simplified84.8%
if 4.80000000000000039e-305 < l Initial program 66.1%
Simplified66.1%
*-commutative66.1%
sqrt-div72.2%
sqrt-div81.2%
frac-times81.2%
add-sqr-sqrt81.4%
Applied egg-rr81.4%
Final simplification78.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 (pow (* (/ 0.5 d) (* D_m M)) 2.0)))
(if (<= l -42000.0)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ -1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0)))))
(if (<= l 1e-307)
(* (sqrt (* (/ d l) (/ d h))) (fma (* h (/ t_0 l)) -0.5 1.0))
(* (+ 1.0 (* t_0 (* (/ h l) -0.5))) (/ (/ 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(((0.5 / d) * (D_m * M)), 2.0);
double tmp;
if (l <= -42000.0) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0))));
} else if (l <= 1e-307) {
tmp = sqrt(((d / l) * (d / h))) * fma((h * (t_0 / l)), -0.5, 1.0);
} else {
tmp = (1.0 + (t_0 * ((h / l) * -0.5))) * ((d / sqrt(h)) / sqrt(l));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(0.5 / d) * Float64(D_m * M)) ^ 2.0 tmp = 0.0 if (l <= -42000.0) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0))))); elseif (l <= 1e-307) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * fma(Float64(h * Float64(t_0 / l)), -0.5, 1.0)); else tmp = Float64(Float64(1.0 + Float64(t_0 * Float64(Float64(h / l) * -0.5))) * Float64(Float64(d / sqrt(h)) / sqrt(l))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Power[N[(N[(0.5 / d), $MachinePrecision] * N[(D$95$m * M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[l, -42000.0], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1e-307], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(h * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{0.5}{d} \cdot \left(D\_m \cdot M\right)\right)}^{2}\\
\mathbf{if}\;\ell \leq -42000:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right)\\
\mathbf{elif}\;\ell \leq 10^{-307}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \mathsf{fma}\left(h \cdot \frac{t\_0}{\ell}, -0.5, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + t\_0 \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right) \cdot \frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -42000Initial program 61.4%
Simplified59.9%
sqrt-unprod43.0%
pow1/243.0%
frac-times32.3%
pow232.3%
Applied egg-rr32.3%
unpow1/232.3%
*-commutative32.3%
Simplified32.3%
Taylor expanded in d around -inf 64.1%
if -42000 < l < 9.99999999999999909e-308Initial program 81.9%
Simplified80.6%
*-commutative80.6%
clear-num80.6%
un-div-inv81.9%
*-commutative81.9%
associate-*r/83.2%
*-un-lft-identity83.2%
times-frac81.9%
associate-/l/81.9%
*-commutative81.9%
times-frac83.2%
*-commutative83.2%
*-un-lft-identity83.2%
associate-/l*83.2%
*-un-lft-identity83.2%
times-frac83.2%
metadata-eval83.2%
Applied egg-rr83.2%
associate-/l*83.2%
associate-*r*83.2%
associate-/l*83.2%
*-commutative83.2%
associate-*r*83.2%
associate-/l*83.2%
Simplified83.2%
pow183.2%
associate-*r*83.2%
pow1/283.2%
pow1/283.2%
pow-prod-down79.5%
+-commutative79.5%
*-commutative79.5%
fma-define79.5%
div-inv78.2%
associate-*l*76.9%
clear-num76.9%
Applied egg-rr76.9%
unpow176.9%
unpow1/276.9%
associate-*r/83.4%
*-commutative83.4%
associate-*r/83.4%
associate-*r*84.8%
Simplified84.8%
if 9.99999999999999909e-308 < l Initial program 66.1%
Simplified66.1%
Applied egg-rr72.8%
distribute-rgt1-in81.4%
+-commutative81.4%
associate-*r*81.4%
associate-*r*81.4%
associate-/l*81.4%
*-commutative81.4%
associate-*r*81.4%
associate-/l*81.4%
associate-/l/77.9%
Simplified77.9%
Final simplification76.6%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (pow (* l h) -0.5)) (t_1 (* d (- t_0))))
(if (<= l -7e+14)
t_1
(if (<= l -1.22e-275)
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* -0.5 (* (/ h l) (pow (* (/ D_m d) (* M 0.5)) 2.0)))))
(if (<= l -1e-310)
t_1
(if (<= l 5e+174)
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0))))
(* d t_0))
(* d (/ (sqrt (/ 1.0 l)) (sqrt h)))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = pow((l * h), -0.5);
double t_1 = d * -t_0;
double tmp;
if (l <= -7e+14) {
tmp = t_1;
} else if (l <= -1.22e-275) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * pow(((D_m / d) * (M * 0.5)), 2.0))));
} else if (l <= -1e-310) {
tmp = t_1;
} else if (l <= 5e+174) {
tmp = (1.0 - (0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0)))) * (d * t_0);
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (l * h) ** (-0.5d0)
t_1 = d * -t_0
if (l <= (-7d+14)) then
tmp = t_1
else if (l <= (-1.22d-275)) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * ((h / l) * (((d_m / d) * (m * 0.5d0)) ** 2.0d0))))
else if (l <= (-1d-310)) then
tmp = t_1
else if (l <= 5d+174) then
tmp = (1.0d0 - (0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0)))) * (d * t_0)
else
tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.pow((l * h), -0.5);
double t_1 = d * -t_0;
double tmp;
if (l <= -7e+14) {
tmp = t_1;
} else if (l <= -1.22e-275) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * Math.pow(((D_m / d) * (M * 0.5)), 2.0))));
} else if (l <= -1e-310) {
tmp = t_1;
} else if (l <= 5e+174) {
tmp = (1.0 - (0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.0)))) * (d * t_0);
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.pow((l * h), -0.5) t_1 = d * -t_0 tmp = 0 if l <= -7e+14: tmp = t_1 elif l <= -1.22e-275: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * math.pow(((D_m / d) * (M * 0.5)), 2.0)))) elif l <= -1e-310: tmp = t_1 elif l <= 5e+174: tmp = (1.0 - (0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.0)))) * (d * t_0) else: tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(l * h) ^ -0.5 t_1 = Float64(d * Float64(-t_0)) tmp = 0.0 if (l <= -7e+14) tmp = t_1; elseif (l <= -1.22e-275) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M * 0.5)) ^ 2.0))))); elseif (l <= -1e-310) tmp = t_1; elseif (l <= 5e+174) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0)))) * Float64(d * t_0)); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = (l * h) ^ -0.5;
t_1 = d * -t_0;
tmp = 0.0;
if (l <= -7e+14)
tmp = t_1;
elseif (l <= -1.22e-275)
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * (((D_m / d) * (M * 0.5)) ^ 2.0))));
elseif (l <= -1e-310)
tmp = t_1;
elseif (l <= 5e+174)
tmp = (1.0 - (0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.0)))) * (d * t_0);
else
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]}, Block[{t$95$1 = N[(d * (-t$95$0)), $MachinePrecision]}, If[LessEqual[l, -7e+14], t$95$1, If[LessEqual[l, -1.22e-275], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-310], t$95$1, If[LessEqual[l, 5e+174], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d * t$95$0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{-0.5}\\
t_1 := d \cdot \left(-t\_0\right)\\
\mathbf{if}\;\ell \leq -7 \cdot 10^{+14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq -1.22 \cdot 10^{-275}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}\right)\right)\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq 5 \cdot 10^{+174}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right) \cdot \left(d \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -7e14 or -1.21999999999999995e-275 < l < -9.999999999999969e-311Initial program 55.5%
Simplified54.1%
Taylor expanded in d around inf 9.1%
*-commutative9.1%
Simplified9.1%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt58.3%
neg-mul-158.3%
Simplified58.3%
if -7e14 < l < -1.21999999999999995e-275Initial program 89.9%
Simplified90.0%
add-sqr-sqrt89.9%
pow289.9%
sqrt-prod89.9%
sqrt-pow192.8%
metadata-eval92.8%
frac-times92.8%
pow192.8%
associate-/l*92.8%
*-un-lft-identity92.8%
times-frac92.8%
metadata-eval92.8%
Applied egg-rr92.8%
pow192.8%
Applied egg-rr87.2%
unpow187.2%
*-commutative87.2%
*-commutative87.2%
*-commutative87.2%
*-commutative87.2%
*-commutative87.2%
Simplified87.2%
if -9.999999999999969e-311 < l < 4.9999999999999997e174Initial program 73.4%
Simplified73.4%
sqrt-unprod60.1%
pow1/260.1%
frac-times53.2%
pow253.2%
Applied egg-rr53.2%
unpow1/253.2%
*-commutative53.2%
Simplified53.2%
div-inv53.1%
sqrt-prod61.1%
sqrt-pow176.9%
metadata-eval76.9%
pow176.9%
*-commutative76.9%
inv-pow76.9%
sqrt-pow177.7%
*-commutative77.7%
metadata-eval77.7%
Applied egg-rr77.7%
if 4.9999999999999997e174 < l Initial program 39.2%
Simplified39.2%
Taylor expanded in d around inf 38.3%
*-commutative38.3%
Simplified38.3%
associate-/r*41.8%
sqrt-div60.7%
Applied egg-rr60.7%
Final simplification73.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 (- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0)))))
(t_1 (pow (* l h) -0.5))
(t_2 (* d (- t_1))))
(if (<= l -2.7e-18)
t_2
(if (<= l -7e-276)
(* t_0 (sqrt (/ (* d d) (* l h))))
(if (<= l -1e-310)
t_2
(if (<= l 1.8e+175)
(* t_0 (* d t_1))
(* d (/ (sqrt (/ 1.0 l)) (sqrt h)))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = 1.0 - (0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0)));
double t_1 = pow((l * h), -0.5);
double t_2 = d * -t_1;
double tmp;
if (l <= -2.7e-18) {
tmp = t_2;
} else if (l <= -7e-276) {
tmp = t_0 * sqrt(((d * d) / (l * h)));
} else if (l <= -1e-310) {
tmp = t_2;
} else if (l <= 1.8e+175) {
tmp = t_0 * (d * t_1);
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = 1.0d0 - (0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0)))
t_1 = (l * h) ** (-0.5d0)
t_2 = d * -t_1
if (l <= (-2.7d-18)) then
tmp = t_2
else if (l <= (-7d-276)) then
tmp = t_0 * sqrt(((d * d) / (l * h)))
else if (l <= (-1d-310)) then
tmp = t_2
else if (l <= 1.8d+175) then
tmp = t_0 * (d * t_1)
else
tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = 1.0 - (0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.0)));
double t_1 = Math.pow((l * h), -0.5);
double t_2 = d * -t_1;
double tmp;
if (l <= -2.7e-18) {
tmp = t_2;
} else if (l <= -7e-276) {
tmp = t_0 * Math.sqrt(((d * d) / (l * h)));
} else if (l <= -1e-310) {
tmp = t_2;
} else if (l <= 1.8e+175) {
tmp = t_0 * (d * t_1);
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = 1.0 - (0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.0))) t_1 = math.pow((l * h), -0.5) t_2 = d * -t_1 tmp = 0 if l <= -2.7e-18: tmp = t_2 elif l <= -7e-276: tmp = t_0 * math.sqrt(((d * d) / (l * h))) elif l <= -1e-310: tmp = t_2 elif l <= 1.8e+175: tmp = t_0 * (d * t_1) else: tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0)))) t_1 = Float64(l * h) ^ -0.5 t_2 = Float64(d * Float64(-t_1)) tmp = 0.0 if (l <= -2.7e-18) tmp = t_2; elseif (l <= -7e-276) tmp = Float64(t_0 * sqrt(Float64(Float64(d * d) / Float64(l * h)))); elseif (l <= -1e-310) tmp = t_2; elseif (l <= 1.8e+175) tmp = Float64(t_0 * Float64(d * t_1)); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = 1.0 - (0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.0)));
t_1 = (l * h) ^ -0.5;
t_2 = d * -t_1;
tmp = 0.0;
if (l <= -2.7e-18)
tmp = t_2;
elseif (l <= -7e-276)
tmp = t_0 * sqrt(((d * d) / (l * h)));
elseif (l <= -1e-310)
tmp = t_2;
elseif (l <= 1.8e+175)
tmp = t_0 * (d * t_1);
else
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]}, Block[{t$95$2 = N[(d * (-t$95$1)), $MachinePrecision]}, If[LessEqual[l, -2.7e-18], t$95$2, If[LessEqual[l, -7e-276], N[(t$95$0 * N[Sqrt[N[(N[(d * d), $MachinePrecision] / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-310], t$95$2, If[LessEqual[l, 1.8e+175], N[(t$95$0 * N[(d * t$95$1), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := 1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\\
t_1 := {\left(\ell \cdot h\right)}^{-0.5}\\
t_2 := d \cdot \left(-t\_1\right)\\
\mathbf{if}\;\ell \leq -2.7 \cdot 10^{-18}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\ell \leq -7 \cdot 10^{-276}:\\
\;\;\;\;t\_0 \cdot \sqrt{\frac{d \cdot d}{\ell \cdot h}}\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\ell \leq 1.8 \cdot 10^{+175}:\\
\;\;\;\;t\_0 \cdot \left(d \cdot t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -2.69999999999999989e-18 or -6.99999999999999986e-276 < l < -9.999999999999969e-311Initial program 58.8%
Simplified57.5%
Taylor expanded in d around inf 9.7%
*-commutative9.7%
Simplified9.7%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt60.0%
neg-mul-160.0%
Simplified60.0%
if -2.69999999999999989e-18 < l < -6.99999999999999986e-276Initial program 90.3%
Simplified90.4%
sqrt-unprod88.8%
pow1/288.8%
frac-times65.7%
pow265.7%
Applied egg-rr65.7%
unpow1/265.7%
*-commutative65.7%
Simplified65.7%
unpow265.7%
Applied egg-rr65.7%
if -9.999999999999969e-311 < l < 1.80000000000000017e175Initial program 73.4%
Simplified73.4%
sqrt-unprod60.1%
pow1/260.1%
frac-times53.2%
pow253.2%
Applied egg-rr53.2%
unpow1/253.2%
*-commutative53.2%
Simplified53.2%
div-inv53.1%
sqrt-prod61.1%
sqrt-pow176.9%
metadata-eval76.9%
pow176.9%
*-commutative76.9%
inv-pow76.9%
sqrt-pow177.7%
*-commutative77.7%
metadata-eval77.7%
Applied egg-rr77.7%
if 1.80000000000000017e175 < l Initial program 39.2%
Simplified39.2%
Taylor expanded in d around inf 38.3%
*-commutative38.3%
Simplified38.3%
associate-/r*41.8%
sqrt-div60.7%
Applied egg-rr60.7%
Final simplification67.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 (pow (* l h) -0.5)) (t_1 (* d (- t_0))))
(if (<= l -2.8e-81)
t_1
(if (<= l -6.3e-276)
(/ d (sqrt 0.0))
(if (<= l -1e-310)
t_1
(if (<= l 1.5e+175)
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0))))
(* d t_0))
(* d (/ (sqrt (/ 1.0 l)) (sqrt h)))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = pow((l * h), -0.5);
double t_1 = d * -t_0;
double tmp;
if (l <= -2.8e-81) {
tmp = t_1;
} else if (l <= -6.3e-276) {
tmp = d / sqrt(0.0);
} else if (l <= -1e-310) {
tmp = t_1;
} else if (l <= 1.5e+175) {
tmp = (1.0 - (0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0)))) * (d * t_0);
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (l * h) ** (-0.5d0)
t_1 = d * -t_0
if (l <= (-2.8d-81)) then
tmp = t_1
else if (l <= (-6.3d-276)) then
tmp = d / sqrt(0.0d0)
else if (l <= (-1d-310)) then
tmp = t_1
else if (l <= 1.5d+175) then
tmp = (1.0d0 - (0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0)))) * (d * t_0)
else
tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.pow((l * h), -0.5);
double t_1 = d * -t_0;
double tmp;
if (l <= -2.8e-81) {
tmp = t_1;
} else if (l <= -6.3e-276) {
tmp = d / Math.sqrt(0.0);
} else if (l <= -1e-310) {
tmp = t_1;
} else if (l <= 1.5e+175) {
tmp = (1.0 - (0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.0)))) * (d * t_0);
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.pow((l * h), -0.5) t_1 = d * -t_0 tmp = 0 if l <= -2.8e-81: tmp = t_1 elif l <= -6.3e-276: tmp = d / math.sqrt(0.0) elif l <= -1e-310: tmp = t_1 elif l <= 1.5e+175: tmp = (1.0 - (0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.0)))) * (d * t_0) else: tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(l * h) ^ -0.5 t_1 = Float64(d * Float64(-t_0)) tmp = 0.0 if (l <= -2.8e-81) tmp = t_1; elseif (l <= -6.3e-276) tmp = Float64(d / sqrt(0.0)); elseif (l <= -1e-310) tmp = t_1; elseif (l <= 1.5e+175) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0)))) * Float64(d * t_0)); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = (l * h) ^ -0.5;
t_1 = d * -t_0;
tmp = 0.0;
if (l <= -2.8e-81)
tmp = t_1;
elseif (l <= -6.3e-276)
tmp = d / sqrt(0.0);
elseif (l <= -1e-310)
tmp = t_1;
elseif (l <= 1.5e+175)
tmp = (1.0 - (0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.0)))) * (d * t_0);
else
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]}, Block[{t$95$1 = N[(d * (-t$95$0)), $MachinePrecision]}, If[LessEqual[l, -2.8e-81], t$95$1, If[LessEqual[l, -6.3e-276], N[(d / N[Sqrt[0.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-310], t$95$1, If[LessEqual[l, 1.5e+175], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d * t$95$0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{-0.5}\\
t_1 := d \cdot \left(-t\_0\right)\\
\mathbf{if}\;\ell \leq -2.8 \cdot 10^{-81}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq -6.3 \cdot 10^{-276}:\\
\;\;\;\;\frac{d}{\sqrt{0}}\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq 1.5 \cdot 10^{+175}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right) \cdot \left(d \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -2.7999999999999999e-81 or -6.29999999999999979e-276 < l < -9.999999999999969e-311Initial program 63.3%
Simplified62.3%
Taylor expanded in d around inf 8.7%
*-commutative8.7%
Simplified8.7%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt56.6%
neg-mul-156.6%
Simplified56.6%
if -2.7999999999999999e-81 < l < -6.29999999999999979e-276Initial program 91.4%
Simplified91.4%
Taylor expanded in d around inf 26.1%
*-commutative26.1%
Simplified26.1%
pow126.1%
metadata-eval26.1%
sqrt-pow120.2%
sqrt-prod20.2%
div-inv20.3%
sqrt-div20.3%
sqrt-pow124.0%
metadata-eval24.0%
pow124.0%
*-commutative24.0%
Applied egg-rr24.0%
expm1-log1p-u24.0%
expm1-undefine51.0%
*-commutative51.0%
Applied egg-rr51.0%
log1p-undefine51.0%
rem-exp-log51.0%
associate-+r-51.0%
*-commutative51.0%
fma-neg51.0%
metadata-eval51.0%
Simplified51.0%
Taylor expanded in h around 0 61.5%
if -9.999999999999969e-311 < l < 1.5000000000000001e175Initial program 73.4%
Simplified73.4%
sqrt-unprod60.1%
pow1/260.1%
frac-times53.2%
pow253.2%
Applied egg-rr53.2%
unpow1/253.2%
*-commutative53.2%
Simplified53.2%
div-inv53.1%
sqrt-prod61.1%
sqrt-pow176.9%
metadata-eval76.9%
pow176.9%
*-commutative76.9%
inv-pow76.9%
sqrt-pow177.7%
*-commutative77.7%
metadata-eval77.7%
Applied egg-rr77.7%
if 1.5000000000000001e175 < l Initial program 39.2%
Simplified39.2%
Taylor expanded in d around inf 38.3%
*-commutative38.3%
Simplified38.3%
associate-/r*41.8%
sqrt-div60.7%
Applied egg-rr60.7%
Final simplification65.5%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* d (- (pow (* l h) -0.5)))))
(if (<= l -8e-82)
t_0
(if (<= l -6.2e-276)
(/ d (sqrt 0.0))
(if (<= l -1e-310)
t_0
(if (<= l 1.3e+175)
(*
(+ 1.0 (* -0.5 (* (/ h l) (pow (* (/ D_m d) (* M 0.5)) 2.0))))
(/ d (sqrt (* l h))))
(* d (/ (sqrt (/ 1.0 l)) (sqrt h)))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = d * -pow((l * h), -0.5);
double tmp;
if (l <= -8e-82) {
tmp = t_0;
} else if (l <= -6.2e-276) {
tmp = d / sqrt(0.0);
} else if (l <= -1e-310) {
tmp = t_0;
} else if (l <= 1.3e+175) {
tmp = (1.0 + (-0.5 * ((h / l) * pow(((D_m / d) * (M * 0.5)), 2.0)))) * (d / sqrt((l * h)));
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = d * -((l * h) ** (-0.5d0))
if (l <= (-8d-82)) then
tmp = t_0
else if (l <= (-6.2d-276)) then
tmp = d / sqrt(0.0d0)
else if (l <= (-1d-310)) then
tmp = t_0
else if (l <= 1.3d+175) then
tmp = (1.0d0 + ((-0.5d0) * ((h / l) * (((d_m / d) * (m * 0.5d0)) ** 2.0d0)))) * (d / sqrt((l * h)))
else
tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = d * -Math.pow((l * h), -0.5);
double tmp;
if (l <= -8e-82) {
tmp = t_0;
} else if (l <= -6.2e-276) {
tmp = d / Math.sqrt(0.0);
} else if (l <= -1e-310) {
tmp = t_0;
} else if (l <= 1.3e+175) {
tmp = (1.0 + (-0.5 * ((h / l) * Math.pow(((D_m / d) * (M * 0.5)), 2.0)))) * (d / Math.sqrt((l * h)));
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = d * -math.pow((l * h), -0.5) tmp = 0 if l <= -8e-82: tmp = t_0 elif l <= -6.2e-276: tmp = d / math.sqrt(0.0) elif l <= -1e-310: tmp = t_0 elif l <= 1.3e+175: tmp = (1.0 + (-0.5 * ((h / l) * math.pow(((D_m / d) * (M * 0.5)), 2.0)))) * (d / math.sqrt((l * h))) else: tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(d * Float64(-(Float64(l * h) ^ -0.5))) tmp = 0.0 if (l <= -8e-82) tmp = t_0; elseif (l <= -6.2e-276) tmp = Float64(d / sqrt(0.0)); elseif (l <= -1e-310) tmp = t_0; elseif (l <= 1.3e+175) tmp = Float64(Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M * 0.5)) ^ 2.0)))) * Float64(d / sqrt(Float64(l * h)))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = d * -((l * h) ^ -0.5);
tmp = 0.0;
if (l <= -8e-82)
tmp = t_0;
elseif (l <= -6.2e-276)
tmp = d / sqrt(0.0);
elseif (l <= -1e-310)
tmp = t_0;
elseif (l <= 1.3e+175)
tmp = (1.0 + (-0.5 * ((h / l) * (((D_m / d) * (M * 0.5)) ^ 2.0)))) * (d / sqrt((l * h)));
else
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[l, -8e-82], t$95$0, If[LessEqual[l, -6.2e-276], N[(d / N[Sqrt[0.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-310], t$95$0, If[LessEqual[l, 1.3e+175], N[(N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{if}\;\ell \leq -8 \cdot 10^{-82}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -6.2 \cdot 10^{-276}:\\
\;\;\;\;\frac{d}{\sqrt{0}}\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 1.3 \cdot 10^{+175}:\\
\;\;\;\;\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -8e-82 or -6.19999999999999978e-276 < l < -9.999999999999969e-311Initial program 63.3%
Simplified62.3%
Taylor expanded in d around inf 8.7%
*-commutative8.7%
Simplified8.7%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt56.6%
neg-mul-156.6%
Simplified56.6%
if -8e-82 < l < -6.19999999999999978e-276Initial program 91.4%
Simplified91.4%
Taylor expanded in d around inf 26.1%
*-commutative26.1%
Simplified26.1%
pow126.1%
metadata-eval26.1%
sqrt-pow120.2%
sqrt-prod20.2%
div-inv20.3%
sqrt-div20.3%
sqrt-pow124.0%
metadata-eval24.0%
pow124.0%
*-commutative24.0%
Applied egg-rr24.0%
expm1-log1p-u24.0%
expm1-undefine51.0%
*-commutative51.0%
Applied egg-rr51.0%
log1p-undefine51.0%
rem-exp-log51.0%
associate-+r-51.0%
*-commutative51.0%
fma-neg51.0%
metadata-eval51.0%
Simplified51.0%
Taylor expanded in h around 0 61.5%
if -9.999999999999969e-311 < l < 1.3e175Initial program 73.4%
Simplified73.4%
sqrt-unprod60.1%
pow1/260.1%
frac-times53.2%
pow253.2%
Applied egg-rr53.2%
unpow1/253.2%
*-commutative53.2%
Simplified53.2%
pow153.2%
Applied egg-rr77.7%
unpow177.7%
*-commutative77.7%
*-commutative77.7%
*-commutative77.7%
Simplified77.7%
if 1.3e175 < l Initial program 39.2%
Simplified39.2%
Taylor expanded in d around inf 38.3%
*-commutative38.3%
Simplified38.3%
associate-/r*41.8%
sqrt-div60.7%
Applied egg-rr60.7%
Final simplification65.4%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0)))))
(if (<= l -7e-308)
(* (* d (sqrt (/ 1.0 (* l h)))) (+ -1.0 t_0))
(if (<= l 4.8e+175)
(* (- 1.0 t_0) (* d (pow (* l h) -0.5)))
(* d (/ (sqrt (/ 1.0 l)) (sqrt h)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = 0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0));
double tmp;
if (l <= -7e-308) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + t_0);
} else if (l <= 4.8e+175) {
tmp = (1.0 - t_0) * (d * pow((l * h), -0.5));
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0))
if (l <= (-7d-308)) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + t_0)
else if (l <= 4.8d+175) then
tmp = (1.0d0 - t_0) * (d * ((l * h) ** (-0.5d0)))
else
tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = 0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.0));
double tmp;
if (l <= -7e-308) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + t_0);
} else if (l <= 4.8e+175) {
tmp = (1.0 - t_0) * (d * Math.pow((l * h), -0.5));
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = 0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.0)) tmp = 0 if l <= -7e-308: tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + t_0) elif l <= 4.8e+175: tmp = (1.0 - t_0) * (d * math.pow((l * h), -0.5)) else: tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0))) tmp = 0.0 if (l <= -7e-308) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + t_0)); elseif (l <= 4.8e+175) tmp = Float64(Float64(1.0 - t_0) * Float64(d * (Float64(l * h) ^ -0.5))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = 0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.0));
tmp = 0.0;
if (l <= -7e-308)
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + t_0);
elseif (l <= 4.8e+175)
tmp = (1.0 - t_0) * (d * ((l * h) ^ -0.5));
else
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -7e-308], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.8e+175], N[(N[(1.0 - t$95$0), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\\
\mathbf{if}\;\ell \leq -7 \cdot 10^{-308}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + t\_0\right)\\
\mathbf{elif}\;\ell \leq 4.8 \cdot 10^{+175}:\\
\;\;\;\;\left(1 - t\_0\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -7e-308Initial program 73.1%
Simplified72.4%
sqrt-unprod62.7%
pow1/262.7%
frac-times46.9%
pow246.9%
Applied egg-rr46.9%
unpow1/246.9%
*-commutative46.9%
Simplified46.9%
Taylor expanded in d around -inf 71.0%
if -7e-308 < l < 4.8e175Initial program 72.6%
Simplified72.6%
sqrt-unprod59.4%
pow1/259.4%
frac-times52.6%
pow252.6%
Applied egg-rr52.6%
unpow1/252.6%
*-commutative52.6%
Simplified52.6%
div-inv52.6%
sqrt-prod60.4%
sqrt-pow176.1%
metadata-eval76.1%
pow176.1%
*-commutative76.1%
inv-pow76.1%
sqrt-pow176.9%
*-commutative76.9%
metadata-eval76.9%
Applied egg-rr76.9%
if 4.8e175 < l Initial program 39.2%
Simplified39.2%
Taylor expanded in d around inf 38.3%
*-commutative38.3%
Simplified38.3%
associate-/r*41.8%
sqrt-div60.7%
Applied egg-rr60.7%
Final simplification72.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 (* d (- (pow (* l h) -0.5)))))
(if (<= l -2.9e-83)
t_0
(if (<= l -6.2e-276)
(/ d (sqrt 0.0))
(if (<= l 3.7e-284) t_0 (* d (/ (sqrt (/ 1.0 l)) (sqrt h))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = d * -pow((l * h), -0.5);
double tmp;
if (l <= -2.9e-83) {
tmp = t_0;
} else if (l <= -6.2e-276) {
tmp = d / sqrt(0.0);
} else if (l <= 3.7e-284) {
tmp = t_0;
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = d * -((l * h) ** (-0.5d0))
if (l <= (-2.9d-83)) then
tmp = t_0
else if (l <= (-6.2d-276)) then
tmp = d / sqrt(0.0d0)
else if (l <= 3.7d-284) then
tmp = t_0
else
tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = d * -Math.pow((l * h), -0.5);
double tmp;
if (l <= -2.9e-83) {
tmp = t_0;
} else if (l <= -6.2e-276) {
tmp = d / Math.sqrt(0.0);
} else if (l <= 3.7e-284) {
tmp = t_0;
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = d * -math.pow((l * h), -0.5) tmp = 0 if l <= -2.9e-83: tmp = t_0 elif l <= -6.2e-276: tmp = d / math.sqrt(0.0) elif l <= 3.7e-284: tmp = t_0 else: tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(d * Float64(-(Float64(l * h) ^ -0.5))) tmp = 0.0 if (l <= -2.9e-83) tmp = t_0; elseif (l <= -6.2e-276) tmp = Float64(d / sqrt(0.0)); elseif (l <= 3.7e-284) tmp = t_0; else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = d * -((l * h) ^ -0.5);
tmp = 0.0;
if (l <= -2.9e-83)
tmp = t_0;
elseif (l <= -6.2e-276)
tmp = d / sqrt(0.0);
elseif (l <= 3.7e-284)
tmp = t_0;
else
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[l, -2.9e-83], t$95$0, If[LessEqual[l, -6.2e-276], N[(d / N[Sqrt[0.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.7e-284], t$95$0, N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{if}\;\ell \leq -2.9 \cdot 10^{-83}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -6.2 \cdot 10^{-276}:\\
\;\;\;\;\frac{d}{\sqrt{0}}\\
\mathbf{elif}\;\ell \leq 3.7 \cdot 10^{-284}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -2.8999999999999999e-83 or -6.19999999999999978e-276 < l < 3.7e-284Initial program 63.7%
Simplified62.7%
Taylor expanded in d around inf 8.6%
*-commutative8.6%
Simplified8.6%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt57.0%
neg-mul-157.0%
Simplified57.0%
if -2.8999999999999999e-83 < l < -6.19999999999999978e-276Initial program 91.4%
Simplified91.4%
Taylor expanded in d around inf 26.1%
*-commutative26.1%
Simplified26.1%
pow126.1%
metadata-eval26.1%
sqrt-pow120.2%
sqrt-prod20.2%
div-inv20.3%
sqrt-div20.3%
sqrt-pow124.0%
metadata-eval24.0%
pow124.0%
*-commutative24.0%
Applied egg-rr24.0%
expm1-log1p-u24.0%
expm1-undefine51.0%
*-commutative51.0%
Applied egg-rr51.0%
log1p-undefine51.0%
rem-exp-log51.0%
associate-+r-51.0%
*-commutative51.0%
fma-neg51.0%
metadata-eval51.0%
Simplified51.0%
Taylor expanded in h around 0 61.5%
if 3.7e-284 < l Initial program 65.8%
Simplified65.8%
Taylor expanded in d around inf 34.8%
*-commutative34.8%
Simplified34.8%
associate-/r*35.5%
sqrt-div43.7%
Applied egg-rr43.7%
Final simplification51.8%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* d (- (pow (* l h) -0.5)))))
(if (<= l -1.5e-79)
t_0
(if (<= l -2.05e-274)
(/ d (sqrt 0.0))
(if (<= l 3.9e-277) t_0 (/ d (* (sqrt l) (sqrt h))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = d * -pow((l * h), -0.5);
double tmp;
if (l <= -1.5e-79) {
tmp = t_0;
} else if (l <= -2.05e-274) {
tmp = d / sqrt(0.0);
} else if (l <= 3.9e-277) {
tmp = t_0;
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = d * -((l * h) ** (-0.5d0))
if (l <= (-1.5d-79)) then
tmp = t_0
else if (l <= (-2.05d-274)) then
tmp = d / sqrt(0.0d0)
else if (l <= 3.9d-277) then
tmp = t_0
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = d * -Math.pow((l * h), -0.5);
double tmp;
if (l <= -1.5e-79) {
tmp = t_0;
} else if (l <= -2.05e-274) {
tmp = d / Math.sqrt(0.0);
} else if (l <= 3.9e-277) {
tmp = t_0;
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = d * -math.pow((l * h), -0.5) tmp = 0 if l <= -1.5e-79: tmp = t_0 elif l <= -2.05e-274: tmp = d / math.sqrt(0.0) elif l <= 3.9e-277: tmp = t_0 else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(d * Float64(-(Float64(l * h) ^ -0.5))) tmp = 0.0 if (l <= -1.5e-79) tmp = t_0; elseif (l <= -2.05e-274) tmp = Float64(d / sqrt(0.0)); elseif (l <= 3.9e-277) tmp = t_0; else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = d * -((l * h) ^ -0.5);
tmp = 0.0;
if (l <= -1.5e-79)
tmp = t_0;
elseif (l <= -2.05e-274)
tmp = d / sqrt(0.0);
elseif (l <= 3.9e-277)
tmp = t_0;
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[l, -1.5e-79], t$95$0, If[LessEqual[l, -2.05e-274], N[(d / N[Sqrt[0.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.9e-277], t$95$0, N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{if}\;\ell \leq -1.5 \cdot 10^{-79}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -2.05 \cdot 10^{-274}:\\
\;\;\;\;\frac{d}{\sqrt{0}}\\
\mathbf{elif}\;\ell \leq 3.9 \cdot 10^{-277}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -1.5e-79 or -2.04999999999999994e-274 < l < 3.89999999999999987e-277Initial program 63.7%
Simplified62.7%
Taylor expanded in d around inf 8.6%
*-commutative8.6%
Simplified8.6%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt57.0%
neg-mul-157.0%
Simplified57.0%
if -1.5e-79 < l < -2.04999999999999994e-274Initial program 91.4%
Simplified91.4%
Taylor expanded in d around inf 26.1%
*-commutative26.1%
Simplified26.1%
pow126.1%
metadata-eval26.1%
sqrt-pow120.2%
sqrt-prod20.2%
div-inv20.3%
sqrt-div20.3%
sqrt-pow124.0%
metadata-eval24.0%
pow124.0%
*-commutative24.0%
Applied egg-rr24.0%
expm1-log1p-u24.0%
expm1-undefine51.0%
*-commutative51.0%
Applied egg-rr51.0%
log1p-undefine51.0%
rem-exp-log51.0%
associate-+r-51.0%
*-commutative51.0%
fma-neg51.0%
metadata-eval51.0%
Simplified51.0%
Taylor expanded in h around 0 61.5%
if 3.89999999999999987e-277 < l Initial program 65.8%
Simplified65.8%
Taylor expanded in d around inf 34.8%
*-commutative34.8%
Simplified34.8%
pow134.8%
metadata-eval34.8%
sqrt-pow125.9%
sqrt-prod21.1%
div-inv21.2%
sqrt-div25.9%
sqrt-pow135.1%
metadata-eval35.1%
pow135.1%
*-commutative35.1%
Applied egg-rr35.1%
*-commutative35.1%
sqrt-prod43.6%
Applied egg-rr43.6%
Final simplification51.8%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* d (- (pow (* l h) -0.5)))))
(if (<= l -2.45e-82)
t_0
(if (<= l -1.68e-273)
(/ d (sqrt 0.0))
(if (<= l 1.28e-270) t_0 (* 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 t_0 = d * -pow((l * h), -0.5);
double tmp;
if (l <= -2.45e-82) {
tmp = t_0;
} else if (l <= -1.68e-273) {
tmp = d / sqrt(0.0);
} else if (l <= 1.28e-270) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = d * -((l * h) ** (-0.5d0))
if (l <= (-2.45d-82)) then
tmp = t_0
else if (l <= (-1.68d-273)) then
tmp = d / sqrt(0.0d0)
else if (l <= 1.28d-270) then
tmp = t_0
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 t_0 = d * -Math.pow((l * h), -0.5);
double tmp;
if (l <= -2.45e-82) {
tmp = t_0;
} else if (l <= -1.68e-273) {
tmp = d / Math.sqrt(0.0);
} else if (l <= 1.28e-270) {
tmp = t_0;
} 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): t_0 = d * -math.pow((l * h), -0.5) tmp = 0 if l <= -2.45e-82: tmp = t_0 elif l <= -1.68e-273: tmp = d / math.sqrt(0.0) elif l <= 1.28e-270: tmp = t_0 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) t_0 = Float64(d * Float64(-(Float64(l * h) ^ -0.5))) tmp = 0.0 if (l <= -2.45e-82) tmp = t_0; elseif (l <= -1.68e-273) tmp = Float64(d / sqrt(0.0)); elseif (l <= 1.28e-270) tmp = t_0; 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)
t_0 = d * -((l * h) ^ -0.5);
tmp = 0.0;
if (l <= -2.45e-82)
tmp = t_0;
elseif (l <= -1.68e-273)
tmp = d / sqrt(0.0);
elseif (l <= 1.28e-270)
tmp = t_0;
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_] := Block[{t$95$0 = N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[l, -2.45e-82], t$95$0, If[LessEqual[l, -1.68e-273], N[(d / N[Sqrt[0.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.28e-270], t$95$0, 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}
t_0 := d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{if}\;\ell \leq -2.45 \cdot 10^{-82}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -1.68 \cdot 10^{-273}:\\
\;\;\;\;\frac{d}{\sqrt{0}}\\
\mathbf{elif}\;\ell \leq 1.28 \cdot 10^{-270}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if l < -2.4500000000000001e-82 or -1.67999999999999995e-273 < l < 1.27999999999999991e-270Initial program 64.5%
Simplified63.4%
Taylor expanded in d around inf 8.4%
*-commutative8.4%
Simplified8.4%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt55.9%
neg-mul-155.9%
Simplified55.9%
if -2.4500000000000001e-82 < l < -1.67999999999999995e-273Initial program 91.4%
Simplified91.4%
Taylor expanded in d around inf 26.1%
*-commutative26.1%
Simplified26.1%
pow126.1%
metadata-eval26.1%
sqrt-pow120.2%
sqrt-prod20.2%
div-inv20.3%
sqrt-div20.3%
sqrt-pow124.0%
metadata-eval24.0%
pow124.0%
*-commutative24.0%
Applied egg-rr24.0%
expm1-log1p-u24.0%
expm1-undefine51.0%
*-commutative51.0%
Applied egg-rr51.0%
log1p-undefine51.0%
rem-exp-log51.0%
associate-+r-51.0%
*-commutative51.0%
fma-neg51.0%
metadata-eval51.0%
Simplified51.0%
Taylor expanded in h around 0 61.5%
if 1.27999999999999991e-270 < l Initial program 65.2%
Simplified65.2%
Taylor expanded in d around inf 35.4%
*-commutative35.4%
Simplified35.4%
Taylor expanded in l around 0 35.4%
associate-/r*36.1%
Simplified36.1%
Final simplification48.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 (<= M 6.4e-115) (* d (sqrt (/ (/ 1.0 h) l))) (/ d (sqrt 0.0))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (M <= 6.4e-115) {
tmp = d * sqrt(((1.0 / h) / l));
} else {
tmp = d / sqrt(0.0);
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: tmp
if (m <= 6.4d-115) then
tmp = d * sqrt(((1.0d0 / h) / l))
else
tmp = d / sqrt(0.0d0)
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (M <= 6.4e-115) {
tmp = d * Math.sqrt(((1.0 / h) / l));
} else {
tmp = d / Math.sqrt(0.0);
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if M <= 6.4e-115: tmp = d * math.sqrt(((1.0 / h) / l)) else: tmp = d / math.sqrt(0.0) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (M <= 6.4e-115) tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); else tmp = Float64(d / sqrt(0.0)); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (M <= 6.4e-115)
tmp = d * sqrt(((1.0 / h) / l));
else
tmp = d / sqrt(0.0);
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[M, 6.4e-115], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[Sqrt[0.0], $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}\;M \leq 6.4 \cdot 10^{-115}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{0}}\\
\end{array}
\end{array}
if M < 6.4e-115Initial program 69.3%
Simplified68.7%
Taylor expanded in d around inf 24.5%
*-commutative24.5%
Simplified24.5%
Taylor expanded in l around 0 24.5%
associate-/r*25.0%
Simplified25.0%
if 6.4e-115 < M Initial program 70.2%
Simplified70.2%
Taylor expanded in d around inf 22.1%
*-commutative22.1%
Simplified22.1%
pow122.1%
metadata-eval22.1%
sqrt-pow123.9%
sqrt-prod20.1%
div-inv20.1%
sqrt-div24.0%
sqrt-pow121.2%
metadata-eval21.2%
pow121.2%
*-commutative21.2%
Applied egg-rr21.2%
expm1-log1p-u21.0%
expm1-undefine28.0%
*-commutative28.0%
Applied egg-rr28.0%
log1p-undefine28.0%
rem-exp-log28.2%
associate-+r-28.2%
*-commutative28.2%
fma-neg28.2%
metadata-eval28.2%
Simplified28.2%
Taylor expanded in h around 0 31.8%
Final simplification27.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 (<= M 2.7e-115) (* d (pow (* l h) -0.5)) (/ d (sqrt 0.0))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (M <= 2.7e-115) {
tmp = d * pow((l * h), -0.5);
} else {
tmp = d / sqrt(0.0);
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: tmp
if (m <= 2.7d-115) then
tmp = d * ((l * h) ** (-0.5d0))
else
tmp = d / sqrt(0.0d0)
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (M <= 2.7e-115) {
tmp = d * Math.pow((l * h), -0.5);
} else {
tmp = d / Math.sqrt(0.0);
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if M <= 2.7e-115: tmp = d * math.pow((l * h), -0.5) else: tmp = d / math.sqrt(0.0) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (M <= 2.7e-115) tmp = Float64(d * (Float64(l * h) ^ -0.5)); else tmp = Float64(d / sqrt(0.0)); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (M <= 2.7e-115)
tmp = d * ((l * h) ^ -0.5);
else
tmp = d / sqrt(0.0);
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[M, 2.7e-115], N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d / N[Sqrt[0.0], $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}\;M \leq 2.7 \cdot 10^{-115}:\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{0}}\\
\end{array}
\end{array}
if M < 2.7e-115Initial program 69.3%
Simplified68.7%
Taylor expanded in d around inf 24.5%
*-commutative24.5%
Simplified24.5%
Taylor expanded in l around 0 24.5%
unpow-124.5%
metadata-eval24.5%
pow-sqr24.5%
rem-sqrt-square24.7%
rem-square-sqrt24.6%
fabs-sqr24.6%
rem-square-sqrt24.7%
Simplified24.7%
if 2.7e-115 < M Initial program 70.2%
Simplified70.2%
Taylor expanded in d around inf 22.1%
*-commutative22.1%
Simplified22.1%
pow122.1%
metadata-eval22.1%
sqrt-pow123.9%
sqrt-prod20.1%
div-inv20.1%
sqrt-div24.0%
sqrt-pow121.2%
metadata-eval21.2%
pow121.2%
*-commutative21.2%
Applied egg-rr21.2%
expm1-log1p-u21.0%
expm1-undefine28.0%
*-commutative28.0%
Applied egg-rr28.0%
log1p-undefine28.0%
rem-exp-log28.2%
associate-+r-28.2%
*-commutative28.2%
fma-neg28.2%
metadata-eval28.2%
Simplified28.2%
Taylor expanded in h around 0 31.8%
Final simplification27.4%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (if (<= M 2.75e-115) (/ d (sqrt (* l h))) (/ d (sqrt 0.0))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (M <= 2.75e-115) {
tmp = d / sqrt((l * h));
} else {
tmp = d / sqrt(0.0);
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: tmp
if (m <= 2.75d-115) then
tmp = d / sqrt((l * h))
else
tmp = d / sqrt(0.0d0)
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (M <= 2.75e-115) {
tmp = d / Math.sqrt((l * h));
} else {
tmp = d / Math.sqrt(0.0);
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if M <= 2.75e-115: tmp = d / math.sqrt((l * h)) else: tmp = d / math.sqrt(0.0) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (M <= 2.75e-115) tmp = Float64(d / sqrt(Float64(l * h))); else tmp = Float64(d / sqrt(0.0)); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (M <= 2.75e-115)
tmp = d / sqrt((l * h));
else
tmp = d / sqrt(0.0);
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[M, 2.75e-115], N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[Sqrt[0.0], $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}\;M \leq 2.75 \cdot 10^{-115}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{0}}\\
\end{array}
\end{array}
if M < 2.75000000000000014e-115Initial program 69.3%
Simplified68.7%
Taylor expanded in d around inf 24.5%
*-commutative24.5%
Simplified24.5%
pow124.5%
metadata-eval24.5%
sqrt-pow132.0%
sqrt-prod28.1%
div-inv28.6%
sqrt-div32.4%
sqrt-pow124.7%
metadata-eval24.7%
pow124.7%
*-commutative24.7%
Applied egg-rr24.7%
if 2.75000000000000014e-115 < M Initial program 70.2%
Simplified70.2%
Taylor expanded in d around inf 22.1%
*-commutative22.1%
Simplified22.1%
pow122.1%
metadata-eval22.1%
sqrt-pow123.9%
sqrt-prod20.1%
div-inv20.1%
sqrt-div24.0%
sqrt-pow121.2%
metadata-eval21.2%
pow121.2%
*-commutative21.2%
Applied egg-rr21.2%
expm1-log1p-u21.0%
expm1-undefine28.0%
*-commutative28.0%
Applied egg-rr28.0%
log1p-undefine28.0%
rem-exp-log28.2%
associate-+r-28.2%
*-commutative28.2%
fma-neg28.2%
metadata-eval28.2%
Simplified28.2%
Taylor expanded in h around 0 31.8%
Final simplification27.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 (/ d (sqrt (* l h))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
return d / sqrt((l * h));
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
code = d / sqrt((l * h))
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
return d / Math.sqrt((l * h));
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): return d / math.sqrt((l * h))
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) return Float64(d / sqrt(Float64(l * h))) end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp = code(d, h, l, M, D_m)
tmp = d / sqrt((l * h));
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 69.6%
Simplified69.3%
Taylor expanded in d around inf 23.6%
*-commutative23.6%
Simplified23.6%
pow123.6%
metadata-eval23.6%
sqrt-pow129.0%
sqrt-prod25.1%
div-inv25.4%
sqrt-div29.2%
sqrt-pow123.3%
metadata-eval23.3%
pow123.3%
*-commutative23.3%
Applied egg-rr23.3%
Final simplification23.3%
herbie shell --seed 2024135
(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)))))