
(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 26 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}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= d -3.2e-37)
(*
(* (pow (* (pow (/ -1.0 h) 0.25) (pow (/ -1.0 d) -0.25)) 2.0) t_0)
(- 1.0 (* 0.5 (* (pow (* (/ M 2.0) (/ D d)) 2.0) (/ h l)))))
(if (<= d 1.18e-275)
(*
(fma (/ h l) (* (pow (* D (/ M d)) 2.0) -0.125) 1.0)
(* d (- (pow (* h l) -0.5))))
(*
(* t_0 (/ (sqrt d) (sqrt h)))
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D d) (* 0.5 M)) 2.0)) l))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (d <= -3.2e-37) {
tmp = (pow((pow((-1.0 / h), 0.25) * pow((-1.0 / d), -0.25)), 2.0) * t_0) * (1.0 - (0.5 * (pow(((M / 2.0) * (D / d)), 2.0) * (h / l))));
} else if (d <= 1.18e-275) {
tmp = fma((h / l), (pow((D * (M / d)), 2.0) * -0.125), 1.0) * (d * -pow((h * l), -0.5));
} else {
tmp = (t_0 * (sqrt(d) / sqrt(h))) * (1.0 - (0.5 * ((h * pow(((D / d) * (0.5 * M)), 2.0)) / l)));
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (d <= -3.2e-37) tmp = Float64(Float64((Float64((Float64(-1.0 / h) ^ 0.25) * (Float64(-1.0 / d) ^ -0.25)) ^ 2.0) * t_0) * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(h / l))))); elseif (d <= 1.18e-275) tmp = Float64(fma(Float64(h / l), Float64((Float64(D * Float64(M / d)) ^ 2.0) * -0.125), 1.0) * Float64(d * Float64(-(Float64(h * l) ^ -0.5)))); else tmp = Float64(Float64(t_0 * Float64(sqrt(d) / sqrt(h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D / d) * Float64(0.5 * M)) ^ 2.0)) / l)))); end return tmp end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -3.2e-37], N[(N[(N[Power[N[(N[Power[N[(-1.0 / h), $MachinePrecision], 0.25], $MachinePrecision] * N[Power[N[(-1.0 / d), $MachinePrecision], -0.25], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.18e-275], N[(N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -3.2 \cdot 10^{-37}:\\
\;\;\;\;\left({\left({\left(\frac{-1}{h}\right)}^{0.25} \cdot {\left(\frac{-1}{d}\right)}^{-0.25}\right)}^{2} \cdot t_0\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\\
\mathbf{elif}\;d \leq 1.18 \cdot 10^{-275}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot -0.125, 1\right) \cdot \left(d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)}^{2}}{\ell}\right)\\
\end{array}
\end{array}
if d < -3.1999999999999999e-37Initial program 72.5%
Simplified72.5%
pow1/272.5%
sqr-pow72.4%
pow272.4%
metadata-eval72.4%
Applied egg-rr72.4%
Taylor expanded in d around -inf 77.4%
distribute-lft-in77.4%
exp-sum77.9%
*-commutative77.9%
exp-to-pow78.7%
*-commutative78.7%
*-commutative78.7%
associate-*l*78.7%
metadata-eval78.7%
metadata-eval78.7%
exp-to-pow81.8%
metadata-eval81.8%
Simplified81.8%
if -3.1999999999999999e-37 < d < 1.17999999999999995e-275Initial program 43.8%
Simplified41.9%
Applied egg-rr3.5%
expm1-def8.6%
expm1-log1p23.4%
*-commutative23.4%
Simplified25.2%
Taylor expanded in d around -inf 57.4%
mul-1-neg57.4%
*-commutative57.4%
distribute-rgt-neg-in57.4%
unpow-157.4%
sqr-pow57.4%
rem-sqrt-square57.4%
metadata-eval57.4%
sqr-pow57.4%
fabs-sqr57.4%
sqr-pow57.4%
Simplified57.4%
if 1.17999999999999995e-275 < d Initial program 78.0%
Simplified77.1%
associate-*r/79.8%
div-inv79.8%
metadata-eval79.8%
Applied egg-rr79.8%
sqrt-div86.4%
Applied egg-rr86.4%
Final simplification77.7%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d h))))
(if (<= d -9.8e+85)
(*
(* (sqrt (/ d l)) t_0)
(- 1.0 (* 0.5 (/ (* 0.25 (* (pow (/ D d) 2.0) (* M (* h M)))) l))))
(if (<= d -5e-310)
(*
(fma (/ h l) (* (pow (* D (/ M d)) 2.0) -0.125) 1.0)
(* d (- (pow (* h l) -0.5))))
(if (<= d 7.5e-236)
(* -0.125 (/ (* (* M (* M (* D D))) (sqrt (/ h (pow l 3.0)))) d))
(*
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D d) (* 0.5 M)) 2.0)) l)))
(* t_0 (/ (sqrt d) (sqrt l)))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double tmp;
if (d <= -9.8e+85) {
tmp = (sqrt((d / l)) * t_0) * (1.0 - (0.5 * ((0.25 * (pow((D / d), 2.0) * (M * (h * M)))) / l)));
} else if (d <= -5e-310) {
tmp = fma((h / l), (pow((D * (M / d)), 2.0) * -0.125), 1.0) * (d * -pow((h * l), -0.5));
} else if (d <= 7.5e-236) {
tmp = -0.125 * (((M * (M * (D * D))) * sqrt((h / pow(l, 3.0)))) / d);
} else {
tmp = (1.0 - (0.5 * ((h * pow(((D / d) * (0.5 * M)), 2.0)) / l))) * (t_0 * (sqrt(d) / sqrt(l)));
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) tmp = 0.0 if (d <= -9.8e+85) tmp = Float64(Float64(sqrt(Float64(d / l)) * t_0) * Float64(1.0 - Float64(0.5 * Float64(Float64(0.25 * Float64((Float64(D / d) ^ 2.0) * Float64(M * Float64(h * M)))) / l)))); elseif (d <= -5e-310) tmp = Float64(fma(Float64(h / l), Float64((Float64(D * Float64(M / d)) ^ 2.0) * -0.125), 1.0) * Float64(d * Float64(-(Float64(h * l) ^ -0.5)))); elseif (d <= 7.5e-236) tmp = Float64(-0.125 * Float64(Float64(Float64(M * Float64(M * Float64(D * D))) * sqrt(Float64(h / (l ^ 3.0)))) / d)); else tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D / d) * Float64(0.5 * M)) ^ 2.0)) / l))) * Float64(t_0 * Float64(sqrt(d) / sqrt(l)))); end return tmp end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -9.8e+85], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(0.25 * N[(N[Power[N[(D / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7.5e-236], N[(-0.125 * N[(N[(N[(M * N[(M * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;d \leq -9.8 \cdot 10^{+85}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot t_0\right) \cdot \left(1 - 0.5 \cdot \frac{0.25 \cdot \left({\left(\frac{D}{d}\right)}^{2} \cdot \left(M \cdot \left(h \cdot M\right)\right)\right)}{\ell}\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot -0.125, 1\right) \cdot \left(d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\right)\\
\mathbf{elif}\;d \leq 7.5 \cdot 10^{-236}:\\
\;\;\;\;-0.125 \cdot \frac{\left(M \cdot \left(M \cdot \left(D \cdot D\right)\right)\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{d}\\
\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)}^{2}}{\ell}\right) \cdot \left(t_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
\end{array}
\end{array}
if d < -9.7999999999999993e85Initial program 69.3%
Simplified69.3%
associate-*r/77.1%
div-inv77.1%
metadata-eval77.1%
Applied egg-rr77.1%
Taylor expanded in M around 0 32.6%
associate-/l*34.5%
associate-/r/34.5%
unpow234.5%
unpow234.5%
times-frac60.4%
unpow260.4%
unpow260.4%
associate-*l*64.3%
Simplified64.3%
if -9.7999999999999993e85 < d < -4.999999999999985e-310Initial program 56.5%
Simplified55.3%
Applied egg-rr8.7%
expm1-def14.4%
expm1-log1p36.8%
*-commutative36.8%
Simplified38.0%
Taylor expanded in d around -inf 65.8%
mul-1-neg65.8%
*-commutative65.8%
distribute-rgt-neg-in65.8%
unpow-165.8%
sqr-pow65.8%
rem-sqrt-square65.8%
metadata-eval65.8%
sqr-pow65.9%
fabs-sqr65.9%
sqr-pow65.8%
Simplified65.8%
if -4.999999999999985e-310 < d < 7.4999999999999997e-236Initial program 16.2%
Simplified14.6%
Taylor expanded in d around 0 38.0%
associate-*l/38.0%
*-commutative38.0%
unpow238.0%
associate-*l*45.2%
unpow245.2%
Simplified45.2%
if 7.4999999999999997e-236 < d Initial program 82.7%
Simplified81.8%
associate-*r/84.7%
div-inv84.7%
metadata-eval84.7%
Applied egg-rr84.7%
sqrt-div86.0%
Applied egg-rr86.0%
Final simplification72.7%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= h -2.6e+35)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D d) (* 0.5 M)) 2.0)) l)))
(* t_0 (sqrt (/ d h))))
(if (<= h -2e-310)
(*
(fma (/ h l) (* (pow (* D (/ M d)) 2.0) -0.125) 1.0)
(* d (- (sqrt (/ 1.0 (* h l))))))
(*
(- 1.0 (* 0.5 (* (pow (* (/ M 2.0) (/ D d)) 2.0) (/ h l))))
(* t_0 (/ (sqrt d) (sqrt h))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (h <= -2.6e+35) {
tmp = (1.0 - (0.5 * ((h * pow(((D / d) * (0.5 * M)), 2.0)) / l))) * (t_0 * sqrt((d / h)));
} else if (h <= -2e-310) {
tmp = fma((h / l), (pow((D * (M / d)), 2.0) * -0.125), 1.0) * (d * -sqrt((1.0 / (h * l))));
} else {
tmp = (1.0 - (0.5 * (pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) * (t_0 * (sqrt(d) / sqrt(h)));
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (h <= -2.6e+35) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D / d) * Float64(0.5 * M)) ^ 2.0)) / l))) * Float64(t_0 * sqrt(Float64(d / h)))); elseif (h <= -2e-310) tmp = Float64(fma(Float64(h / l), Float64((Float64(D * Float64(M / d)) ^ 2.0) * -0.125), 1.0) * Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l)))))); else tmp = Float64(Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(h / l)))) * Float64(t_0 * Float64(sqrt(d) / sqrt(h)))); end return tmp end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -2.6e+35], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], N[(N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;h \leq -2.6 \cdot 10^{+35}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)}^{2}}{\ell}\right) \cdot \left(t_0 \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot -0.125, 1\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot \left(t_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\end{array}
\end{array}
if h < -2.60000000000000007e35Initial program 55.5%
Simplified55.5%
associate-*r/59.3%
div-inv59.3%
metadata-eval59.3%
Applied egg-rr59.3%
if -2.60000000000000007e35 < h < -1.999999999999994e-310Initial program 66.6%
Simplified65.3%
Applied egg-rr20.2%
expm1-def26.2%
expm1-log1p50.0%
*-commutative50.0%
Simplified51.3%
Taylor expanded in d around -inf 81.7%
mul-1-neg81.7%
*-commutative81.7%
distribute-rgt-neg-in81.7%
Simplified81.7%
if -1.999999999999994e-310 < h Initial program 74.9%
Simplified73.9%
sqrt-div82.8%
Applied egg-rr80.2%
Final simplification75.6%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (- 1.0 (* 0.5 (/ (* h (pow (* (/ D d) (* 0.5 M)) 2.0)) l))))
(t_1 (sqrt (/ d l))))
(if (<= h -1.95e+35)
(* t_0 (* t_1 (sqrt (/ d h))))
(if (<= h -2e-310)
(*
(fma (/ h l) (* (pow (* D (/ M d)) 2.0) -0.125) 1.0)
(* d (- (sqrt (/ 1.0 (* h l))))))
(* (* t_1 (/ (sqrt d) (sqrt h))) t_0)))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 - (0.5 * ((h * pow(((D / d) * (0.5 * M)), 2.0)) / l));
double t_1 = sqrt((d / l));
double tmp;
if (h <= -1.95e+35) {
tmp = t_0 * (t_1 * sqrt((d / h)));
} else if (h <= -2e-310) {
tmp = fma((h / l), (pow((D * (M / d)), 2.0) * -0.125), 1.0) * (d * -sqrt((1.0 / (h * l))));
} else {
tmp = (t_1 * (sqrt(d) / sqrt(h))) * t_0;
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D / d) * Float64(0.5 * M)) ^ 2.0)) / l))) t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (h <= -1.95e+35) tmp = Float64(t_0 * Float64(t_1 * sqrt(Float64(d / h)))); elseif (h <= -2e-310) tmp = Float64(fma(Float64(h / l), Float64((Float64(D * Float64(M / d)) ^ 2.0) * -0.125), 1.0) * Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l)))))); else tmp = Float64(Float64(t_1 * Float64(sqrt(d) / sqrt(h))) * t_0); end return tmp end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -1.95e+35], N[(t$95$0 * N[(t$95$1 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], N[(N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)}^{2}}{\ell}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;h \leq -1.95 \cdot 10^{+35}:\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot -0.125, 1\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_1 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right) \cdot t_0\\
\end{array}
\end{array}
if h < -1.95e35Initial program 55.5%
Simplified55.5%
associate-*r/59.3%
div-inv59.3%
metadata-eval59.3%
Applied egg-rr59.3%
if -1.95e35 < h < -1.999999999999994e-310Initial program 66.6%
Simplified65.3%
Applied egg-rr20.2%
expm1-def26.2%
expm1-log1p50.0%
*-commutative50.0%
Simplified51.3%
Taylor expanded in d around -inf 81.7%
mul-1-neg81.7%
*-commutative81.7%
distribute-rgt-neg-in81.7%
Simplified81.7%
if -1.999999999999994e-310 < h Initial program 74.9%
Simplified73.9%
associate-*r/76.4%
div-inv76.4%
metadata-eval76.4%
Applied egg-rr76.4%
sqrt-div82.8%
Applied egg-rr82.8%
Final simplification76.8%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D d) (* 0.5 M)) 2.0)) l)))
(* (sqrt (/ d l)) (sqrt (/ d h))))))
(if (<= d -2.8e-26)
t_0
(if (<= d -5e-310)
(*
(fma (/ h l) (* (pow (* D (/ M d)) 2.0) -0.125) 1.0)
(* d (- (pow (* h l) -0.5))))
(if (<= d 3.8e-237)
(* -0.125 (/ (* (* M (* M (* D D))) (sqrt (/ h (pow l 3.0)))) d))
t_0)))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (1.0 - (0.5 * ((h * pow(((D / d) * (0.5 * M)), 2.0)) / l))) * (sqrt((d / l)) * sqrt((d / h)));
double tmp;
if (d <= -2.8e-26) {
tmp = t_0;
} else if (d <= -5e-310) {
tmp = fma((h / l), (pow((D * (M / d)), 2.0) * -0.125), 1.0) * (d * -pow((h * l), -0.5));
} else if (d <= 3.8e-237) {
tmp = -0.125 * (((M * (M * (D * D))) * sqrt((h / pow(l, 3.0)))) / d);
} else {
tmp = t_0;
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D / d) * Float64(0.5 * M)) ^ 2.0)) / l))) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)))) tmp = 0.0 if (d <= -2.8e-26) tmp = t_0; elseif (d <= -5e-310) tmp = Float64(fma(Float64(h / l), Float64((Float64(D * Float64(M / d)) ^ 2.0) * -0.125), 1.0) * Float64(d * Float64(-(Float64(h * l) ^ -0.5)))); elseif (d <= 3.8e-237) tmp = Float64(-0.125 * Float64(Float64(Float64(M * Float64(M * Float64(D * D))) * sqrt(Float64(h / (l ^ 3.0)))) / d)); else tmp = t_0; end return tmp end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.8e-26], t$95$0, If[LessEqual[d, -5e-310], N[(N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.8e-237], N[(-0.125 * N[(N[(N[(M * N[(M * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)}^{2}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{if}\;d \leq -2.8 \cdot 10^{-26}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot -0.125, 1\right) \cdot \left(d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\right)\\
\mathbf{elif}\;d \leq 3.8 \cdot 10^{-237}:\\
\;\;\;\;-0.125 \cdot \frac{\left(M \cdot \left(M \cdot \left(D \cdot D\right)\right)\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{d}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d < -2.8000000000000001e-26 or 3.80000000000000024e-237 < d Initial program 78.0%
Simplified77.5%
associate-*r/81.0%
div-inv81.0%
metadata-eval81.0%
Applied egg-rr81.0%
if -2.8000000000000001e-26 < d < -4.999999999999985e-310Initial program 49.6%
Simplified48.0%
Applied egg-rr3.7%
expm1-def10.5%
expm1-log1p29.0%
*-commutative29.0%
Simplified30.5%
Taylor expanded in d around -inf 63.7%
mul-1-neg63.7%
*-commutative63.7%
distribute-rgt-neg-in63.7%
unpow-163.7%
sqr-pow63.7%
rem-sqrt-square63.7%
metadata-eval63.7%
sqr-pow63.7%
fabs-sqr63.7%
sqr-pow63.7%
Simplified63.7%
if -4.999999999999985e-310 < d < 3.80000000000000024e-237Initial program 16.2%
Simplified14.6%
Taylor expanded in d around 0 38.0%
associate-*l/38.0%
*-commutative38.0%
unpow238.0%
associate-*l*45.2%
unpow245.2%
Simplified45.2%
Final simplification74.9%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (sqrt (/ d l)) (sqrt (/ d h)))))
(if (<= d -9.2e+85)
(* t_0 (- 1.0 (* 0.5 (/ (* 0.25 (* (pow (/ D d) 2.0) (* M (* h M)))) l))))
(if (<= d -5e-310)
(*
(fma (/ h l) (* (pow (* D (/ M d)) 2.0) -0.125) 1.0)
(* d (- (pow (* h l) -0.5))))
(if (<= d 1.15e-235)
(* -0.125 (/ (* (* M (* M (* D D))) (sqrt (/ h (pow l 3.0)))) d))
(*
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D d) (* 0.5 M)) 2.0)) l)))
t_0))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l)) * sqrt((d / h));
double tmp;
if (d <= -9.2e+85) {
tmp = t_0 * (1.0 - (0.5 * ((0.25 * (pow((D / d), 2.0) * (M * (h * M)))) / l)));
} else if (d <= -5e-310) {
tmp = fma((h / l), (pow((D * (M / d)), 2.0) * -0.125), 1.0) * (d * -pow((h * l), -0.5));
} else if (d <= 1.15e-235) {
tmp = -0.125 * (((M * (M * (D * D))) * sqrt((h / pow(l, 3.0)))) / d);
} else {
tmp = (1.0 - (0.5 * ((h * pow(((D / d) * (0.5 * M)), 2.0)) / l))) * t_0;
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) tmp = 0.0 if (d <= -9.2e+85) tmp = Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64(Float64(0.25 * Float64((Float64(D / d) ^ 2.0) * Float64(M * Float64(h * M)))) / l)))); elseif (d <= -5e-310) tmp = Float64(fma(Float64(h / l), Float64((Float64(D * Float64(M / d)) ^ 2.0) * -0.125), 1.0) * Float64(d * Float64(-(Float64(h * l) ^ -0.5)))); elseif (d <= 1.15e-235) tmp = Float64(-0.125 * Float64(Float64(Float64(M * Float64(M * Float64(D * D))) * sqrt(Float64(h / (l ^ 3.0)))) / d)); else tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D / d) * Float64(0.5 * M)) ^ 2.0)) / l))) * t_0); end return tmp end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -9.2e+85], N[(t$95$0 * N[(1.0 - N[(0.5 * N[(N[(0.25 * N[(N[Power[N[(D / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.15e-235], N[(-0.125 * N[(N[(N[(M * N[(M * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{if}\;d \leq -9.2 \cdot 10^{+85}:\\
\;\;\;\;t_0 \cdot \left(1 - 0.5 \cdot \frac{0.25 \cdot \left({\left(\frac{D}{d}\right)}^{2} \cdot \left(M \cdot \left(h \cdot M\right)\right)\right)}{\ell}\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot -0.125, 1\right) \cdot \left(d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\right)\\
\mathbf{elif}\;d \leq 1.15 \cdot 10^{-235}:\\
\;\;\;\;-0.125 \cdot \frac{\left(M \cdot \left(M \cdot \left(D \cdot D\right)\right)\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{d}\\
\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)}^{2}}{\ell}\right) \cdot t_0\\
\end{array}
\end{array}
if d < -9.1999999999999996e85Initial program 69.3%
Simplified69.3%
associate-*r/77.1%
div-inv77.1%
metadata-eval77.1%
Applied egg-rr77.1%
Taylor expanded in M around 0 32.6%
associate-/l*34.5%
associate-/r/34.5%
unpow234.5%
unpow234.5%
times-frac60.4%
unpow260.4%
unpow260.4%
associate-*l*64.3%
Simplified64.3%
if -9.1999999999999996e85 < d < -4.999999999999985e-310Initial program 56.5%
Simplified55.3%
Applied egg-rr8.7%
expm1-def14.4%
expm1-log1p36.8%
*-commutative36.8%
Simplified38.0%
Taylor expanded in d around -inf 65.8%
mul-1-neg65.8%
*-commutative65.8%
distribute-rgt-neg-in65.8%
unpow-165.8%
sqr-pow65.8%
rem-sqrt-square65.8%
metadata-eval65.8%
sqr-pow65.9%
fabs-sqr65.9%
sqr-pow65.8%
Simplified65.8%
if -4.999999999999985e-310 < d < 1.14999999999999999e-235Initial program 16.2%
Simplified14.6%
Taylor expanded in d around 0 38.0%
associate-*l/38.0%
*-commutative38.0%
unpow238.0%
associate-*l*45.2%
unpow245.2%
Simplified45.2%
if 1.14999999999999999e-235 < d Initial program 82.7%
Simplified81.8%
associate-*r/84.7%
div-inv84.7%
metadata-eval84.7%
Applied egg-rr84.7%
Final simplification72.1%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (or (<= h -1.48e+169) (not (<= h -1.12e-304)))
(*
(- 1.0 (* 0.5 (* (pow (* (/ M 2.0) (/ D d)) 2.0) (/ h l))))
(* (sqrt (/ d l)) (sqrt (/ d h))))
(*
(fma (/ h l) (* (pow (* D (/ M d)) 2.0) -0.125) 1.0)
(* d (- (sqrt (/ 1.0 (* h l))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if ((h <= -1.48e+169) || !(h <= -1.12e-304)) {
tmp = (1.0 - (0.5 * (pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) * (sqrt((d / l)) * sqrt((d / h)));
} else {
tmp = fma((h / l), (pow((D * (M / d)), 2.0) * -0.125), 1.0) * (d * -sqrt((1.0 / (h * l))));
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if ((h <= -1.48e+169) || !(h <= -1.12e-304)) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(h / l)))) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)))); else tmp = Float64(fma(Float64(h / l), Float64((Float64(D * Float64(M / d)) ^ 2.0) * -0.125), 1.0) * Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l)))))); end return tmp end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[Or[LessEqual[h, -1.48e+169], N[Not[LessEqual[h, -1.12e-304]], $MachinePrecision]], N[(N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1.48 \cdot 10^{+169} \lor \neg \left(h \leq -1.12 \cdot 10^{-304}\right):\\
\;\;\;\;\left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot -0.125, 1\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)\\
\end{array}
\end{array}
if h < -1.48000000000000004e169 or -1.12000000000000006e-304 < h Initial program 68.6%
Simplified67.8%
if -1.48000000000000004e169 < h < -1.12000000000000006e-304Initial program 66.4%
Simplified65.4%
Applied egg-rr17.0%
expm1-def21.5%
expm1-log1p45.0%
*-commutative45.0%
Simplified46.0%
Taylor expanded in d around -inf 78.0%
mul-1-neg78.0%
*-commutative78.0%
distribute-rgt-neg-in78.0%
Simplified78.0%
Final simplification71.7%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -3.5e-245)
(*
(fma (/ h l) (* (pow (* D (/ M d)) 2.0) -0.125) 1.0)
(* d (- (pow (* h l) -0.5))))
(if (<= l 1.4e+86)
(*
(sqrt (/ d (/ h (/ d l))))
(fma -0.125 (* (/ h l) (pow (* M (/ D d)) 2.0)) 1.0))
(* d (* (pow h -0.5) (pow l -0.5))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -3.5e-245) {
tmp = fma((h / l), (pow((D * (M / d)), 2.0) * -0.125), 1.0) * (d * -pow((h * l), -0.5));
} else if (l <= 1.4e+86) {
tmp = sqrt((d / (h / (d / l)))) * fma(-0.125, ((h / l) * pow((M * (D / d)), 2.0)), 1.0);
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -3.5e-245) tmp = Float64(fma(Float64(h / l), Float64((Float64(D * Float64(M / d)) ^ 2.0) * -0.125), 1.0) * Float64(d * Float64(-(Float64(h * l) ^ -0.5)))); elseif (l <= 1.4e+86) tmp = Float64(sqrt(Float64(d / Float64(h / Float64(d / l)))) * fma(-0.125, Float64(Float64(h / l) * (Float64(M * Float64(D / d)) ^ 2.0)), 1.0)); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -3.5e-245], N[(N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.4e+86], N[(N[Sqrt[N[(d / N[(h / N[(d / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.5 \cdot 10^{-245}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot -0.125, 1\right) \cdot \left(d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\right)\\
\mathbf{elif}\;\ell \leq 1.4 \cdot 10^{+86}:\\
\;\;\;\;\sqrt{\frac{d}{\frac{h}{\frac{d}{\ell}}}} \cdot \mathsf{fma}\left(-0.125, \frac{h}{\ell} \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -3.50000000000000016e-245Initial program 62.7%
Simplified61.9%
Applied egg-rr14.9%
expm1-def21.4%
expm1-log1p42.6%
*-commutative42.6%
Simplified43.3%
Taylor expanded in d around -inf 66.4%
mul-1-neg66.4%
*-commutative66.4%
distribute-rgt-neg-in66.4%
unpow-166.4%
sqr-pow66.3%
rem-sqrt-square66.3%
metadata-eval66.3%
sqr-pow66.3%
fabs-sqr66.3%
sqr-pow66.3%
Simplified66.3%
if -3.50000000000000016e-245 < l < 1.40000000000000002e86Initial program 80.3%
Simplified79.2%
Applied egg-rr21.7%
expm1-def26.4%
expm1-log1p72.6%
*-commutative72.6%
Simplified72.6%
pow172.6%
sqrt-prod79.1%
*-commutative79.1%
*-commutative79.1%
sqrt-unprod72.6%
Applied egg-rr72.6%
Simplified72.6%
if 1.40000000000000002e86 < l Initial program 57.4%
Simplified56.9%
associate-*r/59.1%
div-inv59.1%
metadata-eval59.1%
Applied egg-rr59.1%
Taylor expanded in d around inf 46.6%
unpow-146.6%
sqr-pow46.6%
rem-sqrt-square46.6%
metadata-eval46.6%
sqr-pow46.6%
fabs-sqr46.6%
sqr-pow46.6%
Simplified46.6%
unpow-prod-down60.1%
Applied egg-rr60.1%
Final simplification67.4%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -3.5e-245)
(*
(fma (/ h l) (* (pow (* D (/ M d)) 2.0) -0.125) 1.0)
(* d (- (pow (* h l) -0.5))))
(if (<= l 1.2e+82)
(*
(fma (/ h l) (* -0.125 (pow (/ (* M D) d) 2.0)) 1.0)
(sqrt (* (/ d l) (/ d h))))
(* d (* (pow h -0.5) (pow l -0.5))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -3.5e-245) {
tmp = fma((h / l), (pow((D * (M / d)), 2.0) * -0.125), 1.0) * (d * -pow((h * l), -0.5));
} else if (l <= 1.2e+82) {
tmp = fma((h / l), (-0.125 * pow(((M * D) / d), 2.0)), 1.0) * sqrt(((d / l) * (d / h)));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -3.5e-245) tmp = Float64(fma(Float64(h / l), Float64((Float64(D * Float64(M / d)) ^ 2.0) * -0.125), 1.0) * Float64(d * Float64(-(Float64(h * l) ^ -0.5)))); elseif (l <= 1.2e+82) tmp = Float64(fma(Float64(h / l), Float64(-0.125 * (Float64(Float64(M * D) / d) ^ 2.0)), 1.0) * sqrt(Float64(Float64(d / l) * Float64(d / h)))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -3.5e-245], N[(N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.2e+82], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.125 * N[Power[N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.5 \cdot 10^{-245}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot -0.125, 1\right) \cdot \left(d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\right)\\
\mathbf{elif}\;\ell \leq 1.2 \cdot 10^{+82}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.125 \cdot {\left(\frac{M \cdot D}{d}\right)}^{2}, 1\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -3.50000000000000016e-245Initial program 62.7%
Simplified61.9%
Applied egg-rr14.9%
expm1-def21.4%
expm1-log1p42.6%
*-commutative42.6%
Simplified43.3%
Taylor expanded in d around -inf 66.4%
mul-1-neg66.4%
*-commutative66.4%
distribute-rgt-neg-in66.4%
unpow-166.4%
sqr-pow66.3%
rem-sqrt-square66.3%
metadata-eval66.3%
sqr-pow66.3%
fabs-sqr66.3%
sqr-pow66.3%
Simplified66.3%
if -3.50000000000000016e-245 < l < 1.19999999999999999e82Initial program 80.1%
Simplified78.9%
Applied egg-rr20.9%
expm1-def25.6%
expm1-log1p72.3%
*-commutative72.3%
Simplified72.2%
Taylor expanded in D around 0 73.4%
if 1.19999999999999999e82 < l Initial program 58.4%
Simplified57.9%
associate-*r/60.1%
div-inv60.1%
metadata-eval60.1%
Applied egg-rr60.1%
Taylor expanded in d around inf 47.9%
unpow-147.9%
sqr-pow47.8%
rem-sqrt-square47.8%
metadata-eval47.8%
sqr-pow47.8%
fabs-sqr47.8%
sqr-pow47.8%
Simplified47.8%
unpow-prod-down61.0%
Applied egg-rr61.0%
Final simplification67.8%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -4.8e-245)
(*
(fma (/ h l) (* (pow (* D (/ M d)) 2.0) -0.125) 1.0)
(* d (- (sqrt (/ 1.0 (* h l))))))
(if (<= l 5.8e+82)
(*
(fma (/ h l) (* -0.125 (pow (/ (* M D) d) 2.0)) 1.0)
(sqrt (* (/ d l) (/ d h))))
(* d (* (pow h -0.5) (pow l -0.5))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -4.8e-245) {
tmp = fma((h / l), (pow((D * (M / d)), 2.0) * -0.125), 1.0) * (d * -sqrt((1.0 / (h * l))));
} else if (l <= 5.8e+82) {
tmp = fma((h / l), (-0.125 * pow(((M * D) / d), 2.0)), 1.0) * sqrt(((d / l) * (d / h)));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -4.8e-245) tmp = Float64(fma(Float64(h / l), Float64((Float64(D * Float64(M / d)) ^ 2.0) * -0.125), 1.0) * Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l)))))); elseif (l <= 5.8e+82) tmp = Float64(fma(Float64(h / l), Float64(-0.125 * (Float64(Float64(M * D) / d) ^ 2.0)), 1.0) * sqrt(Float64(Float64(d / l) * Float64(d / h)))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -4.8e-245], N[(N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.8e+82], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.125 * N[Power[N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.8 \cdot 10^{-245}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, {\left(D \cdot \frac{M}{d}\right)}^{2} \cdot -0.125, 1\right) \cdot \left(d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\right)\\
\mathbf{elif}\;\ell \leq 5.8 \cdot 10^{+82}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.125 \cdot {\left(\frac{M \cdot D}{d}\right)}^{2}, 1\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -4.8e-245Initial program 62.7%
Simplified61.9%
Applied egg-rr14.9%
expm1-def21.4%
expm1-log1p42.6%
*-commutative42.6%
Simplified43.3%
Taylor expanded in d around -inf 66.4%
mul-1-neg66.4%
*-commutative66.4%
distribute-rgt-neg-in66.4%
Simplified66.4%
if -4.8e-245 < l < 5.8000000000000003e82Initial program 80.1%
Simplified78.9%
Applied egg-rr20.9%
expm1-def25.6%
expm1-log1p72.3%
*-commutative72.3%
Simplified72.2%
Taylor expanded in D around 0 73.4%
if 5.8000000000000003e82 < l Initial program 58.4%
Simplified57.9%
associate-*r/60.1%
div-inv60.1%
metadata-eval60.1%
Applied egg-rr60.1%
Taylor expanded in d around inf 47.9%
unpow-147.9%
sqr-pow47.8%
rem-sqrt-square47.8%
metadata-eval47.8%
sqr-pow47.8%
fabs-sqr47.8%
sqr-pow47.8%
Simplified47.8%
unpow-prod-down61.0%
Applied egg-rr61.0%
Final simplification67.8%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= D 1.8e+142)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (* 0.5 (* (/ 0.25 l) (* (* (/ (* D D) d) (* M M)) (/ h d))))))
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* (/ h l) (* (pow (* D (/ M d)) 2.0) -0.125))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (D <= 1.8e+142) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * ((0.25 / l) * ((((D * D) / d) * (M * M)) * (h / d)))));
} else {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + ((h / l) * (pow((D * (M / d)), 2.0) * -0.125)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (d_1 <= 1.8d+142) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - (0.5d0 * ((0.25d0 / l) * ((((d_1 * d_1) / d) * (m * m)) * (h / d)))))
else
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((h / l) * (((d_1 * (m / d)) ** 2.0d0) * (-0.125d0))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (D <= 1.8e+142) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - (0.5 * ((0.25 / l) * ((((D * D) / d) * (M * M)) * (h / d)))));
} else {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + ((h / l) * (Math.pow((D * (M / d)), 2.0) * -0.125)));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if D <= 1.8e+142: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - (0.5 * ((0.25 / l) * ((((D * D) / d) * (M * M)) * (h / d))))) else: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + ((h / l) * (math.pow((D * (M / d)), 2.0) * -0.125))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (D <= 1.8e+142) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(0.25 / l) * Float64(Float64(Float64(Float64(D * D) / d) * Float64(M * M)) * Float64(h / d)))))); else tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(M / d)) ^ 2.0) * -0.125)))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (D <= 1.8e+142)
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * ((0.25 / l) * ((((D * D) / d) * (M * M)) * (h / d)))));
else
tmp = sqrt(((d / l) * (d / h))) * (1.0 + ((h / l) * (((D * (M / d)) ^ 2.0) * -0.125)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[D, 1.8e+142], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(0.25 / l), $MachinePrecision] * N[(N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] * N[(M * M), $MachinePrecision]), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;D \leq 1.8 \cdot 10^{+142}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{0.25}{\ell} \cdot \left(\left(\frac{D \cdot D}{d} \cdot \left(M \cdot M\right)\right) \cdot \frac{h}{d}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot -0.125\right)\right)\\
\end{array}
\end{array}
if D < 1.8000000000000001e142Initial program 68.0%
Simplified67.0%
Taylor expanded in M around 0 41.4%
associate-*r/41.4%
*-commutative41.4%
times-frac41.5%
associate-*r*44.2%
unpow244.2%
times-frac50.6%
associate-/l*51.1%
associate-/r/50.5%
unpow250.5%
unpow250.5%
Simplified50.5%
if 1.8000000000000001e142 < D Initial program 66.5%
Simplified66.5%
Applied egg-rr9.7%
expm1-def11.4%
expm1-log1p57.6%
*-commutative57.6%
Simplified57.6%
fma-udef57.6%
Applied egg-rr57.6%
Final simplification51.5%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* d (- (sqrt (/ 1.0 (* h l)))))))
(if (<= d -3.9e+34)
t_0
(if (<= d -2.1e-54)
(*
(sqrt (* (/ d l) (/ d h)))
(* -0.125 (* (/ (* D D) (* d d)) (* M (* M (/ h l))))))
(if (<= d -5.2e-142)
t_0
(if (<= d 7.7e-261)
(* d (cbrt (/ 1.0 (* (* h l) (sqrt (* h l))))))
(if (<= d 1.3e-17)
(* -0.125 (/ (* D (* D (* M M))) (/ d (sqrt (/ h (pow l 3.0))))))
(* d (* (pow h -0.5) (pow l -0.5))))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = d * -sqrt((1.0 / (h * l)));
double tmp;
if (d <= -3.9e+34) {
tmp = t_0;
} else if (d <= -2.1e-54) {
tmp = sqrt(((d / l) * (d / h))) * (-0.125 * (((D * D) / (d * d)) * (M * (M * (h / l)))));
} else if (d <= -5.2e-142) {
tmp = t_0;
} else if (d <= 7.7e-261) {
tmp = d * cbrt((1.0 / ((h * l) * sqrt((h * l)))));
} else if (d <= 1.3e-17) {
tmp = -0.125 * ((D * (D * (M * M))) / (d / sqrt((h / pow(l, 3.0)))));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
return tmp;
}
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = d * -Math.sqrt((1.0 / (h * l)));
double tmp;
if (d <= -3.9e+34) {
tmp = t_0;
} else if (d <= -2.1e-54) {
tmp = Math.sqrt(((d / l) * (d / h))) * (-0.125 * (((D * D) / (d * d)) * (M * (M * (h / l)))));
} else if (d <= -5.2e-142) {
tmp = t_0;
} else if (d <= 7.7e-261) {
tmp = d * Math.cbrt((1.0 / ((h * l) * Math.sqrt((h * l)))));
} else if (d <= 1.3e-17) {
tmp = -0.125 * ((D * (D * (M * M))) / (d / Math.sqrt((h / Math.pow(l, 3.0)))));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l))))) tmp = 0.0 if (d <= -3.9e+34) tmp = t_0; elseif (d <= -2.1e-54) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(-0.125 * Float64(Float64(Float64(D * D) / Float64(d * d)) * Float64(M * Float64(M * Float64(h / l)))))); elseif (d <= -5.2e-142) tmp = t_0; elseif (d <= 7.7e-261) tmp = Float64(d * cbrt(Float64(1.0 / Float64(Float64(h * l) * sqrt(Float64(h * l)))))); elseif (d <= 1.3e-17) tmp = Float64(-0.125 * Float64(Float64(D * Float64(D * Float64(M * M))) / Float64(d / sqrt(Float64(h / (l ^ 3.0)))))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[d, -3.9e+34], t$95$0, If[LessEqual[d, -2.1e-54], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[(M * N[(M * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5.2e-142], t$95$0, If[LessEqual[d, 7.7e-261], N[(d * N[Power[N[(1.0 / N[(N[(h * l), $MachinePrecision] * N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.3e-17], N[(-0.125 * N[(N[(D * N[(D * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d / N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{if}\;d \leq -3.9 \cdot 10^{+34}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -2.1 \cdot 10^{-54}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(-0.125 \cdot \left(\frac{D \cdot D}{d \cdot d} \cdot \left(M \cdot \left(M \cdot \frac{h}{\ell}\right)\right)\right)\right)\\
\mathbf{elif}\;d \leq -5.2 \cdot 10^{-142}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 7.7 \cdot 10^{-261}:\\
\;\;\;\;d \cdot \sqrt[3]{\frac{1}{\left(h \cdot \ell\right) \cdot \sqrt{h \cdot \ell}}}\\
\mathbf{elif}\;d \leq 1.3 \cdot 10^{-17}:\\
\;\;\;\;-0.125 \cdot \frac{D \cdot \left(D \cdot \left(M \cdot M\right)\right)}{\frac{d}{\sqrt{\frac{h}{{\ell}^{3}}}}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -3.90000000000000019e34 or -2.1e-54 < d < -5.1999999999999999e-142Initial program 62.1%
Simplified61.0%
Applied egg-rr20.9%
expm1-def28.7%
expm1-log1p46.5%
*-commutative46.5%
Simplified47.6%
Taylor expanded in D around 0 47.6%
Taylor expanded in d around -inf 58.8%
associate-*r*58.8%
mul-1-neg58.8%
Simplified58.8%
if -3.90000000000000019e34 < d < -2.1e-54Initial program 99.3%
Simplified99.2%
Applied egg-rr7.8%
expm1-def14.2%
expm1-log1p80.9%
*-commutative80.9%
Simplified80.9%
Taylor expanded in h around inf 60.4%
times-frac60.4%
unpow260.4%
unpow260.4%
times-frac60.5%
unpow260.5%
unpow260.5%
associate-*r/61.1%
unpow261.1%
times-frac61.1%
associate-*l*68.0%
Simplified68.0%
if -5.1999999999999999e-142 < d < 7.6999999999999997e-261Initial program 41.0%
Simplified40.6%
Taylor expanded in d around inf 14.0%
add-cbrt-cube20.5%
add-sqr-sqrt20.5%
sqrt-div20.5%
metadata-eval20.5%
Applied egg-rr20.5%
associate-*r/20.5%
*-rgt-identity20.5%
associate-/l/20.5%
Simplified20.5%
if 7.6999999999999997e-261 < d < 1.30000000000000002e-17Initial program 68.6%
Simplified68.6%
associate-*r/70.6%
div-inv70.6%
metadata-eval70.6%
Applied egg-rr70.6%
Taylor expanded in d around 0 48.4%
associate-*l/48.5%
unpow248.5%
associate-/l*48.3%
unpow248.3%
associate-*l*50.2%
Simplified50.2%
if 1.30000000000000002e-17 < d Initial program 88.0%
Simplified86.3%
associate-*r/89.6%
div-inv89.6%
metadata-eval89.6%
Applied egg-rr89.6%
Taylor expanded in d around inf 61.8%
unpow-161.8%
sqr-pow61.8%
rem-sqrt-square61.8%
metadata-eval61.8%
sqr-pow61.7%
fabs-sqr61.7%
sqr-pow61.8%
Simplified61.8%
unpow-prod-down71.7%
Applied egg-rr71.7%
Final simplification53.6%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* d (- (sqrt (/ 1.0 (* h l)))))))
(if (<= d -1e+34)
t_0
(if (<= d -4.2e-53)
(*
(sqrt (* (/ d l) (/ d h)))
(* -0.125 (* (/ (* D D) (* d d)) (* M (* M (/ h l))))))
(if (<= d -4.1e-141)
t_0
(if (<= d 2.6e-282)
(* d (cbrt (/ 1.0 (* (* h l) (sqrt (* h l))))))
(if (<= d 3.2e-16)
(* -0.125 (/ (* D (* D (* M M))) (/ d (/ (sqrt h) (pow l 1.5)))))
(* d (* (pow h -0.5) (pow l -0.5))))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = d * -sqrt((1.0 / (h * l)));
double tmp;
if (d <= -1e+34) {
tmp = t_0;
} else if (d <= -4.2e-53) {
tmp = sqrt(((d / l) * (d / h))) * (-0.125 * (((D * D) / (d * d)) * (M * (M * (h / l)))));
} else if (d <= -4.1e-141) {
tmp = t_0;
} else if (d <= 2.6e-282) {
tmp = d * cbrt((1.0 / ((h * l) * sqrt((h * l)))));
} else if (d <= 3.2e-16) {
tmp = -0.125 * ((D * (D * (M * M))) / (d / (sqrt(h) / pow(l, 1.5))));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
return tmp;
}
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = d * -Math.sqrt((1.0 / (h * l)));
double tmp;
if (d <= -1e+34) {
tmp = t_0;
} else if (d <= -4.2e-53) {
tmp = Math.sqrt(((d / l) * (d / h))) * (-0.125 * (((D * D) / (d * d)) * (M * (M * (h / l)))));
} else if (d <= -4.1e-141) {
tmp = t_0;
} else if (d <= 2.6e-282) {
tmp = d * Math.cbrt((1.0 / ((h * l) * Math.sqrt((h * l)))));
} else if (d <= 3.2e-16) {
tmp = -0.125 * ((D * (D * (M * M))) / (d / (Math.sqrt(h) / Math.pow(l, 1.5))));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l))))) tmp = 0.0 if (d <= -1e+34) tmp = t_0; elseif (d <= -4.2e-53) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(-0.125 * Float64(Float64(Float64(D * D) / Float64(d * d)) * Float64(M * Float64(M * Float64(h / l)))))); elseif (d <= -4.1e-141) tmp = t_0; elseif (d <= 2.6e-282) tmp = Float64(d * cbrt(Float64(1.0 / Float64(Float64(h * l) * sqrt(Float64(h * l)))))); elseif (d <= 3.2e-16) tmp = Float64(-0.125 * Float64(Float64(D * Float64(D * Float64(M * M))) / Float64(d / Float64(sqrt(h) / (l ^ 1.5))))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[d, -1e+34], t$95$0, If[LessEqual[d, -4.2e-53], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[(M * N[(M * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4.1e-141], t$95$0, If[LessEqual[d, 2.6e-282], N[(d * N[Power[N[(1.0 / N[(N[(h * l), $MachinePrecision] * N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.2e-16], N[(-0.125 * N[(N[(D * N[(D * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d / N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{if}\;d \leq -1 \cdot 10^{+34}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -4.2 \cdot 10^{-53}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(-0.125 \cdot \left(\frac{D \cdot D}{d \cdot d} \cdot \left(M \cdot \left(M \cdot \frac{h}{\ell}\right)\right)\right)\right)\\
\mathbf{elif}\;d \leq -4.1 \cdot 10^{-141}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 2.6 \cdot 10^{-282}:\\
\;\;\;\;d \cdot \sqrt[3]{\frac{1}{\left(h \cdot \ell\right) \cdot \sqrt{h \cdot \ell}}}\\
\mathbf{elif}\;d \leq 3.2 \cdot 10^{-16}:\\
\;\;\;\;-0.125 \cdot \frac{D \cdot \left(D \cdot \left(M \cdot M\right)\right)}{\frac{d}{\frac{\sqrt{h}}{{\ell}^{1.5}}}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -9.99999999999999946e33 or -4.19999999999999955e-53 < d < -4.10000000000000002e-141Initial program 62.1%
Simplified61.0%
Applied egg-rr20.9%
expm1-def28.7%
expm1-log1p46.5%
*-commutative46.5%
Simplified47.6%
Taylor expanded in D around 0 47.6%
Taylor expanded in d around -inf 58.8%
associate-*r*58.8%
mul-1-neg58.8%
Simplified58.8%
if -9.99999999999999946e33 < d < -4.19999999999999955e-53Initial program 99.3%
Simplified99.2%
Applied egg-rr7.8%
expm1-def14.2%
expm1-log1p80.9%
*-commutative80.9%
Simplified80.9%
Taylor expanded in h around inf 60.4%
times-frac60.4%
unpow260.4%
unpow260.4%
times-frac60.5%
unpow260.5%
unpow260.5%
associate-*r/61.1%
unpow261.1%
times-frac61.1%
associate-*l*68.0%
Simplified68.0%
if -4.10000000000000002e-141 < d < 2.60000000000000012e-282Initial program 42.6%
Simplified42.1%
Taylor expanded in d around inf 15.1%
add-cbrt-cube22.3%
add-sqr-sqrt22.3%
sqrt-div22.3%
metadata-eval22.3%
Applied egg-rr22.3%
associate-*r/22.3%
*-rgt-identity22.3%
associate-/l/22.3%
Simplified22.3%
if 2.60000000000000012e-282 < d < 3.20000000000000023e-16Initial program 65.7%
Simplified65.7%
associate-*r/67.5%
div-inv67.5%
metadata-eval67.5%
Applied egg-rr67.5%
Taylor expanded in d around 0 45.2%
associate-*l/45.3%
unpow245.3%
associate-/l*45.2%
unpow245.2%
associate-*l*48.6%
Simplified48.6%
sqrt-div51.8%
Applied egg-rr51.8%
sqr-pow51.8%
rem-sqrt-square55.2%
sqr-pow55.2%
fabs-sqr55.2%
sqr-pow55.2%
metadata-eval55.2%
Simplified55.2%
if 3.20000000000000023e-16 < d Initial program 88.0%
Simplified86.3%
associate-*r/89.6%
div-inv89.6%
metadata-eval89.6%
Applied egg-rr89.6%
Taylor expanded in d around inf 61.8%
unpow-161.8%
sqr-pow61.8%
rem-sqrt-square61.8%
metadata-eval61.8%
sqr-pow61.7%
fabs-sqr61.7%
sqr-pow61.8%
Simplified61.8%
unpow-prod-down71.7%
Applied egg-rr71.7%
Final simplification55.5%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -6.6e-94)
(* d (- (sqrt (/ 1.0 (* h l)))))
(if (<= l 3e+82)
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* (/ h l) (* (pow (* D (/ M d)) 2.0) -0.125))))
(* d (* (pow h -0.5) (pow l -0.5))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -6.6e-94) {
tmp = d * -sqrt((1.0 / (h * l)));
} else if (l <= 3e+82) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + ((h / l) * (pow((D * (M / d)), 2.0) * -0.125)));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (l <= (-6.6d-94)) then
tmp = d * -sqrt((1.0d0 / (h * l)))
else if (l <= 3d+82) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((h / l) * (((d_1 * (m / d)) ** 2.0d0) * (-0.125d0))))
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -6.6e-94) {
tmp = d * -Math.sqrt((1.0 / (h * l)));
} else if (l <= 3e+82) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + ((h / l) * (Math.pow((D * (M / d)), 2.0) * -0.125)));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -6.6e-94: tmp = d * -math.sqrt((1.0 / (h * l))) elif l <= 3e+82: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + ((h / l) * (math.pow((D * (M / d)), 2.0) * -0.125))) else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -6.6e-94) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l))))); elseif (l <= 3e+82) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(M / d)) ^ 2.0) * -0.125)))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -6.6e-94)
tmp = d * -sqrt((1.0 / (h * l)));
elseif (l <= 3e+82)
tmp = sqrt(((d / l) * (d / h))) * (1.0 + ((h / l) * (((D * (M / d)) ^ 2.0) * -0.125)));
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -6.6e-94], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 3e+82], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.6 \cdot 10^{-94}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{elif}\;\ell \leq 3 \cdot 10^{+82}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot -0.125\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -6.6000000000000003e-94Initial program 60.5%
Simplified59.4%
Applied egg-rr15.5%
expm1-def23.9%
expm1-log1p36.0%
*-commutative36.0%
Simplified37.1%
Taylor expanded in D around 0 37.1%
Taylor expanded in d around -inf 47.0%
associate-*r*47.0%
mul-1-neg47.0%
Simplified47.0%
if -6.6000000000000003e-94 < l < 2.99999999999999989e82Initial program 76.2%
Simplified75.4%
Applied egg-rr18.6%
expm1-def22.5%
expm1-log1p67.6%
*-commutative67.6%
Simplified67.6%
fma-udef67.6%
Applied egg-rr67.6%
if 2.99999999999999989e82 < l Initial program 58.4%
Simplified57.9%
associate-*r/60.1%
div-inv60.1%
metadata-eval60.1%
Applied egg-rr60.1%
Taylor expanded in d around inf 47.9%
unpow-147.9%
sqr-pow47.8%
rem-sqrt-square47.8%
metadata-eval47.8%
sqr-pow47.8%
fabs-sqr47.8%
sqr-pow47.8%
Simplified47.8%
unpow-prod-down61.0%
Applied egg-rr61.0%
Final simplification59.3%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -7e-94)
(* d (- (sqrt (/ 1.0 (* h l)))))
(if (<= l 6e+82)
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* (/ h l) (* -0.125 (pow (/ D (/ d M)) 2.0)))))
(* d (* (pow h -0.5) (pow l -0.5))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -7e-94) {
tmp = d * -sqrt((1.0 / (h * l)));
} else if (l <= 6e+82) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + ((h / l) * (-0.125 * pow((D / (d / M)), 2.0))));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (l <= (-7d-94)) then
tmp = d * -sqrt((1.0d0 / (h * l)))
else if (l <= 6d+82) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((h / l) * ((-0.125d0) * ((d_1 / (d / m)) ** 2.0d0))))
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -7e-94) {
tmp = d * -Math.sqrt((1.0 / (h * l)));
} else if (l <= 6e+82) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + ((h / l) * (-0.125 * Math.pow((D / (d / M)), 2.0))));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -7e-94: tmp = d * -math.sqrt((1.0 / (h * l))) elif l <= 6e+82: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + ((h / l) * (-0.125 * math.pow((D / (d / M)), 2.0)))) else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -7e-94) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l))))); elseif (l <= 6e+82) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.125 * (Float64(D / Float64(d / M)) ^ 2.0))))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -7e-94)
tmp = d * -sqrt((1.0 / (h * l)));
elseif (l <= 6e+82)
tmp = sqrt(((d / l) * (d / h))) * (1.0 + ((h / l) * (-0.125 * ((D / (d / M)) ^ 2.0))));
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -7e-94], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 6e+82], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.125 * N[Power[N[(D / N[(d / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -7 \cdot 10^{-94}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{elif}\;\ell \leq 6 \cdot 10^{+82}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.125 \cdot {\left(\frac{D}{\frac{d}{M}}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -6.99999999999999996e-94Initial program 60.5%
Simplified59.4%
Applied egg-rr15.5%
expm1-def23.9%
expm1-log1p36.0%
*-commutative36.0%
Simplified37.1%
Taylor expanded in D around 0 37.1%
Taylor expanded in d around -inf 47.0%
associate-*r*47.0%
mul-1-neg47.0%
Simplified47.0%
if -6.99999999999999996e-94 < l < 5.99999999999999978e82Initial program 76.2%
Simplified75.4%
Applied egg-rr18.6%
expm1-def22.5%
expm1-log1p67.6%
*-commutative67.6%
Simplified67.6%
Taylor expanded in D around 0 68.5%
fma-udef68.5%
associate-/l*68.0%
Applied egg-rr68.0%
if 5.99999999999999978e82 < l Initial program 58.4%
Simplified57.9%
associate-*r/60.1%
div-inv60.1%
metadata-eval60.1%
Applied egg-rr60.1%
Taylor expanded in d around inf 47.9%
unpow-147.9%
sqr-pow47.8%
rem-sqrt-square47.8%
metadata-eval47.8%
sqr-pow47.8%
fabs-sqr47.8%
sqr-pow47.8%
Simplified47.8%
unpow-prod-down61.0%
Applied egg-rr61.0%
Final simplification59.5%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= M 9.6e-24)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(*
(sqrt (* (/ d l) (/ d h)))
(* (pow (* M (/ D d)) 2.0) (* (/ h l) -0.125)))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (M <= 9.6e-24) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else {
tmp = sqrt(((d / l) * (d / h))) * (pow((M * (D / d)), 2.0) * ((h / l) * -0.125));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (m <= 9.6d-24) then
tmp = sqrt((d / l)) * sqrt((d / h))
else
tmp = sqrt(((d / l) * (d / h))) * (((m * (d_1 / d)) ** 2.0d0) * ((h / l) * (-0.125d0)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (M <= 9.6e-24) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else {
tmp = Math.sqrt(((d / l) * (d / h))) * (Math.pow((M * (D / d)), 2.0) * ((h / l) * -0.125));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if M <= 9.6e-24: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) else: tmp = math.sqrt(((d / l) * (d / h))) * (math.pow((M * (D / d)), 2.0) * ((h / l) * -0.125)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (M <= 9.6e-24) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); else tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64((Float64(M * Float64(D / d)) ^ 2.0) * Float64(Float64(h / l) * -0.125))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (M <= 9.6e-24)
tmp = sqrt((d / l)) * sqrt((d / h));
else
tmp = sqrt(((d / l) * (d / h))) * (((M * (D / d)) ^ 2.0) * ((h / l) * -0.125));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[M, 9.6e-24], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Power[N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 9.6 \cdot 10^{-24}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left({\left(M \cdot \frac{D}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.125\right)\right)\\
\end{array}
\end{array}
if M < 9.5999999999999993e-24Initial program 70.7%
Simplified70.1%
Taylor expanded in M around 0 41.1%
if 9.5999999999999993e-24 < M Initial program 59.7%
Simplified59.7%
Applied egg-rr12.8%
expm1-def16.6%
expm1-log1p46.1%
*-commutative46.1%
Simplified46.0%
Taylor expanded in h around inf 16.2%
times-frac16.4%
unpow216.4%
associate-*r/16.8%
unpow216.8%
unpow216.8%
times-frac22.8%
unpow222.8%
associate-*r*22.7%
unpow222.7%
unswap-sqr30.0%
associate-/r/30.0%
associate-/l*30.0%
associate-*r/30.0%
associate-/r/30.0%
associate-/l*30.0%
associate-*r/29.9%
unpow229.9%
*-commutative29.9%
Simplified30.0%
Final simplification38.1%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(sqrt (* (/ d l) (/ d h)))
(* -0.125 (* (/ (* D D) (* d d)) (* M (* M (/ h l)))))))
(t_1 (* d (- (sqrt (/ 1.0 (* h l)))))))
(if (<= d -1.9e+34)
t_1
(if (<= d -8.8e-57)
t_0
(if (<= d -3.25e-142)
t_1
(if (<= d 1.2e-241)
(/ d (cbrt (pow (* h l) 1.5)))
(if (<= d 1.95e-16) t_0 (* d (* (pow h -0.5) (pow l -0.5))))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(((d / l) * (d / h))) * (-0.125 * (((D * D) / (d * d)) * (M * (M * (h / l)))));
double t_1 = d * -sqrt((1.0 / (h * l)));
double tmp;
if (d <= -1.9e+34) {
tmp = t_1;
} else if (d <= -8.8e-57) {
tmp = t_0;
} else if (d <= -3.25e-142) {
tmp = t_1;
} else if (d <= 1.2e-241) {
tmp = d / cbrt(pow((h * l), 1.5));
} else if (d <= 1.95e-16) {
tmp = t_0;
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
return tmp;
}
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt(((d / l) * (d / h))) * (-0.125 * (((D * D) / (d * d)) * (M * (M * (h / l)))));
double t_1 = d * -Math.sqrt((1.0 / (h * l)));
double tmp;
if (d <= -1.9e+34) {
tmp = t_1;
} else if (d <= -8.8e-57) {
tmp = t_0;
} else if (d <= -3.25e-142) {
tmp = t_1;
} else if (d <= 1.2e-241) {
tmp = d / Math.cbrt(Math.pow((h * l), 1.5));
} else if (d <= 1.95e-16) {
tmp = t_0;
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(-0.125 * Float64(Float64(Float64(D * D) / Float64(d * d)) * Float64(M * Float64(M * Float64(h / l)))))) t_1 = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l))))) tmp = 0.0 if (d <= -1.9e+34) tmp = t_1; elseif (d <= -8.8e-57) tmp = t_0; elseif (d <= -3.25e-142) tmp = t_1; elseif (d <= 1.2e-241) tmp = Float64(d / cbrt((Float64(h * l) ^ 1.5))); elseif (d <= 1.95e-16) tmp = t_0; else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[(M * N[(M * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[d, -1.9e+34], t$95$1, If[LessEqual[d, -8.8e-57], t$95$0, If[LessEqual[d, -3.25e-142], t$95$1, If[LessEqual[d, 1.2e-241], N[(d / N[Power[N[Power[N[(h * l), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.95e-16], t$95$0, N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(-0.125 \cdot \left(\frac{D \cdot D}{d \cdot d} \cdot \left(M \cdot \left(M \cdot \frac{h}{\ell}\right)\right)\right)\right)\\
t_1 := d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{if}\;d \leq -1.9 \cdot 10^{+34}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq -8.8 \cdot 10^{-57}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -3.25 \cdot 10^{-142}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq 1.2 \cdot 10^{-241}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\
\mathbf{elif}\;d \leq 1.95 \cdot 10^{-16}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -1.9000000000000001e34 or -8.79999999999999994e-57 < d < -3.25000000000000013e-142Initial program 62.1%
Simplified61.0%
Applied egg-rr20.9%
expm1-def28.7%
expm1-log1p46.5%
*-commutative46.5%
Simplified47.6%
Taylor expanded in D around 0 47.6%
Taylor expanded in d around -inf 58.8%
associate-*r*58.8%
mul-1-neg58.8%
Simplified58.8%
if -1.9000000000000001e34 < d < -8.79999999999999994e-57 or 1.2e-241 < d < 1.94999999999999989e-16Initial program 80.9%
Simplified80.9%
Applied egg-rr6.7%
expm1-def17.2%
expm1-log1p69.8%
*-commutative69.8%
Simplified68.3%
Taylor expanded in h around inf 43.6%
times-frac42.1%
unpow242.1%
unpow242.1%
times-frac42.8%
unpow242.8%
unpow242.8%
associate-*r/47.1%
unpow247.1%
times-frac46.9%
associate-*l*51.5%
Simplified51.5%
if -3.25000000000000013e-142 < d < 1.2e-241Initial program 37.0%
Simplified36.6%
Taylor expanded in d around inf 12.8%
pow112.8%
sqrt-div12.8%
metadata-eval12.8%
Applied egg-rr12.8%
unpow112.8%
associate-*r/12.8%
*-rgt-identity12.8%
Simplified12.8%
add-cbrt-cube16.7%
add-sqr-sqrt16.7%
Applied egg-rr16.7%
*-commutative16.7%
unpow1/216.7%
pow-plus16.7%
metadata-eval16.7%
Simplified16.7%
if 1.94999999999999989e-16 < d Initial program 88.0%
Simplified86.3%
associate-*r/89.6%
div-inv89.6%
metadata-eval89.6%
Applied egg-rr89.6%
Taylor expanded in d around inf 61.8%
unpow-161.8%
sqr-pow61.8%
rem-sqrt-square61.8%
metadata-eval61.8%
sqr-pow61.7%
fabs-sqr61.7%
sqr-pow61.8%
Simplified61.8%
unpow-prod-down71.7%
Applied egg-rr71.7%
Final simplification51.6%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(sqrt (* (/ d l) (/ d h)))
(* -0.125 (* (/ (* D D) (* d d)) (* M (* M (/ h l)))))))
(t_1 (* d (- (sqrt (/ 1.0 (* h l)))))))
(if (<= d -4e+34)
t_1
(if (<= d -1.55e-51)
t_0
(if (<= d -1.02e-143)
t_1
(if (<= d 7.5e-243)
(/ d (cbrt (pow (* h l) 1.5)))
(if (<= d 2.1e-15) t_0 (/ d (* (sqrt h) (sqrt l))))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(((d / l) * (d / h))) * (-0.125 * (((D * D) / (d * d)) * (M * (M * (h / l)))));
double t_1 = d * -sqrt((1.0 / (h * l)));
double tmp;
if (d <= -4e+34) {
tmp = t_1;
} else if (d <= -1.55e-51) {
tmp = t_0;
} else if (d <= -1.02e-143) {
tmp = t_1;
} else if (d <= 7.5e-243) {
tmp = d / cbrt(pow((h * l), 1.5));
} else if (d <= 2.1e-15) {
tmp = t_0;
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt(((d / l) * (d / h))) * (-0.125 * (((D * D) / (d * d)) * (M * (M * (h / l)))));
double t_1 = d * -Math.sqrt((1.0 / (h * l)));
double tmp;
if (d <= -4e+34) {
tmp = t_1;
} else if (d <= -1.55e-51) {
tmp = t_0;
} else if (d <= -1.02e-143) {
tmp = t_1;
} else if (d <= 7.5e-243) {
tmp = d / Math.cbrt(Math.pow((h * l), 1.5));
} else if (d <= 2.1e-15) {
tmp = t_0;
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(-0.125 * Float64(Float64(Float64(D * D) / Float64(d * d)) * Float64(M * Float64(M * Float64(h / l)))))) t_1 = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l))))) tmp = 0.0 if (d <= -4e+34) tmp = t_1; elseif (d <= -1.55e-51) tmp = t_0; elseif (d <= -1.02e-143) tmp = t_1; elseif (d <= 7.5e-243) tmp = Float64(d / cbrt((Float64(h * l) ^ 1.5))); elseif (d <= 2.1e-15) tmp = t_0; else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[(M * N[(M * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[d, -4e+34], t$95$1, If[LessEqual[d, -1.55e-51], t$95$0, If[LessEqual[d, -1.02e-143], t$95$1, If[LessEqual[d, 7.5e-243], N[(d / N[Power[N[Power[N[(h * l), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.1e-15], t$95$0, N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(-0.125 \cdot \left(\frac{D \cdot D}{d \cdot d} \cdot \left(M \cdot \left(M \cdot \frac{h}{\ell}\right)\right)\right)\right)\\
t_1 := d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{if}\;d \leq -4 \cdot 10^{+34}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq -1.55 \cdot 10^{-51}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -1.02 \cdot 10^{-143}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq 7.5 \cdot 10^{-243}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\
\mathbf{elif}\;d \leq 2.1 \cdot 10^{-15}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -3.99999999999999978e34 or -1.5499999999999999e-51 < d < -1.02e-143Initial program 62.1%
Simplified61.0%
Applied egg-rr20.9%
expm1-def28.7%
expm1-log1p46.5%
*-commutative46.5%
Simplified47.6%
Taylor expanded in D around 0 47.6%
Taylor expanded in d around -inf 58.8%
associate-*r*58.8%
mul-1-neg58.8%
Simplified58.8%
if -3.99999999999999978e34 < d < -1.5499999999999999e-51 or 7.5e-243 < d < 2.09999999999999981e-15Initial program 80.9%
Simplified80.9%
Applied egg-rr6.7%
expm1-def17.2%
expm1-log1p69.8%
*-commutative69.8%
Simplified68.3%
Taylor expanded in h around inf 43.6%
times-frac42.1%
unpow242.1%
unpow242.1%
times-frac42.8%
unpow242.8%
unpow242.8%
associate-*r/47.1%
unpow247.1%
times-frac46.9%
associate-*l*51.5%
Simplified51.5%
if -1.02e-143 < d < 7.5e-243Initial program 37.0%
Simplified36.6%
Taylor expanded in d around inf 12.8%
pow112.8%
sqrt-div12.8%
metadata-eval12.8%
Applied egg-rr12.8%
unpow112.8%
associate-*r/12.8%
*-rgt-identity12.8%
Simplified12.8%
add-cbrt-cube16.7%
add-sqr-sqrt16.7%
Applied egg-rr16.7%
*-commutative16.7%
unpow1/216.7%
pow-plus16.7%
metadata-eval16.7%
Simplified16.7%
if 2.09999999999999981e-15 < d Initial program 88.0%
Simplified86.3%
Taylor expanded in d around inf 61.8%
pow161.8%
sqrt-div61.7%
metadata-eval61.7%
Applied egg-rr61.7%
unpow161.7%
associate-*r/61.8%
*-rgt-identity61.8%
Simplified61.8%
sqrt-prod71.6%
Applied egg-rr71.6%
Final simplification51.6%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(sqrt (* (/ d l) (/ d h)))
(* -0.125 (* (/ (* D D) (* d d)) (* M (* M (/ h l)))))))
(t_1 (* d (- (sqrt (/ 1.0 (* h l)))))))
(if (<= d -1.4e+34)
t_1
(if (<= d -1.75e-56)
t_0
(if (<= d 1.25e-225)
t_1
(if (<= d 3.1e-16) t_0 (/ d (* (sqrt h) (sqrt l)))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(((d / l) * (d / h))) * (-0.125 * (((D * D) / (d * d)) * (M * (M * (h / l)))));
double t_1 = d * -sqrt((1.0 / (h * l)));
double tmp;
if (d <= -1.4e+34) {
tmp = t_1;
} else if (d <= -1.75e-56) {
tmp = t_0;
} else if (d <= 1.25e-225) {
tmp = t_1;
} else if (d <= 3.1e-16) {
tmp = t_0;
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt(((d / l) * (d / h))) * ((-0.125d0) * (((d_1 * d_1) / (d * d)) * (m * (m * (h / l)))))
t_1 = d * -sqrt((1.0d0 / (h * l)))
if (d <= (-1.4d+34)) then
tmp = t_1
else if (d <= (-1.75d-56)) then
tmp = t_0
else if (d <= 1.25d-225) then
tmp = t_1
else if (d <= 3.1d-16) then
tmp = t_0
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt(((d / l) * (d / h))) * (-0.125 * (((D * D) / (d * d)) * (M * (M * (h / l)))));
double t_1 = d * -Math.sqrt((1.0 / (h * l)));
double tmp;
if (d <= -1.4e+34) {
tmp = t_1;
} else if (d <= -1.75e-56) {
tmp = t_0;
} else if (d <= 1.25e-225) {
tmp = t_1;
} else if (d <= 3.1e-16) {
tmp = t_0;
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt(((d / l) * (d / h))) * (-0.125 * (((D * D) / (d * d)) * (M * (M * (h / l))))) t_1 = d * -math.sqrt((1.0 / (h * l))) tmp = 0 if d <= -1.4e+34: tmp = t_1 elif d <= -1.75e-56: tmp = t_0 elif d <= 1.25e-225: tmp = t_1 elif d <= 3.1e-16: tmp = t_0 else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(-0.125 * Float64(Float64(Float64(D * D) / Float64(d * d)) * Float64(M * Float64(M * Float64(h / l)))))) t_1 = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l))))) tmp = 0.0 if (d <= -1.4e+34) tmp = t_1; elseif (d <= -1.75e-56) tmp = t_0; elseif (d <= 1.25e-225) tmp = t_1; elseif (d <= 3.1e-16) tmp = t_0; else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt(((d / l) * (d / h))) * (-0.125 * (((D * D) / (d * d)) * (M * (M * (h / l)))));
t_1 = d * -sqrt((1.0 / (h * l)));
tmp = 0.0;
if (d <= -1.4e+34)
tmp = t_1;
elseif (d <= -1.75e-56)
tmp = t_0;
elseif (d <= 1.25e-225)
tmp = t_1;
elseif (d <= 3.1e-16)
tmp = t_0;
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[(M * N[(M * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[d, -1.4e+34], t$95$1, If[LessEqual[d, -1.75e-56], t$95$0, If[LessEqual[d, 1.25e-225], t$95$1, If[LessEqual[d, 3.1e-16], t$95$0, N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(-0.125 \cdot \left(\frac{D \cdot D}{d \cdot d} \cdot \left(M \cdot \left(M \cdot \frac{h}{\ell}\right)\right)\right)\right)\\
t_1 := d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{if}\;d \leq -1.4 \cdot 10^{+34}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq -1.75 \cdot 10^{-56}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 1.25 \cdot 10^{-225}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq 3.1 \cdot 10^{-16}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.40000000000000004e34 or -1.7499999999999999e-56 < d < 1.25e-225Initial program 51.6%
Simplified50.7%
Applied egg-rr13.6%
expm1-def19.0%
expm1-log1p34.9%
*-commutative34.9%
Simplified35.7%
Taylor expanded in D around 0 35.7%
Taylor expanded in d around -inf 39.2%
associate-*r*39.2%
mul-1-neg39.2%
Simplified39.2%
if -1.40000000000000004e34 < d < -1.7499999999999999e-56 or 1.25e-225 < d < 3.1000000000000001e-16Initial program 86.0%
Simplified86.0%
Applied egg-rr7.3%
expm1-def18.6%
expm1-log1p74.0%
*-commutative74.0%
Simplified72.3%
Taylor expanded in h around inf 47.3%
times-frac45.6%
unpow245.6%
unpow245.6%
times-frac46.3%
unpow246.3%
unpow246.3%
associate-*r/49.4%
unpow249.4%
times-frac49.1%
associate-*l*54.2%
Simplified54.2%
if 3.1000000000000001e-16 < d Initial program 88.0%
Simplified86.3%
Taylor expanded in d around inf 61.8%
pow161.8%
sqrt-div61.7%
metadata-eval61.7%
Applied egg-rr61.7%
unpow161.7%
associate-*r/61.8%
*-rgt-identity61.8%
Simplified61.8%
sqrt-prod71.6%
Applied egg-rr71.6%
Final simplification50.0%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= M 5.4e-13)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(*
(sqrt (* (/ d l) (/ d h)))
(* -0.125 (* (/ (* D D) (* d d)) (/ (* h (* M M)) l))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (M <= 5.4e-13) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else {
tmp = sqrt(((d / l) * (d / h))) * (-0.125 * (((D * D) / (d * d)) * ((h * (M * M)) / l)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (m <= 5.4d-13) then
tmp = sqrt((d / l)) * sqrt((d / h))
else
tmp = sqrt(((d / l) * (d / h))) * ((-0.125d0) * (((d_1 * d_1) / (d * d)) * ((h * (m * m)) / l)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (M <= 5.4e-13) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else {
tmp = Math.sqrt(((d / l) * (d / h))) * (-0.125 * (((D * D) / (d * d)) * ((h * (M * M)) / l)));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if M <= 5.4e-13: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) else: tmp = math.sqrt(((d / l) * (d / h))) * (-0.125 * (((D * D) / (d * d)) * ((h * (M * M)) / l))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (M <= 5.4e-13) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); else tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(-0.125 * Float64(Float64(Float64(D * D) / Float64(d * d)) * Float64(Float64(h * Float64(M * M)) / l)))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (M <= 5.4e-13)
tmp = sqrt((d / l)) * sqrt((d / h));
else
tmp = sqrt(((d / l) * (d / h))) * (-0.125 * (((D * D) / (d * d)) * ((h * (M * M)) / l)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[M, 5.4e-13], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 5.4 \cdot 10^{-13}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(-0.125 \cdot \left(\frac{D \cdot D}{d \cdot d} \cdot \frac{h \cdot \left(M \cdot M\right)}{\ell}\right)\right)\\
\end{array}
\end{array}
if M < 5.40000000000000021e-13Initial program 70.3%
Simplified69.7%
Taylor expanded in M around 0 40.9%
if 5.40000000000000021e-13 < M Initial program 60.6%
Simplified60.6%
Applied egg-rr13.0%
expm1-def16.8%
expm1-log1p46.7%
*-commutative46.7%
Simplified46.7%
Taylor expanded in D around 0 46.8%
Taylor expanded in h around inf 16.5%
unpow216.5%
times-frac16.6%
unpow216.6%
times-frac24.2%
*-commutative24.2%
unpow224.2%
unpow224.2%
*-commutative24.2%
associate-/l*23.2%
unpow223.2%
times-frac17.1%
unpow217.1%
associate-/l*16.6%
Simplified16.6%
Final simplification34.5%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(sqrt (* (/ d l) (/ d h)))
(* -0.125 (* (/ (* D D) (* d d)) (* M (* M (/ h l)))))))
(t_1 (* d (- (sqrt (/ 1.0 (* h l)))))))
(if (<= d -4.1e+34)
t_1
(if (<= d -3.8e-49)
t_0
(if (<= d 5.3e-225)
t_1
(if (<= d 1.9e-15) t_0 (/ d (sqrt (* h l)))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(((d / l) * (d / h))) * (-0.125 * (((D * D) / (d * d)) * (M * (M * (h / l)))));
double t_1 = d * -sqrt((1.0 / (h * l)));
double tmp;
if (d <= -4.1e+34) {
tmp = t_1;
} else if (d <= -3.8e-49) {
tmp = t_0;
} else if (d <= 5.3e-225) {
tmp = t_1;
} else if (d <= 1.9e-15) {
tmp = t_0;
} else {
tmp = d / sqrt((h * l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt(((d / l) * (d / h))) * ((-0.125d0) * (((d_1 * d_1) / (d * d)) * (m * (m * (h / l)))))
t_1 = d * -sqrt((1.0d0 / (h * l)))
if (d <= (-4.1d+34)) then
tmp = t_1
else if (d <= (-3.8d-49)) then
tmp = t_0
else if (d <= 5.3d-225) then
tmp = t_1
else if (d <= 1.9d-15) then
tmp = t_0
else
tmp = d / sqrt((h * l))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt(((d / l) * (d / h))) * (-0.125 * (((D * D) / (d * d)) * (M * (M * (h / l)))));
double t_1 = d * -Math.sqrt((1.0 / (h * l)));
double tmp;
if (d <= -4.1e+34) {
tmp = t_1;
} else if (d <= -3.8e-49) {
tmp = t_0;
} else if (d <= 5.3e-225) {
tmp = t_1;
} else if (d <= 1.9e-15) {
tmp = t_0;
} else {
tmp = d / Math.sqrt((h * l));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt(((d / l) * (d / h))) * (-0.125 * (((D * D) / (d * d)) * (M * (M * (h / l))))) t_1 = d * -math.sqrt((1.0 / (h * l))) tmp = 0 if d <= -4.1e+34: tmp = t_1 elif d <= -3.8e-49: tmp = t_0 elif d <= 5.3e-225: tmp = t_1 elif d <= 1.9e-15: tmp = t_0 else: tmp = d / math.sqrt((h * l)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(-0.125 * Float64(Float64(Float64(D * D) / Float64(d * d)) * Float64(M * Float64(M * Float64(h / l)))))) t_1 = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l))))) tmp = 0.0 if (d <= -4.1e+34) tmp = t_1; elseif (d <= -3.8e-49) tmp = t_0; elseif (d <= 5.3e-225) tmp = t_1; elseif (d <= 1.9e-15) tmp = t_0; else tmp = Float64(d / sqrt(Float64(h * l))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt(((d / l) * (d / h))) * (-0.125 * (((D * D) / (d * d)) * (M * (M * (h / l)))));
t_1 = d * -sqrt((1.0 / (h * l)));
tmp = 0.0;
if (d <= -4.1e+34)
tmp = t_1;
elseif (d <= -3.8e-49)
tmp = t_0;
elseif (d <= 5.3e-225)
tmp = t_1;
elseif (d <= 1.9e-15)
tmp = t_0;
else
tmp = d / sqrt((h * l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[(M * N[(M * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[d, -4.1e+34], t$95$1, If[LessEqual[d, -3.8e-49], t$95$0, If[LessEqual[d, 5.3e-225], t$95$1, If[LessEqual[d, 1.9e-15], t$95$0, N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(-0.125 \cdot \left(\frac{D \cdot D}{d \cdot d} \cdot \left(M \cdot \left(M \cdot \frac{h}{\ell}\right)\right)\right)\right)\\
t_1 := d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{if}\;d \leq -4.1 \cdot 10^{+34}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq -3.8 \cdot 10^{-49}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 5.3 \cdot 10^{-225}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq 1.9 \cdot 10^{-15}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if d < -4.0999999999999998e34 or -3.7999999999999997e-49 < d < 5.30000000000000005e-225Initial program 51.6%
Simplified50.7%
Applied egg-rr13.6%
expm1-def19.0%
expm1-log1p34.9%
*-commutative34.9%
Simplified35.7%
Taylor expanded in D around 0 35.7%
Taylor expanded in d around -inf 39.2%
associate-*r*39.2%
mul-1-neg39.2%
Simplified39.2%
if -4.0999999999999998e34 < d < -3.7999999999999997e-49 or 5.30000000000000005e-225 < d < 1.9000000000000001e-15Initial program 86.0%
Simplified86.0%
Applied egg-rr7.3%
expm1-def18.6%
expm1-log1p74.0%
*-commutative74.0%
Simplified72.3%
Taylor expanded in h around inf 47.3%
times-frac45.6%
unpow245.6%
unpow245.6%
times-frac46.3%
unpow246.3%
unpow246.3%
associate-*r/49.4%
unpow249.4%
times-frac49.1%
associate-*l*54.2%
Simplified54.2%
if 1.9000000000000001e-15 < d Initial program 88.0%
Simplified86.3%
Taylor expanded in d around inf 61.8%
pow161.8%
sqrt-div61.7%
metadata-eval61.7%
Applied egg-rr61.7%
unpow161.7%
associate-*r/61.8%
*-rgt-identity61.8%
Simplified61.8%
Final simplification47.8%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (let* ((t_0 (sqrt (/ 1.0 (* h l))))) (if (<= l 1.95e-144) (* d (- t_0)) (* d t_0))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (h * l)));
double tmp;
if (l <= 1.95e-144) {
tmp = d * -t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((1.0d0 / (h * l)))
if (l <= 1.95d-144) then
tmp = d * -t_0
else
tmp = d * t_0
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((1.0 / (h * l)));
double tmp;
if (l <= 1.95e-144) {
tmp = d * -t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((1.0 / (h * l))) tmp = 0 if l <= 1.95e-144: tmp = d * -t_0 else: tmp = d * t_0 return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(h * l))) tmp = 0.0 if (l <= 1.95e-144) tmp = Float64(d * Float64(-t_0)); else tmp = Float64(d * t_0); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((1.0 / (h * l)));
tmp = 0.0;
if (l <= 1.95e-144)
tmp = d * -t_0;
else
tmp = d * t_0;
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, 1.95e-144], N[(d * (-t$95$0)), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{if}\;\ell \leq 1.95 \cdot 10^{-144}:\\
\;\;\;\;d \cdot \left(-t_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot t_0\\
\end{array}
\end{array}
if l < 1.95000000000000007e-144Initial program 65.3%
Simplified64.1%
Applied egg-rr15.3%
expm1-def20.4%
expm1-log1p49.5%
*-commutative49.5%
Simplified50.6%
Taylor expanded in D around 0 50.6%
Taylor expanded in d around -inf 38.8%
associate-*r*38.8%
mul-1-neg38.8%
Simplified38.8%
if 1.95000000000000007e-144 < l Initial program 72.5%
Simplified72.2%
Taylor expanded in d around inf 44.6%
Final simplification40.8%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= d -6.5e-131) (sqrt (* (/ d l) (/ d h))) (/ d (sqrt (* h l)))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -6.5e-131) {
tmp = sqrt(((d / l) * (d / h)));
} else {
tmp = d / sqrt((h * l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (d <= (-6.5d-131)) then
tmp = sqrt(((d / l) * (d / h)))
else
tmp = d / sqrt((h * l))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -6.5e-131) {
tmp = Math.sqrt(((d / l) * (d / h)));
} else {
tmp = d / Math.sqrt((h * l));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= -6.5e-131: tmp = math.sqrt(((d / l) * (d / h))) else: tmp = d / math.sqrt((h * l)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -6.5e-131) tmp = sqrt(Float64(Float64(d / l) * Float64(d / h))); else tmp = Float64(d / sqrt(Float64(h * l))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= -6.5e-131)
tmp = sqrt(((d / l) * (d / h)));
else
tmp = d / sqrt((h * l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -6.5e-131], N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -6.5 \cdot 10^{-131}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if d < -6.5000000000000002e-131Initial program 67.1%
Simplified67.2%
Taylor expanded in M around 0 43.5%
pow143.5%
*-rgt-identity43.5%
*-commutative43.5%
sqrt-unprod30.9%
Applied egg-rr30.9%
unpow130.9%
Simplified30.9%
if -6.5000000000000002e-131 < d Initial program 68.1%
Simplified67.4%
Taylor expanded in d around inf 32.2%
pow132.2%
sqrt-div32.2%
metadata-eval32.2%
Applied egg-rr32.2%
unpow132.2%
associate-*r/32.2%
*-rgt-identity32.2%
Simplified32.2%
Final simplification31.7%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= d -3.7e-131) (sqrt (/ d (/ h (/ d l)))) (/ d (sqrt (* h l)))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -3.7e-131) {
tmp = sqrt((d / (h / (d / l))));
} else {
tmp = d / sqrt((h * l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (d <= (-3.7d-131)) then
tmp = sqrt((d / (h / (d / l))))
else
tmp = d / sqrt((h * l))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -3.7e-131) {
tmp = Math.sqrt((d / (h / (d / l))));
} else {
tmp = d / Math.sqrt((h * l));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= -3.7e-131: tmp = math.sqrt((d / (h / (d / l)))) else: tmp = d / math.sqrt((h * l)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -3.7e-131) tmp = sqrt(Float64(d / Float64(h / Float64(d / l)))); else tmp = Float64(d / sqrt(Float64(h * l))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= -3.7e-131)
tmp = sqrt((d / (h / (d / l))));
else
tmp = d / sqrt((h * l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -3.7e-131], N[Sqrt[N[(d / N[(h / N[(d / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -3.7 \cdot 10^{-131}:\\
\;\;\;\;\sqrt{\frac{d}{\frac{h}{\frac{d}{\ell}}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if d < -3.7000000000000002e-131Initial program 67.1%
Simplified67.2%
Taylor expanded in M around 0 43.5%
pow143.5%
*-rgt-identity43.5%
*-commutative43.5%
sqrt-unprod30.9%
Applied egg-rr30.9%
unpow130.9%
associate-*l/27.4%
associate-/l*31.1%
Simplified31.1%
if -3.7000000000000002e-131 < d Initial program 68.1%
Simplified67.4%
Taylor expanded in d around inf 32.2%
pow132.2%
sqrt-div32.2%
metadata-eval32.2%
Applied egg-rr32.2%
unpow132.2%
associate-*r/32.2%
*-rgt-identity32.2%
Simplified32.2%
Final simplification31.8%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= d -3.1e-133) (sqrt (/ d (/ h (/ d l)))) (* d (sqrt (/ 1.0 (* h l))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -3.1e-133) {
tmp = sqrt((d / (h / (d / l))));
} else {
tmp = d * sqrt((1.0 / (h * l)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (d <= (-3.1d-133)) then
tmp = sqrt((d / (h / (d / l))))
else
tmp = d * sqrt((1.0d0 / (h * l)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -3.1e-133) {
tmp = Math.sqrt((d / (h / (d / l))));
} else {
tmp = d * Math.sqrt((1.0 / (h * l)));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= -3.1e-133: tmp = math.sqrt((d / (h / (d / l)))) else: tmp = d * math.sqrt((1.0 / (h * l))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -3.1e-133) tmp = sqrt(Float64(d / Float64(h / Float64(d / l)))); else tmp = Float64(d * sqrt(Float64(1.0 / Float64(h * l)))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= -3.1e-133)
tmp = sqrt((d / (h / (d / l))));
else
tmp = d * sqrt((1.0 / (h * l)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -3.1e-133], N[Sqrt[N[(d / N[(h / N[(d / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -3.1 \cdot 10^{-133}:\\
\;\;\;\;\sqrt{\frac{d}{\frac{h}{\frac{d}{\ell}}}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\end{array}
\end{array}
if d < -3.10000000000000016e-133Initial program 67.1%
Simplified67.2%
Taylor expanded in M around 0 43.5%
pow143.5%
*-rgt-identity43.5%
*-commutative43.5%
sqrt-unprod30.9%
Applied egg-rr30.9%
unpow130.9%
associate-*l/27.4%
associate-/l*31.1%
Simplified31.1%
if -3.10000000000000016e-133 < d Initial program 68.1%
Simplified67.4%
Taylor expanded in d around inf 32.2%
Final simplification31.8%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (/ d (sqrt (* h l))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d / sqrt((h * l));
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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 / sqrt((h * l))
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d / Math.sqrt((h * l));
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d / math.sqrt((h * l))
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d / sqrt(Float64(h * l))) end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d / sqrt((h * l));
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Initial program 67.8%
Simplified66.9%
Taylor expanded in d around inf 22.4%
pow122.4%
sqrt-div22.4%
metadata-eval22.4%
Applied egg-rr22.4%
unpow122.4%
associate-*r/22.4%
*-rgt-identity22.4%
Simplified22.4%
Final simplification22.4%
herbie shell --seed 2023279
(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)))))