
(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 21 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: 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))) (t_1 (sqrt (/ d h))))
(if (<= l -8.8e+109)
(*
(* t_1 (pow (* (pow (/ -1.0 l) 0.25) (pow (- d) 0.25)) 2.0))
(- 1.0 (* 0.5 (* (pow (* (/ M 2.0) (/ D d)) 2.0) (/ h l)))))
(if (<= l -5e-310)
(*
(* t_1 t_0)
(- 1.0 (* 0.5 (pow (* (/ (* (* M D) (sqrt (/ h l))) d) -0.5) 2.0))))
(*
(* t_0 (/ (sqrt d) (sqrt h)))
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D d) (* 0.5 M)) 2.0)) l))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = sqrt((d / h));
double tmp;
if (l <= -8.8e+109) {
tmp = (t_1 * pow((pow((-1.0 / l), 0.25) * pow(-d, 0.25)), 2.0)) * (1.0 - (0.5 * (pow(((M / 2.0) * (D / d)), 2.0) * (h / l))));
} else if (l <= -5e-310) {
tmp = (t_1 * t_0) * (1.0 - (0.5 * pow(((((M * D) * sqrt((h / l))) / d) * -0.5), 2.0)));
} else {
tmp = (t_0 * (sqrt(d) / sqrt(h))) * (1.0 - (0.5 * ((h * pow(((D / d) * (0.5 * M)), 2.0)) / l)));
}
return tmp;
}
NOTE: M 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))
t_1 = sqrt((d / h))
if (l <= (-8.8d+109)) then
tmp = (t_1 * (((((-1.0d0) / l) ** 0.25d0) * (-d ** 0.25d0)) ** 2.0d0)) * (1.0d0 - (0.5d0 * ((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (h / l))))
else if (l <= (-5d-310)) then
tmp = (t_1 * t_0) * (1.0d0 - (0.5d0 * (((((m * d_1) * sqrt((h / l))) / d) * (-0.5d0)) ** 2.0d0)))
else
tmp = (t_0 * (sqrt(d) / sqrt(h))) * (1.0d0 - (0.5d0 * ((h * (((d_1 / d) * (0.5d0 * m)) ** 2.0d0)) / l)))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double t_1 = Math.sqrt((d / h));
double tmp;
if (l <= -8.8e+109) {
tmp = (t_1 * Math.pow((Math.pow((-1.0 / l), 0.25) * Math.pow(-d, 0.25)), 2.0)) * (1.0 - (0.5 * (Math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l))));
} else if (l <= -5e-310) {
tmp = (t_1 * t_0) * (1.0 - (0.5 * Math.pow(((((M * D) * Math.sqrt((h / l))) / d) * -0.5), 2.0)));
} else {
tmp = (t_0 * (Math.sqrt(d) / Math.sqrt(h))) * (1.0 - (0.5 * ((h * Math.pow(((D / d) * (0.5 * M)), 2.0)) / l)));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) t_1 = math.sqrt((d / h)) tmp = 0 if l <= -8.8e+109: tmp = (t_1 * math.pow((math.pow((-1.0 / l), 0.25) * math.pow(-d, 0.25)), 2.0)) * (1.0 - (0.5 * (math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) elif l <= -5e-310: tmp = (t_1 * t_0) * (1.0 - (0.5 * math.pow(((((M * D) * math.sqrt((h / l))) / d) * -0.5), 2.0))) else: tmp = (t_0 * (math.sqrt(d) / math.sqrt(h))) * (1.0 - (0.5 * ((h * math.pow(((D / d) * (0.5 * M)), 2.0)) / l))) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = sqrt(Float64(d / h)) tmp = 0.0 if (l <= -8.8e+109) tmp = Float64(Float64(t_1 * (Float64((Float64(-1.0 / l) ^ 0.25) * (Float64(-d) ^ 0.25)) ^ 2.0)) * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(h / l))))); elseif (l <= -5e-310) tmp = Float64(Float64(t_1 * t_0) * Float64(1.0 - Float64(0.5 * (Float64(Float64(Float64(Float64(M * D) * sqrt(Float64(h / l))) / d) * -0.5) ^ 2.0)))); 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
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / l));
t_1 = sqrt((d / h));
tmp = 0.0;
if (l <= -8.8e+109)
tmp = (t_1 * ((((-1.0 / l) ^ 0.25) * (-d ^ 0.25)) ^ 2.0)) * (1.0 - (0.5 * ((((M / 2.0) * (D / d)) ^ 2.0) * (h / l))));
elseif (l <= -5e-310)
tmp = (t_1 * t_0) * (1.0 - (0.5 * (((((M * D) * sqrt((h / l))) / d) * -0.5) ^ 2.0)));
else
tmp = (t_0 * (sqrt(d) / sqrt(h))) * (1.0 - (0.5 * ((h * (((D / d) * (0.5 * M)) ^ 2.0)) / l)));
end
tmp_2 = tmp;
end
NOTE: M 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]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -8.8e+109], N[(N[(t$95$1 * N[Power[N[(N[Power[N[(-1.0 / l), $MachinePrecision], 0.25], $MachinePrecision] * N[Power[(-d), 0.25], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $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[l, -5e-310], N[(N[(t$95$1 * t$95$0), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(N[(N[(N[(M * D), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * -0.5), $MachinePrecision], 2.0], $MachinePrecision]), $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|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;\ell \leq -8.8 \cdot 10^{+109}:\\
\;\;\;\;\left(t_1 \cdot {\left({\left(\frac{-1}{\ell}\right)}^{0.25} \cdot {\left(-d\right)}^{0.25}\right)}^{2}\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}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(t_1 \cdot t_0\right) \cdot \left(1 - 0.5 \cdot {\left(\frac{\left(M \cdot D\right) \cdot \sqrt{\frac{h}{\ell}}}{d} \cdot -0.5\right)}^{2}\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 l < -8.7999999999999997e109Initial program 55.4%
Simplified55.4%
pow1/255.4%
sqr-pow55.3%
pow255.3%
metadata-eval55.3%
Applied egg-rr55.3%
Taylor expanded in l around -inf 61.6%
distribute-lft-in61.6%
exp-sum61.7%
*-commutative61.7%
exp-to-pow63.0%
*-commutative63.0%
rem-square-sqrt0.0%
unpow20.0%
exp-to-pow0.0%
unpow20.0%
rem-square-sqrt66.0%
mul-1-neg66.0%
Simplified66.0%
if -8.7999999999999997e109 < l < -4.999999999999985e-310Initial program 64.4%
Simplified63.4%
add-sqr-sqrt63.4%
pow263.4%
*-commutative63.4%
div-inv63.4%
metadata-eval63.4%
Applied egg-rr63.4%
Taylor expanded in M around -inf 69.6%
*-commutative69.6%
associate-*l/69.6%
Simplified69.6%
if -4.999999999999985e-310 < l 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 simplification75.1%
NOTE: M 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 (<=
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* M D) (* d 2.0)) 2.0)))))
INFINITY)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(- 1.0 (* 0.5 (pow (* (/ (* (* M D) (sqrt (/ h l))) d) -0.5) 2.0))))
(* d (sqrt (+ -1.0 (exp (fma h l (- (log (* l h))))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (((pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((M * D) / (d * 2.0)), 2.0))))) <= ((double) INFINITY)) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.5 * pow(((((M * D) * sqrt((h / l))) / d) * -0.5), 2.0)));
} else {
tmp = d * sqrt((-1.0 + exp(fma(h, l, -log((l * h))))));
}
return tmp;
}
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0))))) <= Inf) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * (Float64(Float64(Float64(Float64(M * D) * sqrt(Float64(h / l))) / d) * -0.5) ^ 2.0)))); else tmp = Float64(d * sqrt(Float64(-1.0 + exp(fma(h, l, Float64(-log(Float64(l * h)))))))); end return tmp end
NOTE: M 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[N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(N[(N[(N[(M * D), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * -0.5), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(-1.0 + N[Exp[N[(h * l + (-N[Log[N[(l * h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \leq \infty:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\frac{\left(M \cdot D\right) \cdot \sqrt{\frac{h}{\ell}}}{d} \cdot -0.5\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{-1 + e^{\mathsf{fma}\left(h, \ell, -\log \left(\ell \cdot h\right)\right)}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < +inf.0Initial program 83.0%
Simplified81.9%
add-sqr-sqrt81.9%
pow281.9%
*-commutative81.9%
div-inv81.9%
metadata-eval81.9%
Applied egg-rr81.9%
Taylor expanded in M around -inf 84.8%
*-commutative84.8%
associate-*l/84.8%
Simplified84.8%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) Initial program 0.0%
Simplified0.1%
Taylor expanded in d around inf 4.4%
*-commutative4.4%
associate-/r*4.4%
Simplified4.4%
expm1-log1p-u4.4%
expm1-udef4.6%
associate-/l/4.6%
Applied egg-rr4.6%
Taylor expanded in h around 0 2.4%
*-commutative2.4%
fma-def2.4%
log-rec2.4%
mul-1-neg2.4%
distribute-neg-out2.4%
+-commutative2.4%
log-prod18.5%
Simplified18.5%
Final simplification72.6%
NOTE: M 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
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* M D) (* d 2.0)) 2.0)))))))
(if (<= t_0 INFINITY)
t_0
(* d (sqrt (+ -1.0 (exp (fma h l (- (log (* l h)))))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((M * D) / (d * 2.0)), 2.0))));
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = t_0;
} else {
tmp = d * sqrt((-1.0 + exp(fma(h, l, -log((l * h))))));
}
return tmp;
}
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0))))) tmp = 0.0 if (t_0 <= Inf) tmp = t_0; else tmp = Float64(d * sqrt(Float64(-1.0 + exp(fma(h, l, Float64(-log(Float64(l * h)))))))); end return tmp end
NOTE: M 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[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], t$95$0, N[(d * N[Sqrt[N[(-1.0 + N[Exp[N[(h * l + (-N[Log[N[(l * h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right)\\
\mathbf{if}\;t_0 \leq \infty:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{-1 + e^{\mathsf{fma}\left(h, \ell, -\log \left(\ell \cdot h\right)\right)}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < +inf.0Initial program 83.0%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) Initial program 0.0%
Simplified0.1%
Taylor expanded in d around inf 4.4%
*-commutative4.4%
associate-/r*4.4%
Simplified4.4%
expm1-log1p-u4.4%
expm1-udef4.6%
associate-/l/4.6%
Applied egg-rr4.6%
Taylor expanded in h around 0 2.4%
*-commutative2.4%
fma-def2.4%
log-rec2.4%
mul-1-neg2.4%
distribute-neg-out2.4%
+-commutative2.4%
log-prod18.5%
Simplified18.5%
Final simplification71.1%
NOTE: M 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
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* M D) (* d 2.0)) 2.0)))))))
(if (<= t_0 INFINITY)
t_0
(* -0.125 (* (/ (* M (* M (* D D))) d) (sqrt (/ h (pow l 3.0))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((M * D) / (d * 2.0)), 2.0))));
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = t_0;
} else {
tmp = -0.125 * (((M * (M * (D * D))) / d) * sqrt((h / pow(l, 3.0))));
}
return tmp;
}
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((M * D) / (d * 2.0)), 2.0))));
double tmp;
if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_0;
} else {
tmp = -0.125 * (((M * (M * (D * D))) / d) * Math.sqrt((h / Math.pow(l, 3.0))));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((M * D) / (d * 2.0)), 2.0)))) tmp = 0 if t_0 <= math.inf: tmp = t_0 else: tmp = -0.125 * (((M * (M * (D * D))) / d) * math.sqrt((h / math.pow(l, 3.0)))) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0))))) tmp = 0.0 if (t_0 <= Inf) tmp = t_0; else tmp = Float64(-0.125 * Float64(Float64(Float64(M * Float64(M * Float64(D * D))) / d) * sqrt(Float64(h / (l ^ 3.0))))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((M * D) / (d * 2.0)) ^ 2.0))));
tmp = 0.0;
if (t_0 <= Inf)
tmp = t_0;
else
tmp = -0.125 * (((M * (M * (D * D))) / d) * sqrt((h / (l ^ 3.0))));
end
tmp_2 = tmp;
end
NOTE: M 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[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], t$95$0, N[(-0.125 * N[(N[(N[(M * N[(M * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right)\\
\mathbf{if}\;t_0 \leq \infty:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(\frac{M \cdot \left(M \cdot \left(D \cdot D\right)\right)}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < +inf.0Initial program 83.0%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) Initial program 0.0%
Simplified0.1%
Taylor expanded in d around 0 10.8%
*-commutative10.8%
unpow210.8%
associate-*l*13.1%
unpow213.1%
Simplified13.1%
Final simplification70.2%
NOTE: M 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 1.3e-258)
(*
(* (sqrt (/ d h)) t_0)
(- 1.0 (* 0.5 (pow (* (/ (* (* M D) (sqrt (/ h l))) d) -0.5) 2.0))))
(*
(* t_0 (/ (sqrt d) (sqrt h)))
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D d) (* 0.5 M)) 2.0)) l)))))))M = abs(M);
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 <= 1.3e-258) {
tmp = (sqrt((d / h)) * t_0) * (1.0 - (0.5 * pow(((((M * D) * sqrt((h / l))) / d) * -0.5), 2.0)));
} else {
tmp = (t_0 * (sqrt(d) / sqrt(h))) * (1.0 - (0.5 * ((h * pow(((D / d) * (0.5 * M)), 2.0)) / l)));
}
return tmp;
}
NOTE: M 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((d / l))
if (d <= 1.3d-258) then
tmp = (sqrt((d / h)) * t_0) * (1.0d0 - (0.5d0 * (((((m * d_1) * sqrt((h / l))) / d) * (-0.5d0)) ** 2.0d0)))
else
tmp = (t_0 * (sqrt(d) / sqrt(h))) * (1.0d0 - (0.5d0 * ((h * (((d_1 / d) * (0.5d0 * m)) ** 2.0d0)) / l)))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double tmp;
if (d <= 1.3e-258) {
tmp = (Math.sqrt((d / h)) * t_0) * (1.0 - (0.5 * Math.pow(((((M * D) * Math.sqrt((h / l))) / d) * -0.5), 2.0)));
} else {
tmp = (t_0 * (Math.sqrt(d) / Math.sqrt(h))) * (1.0 - (0.5 * ((h * Math.pow(((D / d) * (0.5 * M)), 2.0)) / l)));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) tmp = 0 if d <= 1.3e-258: tmp = (math.sqrt((d / h)) * t_0) * (1.0 - (0.5 * math.pow(((((M * D) * math.sqrt((h / l))) / d) * -0.5), 2.0))) else: tmp = (t_0 * (math.sqrt(d) / math.sqrt(h))) * (1.0 - (0.5 * ((h * math.pow(((D / d) * (0.5 * M)), 2.0)) / l))) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (d <= 1.3e-258) tmp = Float64(Float64(sqrt(Float64(d / h)) * t_0) * Float64(1.0 - Float64(0.5 * (Float64(Float64(Float64(Float64(M * D) * sqrt(Float64(h / l))) / d) * -0.5) ^ 2.0)))); 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
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / l));
tmp = 0.0;
if (d <= 1.3e-258)
tmp = (sqrt((d / h)) * t_0) * (1.0 - (0.5 * (((((M * D) * sqrt((h / l))) / d) * -0.5) ^ 2.0)));
else
tmp = (t_0 * (sqrt(d) / sqrt(h))) * (1.0 - (0.5 * ((h * (((D / d) * (0.5 * M)) ^ 2.0)) / l)));
end
tmp_2 = tmp;
end
NOTE: M 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, 1.3e-258], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(N[(N[(N[(M * D), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * -0.5), $MachinePrecision], 2.0], $MachinePrecision]), $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|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq 1.3 \cdot 10^{-258}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot t_0\right) \cdot \left(1 - 0.5 \cdot {\left(\frac{\left(M \cdot D\right) \cdot \sqrt{\frac{h}{\ell}}}{d} \cdot -0.5\right)}^{2}\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 < 1.30000000000000009e-258Initial program 59.0%
Simplified58.2%
add-sqr-sqrt58.2%
pow258.2%
*-commutative58.2%
div-inv58.2%
metadata-eval58.2%
Applied egg-rr58.2%
Taylor expanded in M around -inf 62.4%
*-commutative62.4%
associate-*l/62.4%
Simplified62.4%
if 1.30000000000000009e-258 < d Initial program 79.1%
Simplified78.3%
associate-*r/81.0%
div-inv81.0%
metadata-eval81.0%
Applied egg-rr81.0%
sqrt-div87.8%
Applied egg-rr87.8%
Final simplification73.4%
NOTE: M 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)) (sqrt (/ d l)))))
(if (<= D 4.5e-20)
t_0
(if (<= D 2.9e+138)
(*
t_0
(- 1.0 (* 0.5 (* (/ D (/ l D)) (* 0.25 (/ h (/ (* d d) (* M M))))))))
(*
(sqrt (* (/ d h) (/ d l)))
(+
1.0
(* -0.5 (* 0.25 (pow (* (sqrt (/ h l)) (/ (* M D) d)) 2.0)))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h)) * sqrt((d / l));
double tmp;
if (D <= 4.5e-20) {
tmp = t_0;
} else if (D <= 2.9e+138) {
tmp = t_0 * (1.0 - (0.5 * ((D / (l / D)) * (0.25 * (h / ((d * d) / (M * M)))))));
} else {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (0.25 * pow((sqrt((h / l)) * ((M * D) / d)), 2.0))));
}
return tmp;
}
NOTE: M 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((d / h)) * sqrt((d / l))
if (d_1 <= 4.5d-20) then
tmp = t_0
else if (d_1 <= 2.9d+138) then
tmp = t_0 * (1.0d0 - (0.5d0 * ((d_1 / (l / d_1)) * (0.25d0 * (h / ((d * d) / (m * m)))))))
else
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) * (0.25d0 * ((sqrt((h / l)) * ((m * d_1) / d)) ** 2.0d0))))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h)) * Math.sqrt((d / l));
double tmp;
if (D <= 4.5e-20) {
tmp = t_0;
} else if (D <= 2.9e+138) {
tmp = t_0 * (1.0 - (0.5 * ((D / (l / D)) * (0.25 * (h / ((d * d) / (M * M)))))));
} else {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (0.25 * Math.pow((Math.sqrt((h / l)) * ((M * D) / d)), 2.0))));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) * math.sqrt((d / l)) tmp = 0 if D <= 4.5e-20: tmp = t_0 elif D <= 2.9e+138: tmp = t_0 * (1.0 - (0.5 * ((D / (l / D)) * (0.25 * (h / ((d * d) / (M * M))))))) else: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (0.25 * math.pow((math.sqrt((h / l)) * ((M * D) / d)), 2.0)))) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) tmp = 0.0 if (D <= 4.5e-20) tmp = t_0; elseif (D <= 2.9e+138) tmp = Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64(Float64(D / Float64(l / D)) * Float64(0.25 * Float64(h / Float64(Float64(d * d) / Float64(M * M)))))))); else tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(0.25 * (Float64(sqrt(Float64(h / l)) * Float64(Float64(M * D) / d)) ^ 2.0))))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / h)) * sqrt((d / l));
tmp = 0.0;
if (D <= 4.5e-20)
tmp = t_0;
elseif (D <= 2.9e+138)
tmp = t_0 * (1.0 - (0.5 * ((D / (l / D)) * (0.25 * (h / ((d * d) / (M * M)))))));
else
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (0.25 * ((sqrt((h / l)) * ((M * D) / d)) ^ 2.0))));
end
tmp_2 = tmp;
end
NOTE: M 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 / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[D, 4.5e-20], t$95$0, If[LessEqual[D, 2.9e+138], N[(t$95$0 * N[(1.0 - N[(0.5 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(0.25 * N[(h / N[(N[(d * d), $MachinePrecision] / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(0.25 * N[Power[N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;D \leq 4.5 \cdot 10^{-20}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;D \leq 2.9 \cdot 10^{+138}:\\
\;\;\;\;t_0 \cdot \left(1 - 0.5 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \left(0.25 \cdot \frac{h}{\frac{d \cdot d}{M \cdot M}}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot {\left(\sqrt{\frac{h}{\ell}} \cdot \frac{M \cdot D}{d}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if D < 4.5000000000000001e-20Initial program 67.6%
Simplified67.0%
Taylor expanded in M around 0 42.7%
if 4.5000000000000001e-20 < D < 2.9000000000000001e138Initial program 70.8%
Simplified70.8%
Taylor expanded in M around 0 62.3%
*-commutative62.2%
times-frac62.0%
associate-*l*62.0%
unpow262.0%
associate-/l*62.0%
*-commutative62.0%
associate-/l*59.4%
unpow259.4%
unpow259.4%
Simplified59.5%
if 2.9000000000000001e138 < D Initial program 65.6%
Simplified65.6%
add-sqr-sqrt65.6%
pow265.6%
*-commutative65.6%
div-inv65.6%
metadata-eval65.6%
Applied egg-rr65.6%
Taylor expanded in M around -inf 65.7%
*-commutative65.7%
associate-*l/65.7%
Simplified65.7%
pow165.7%
sqrt-unprod57.3%
unpow-prod-down57.3%
associate-/l*57.4%
metadata-eval57.4%
Applied egg-rr57.4%
unpow157.4%
cancel-sign-sub-inv57.4%
metadata-eval57.4%
*-commutative57.4%
associate-/r/57.3%
Simplified57.3%
Final simplification47.0%
NOTE: M 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)) (sqrt (/ d l)))))
(if (<= D 4.5e-20)
t_0
(if (<= D 1.7e+142)
(*
t_0
(- 1.0 (* 0.5 (* (/ D (/ l D)) (* 0.25 (/ h (/ (* d d) (* M M))))))))
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (* -0.125 (pow (* (sqrt (/ h l)) (/ D (/ d M))) 2.0))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h)) * sqrt((d / l));
double tmp;
if (D <= 4.5e-20) {
tmp = t_0;
} else if (D <= 1.7e+142) {
tmp = t_0 * (1.0 - (0.5 * ((D / (l / D)) * (0.25 * (h / ((d * d) / (M * M)))))));
} else {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.125 * pow((sqrt((h / l)) * (D / (d / M))), 2.0)));
}
return tmp;
}
NOTE: M 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((d / h)) * sqrt((d / l))
if (d_1 <= 4.5d-20) then
tmp = t_0
else if (d_1 <= 1.7d+142) then
tmp = t_0 * (1.0d0 - (0.5d0 * ((d_1 / (l / d_1)) * (0.25d0 * (h / ((d * d) / (m * m)))))))
else
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.125d0) * ((sqrt((h / l)) * (d_1 / (d / m))) ** 2.0d0)))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h)) * Math.sqrt((d / l));
double tmp;
if (D <= 4.5e-20) {
tmp = t_0;
} else if (D <= 1.7e+142) {
tmp = t_0 * (1.0 - (0.5 * ((D / (l / D)) * (0.25 * (h / ((d * d) / (M * M)))))));
} else {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.125 * Math.pow((Math.sqrt((h / l)) * (D / (d / M))), 2.0)));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) * math.sqrt((d / l)) tmp = 0 if D <= 4.5e-20: tmp = t_0 elif D <= 1.7e+142: tmp = t_0 * (1.0 - (0.5 * ((D / (l / D)) * (0.25 * (h / ((d * d) / (M * M))))))) else: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.125 * math.pow((math.sqrt((h / l)) * (D / (d / M))), 2.0))) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) tmp = 0.0 if (D <= 4.5e-20) tmp = t_0; elseif (D <= 1.7e+142) tmp = Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64(Float64(D / Float64(l / D)) * Float64(0.25 * Float64(h / Float64(Float64(d * d) / Float64(M * M)))))))); else tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.125 * (Float64(sqrt(Float64(h / l)) * Float64(D / Float64(d / M))) ^ 2.0)))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / h)) * sqrt((d / l));
tmp = 0.0;
if (D <= 4.5e-20)
tmp = t_0;
elseif (D <= 1.7e+142)
tmp = t_0 * (1.0 - (0.5 * ((D / (l / D)) * (0.25 * (h / ((d * d) / (M * M)))))));
else
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.125 * ((sqrt((h / l)) * (D / (d / M))) ^ 2.0)));
end
tmp_2 = tmp;
end
NOTE: M 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 / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[D, 4.5e-20], t$95$0, If[LessEqual[D, 1.7e+142], N[(t$95$0 * N[(1.0 - N[(0.5 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(0.25 * N[(h / N[(N[(d * d), $MachinePrecision] / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.125 * N[Power[N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * N[(D / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;D \leq 4.5 \cdot 10^{-20}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;D \leq 1.7 \cdot 10^{+142}:\\
\;\;\;\;t_0 \cdot \left(1 - 0.5 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \left(0.25 \cdot \frac{h}{\frac{d \cdot d}{M \cdot M}}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.125 \cdot {\left(\sqrt{\frac{h}{\ell}} \cdot \frac{D}{\frac{d}{M}}\right)}^{2}\right)\\
\end{array}
\end{array}
if D < 4.5000000000000001e-20Initial program 67.6%
Simplified67.0%
Taylor expanded in M around 0 42.7%
if 4.5000000000000001e-20 < D < 1.6999999999999999e142Initial program 69.7%
Simplified69.7%
Taylor expanded in M around 0 61.6%
*-commutative61.5%
times-frac61.3%
associate-*l*61.3%
unpow261.3%
associate-/l*61.3%
*-commutative61.3%
associate-/l*58.9%
unpow258.9%
unpow258.9%
Simplified58.9%
if 1.6999999999999999e142 < D Initial program 66.5%
Simplified66.5%
add-sqr-sqrt66.5%
pow266.5%
*-commutative66.5%
div-inv66.5%
metadata-eval66.5%
Applied egg-rr66.5%
Taylor expanded in M around -inf 66.6%
*-commutative66.6%
associate-*l/66.6%
Simplified66.6%
pow166.6%
sqrt-unprod57.7%
unpow-prod-down57.7%
associate-/l*57.8%
metadata-eval57.8%
Applied egg-rr57.8%
unpow157.8%
cancel-sign-sub-inv57.8%
metadata-eval57.8%
*-commutative57.8%
associate-*r*57.8%
metadata-eval57.8%
associate-/r/57.7%
*-commutative57.7%
associate-/l*60.3%
Simplified60.3%
Final simplification47.4%
NOTE: M 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)) (sqrt (/ d l)))))
(if (<= D 1.9e-20)
t_0
(if (<= D 3e+142)
(*
t_0
(- 1.0 (* 0.5 (* (/ D (/ l D)) (* 0.25 (/ h (/ (* d d) (* M M))))))))
(*
(sqrt (* (/ d h) (/ d l)))
(fma (/ h l) (* -0.125 (pow (* D (/ M d)) 2.0)) 1.0))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h)) * sqrt((d / l));
double tmp;
if (D <= 1.9e-20) {
tmp = t_0;
} else if (D <= 3e+142) {
tmp = t_0 * (1.0 - (0.5 * ((D / (l / D)) * (0.25 * (h / ((d * d) / (M * M)))))));
} else {
tmp = sqrt(((d / h) * (d / l))) * fma((h / l), (-0.125 * pow((D * (M / d)), 2.0)), 1.0);
}
return tmp;
}
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) tmp = 0.0 if (D <= 1.9e-20) tmp = t_0; elseif (D <= 3e+142) tmp = Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64(Float64(D / Float64(l / D)) * Float64(0.25 * Float64(h / Float64(Float64(d * d) / Float64(M * M)))))))); else tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * fma(Float64(h / l), Float64(-0.125 * (Float64(D * Float64(M / d)) ^ 2.0)), 1.0)); end return tmp end
NOTE: M 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 / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[D, 1.9e-20], t$95$0, If[LessEqual[D, 3e+142], N[(t$95$0 * N[(1.0 - N[(0.5 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(0.25 * N[(h / N[(N[(d * d), $MachinePrecision] / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * N[(-0.125 * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;D \leq 1.9 \cdot 10^{-20}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;D \leq 3 \cdot 10^{+142}:\\
\;\;\;\;t_0 \cdot \left(1 - 0.5 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \left(0.25 \cdot \frac{h}{\frac{d \cdot d}{M \cdot M}}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, -0.125 \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}, 1\right)\\
\end{array}
\end{array}
if D < 1.8999999999999999e-20Initial program 67.6%
Simplified67.0%
Taylor expanded in M around 0 42.7%
if 1.8999999999999999e-20 < D < 2.99999999999999975e142Initial program 69.7%
Simplified69.7%
Taylor expanded in M around 0 61.6%
*-commutative61.5%
times-frac61.3%
associate-*l*61.3%
unpow261.3%
associate-/l*61.3%
*-commutative61.3%
associate-/l*58.9%
unpow258.9%
unpow258.9%
Simplified58.9%
if 2.99999999999999975e142 < D Initial program 66.5%
Simplified66.5%
Applied egg-rr9.7%
expm1-def11.4%
expm1-log1p57.6%
*-commutative57.6%
Simplified57.6%
Final simplification47.0%
NOTE: M 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 (* (- 1.0 (* 0.5 (* (pow (* (/ M 2.0) (/ D d)) 2.0) (/ h l)))) (* (sqrt (/ d h)) (sqrt (/ d l)))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return (1.0 - (0.5 * (pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) * (sqrt((d / h)) * sqrt((d / l)));
}
NOTE: M 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 = (1.0d0 - (0.5d0 * ((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (h / l)))) * (sqrt((d / h)) * sqrt((d / l)))
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return (1.0 - (0.5 * (Math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) * (Math.sqrt((d / h)) * Math.sqrt((d / l)));
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): return (1.0 - (0.5 * (math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) * (math.sqrt((d / h)) * math.sqrt((d / l)))
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) return 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 / h)) * sqrt(Float64(d / l)))) end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = (1.0 - (0.5 * ((((M / 2.0) * (D / d)) ^ 2.0) * (h / l)))) * (sqrt((d / h)) * sqrt((d / l)));
end
NOTE: M 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[(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 / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\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}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)
\end{array}
Initial program 67.8%
Simplified66.9%
Final simplification66.9%
NOTE: M 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 (* (* (sqrt (/ d h)) (sqrt (/ d l))) (- 1.0 (* 0.5 (/ (* h (pow (* (/ D d) (* 0.5 M)) 2.0)) l)))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.5 * ((h * pow(((D / d) * (0.5 * M)), 2.0)) / l)));
}
NOTE: M 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 = (sqrt((d / h)) * sqrt((d / l))) * (1.0d0 - (0.5d0 * ((h * (((d_1 / d) * (0.5d0 * m)) ** 2.0d0)) / l)))
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - (0.5 * ((h * Math.pow(((D / d) * (0.5 * M)), 2.0)) / l)));
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): return (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - (0.5 * ((h * math.pow(((D / d) * (0.5 * M)), 2.0)) / l)))
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D / d) * Float64(0.5 * M)) ^ 2.0)) / l)))) end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.5 * ((h * (((D / d) * (0.5 * M)) ^ 2.0)) / l)));
end
NOTE: M 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[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $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|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\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}
Initial program 67.8%
Simplified66.9%
associate-*r/69.4%
div-inv69.4%
metadata-eval69.4%
Applied egg-rr69.4%
Final simplification69.4%
NOTE: M 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)) (sqrt (/ d l)))))
(if (<= D 3e-16)
t_0
(if (<= D 1.65e+142)
(*
t_0
(- 1.0 (* 0.5 (* (/ D (/ l D)) (* 0.25 (/ h (/ (* d d) (* M M))))))))
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (* -0.5 (* (/ h l) (pow (* M (* 0.5 (/ D d))) 2.0)))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h)) * sqrt((d / l));
double tmp;
if (D <= 3e-16) {
tmp = t_0;
} else if (D <= 1.65e+142) {
tmp = t_0 * (1.0 - (0.5 * ((D / (l / D)) * (0.25 * (h / ((d * d) / (M * M)))))));
} else {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
NOTE: M 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((d / h)) * sqrt((d / l))
if (d_1 <= 3d-16) then
tmp = t_0
else if (d_1 <= 1.65d+142) then
tmp = t_0 * (1.0d0 - (0.5d0 * ((d_1 / (l / d_1)) * (0.25d0 * (h / ((d * d) / (m * m)))))))
else
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) * ((h / l) * ((m * (0.5d0 * (d_1 / d))) ** 2.0d0))))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h)) * Math.sqrt((d / l));
double tmp;
if (D <= 3e-16) {
tmp = t_0;
} else if (D <= 1.65e+142) {
tmp = t_0 * (1.0 - (0.5 * ((D / (l / D)) * (0.25 * (h / ((d * d) / (M * M)))))));
} else {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * Math.pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) * math.sqrt((d / l)) tmp = 0 if D <= 3e-16: tmp = t_0 elif D <= 1.65e+142: tmp = t_0 * (1.0 - (0.5 * ((D / (l / D)) * (0.25 * (h / ((d * d) / (M * M))))))) else: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * math.pow((M * (0.5 * (D / d))), 2.0)))) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) tmp = 0.0 if (D <= 3e-16) tmp = t_0; elseif (D <= 1.65e+142) tmp = Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64(Float64(D / Float64(l / D)) * Float64(0.25 * Float64(h / Float64(Float64(d * d) / Float64(M * M)))))))); else tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0))))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / h)) * sqrt((d / l));
tmp = 0.0;
if (D <= 3e-16)
tmp = t_0;
elseif (D <= 1.65e+142)
tmp = t_0 * (1.0 - (0.5 * ((D / (l / D)) * (0.25 * (h / ((d * d) / (M * M)))))));
else
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * ((M * (0.5 * (D / d))) ^ 2.0))));
end
tmp_2 = tmp;
end
NOTE: M 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 / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[D, 3e-16], t$95$0, If[LessEqual[D, 1.65e+142], N[(t$95$0 * N[(1.0 - N[(0.5 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(0.25 * N[(h / N[(N[(d * d), $MachinePrecision] / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;D \leq 3 \cdot 10^{-16}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;D \leq 1.65 \cdot 10^{+142}:\\
\;\;\;\;t_0 \cdot \left(1 - 0.5 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \left(0.25 \cdot \frac{h}{\frac{d \cdot d}{M \cdot M}}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if D < 2.99999999999999994e-16Initial program 67.6%
Simplified67.0%
Taylor expanded in M around 0 42.7%
if 2.99999999999999994e-16 < D < 1.6500000000000001e142Initial program 69.7%
Simplified69.7%
Taylor expanded in M around 0 61.6%
*-commutative61.5%
times-frac61.3%
associate-*l*61.3%
unpow261.3%
associate-/l*61.3%
*-commutative61.3%
associate-/l*58.9%
unpow258.9%
unpow258.9%
Simplified58.9%
if 1.6500000000000001e142 < D Initial program 66.5%
Simplified66.5%
Applied egg-rr9.7%
expm1-def11.4%
expm1-log1p57.6%
*-commutative57.6%
associate-*l*57.6%
Simplified57.6%
Final simplification47.0%
NOTE: M 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))) (t_1 (sqrt (/ d l))))
(if (<= M 2e-213)
(* t_0 t_1)
(if (<= M 1.5e-15)
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (* -0.5 (* (/ h l) (pow (* M (* 0.5 (/ D d))) 2.0)))))
(*
t_1
(* t_0 (* -0.125 (* (* (* M (/ M d)) (/ h d)) (* D (/ D l))))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double t_1 = sqrt((d / l));
double tmp;
if (M <= 2e-213) {
tmp = t_0 * t_1;
} else if (M <= 1.5e-15) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * pow((M * (0.5 * (D / d))), 2.0))));
} else {
tmp = t_1 * (t_0 * (-0.125 * (((M * (M / d)) * (h / d)) * (D * (D / l)))));
}
return tmp;
}
NOTE: M 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 / h))
t_1 = sqrt((d / l))
if (m <= 2d-213) then
tmp = t_0 * t_1
else if (m <= 1.5d-15) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) * ((h / l) * ((m * (0.5d0 * (d_1 / d))) ** 2.0d0))))
else
tmp = t_1 * (t_0 * ((-0.125d0) * (((m * (m / d)) * (h / d)) * (d_1 * (d_1 / l)))))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h));
double t_1 = Math.sqrt((d / l));
double tmp;
if (M <= 2e-213) {
tmp = t_0 * t_1;
} else if (M <= 1.5e-15) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * Math.pow((M * (0.5 * (D / d))), 2.0))));
} else {
tmp = t_1 * (t_0 * (-0.125 * (((M * (M / d)) * (h / d)) * (D * (D / l)))));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) t_1 = math.sqrt((d / l)) tmp = 0 if M <= 2e-213: tmp = t_0 * t_1 elif M <= 1.5e-15: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * math.pow((M * (0.5 * (D / d))), 2.0)))) else: tmp = t_1 * (t_0 * (-0.125 * (((M * (M / d)) * (h / d)) * (D * (D / l))))) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (M <= 2e-213) tmp = Float64(t_0 * t_1); elseif (M <= 1.5e-15) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0))))); else tmp = Float64(t_1 * Float64(t_0 * Float64(-0.125 * Float64(Float64(Float64(M * Float64(M / d)) * Float64(h / d)) * Float64(D * Float64(D / l)))))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / h));
t_1 = sqrt((d / l));
tmp = 0.0;
if (M <= 2e-213)
tmp = t_0 * t_1;
elseif (M <= 1.5e-15)
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * ((M * (0.5 * (D / d))) ^ 2.0))));
else
tmp = t_1 * (t_0 * (-0.125 * (((M * (M / d)) * (h / d)) * (D * (D / l)))));
end
tmp_2 = tmp;
end
NOTE: M 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]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[M, 2e-213], N[(t$95$0 * t$95$1), $MachinePrecision], If[LessEqual[M, 1.5e-15], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(t$95$0 * N[(-0.125 * N[(N[(N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision] * N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;M \leq 2 \cdot 10^{-213}:\\
\;\;\;\;t_0 \cdot t_1\\
\mathbf{elif}\;M \leq 1.5 \cdot 10^{-15}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(t_0 \cdot \left(-0.125 \cdot \left(\left(\left(M \cdot \frac{M}{d}\right) \cdot \frac{h}{d}\right) \cdot \left(D \cdot \frac{D}{\ell}\right)\right)\right)\right)\\
\end{array}
\end{array}
if M < 1.9999999999999999e-213Initial program 74.0%
Simplified73.2%
Taylor expanded in M around 0 41.3%
if 1.9999999999999999e-213 < M < 1.5e-15Initial program 57.5%
Simplified57.6%
Applied egg-rr18.8%
expm1-def28.7%
expm1-log1p43.4%
*-commutative43.4%
associate-*l*43.4%
Simplified43.4%
if 1.5e-15 < M Initial program 60.6%
Simplified60.7%
Taylor expanded in M around inf 22.4%
*-commutative22.4%
times-frac24.0%
unpow224.0%
unpow224.0%
unpow224.0%
Simplified24.0%
Taylor expanded in D around 0 22.4%
unpow222.4%
*-commutative22.4%
*-commutative22.4%
unpow222.4%
times-frac24.0%
unpow224.0%
*-commutative24.0%
times-frac29.9%
unpow229.9%
associate-/l*31.3%
associate-/r/31.4%
unpow231.4%
associate-*l/35.7%
*-commutative35.7%
Simplified35.7%
Final simplification40.2%
NOTE: M 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 3.2e-213)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (* -0.5 (* (/ h l) (pow (* M (* 0.5 (/ D d))) 2.0)))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (M <= 3.2e-213) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
NOTE: M 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 <= 3.2d-213) then
tmp = sqrt((d / h)) * sqrt((d / l))
else
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) * ((h / l) * ((m * (0.5d0 * (d_1 / d))) ** 2.0d0))))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (M <= 3.2e-213) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * Math.pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if M <= 3.2e-213: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) else: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * math.pow((M * (0.5 * (D / d))), 2.0)))) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (M <= 3.2e-213) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0))))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (M <= 3.2e-213)
tmp = sqrt((d / h)) * sqrt((d / l));
else
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * ((M * (0.5 * (D / d))) ^ 2.0))));
end
tmp_2 = tmp;
end
NOTE: M 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, 3.2e-213], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 3.2 \cdot 10^{-213}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if M < 3.19999999999999972e-213Initial program 74.0%
Simplified73.2%
Taylor expanded in M around 0 41.3%
if 3.19999999999999972e-213 < M Initial program 59.4%
Simplified59.4%
Applied egg-rr15.2%
expm1-def21.3%
expm1-log1p45.5%
*-commutative45.5%
associate-*l*45.5%
Simplified45.5%
Final simplification43.1%
NOTE: M 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) (/ d l)))
(+
1.0
(* -0.5 (* (* D (/ D l)) (* 0.25 (/ (* h (* M M)) (* d d)))))))))
(if (<= d -1.02e-143)
t_0
(if (<= d 6.5e-163)
(* d (/ 1.0 (sqrt (* l h))))
(if (<= d 5.5e-16) t_0 (* d (/ (sqrt (/ 1.0 l)) (sqrt h))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((D * (D / l)) * (0.25 * ((h * (M * M)) / (d * d))))));
double tmp;
if (d <= -1.02e-143) {
tmp = t_0;
} else if (d <= 6.5e-163) {
tmp = d * (1.0 / sqrt((l * h)));
} else if (d <= 5.5e-16) {
tmp = t_0;
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
NOTE: M 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(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) * ((d_1 * (d_1 / l)) * (0.25d0 * ((h * (m * m)) / (d * d))))))
if (d <= (-1.02d-143)) then
tmp = t_0
else if (d <= 6.5d-163) then
tmp = d * (1.0d0 / sqrt((l * h)))
else if (d <= 5.5d-16) then
tmp = t_0
else
tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((D * (D / l)) * (0.25 * ((h * (M * M)) / (d * d))))));
double tmp;
if (d <= -1.02e-143) {
tmp = t_0;
} else if (d <= 6.5e-163) {
tmp = d * (1.0 / Math.sqrt((l * h)));
} else if (d <= 5.5e-16) {
tmp = t_0;
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((D * (D / l)) * (0.25 * ((h * (M * M)) / (d * d)))))) tmp = 0 if d <= -1.02e-143: tmp = t_0 elif d <= 6.5e-163: tmp = d * (1.0 / math.sqrt((l * h))) elif d <= 5.5e-16: tmp = t_0 else: tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(D * Float64(D / l)) * Float64(0.25 * Float64(Float64(h * Float64(M * M)) / Float64(d * d))))))) tmp = 0.0 if (d <= -1.02e-143) tmp = t_0; elseif (d <= 6.5e-163) tmp = Float64(d * Float64(1.0 / sqrt(Float64(l * h)))); elseif (d <= 5.5e-16) tmp = t_0; else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((D * (D / l)) * (0.25 * ((h * (M * M)) / (d * d))))));
tmp = 0.0;
if (d <= -1.02e-143)
tmp = t_0;
elseif (d <= 6.5e-163)
tmp = d * (1.0 / sqrt((l * h)));
elseif (d <= 5.5e-16)
tmp = t_0;
else
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M 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 / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(0.25 * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.02e-143], t$95$0, If[LessEqual[d, 6.5e-163], N[(d * N[(1.0 / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.5e-16], t$95$0, N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \left(0.25 \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)\right)\\
\mathbf{if}\;d \leq -1.02 \cdot 10^{-143}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 6.5 \cdot 10^{-163}:\\
\;\;\;\;d \cdot \frac{1}{\sqrt{\ell \cdot h}}\\
\mathbf{elif}\;d \leq 5.5 \cdot 10^{-16}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -1.02e-143 or 6.4999999999999999e-163 < d < 5.49999999999999964e-16Initial program 72.2%
Simplified71.5%
pow1/271.5%
sqr-pow71.4%
pow271.4%
metadata-eval71.4%
Applied egg-rr71.4%
Taylor expanded in M around 0 48.9%
*-commutative48.9%
times-frac48.1%
associate-*l*48.1%
unpow248.1%
associate-/l*49.8%
*-commutative49.8%
associate-/l*50.0%
unpow250.0%
unpow250.0%
Simplified50.0%
pow150.0%
Applied egg-rr43.7%
unpow143.7%
*-commutative43.7%
unpow243.7%
associate-*l/42.3%
unpow242.3%
Simplified42.3%
if -1.02e-143 < d < 6.4999999999999999e-163Initial program 40.8%
Simplified40.5%
Taylor expanded in d around inf 13.3%
sqrt-div13.3%
metadata-eval13.3%
*-commutative13.3%
Applied egg-rr13.3%
if 5.49999999999999964e-16 < d Initial program 88.0%
Simplified86.3%
Taylor expanded in d around inf 61.8%
*-commutative61.8%
associate-/r*61.8%
Simplified61.8%
sqrt-div71.7%
Applied egg-rr71.7%
Final simplification41.5%
NOTE: M 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) (/ d l)))
(+
1.0
(* -0.5 (* (* D (/ D l)) (* 0.25 (/ (* h (* M M)) (* d d)))))))))
(if (<= d -1.02e-143)
t_0
(if (<= d 1.45e-162)
(* d (cbrt (pow (/ (/ 1.0 h) l) 1.5)))
(if (<= d 2.4e-15) t_0 (* d (/ (sqrt (/ 1.0 l)) (sqrt h))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((D * (D / l)) * (0.25 * ((h * (M * M)) / (d * d))))));
double tmp;
if (d <= -1.02e-143) {
tmp = t_0;
} else if (d <= 1.45e-162) {
tmp = d * cbrt(pow(((1.0 / h) / l), 1.5));
} else if (d <= 2.4e-15) {
tmp = t_0;
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((D * (D / l)) * (0.25 * ((h * (M * M)) / (d * d))))));
double tmp;
if (d <= -1.02e-143) {
tmp = t_0;
} else if (d <= 1.45e-162) {
tmp = d * Math.cbrt(Math.pow(((1.0 / h) / l), 1.5));
} else if (d <= 2.4e-15) {
tmp = t_0;
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
return tmp;
}
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(D * Float64(D / l)) * Float64(0.25 * Float64(Float64(h * Float64(M * M)) / Float64(d * d))))))) tmp = 0.0 if (d <= -1.02e-143) tmp = t_0; elseif (d <= 1.45e-162) tmp = Float64(d * cbrt((Float64(Float64(1.0 / h) / l) ^ 1.5))); elseif (d <= 2.4e-15) tmp = t_0; else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
NOTE: M 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 / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(0.25 * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.02e-143], t$95$0, If[LessEqual[d, 1.45e-162], N[(d * N[Power[N[Power[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.4e-15], t$95$0, N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \left(0.25 \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)\right)\\
\mathbf{if}\;d \leq -1.02 \cdot 10^{-143}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 1.45 \cdot 10^{-162}:\\
\;\;\;\;d \cdot \sqrt[3]{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{1.5}}\\
\mathbf{elif}\;d \leq 2.4 \cdot 10^{-15}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -1.02e-143 or 1.4500000000000001e-162 < d < 2.39999999999999995e-15Initial program 72.2%
Simplified71.5%
pow1/271.5%
sqr-pow71.4%
pow271.4%
metadata-eval71.4%
Applied egg-rr71.4%
Taylor expanded in M around 0 48.9%
*-commutative48.9%
times-frac48.1%
associate-*l*48.1%
unpow248.1%
associate-/l*49.8%
*-commutative49.8%
associate-/l*50.0%
unpow250.0%
unpow250.0%
Simplified50.0%
pow150.0%
Applied egg-rr43.7%
unpow143.7%
*-commutative43.7%
unpow243.7%
associate-*l/42.3%
unpow242.3%
Simplified42.3%
if -1.02e-143 < d < 1.4500000000000001e-162Initial program 40.8%
Simplified40.5%
Taylor expanded in d around inf 13.3%
*-commutative13.3%
associate-/r*13.3%
Simplified13.3%
expm1-log1p-u13.0%
expm1-udef11.8%
associate-/l/11.8%
Applied egg-rr11.8%
add-cbrt-cube16.4%
add-sqr-sqrt16.4%
expm1-def16.4%
expm1-log1p-u16.4%
associate-/l/16.4%
expm1-def17.6%
expm1-log1p-u17.8%
associate-/l/17.8%
Applied egg-rr17.8%
*-commutative17.8%
unpow1/217.8%
pow-plus17.8%
associate-/r*17.8%
associate-/l/17.7%
metadata-eval17.7%
Simplified17.7%
if 2.39999999999999995e-15 < d Initial program 88.0%
Simplified86.3%
Taylor expanded in d around inf 61.8%
*-commutative61.8%
associate-/r*61.8%
Simplified61.8%
sqrt-div71.7%
Applied egg-rr71.7%
Final simplification42.6%
NOTE: M 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.2e-67)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (* -0.5 (* (* D (/ D l)) (* 0.25 (/ (* h (* M M)) (* d d)))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (M <= 9.2e-67) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((D * (D / l)) * (0.25 * ((h * (M * M)) / (d * d))))));
}
return tmp;
}
NOTE: M 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.2d-67) then
tmp = sqrt((d / h)) * sqrt((d / l))
else
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) * ((d_1 * (d_1 / l)) * (0.25d0 * ((h * (m * m)) / (d * d))))))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (M <= 9.2e-67) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((D * (D / l)) * (0.25 * ((h * (M * M)) / (d * d))))));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if M <= 9.2e-67: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) else: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((D * (D / l)) * (0.25 * ((h * (M * M)) / (d * d)))))) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (M <= 9.2e-67) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(D * Float64(D / l)) * Float64(0.25 * Float64(Float64(h * Float64(M * M)) / Float64(d * d))))))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (M <= 9.2e-67)
tmp = sqrt((d / h)) * sqrt((d / l));
else
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((D * (D / l)) * (0.25 * ((h * (M * M)) / (d * d))))));
end
tmp_2 = tmp;
end
NOTE: M 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.2e-67], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(0.25 * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 9.2 \cdot 10^{-67}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \left(0.25 \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)\right)\\
\end{array}
\end{array}
if M < 9.2000000000000002e-67Initial program 70.8%
Simplified70.1%
Taylor expanded in M around 0 42.3%
if 9.2000000000000002e-67 < M Initial program 61.4%
Simplified61.4%
pow1/261.4%
sqr-pow61.3%
pow261.3%
metadata-eval61.3%
Applied egg-rr61.3%
Taylor expanded in M around 0 30.9%
*-commutative30.9%
times-frac32.3%
associate-*l*32.3%
unpow232.3%
associate-/l*36.0%
*-commutative36.0%
associate-/l*37.1%
unpow237.1%
unpow237.1%
Simplified37.1%
pow137.1%
Applied egg-rr30.1%
unpow130.1%
*-commutative30.1%
unpow230.1%
associate-*l/26.2%
unpow226.2%
Simplified26.2%
Final simplification37.2%
NOTE: M 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) (/ d l)))
(+
1.0
(* -0.5 (* (* D (/ D l)) (* 0.25 (/ (* h (* M M)) (* d d)))))))))
(if (<= d -1.02e-143)
t_0
(if (<= d 5.7e-152)
(* d (/ 1.0 (sqrt (* l h))))
(if (<= d 7e+131) t_0 (* d (sqrt (/ 1.0 (* l h)))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((D * (D / l)) * (0.25 * ((h * (M * M)) / (d * d))))));
double tmp;
if (d <= -1.02e-143) {
tmp = t_0;
} else if (d <= 5.7e-152) {
tmp = d * (1.0 / sqrt((l * h)));
} else if (d <= 7e+131) {
tmp = t_0;
} else {
tmp = d * sqrt((1.0 / (l * h)));
}
return tmp;
}
NOTE: M 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(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) * ((d_1 * (d_1 / l)) * (0.25d0 * ((h * (m * m)) / (d * d))))))
if (d <= (-1.02d-143)) then
tmp = t_0
else if (d <= 5.7d-152) then
tmp = d * (1.0d0 / sqrt((l * h)))
else if (d <= 7d+131) then
tmp = t_0
else
tmp = d * sqrt((1.0d0 / (l * h)))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((D * (D / l)) * (0.25 * ((h * (M * M)) / (d * d))))));
double tmp;
if (d <= -1.02e-143) {
tmp = t_0;
} else if (d <= 5.7e-152) {
tmp = d * (1.0 / Math.sqrt((l * h)));
} else if (d <= 7e+131) {
tmp = t_0;
} else {
tmp = d * Math.sqrt((1.0 / (l * h)));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((D * (D / l)) * (0.25 * ((h * (M * M)) / (d * d)))))) tmp = 0 if d <= -1.02e-143: tmp = t_0 elif d <= 5.7e-152: tmp = d * (1.0 / math.sqrt((l * h))) elif d <= 7e+131: tmp = t_0 else: tmp = d * math.sqrt((1.0 / (l * h))) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(D * Float64(D / l)) * Float64(0.25 * Float64(Float64(h * Float64(M * M)) / Float64(d * d))))))) tmp = 0.0 if (d <= -1.02e-143) tmp = t_0; elseif (d <= 5.7e-152) tmp = Float64(d * Float64(1.0 / sqrt(Float64(l * h)))); elseif (d <= 7e+131) tmp = t_0; else tmp = Float64(d * sqrt(Float64(1.0 / Float64(l * h)))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((D * (D / l)) * (0.25 * ((h * (M * M)) / (d * d))))));
tmp = 0.0;
if (d <= -1.02e-143)
tmp = t_0;
elseif (d <= 5.7e-152)
tmp = d * (1.0 / sqrt((l * h)));
elseif (d <= 7e+131)
tmp = t_0;
else
tmp = d * sqrt((1.0 / (l * h)));
end
tmp_2 = tmp;
end
NOTE: M 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 / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(0.25 * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.02e-143], t$95$0, If[LessEqual[d, 5.7e-152], N[(d * N[(1.0 / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7e+131], t$95$0, N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \left(0.25 \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)\right)\\
\mathbf{if}\;d \leq -1.02 \cdot 10^{-143}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 5.7 \cdot 10^{-152}:\\
\;\;\;\;d \cdot \frac{1}{\sqrt{\ell \cdot h}}\\
\mathbf{elif}\;d \leq 7 \cdot 10^{+131}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\end{array}
\end{array}
if d < -1.02e-143 or 5.7000000000000004e-152 < d < 6.9999999999999998e131Initial program 74.8%
Simplified74.2%
pow1/274.2%
sqr-pow74.1%
pow274.1%
metadata-eval74.1%
Applied egg-rr74.1%
Taylor expanded in M around 0 51.2%
*-commutative51.2%
times-frac51.2%
associate-*l*51.2%
unpow251.2%
associate-/l*53.8%
*-commutative53.8%
associate-/l*54.5%
unpow254.5%
unpow254.5%
Simplified54.5%
pow154.5%
Applied egg-rr49.0%
unpow149.0%
*-commutative49.0%
unpow249.0%
associate-*l/46.7%
unpow246.7%
Simplified46.7%
if -1.02e-143 < d < 5.7000000000000004e-152Initial program 40.8%
Simplified40.5%
Taylor expanded in d around inf 13.3%
sqrt-div13.3%
metadata-eval13.3%
*-commutative13.3%
Applied egg-rr13.3%
if 6.9999999999999998e131 < d Initial program 91.8%
Simplified87.6%
Taylor expanded in d around inf 71.1%
Final simplification40.5%
NOTE: M 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 l) h)) (t_1 (+ 1.0 t_0)))
(if (<= h -1.02e-91)
(* d (sqrt (/ (+ -1.0 (* t_1 t_1)) (+ 1.0 t_1))))
(* d (sqrt t_0)))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (1.0 / l) / h;
double t_1 = 1.0 + t_0;
double tmp;
if (h <= -1.02e-91) {
tmp = d * sqrt(((-1.0 + (t_1 * t_1)) / (1.0 + t_1)));
} else {
tmp = d * sqrt(t_0);
}
return tmp;
}
NOTE: M 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 = (1.0d0 / l) / h
t_1 = 1.0d0 + t_0
if (h <= (-1.02d-91)) then
tmp = d * sqrt((((-1.0d0) + (t_1 * t_1)) / (1.0d0 + t_1)))
else
tmp = d * sqrt(t_0)
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (1.0 / l) / h;
double t_1 = 1.0 + t_0;
double tmp;
if (h <= -1.02e-91) {
tmp = d * Math.sqrt(((-1.0 + (t_1 * t_1)) / (1.0 + t_1)));
} else {
tmp = d * Math.sqrt(t_0);
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = (1.0 / l) / h t_1 = 1.0 + t_0 tmp = 0 if h <= -1.02e-91: tmp = d * math.sqrt(((-1.0 + (t_1 * t_1)) / (1.0 + t_1))) else: tmp = d * math.sqrt(t_0) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(1.0 / l) / h) t_1 = Float64(1.0 + t_0) tmp = 0.0 if (h <= -1.02e-91) tmp = Float64(d * sqrt(Float64(Float64(-1.0 + Float64(t_1 * t_1)) / Float64(1.0 + t_1)))); else tmp = Float64(d * sqrt(t_0)); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (1.0 / l) / h;
t_1 = 1.0 + t_0;
tmp = 0.0;
if (h <= -1.02e-91)
tmp = d * sqrt(((-1.0 + (t_1 * t_1)) / (1.0 + t_1)));
else
tmp = d * sqrt(t_0);
end
tmp_2 = tmp;
end
NOTE: M 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 / l), $MachinePrecision] / h), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + t$95$0), $MachinePrecision]}, If[LessEqual[h, -1.02e-91], N[(d * N[Sqrt[N[(N[(-1.0 + N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \frac{\frac{1}{\ell}}{h}\\
t_1 := 1 + t_0\\
\mathbf{if}\;h \leq -1.02 \cdot 10^{-91}:\\
\;\;\;\;d \cdot \sqrt{\frac{-1 + t_1 \cdot t_1}{1 + t_1}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{t_0}\\
\end{array}
\end{array}
if h < -1.01999999999999994e-91Initial program 65.5%
Simplified64.4%
Taylor expanded in d around inf 3.8%
*-commutative3.8%
associate-/r*3.7%
Simplified3.7%
expm1-log1p-u3.7%
expm1-udef3.8%
associate-/l/3.8%
Applied egg-rr3.8%
flip--9.0%
log1p-udef9.0%
add-exp-log9.0%
associate-/l/9.0%
log1p-udef9.0%
add-exp-log9.0%
associate-/l/9.0%
metadata-eval9.0%
log1p-udef9.0%
add-exp-log9.0%
associate-/l/9.0%
Applied egg-rr9.0%
if -1.01999999999999994e-91 < h Initial program 69.1%
Simplified68.3%
Taylor expanded in d around inf 33.2%
*-commutative33.2%
associate-/r*33.2%
Simplified33.2%
Final simplification24.3%
NOTE: M 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 (/ 1.0 (* l h)))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * sqrt((1.0 / (l * h)));
}
NOTE: M 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((1.0d0 / (l * h)))
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d * Math.sqrt((1.0 / (l * h)));
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.sqrt((1.0 / (l * h)))
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * sqrt((1.0 / (l * h)));
end
NOTE: M 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[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot \sqrt{\frac{1}{\ell \cdot h}}
\end{array}
Initial program 67.8%
Simplified66.9%
Taylor expanded in d around inf 22.4%
Final simplification22.4%
NOTE: M 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 (pow (* l h) -0.5)))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * pow((l * h), -0.5);
}
NOTE: M 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 * ((l * h) ** (-0.5d0))
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d * Math.pow((l * h), -0.5);
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.pow((l * h), -0.5)
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * (Float64(l * h) ^ -0.5)) end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * ((l * h) ^ -0.5);
end
NOTE: M 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[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot {\left(\ell \cdot h\right)}^{-0.5}
\end{array}
Initial program 67.8%
Simplified66.9%
Taylor expanded in d around inf 22.4%
*-un-lft-identity22.4%
*-commutative22.4%
Applied egg-rr22.4%
*-lft-identity22.4%
unpow-122.4%
sqr-pow22.4%
rem-sqrt-square22.4%
metadata-eval22.4%
sqr-pow22.4%
fabs-sqr22.4%
sqr-pow22.4%
Simplified22.4%
Final simplification22.4%
NOTE: M 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 0.0)))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * sqrt(0.0);
}
NOTE: M 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(0.0d0)
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d * Math.sqrt(0.0);
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.sqrt(0.0)
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * sqrt(0.0)) end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * sqrt(0.0);
end
NOTE: M 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[0.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot \sqrt{0}
\end{array}
Initial program 67.8%
Simplified66.9%
Taylor expanded in d around inf 22.4%
*-commutative22.4%
associate-/r*22.4%
Simplified22.4%
expm1-log1p-u22.0%
expm1-udef15.5%
associate-/l/15.5%
Applied egg-rr15.5%
Taylor expanded in h around inf 2.9%
Final simplification2.9%
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)))))