
(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 31 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 (pow (* (/ M 2.0) (/ D d)) 2.0)))
(if (<= d -1.35e-64)
(*
(*
(sqrt (/ d h))
(pow (* (pow (/ -1.0 l) 0.25) (pow (/ -1.0 d) -0.25)) 2.0))
(- 1.0 (* t_0 (* 0.5 (/ h l)))))
(if (<= d -5e-310)
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ -1.0 (* (* D (/ D l)) (* (* (/ M (/ d M)) (/ h d)) 0.125))))
(*
(/ (sqrt d) (sqrt h))
(* (/ (sqrt d) (sqrt l)) (- 1.0 (* 0.5 (* t_0 (/ h l))))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow(((M / 2.0) * (D / d)), 2.0);
double tmp;
if (d <= -1.35e-64) {
tmp = (sqrt((d / h)) * pow((pow((-1.0 / l), 0.25) * pow((-1.0 / d), -0.25)), 2.0)) * (1.0 - (t_0 * (0.5 * (h / l))));
} else if (d <= -5e-310) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125)));
} else {
tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * (t_0 * (h / 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 = ((m / 2.0d0) * (d_1 / d)) ** 2.0d0
if (d <= (-1.35d-64)) then
tmp = (sqrt((d / h)) * (((((-1.0d0) / l) ** 0.25d0) * (((-1.0d0) / d) ** (-0.25d0))) ** 2.0d0)) * (1.0d0 - (t_0 * (0.5d0 * (h / l))))
else if (d <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + ((d_1 * (d_1 / l)) * (((m / (d / m)) * (h / d)) * 0.125d0)))
else
tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) / sqrt(l)) * (1.0d0 - (0.5d0 * (t_0 * (h / 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.pow(((M / 2.0) * (D / d)), 2.0);
double tmp;
if (d <= -1.35e-64) {
tmp = (Math.sqrt((d / h)) * Math.pow((Math.pow((-1.0 / l), 0.25) * Math.pow((-1.0 / d), -0.25)), 2.0)) * (1.0 - (t_0 * (0.5 * (h / l))));
} else if (d <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125)));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * ((Math.sqrt(d) / Math.sqrt(l)) * (1.0 - (0.5 * (t_0 * (h / l)))));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.pow(((M / 2.0) * (D / d)), 2.0) tmp = 0 if d <= -1.35e-64: tmp = (math.sqrt((d / h)) * math.pow((math.pow((-1.0 / l), 0.25) * math.pow((-1.0 / d), -0.25)), 2.0)) * (1.0 - (t_0 * (0.5 * (h / l)))) elif d <= -5e-310: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * ((math.sqrt(d) / math.sqrt(l)) * (1.0 - (0.5 * (t_0 * (h / l))))) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0 tmp = 0.0 if (d <= -1.35e-64) tmp = Float64(Float64(sqrt(Float64(d / h)) * (Float64((Float64(-1.0 / l) ^ 0.25) * (Float64(-1.0 / d) ^ -0.25)) ^ 2.0)) * Float64(1.0 - Float64(t_0 * Float64(0.5 * Float64(h / l))))); elseif (d <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + Float64(Float64(D * Float64(D / l)) * Float64(Float64(Float64(M / Float64(d / M)) * Float64(h / d)) * 0.125)))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(Float64(sqrt(d) / sqrt(l)) * Float64(1.0 - Float64(0.5 * Float64(t_0 * Float64(h / 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 = ((M / 2.0) * (D / d)) ^ 2.0;
tmp = 0.0;
if (d <= -1.35e-64)
tmp = (sqrt((d / h)) * ((((-1.0 / l) ^ 0.25) * ((-1.0 / d) ^ -0.25)) ^ 2.0)) * (1.0 - (t_0 * (0.5 * (h / l))));
elseif (d <= -5e-310)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125)));
else
tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * (t_0 * (h / 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[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[d, -1.35e-64], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Power[N[(N[Power[N[(-1.0 / l), $MachinePrecision], 0.25], $MachinePrecision] * N[Power[N[(-1.0 / d), $MachinePrecision], -0.25], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(t$95$0 * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(t$95$0 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\\
\mathbf{if}\;d \leq -1.35 \cdot 10^{-64}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot {\left({\left(\frac{-1}{\ell}\right)}^{0.25} \cdot {\left(\frac{-1}{d}\right)}^{-0.25}\right)}^{2}\right) \cdot \left(1 - t_0 \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + \left(D \cdot \frac{D}{\ell}\right) \cdot \left(\left(\frac{M}{\frac{d}{M}} \cdot \frac{h}{d}\right) \cdot 0.125\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(1 - 0.5 \cdot \left(t_0 \cdot \frac{h}{\ell}\right)\right)\right)\\
\end{array}
\end{array}
if d < -1.34999999999999993e-64Initial program 80.9%
metadata-eval80.9%
unpow1/280.9%
metadata-eval80.9%
unpow1/280.9%
*-commutative80.9%
associate-*l*80.9%
times-frac80.9%
metadata-eval80.9%
Simplified80.9%
pow1/280.9%
sqr-pow80.9%
pow280.9%
metadata-eval80.9%
Applied egg-rr80.9%
Taylor expanded in d around -inf 81.7%
distribute-lft-in81.7%
exp-sum82.0%
*-commutative82.0%
exp-to-pow83.0%
*-commutative83.0%
*-commutative83.0%
associate-*l*83.0%
metadata-eval83.0%
metadata-eval83.0%
metadata-eval83.0%
exp-to-pow85.3%
metadata-eval85.3%
metadata-eval85.3%
Simplified85.3%
if -1.34999999999999993e-64 < d < -4.999999999999985e-310Initial program 53.6%
Applied egg-rr7.2%
expm1-def13.6%
expm1-log1p49.3%
*-commutative49.3%
*-commutative49.3%
associate-/l*49.3%
Simplified49.3%
Taylor expanded in d around -inf 78.1%
mul-1-neg78.1%
associate-/r*78.1%
distribute-rgt-neg-in78.1%
associate-/l/78.1%
Simplified78.1%
Taylor expanded in M around 0 53.7%
*-commutative53.7%
times-frac60.3%
unpow260.3%
times-frac62.5%
unpow262.5%
associate-*l*62.5%
unpow262.5%
associate-*l/66.9%
*-commutative66.9%
associate-/l*69.1%
Simplified69.1%
if -4.999999999999985e-310 < d Initial program 64.6%
associate-*l*64.0%
metadata-eval64.0%
unpow1/264.0%
metadata-eval64.0%
unpow1/264.0%
associate-*l*64.0%
metadata-eval64.0%
times-frac63.4%
Simplified63.4%
sqrt-div71.2%
Applied egg-rr71.2%
sqrt-div78.7%
Applied egg-rr78.7%
Final simplification78.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 (<= d -3.2e-64)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(- 1.0 (/ (* h (* 0.5 (pow (* M (/ D (* d 2.0))) 2.0))) l)))
(if (<= d -5e-310)
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ -1.0 (* (* D (/ D l)) (* (* (/ M (/ d M)) (/ h d)) 0.125))))
(*
(/ (sqrt d) (sqrt h))
(*
(/ (sqrt d) (sqrt l))
(- 1.0 (* 0.5 (* (pow (* (/ M 2.0) (/ D d)) 2.0) (/ h l)))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -3.2e-64) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - ((h * (0.5 * pow((M * (D / (d * 2.0))), 2.0))) / l));
} else if (d <= -5e-310) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125)));
} else {
tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * (pow(((M / 2.0) * (D / d)), 2.0) * (h / 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) :: tmp
if (d <= (-3.2d-64)) then
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0d0 - ((h * (0.5d0 * ((m * (d_1 / (d * 2.0d0))) ** 2.0d0))) / l))
else if (d <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + ((d_1 * (d_1 / l)) * (((m / (d / m)) * (h / d)) * 0.125d0)))
else
tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) / sqrt(l)) * (1.0d0 - (0.5d0 * ((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (h / 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 tmp;
if (d <= -3.2e-64) {
tmp = (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - ((h * (0.5 * Math.pow((M * (D / (d * 2.0))), 2.0))) / l));
} else if (d <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125)));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * ((Math.sqrt(d) / Math.sqrt(l)) * (1.0 - (0.5 * (Math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= -3.2e-64: tmp = (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - ((h * (0.5 * math.pow((M * (D / (d * 2.0))), 2.0))) / l)) elif d <= -5e-310: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * ((math.sqrt(d) / math.sqrt(l)) * (1.0 - (0.5 * (math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l))))) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -3.2e-64) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(M * Float64(D / Float64(d * 2.0))) ^ 2.0))) / l))); elseif (d <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + Float64(Float64(D * Float64(D / l)) * Float64(Float64(Float64(M / Float64(d / M)) * Float64(h / d)) * 0.125)))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(Float64(sqrt(d) / sqrt(l)) * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(h / l)))))); 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 (d <= -3.2e-64)
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - ((h * (0.5 * ((M * (D / (d * 2.0))) ^ 2.0))) / l));
elseif (d <= -5e-310)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125)));
else
tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * ((((M / 2.0) * (D / d)) ^ 2.0) * (h / 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_] := If[LessEqual[d, -3.2e-64], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(M * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $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]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -3.2 \cdot 10^{-64}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}\right)}{\ell}\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + \left(D \cdot \frac{D}{\ell}\right) \cdot \left(\left(\frac{M}{\frac{d}{M}} \cdot \frac{h}{d}\right) \cdot 0.125\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\
\end{array}
\end{array}
if d < -3.19999999999999975e-64Initial program 80.9%
metadata-eval80.9%
unpow1/280.9%
metadata-eval80.9%
unpow1/280.9%
*-commutative80.9%
associate-*l*80.9%
times-frac80.9%
metadata-eval80.9%
Simplified80.9%
associate-*r*80.9%
frac-times80.9%
*-commutative80.9%
metadata-eval80.9%
associate-*r/82.2%
metadata-eval82.2%
*-commutative82.2%
frac-times82.2%
associate-*l/82.2%
associate-*r/82.2%
associate-/l/82.2%
*-commutative82.2%
Applied egg-rr82.2%
if -3.19999999999999975e-64 < d < -4.999999999999985e-310Initial program 53.6%
Applied egg-rr7.2%
expm1-def13.6%
expm1-log1p49.3%
*-commutative49.3%
*-commutative49.3%
associate-/l*49.3%
Simplified49.3%
Taylor expanded in d around -inf 78.1%
mul-1-neg78.1%
associate-/r*78.1%
distribute-rgt-neg-in78.1%
associate-/l/78.1%
Simplified78.1%
Taylor expanded in M around 0 53.7%
*-commutative53.7%
times-frac60.3%
unpow260.3%
times-frac62.5%
unpow262.5%
associate-*l*62.5%
unpow262.5%
associate-*l/66.9%
*-commutative66.9%
associate-/l*69.1%
Simplified69.1%
if -4.999999999999985e-310 < d Initial program 64.6%
associate-*l*64.0%
metadata-eval64.0%
unpow1/264.0%
metadata-eval64.0%
unpow1/264.0%
associate-*l*64.0%
metadata-eval64.0%
times-frac63.4%
Simplified63.4%
sqrt-div71.2%
Applied egg-rr71.2%
sqrt-div78.7%
Applied egg-rr78.7%
Final simplification77.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
(let* ((t_0 (pow (* (/ M 2.0) (/ D d)) 2.0))
(t_1 (/ (sqrt d) (sqrt h)))
(t_2 (sqrt (/ d h)))
(t_3 (/ M (/ d M)))
(t_4 (sqrt (/ d l))))
(if (<= d -1.26e-64)
(*
(* t_2 t_4)
(- 1.0 (/ (* h (* 0.5 (pow (* M (/ D (* d 2.0))) 2.0))) l)))
(if (<= d -5e-310)
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ -1.0 (* (* D (/ D l)) (* (* t_3 (/ h d)) 0.125))))
(if (<= d 6.4e-226)
(* (sqrt (/ h (pow l 3.0))) (* -0.125 (* D (* D t_3))))
(if (<= d 3.4e-121)
(* (- 1.0 (* t_0 (* 0.5 (/ h l)))) (* t_1 t_4))
(if (<= d 2.2e-94)
(*
t_1
(*
t_4
(-
1.0
(* 0.5 (* 0.25 (* (/ (* D D) (/ d (* M M))) (/ h (* d l))))))))
(if (<= d 2.3e+148)
(*
t_2
(* (/ (sqrt d) (sqrt l)) (- 1.0 (* 0.5 (* t_0 (/ h l))))))
(/ d (* (sqrt h) (sqrt l)))))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow(((M / 2.0) * (D / d)), 2.0);
double t_1 = sqrt(d) / sqrt(h);
double t_2 = sqrt((d / h));
double t_3 = M / (d / M);
double t_4 = sqrt((d / l));
double tmp;
if (d <= -1.26e-64) {
tmp = (t_2 * t_4) * (1.0 - ((h * (0.5 * pow((M * (D / (d * 2.0))), 2.0))) / l));
} else if (d <= -5e-310) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_3 * (h / d)) * 0.125)));
} else if (d <= 6.4e-226) {
tmp = sqrt((h / pow(l, 3.0))) * (-0.125 * (D * (D * t_3)));
} else if (d <= 3.4e-121) {
tmp = (1.0 - (t_0 * (0.5 * (h / l)))) * (t_1 * t_4);
} else if (d <= 2.2e-94) {
tmp = t_1 * (t_4 * (1.0 - (0.5 * (0.25 * (((D * D) / (d / (M * M))) * (h / (d * l)))))));
} else if (d <= 2.3e+148) {
tmp = t_2 * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * (t_0 * (h / l)))));
} else {
tmp = d / (sqrt(h) * sqrt(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) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = ((m / 2.0d0) * (d_1 / d)) ** 2.0d0
t_1 = sqrt(d) / sqrt(h)
t_2 = sqrt((d / h))
t_3 = m / (d / m)
t_4 = sqrt((d / l))
if (d <= (-1.26d-64)) then
tmp = (t_2 * t_4) * (1.0d0 - ((h * (0.5d0 * ((m * (d_1 / (d * 2.0d0))) ** 2.0d0))) / l))
else if (d <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + ((d_1 * (d_1 / l)) * ((t_3 * (h / d)) * 0.125d0)))
else if (d <= 6.4d-226) then
tmp = sqrt((h / (l ** 3.0d0))) * ((-0.125d0) * (d_1 * (d_1 * t_3)))
else if (d <= 3.4d-121) then
tmp = (1.0d0 - (t_0 * (0.5d0 * (h / l)))) * (t_1 * t_4)
else if (d <= 2.2d-94) then
tmp = t_1 * (t_4 * (1.0d0 - (0.5d0 * (0.25d0 * (((d_1 * d_1) / (d / (m * m))) * (h / (d * l)))))))
else if (d <= 2.3d+148) then
tmp = t_2 * ((sqrt(d) / sqrt(l)) * (1.0d0 - (0.5d0 * (t_0 * (h / l)))))
else
tmp = d / (sqrt(h) * sqrt(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.pow(((M / 2.0) * (D / d)), 2.0);
double t_1 = Math.sqrt(d) / Math.sqrt(h);
double t_2 = Math.sqrt((d / h));
double t_3 = M / (d / M);
double t_4 = Math.sqrt((d / l));
double tmp;
if (d <= -1.26e-64) {
tmp = (t_2 * t_4) * (1.0 - ((h * (0.5 * Math.pow((M * (D / (d * 2.0))), 2.0))) / l));
} else if (d <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_3 * (h / d)) * 0.125)));
} else if (d <= 6.4e-226) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (-0.125 * (D * (D * t_3)));
} else if (d <= 3.4e-121) {
tmp = (1.0 - (t_0 * (0.5 * (h / l)))) * (t_1 * t_4);
} else if (d <= 2.2e-94) {
tmp = t_1 * (t_4 * (1.0 - (0.5 * (0.25 * (((D * D) / (d / (M * M))) * (h / (d * l)))))));
} else if (d <= 2.3e+148) {
tmp = t_2 * ((Math.sqrt(d) / Math.sqrt(l)) * (1.0 - (0.5 * (t_0 * (h / l)))));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.pow(((M / 2.0) * (D / d)), 2.0) t_1 = math.sqrt(d) / math.sqrt(h) t_2 = math.sqrt((d / h)) t_3 = M / (d / M) t_4 = math.sqrt((d / l)) tmp = 0 if d <= -1.26e-64: tmp = (t_2 * t_4) * (1.0 - ((h * (0.5 * math.pow((M * (D / (d * 2.0))), 2.0))) / l)) elif d <= -5e-310: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_3 * (h / d)) * 0.125))) elif d <= 6.4e-226: tmp = math.sqrt((h / math.pow(l, 3.0))) * (-0.125 * (D * (D * t_3))) elif d <= 3.4e-121: tmp = (1.0 - (t_0 * (0.5 * (h / l)))) * (t_1 * t_4) elif d <= 2.2e-94: tmp = t_1 * (t_4 * (1.0 - (0.5 * (0.25 * (((D * D) / (d / (M * M))) * (h / (d * l))))))) elif d <= 2.3e+148: tmp = t_2 * ((math.sqrt(d) / math.sqrt(l)) * (1.0 - (0.5 * (t_0 * (h / l))))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0 t_1 = Float64(sqrt(d) / sqrt(h)) t_2 = sqrt(Float64(d / h)) t_3 = Float64(M / Float64(d / M)) t_4 = sqrt(Float64(d / l)) tmp = 0.0 if (d <= -1.26e-64) tmp = Float64(Float64(t_2 * t_4) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(M * Float64(D / Float64(d * 2.0))) ^ 2.0))) / l))); elseif (d <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + Float64(Float64(D * Float64(D / l)) * Float64(Float64(t_3 * Float64(h / d)) * 0.125)))); elseif (d <= 6.4e-226) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(-0.125 * Float64(D * Float64(D * t_3)))); elseif (d <= 3.4e-121) tmp = Float64(Float64(1.0 - Float64(t_0 * Float64(0.5 * Float64(h / l)))) * Float64(t_1 * t_4)); elseif (d <= 2.2e-94) tmp = Float64(t_1 * Float64(t_4 * Float64(1.0 - Float64(0.5 * Float64(0.25 * Float64(Float64(Float64(D * D) / Float64(d / Float64(M * M))) * Float64(h / Float64(d * l)))))))); elseif (d <= 2.3e+148) tmp = Float64(t_2 * Float64(Float64(sqrt(d) / sqrt(l)) * Float64(1.0 - Float64(0.5 * Float64(t_0 * Float64(h / l)))))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(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 = ((M / 2.0) * (D / d)) ^ 2.0;
t_1 = sqrt(d) / sqrt(h);
t_2 = sqrt((d / h));
t_3 = M / (d / M);
t_4 = sqrt((d / l));
tmp = 0.0;
if (d <= -1.26e-64)
tmp = (t_2 * t_4) * (1.0 - ((h * (0.5 * ((M * (D / (d * 2.0))) ^ 2.0))) / l));
elseif (d <= -5e-310)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_3 * (h / d)) * 0.125)));
elseif (d <= 6.4e-226)
tmp = sqrt((h / (l ^ 3.0))) * (-0.125 * (D * (D * t_3)));
elseif (d <= 3.4e-121)
tmp = (1.0 - (t_0 * (0.5 * (h / l)))) * (t_1 * t_4);
elseif (d <= 2.2e-94)
tmp = t_1 * (t_4 * (1.0 - (0.5 * (0.25 * (((D * D) / (d / (M * M))) * (h / (d * l)))))));
elseif (d <= 2.3e+148)
tmp = t_2 * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * (t_0 * (h / l)))));
else
tmp = d / (sqrt(h) * sqrt(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[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.26e-64], N[(N[(t$95$2 * t$95$4), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(M * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$3 * N[(h / d), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6.4e-226], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(D * N[(D * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.4e-121], N[(N[(1.0 - N[(t$95$0 * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * t$95$4), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.2e-94], N[(t$95$1 * N[(t$95$4 * N[(1.0 - N[(0.5 * N[(0.25 * N[(N[(N[(D * D), $MachinePrecision] / N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.3e+148], N[(t$95$2 * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(t$95$0 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\\
t_1 := \frac{\sqrt{d}}{\sqrt{h}}\\
t_2 := \sqrt{\frac{d}{h}}\\
t_3 := \frac{M}{\frac{d}{M}}\\
t_4 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -1.26 \cdot 10^{-64}:\\
\;\;\;\;\left(t_2 \cdot t_4\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}\right)}{\ell}\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + \left(D \cdot \frac{D}{\ell}\right) \cdot \left(\left(t_3 \cdot \frac{h}{d}\right) \cdot 0.125\right)\right)\\
\mathbf{elif}\;d \leq 6.4 \cdot 10^{-226}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(D \cdot \left(D \cdot t_3\right)\right)\right)\\
\mathbf{elif}\;d \leq 3.4 \cdot 10^{-121}:\\
\;\;\;\;\left(1 - t_0 \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \cdot \left(t_1 \cdot t_4\right)\\
\mathbf{elif}\;d \leq 2.2 \cdot 10^{-94}:\\
\;\;\;\;t_1 \cdot \left(t_4 \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{h}{d \cdot \ell}\right)\right)\right)\right)\\
\mathbf{elif}\;d \leq 2.3 \cdot 10^{+148}:\\
\;\;\;\;t_2 \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(1 - 0.5 \cdot \left(t_0 \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.2599999999999999e-64Initial program 80.9%
metadata-eval80.9%
unpow1/280.9%
metadata-eval80.9%
unpow1/280.9%
*-commutative80.9%
associate-*l*80.9%
times-frac80.9%
metadata-eval80.9%
Simplified80.9%
associate-*r*80.9%
frac-times80.9%
*-commutative80.9%
metadata-eval80.9%
associate-*r/82.2%
metadata-eval82.2%
*-commutative82.2%
frac-times82.2%
associate-*l/82.2%
associate-*r/82.2%
associate-/l/82.2%
*-commutative82.2%
Applied egg-rr82.2%
if -1.2599999999999999e-64 < d < -4.999999999999985e-310Initial program 53.6%
Applied egg-rr7.2%
expm1-def13.6%
expm1-log1p49.3%
*-commutative49.3%
*-commutative49.3%
associate-/l*49.3%
Simplified49.3%
Taylor expanded in d around -inf 78.1%
mul-1-neg78.1%
associate-/r*78.1%
distribute-rgt-neg-in78.1%
associate-/l/78.1%
Simplified78.1%
Taylor expanded in M around 0 53.7%
*-commutative53.7%
times-frac60.3%
unpow260.3%
times-frac62.5%
unpow262.5%
associate-*l*62.5%
unpow262.5%
associate-*l/66.9%
*-commutative66.9%
associate-/l*69.1%
Simplified69.1%
if -4.999999999999985e-310 < d < 6.39999999999999965e-226Initial program 39.3%
metadata-eval39.3%
unpow1/239.3%
metadata-eval39.3%
unpow1/239.3%
*-commutative39.3%
associate-*l*39.3%
times-frac36.2%
metadata-eval36.2%
Simplified36.2%
associate-*r*36.2%
frac-times39.3%
*-commutative39.3%
metadata-eval39.3%
associate-*r/39.4%
metadata-eval39.4%
*-commutative39.4%
frac-times36.3%
associate-*l/36.3%
associate-*r/36.3%
associate-/l/36.3%
*-commutative36.3%
Applied egg-rr36.3%
Taylor expanded in d around 0 46.8%
associate-*r*46.8%
*-commutative46.8%
associate-*r/46.8%
unpow246.8%
unpow246.8%
associate-*l*50.5%
associate-/l*57.8%
Simplified57.8%
if 6.39999999999999965e-226 < d < 3.40000000000000001e-121Initial program 58.5%
metadata-eval58.5%
unpow1/258.5%
metadata-eval58.5%
unpow1/258.5%
*-commutative58.5%
associate-*l*58.5%
times-frac58.2%
metadata-eval58.2%
Simplified58.2%
sqrt-div66.2%
Applied egg-rr69.8%
if 3.40000000000000001e-121 < d < 2.20000000000000001e-94Initial program 39.0%
associate-*l*39.0%
metadata-eval39.0%
unpow1/239.0%
metadata-eval39.0%
unpow1/239.0%
associate-*l*39.0%
metadata-eval39.0%
times-frac39.0%
Simplified39.0%
sqrt-div64.0%
Applied egg-rr64.0%
Taylor expanded in M around 0 75.8%
associate-*r/75.8%
*-commutative75.8%
associate-*r/75.8%
associate-*r*88.2%
unpow288.2%
associate-*l*88.2%
times-frac88.0%
associate-/l*88.2%
unpow288.2%
unpow288.2%
Simplified88.2%
if 2.20000000000000001e-94 < d < 2.3000000000000001e148Initial program 80.7%
associate-*l*80.7%
metadata-eval80.7%
unpow1/280.7%
metadata-eval80.7%
unpow1/280.7%
associate-*l*80.7%
metadata-eval80.7%
times-frac80.7%
Simplified80.7%
sqrt-div88.7%
Applied egg-rr87.2%
if 2.3000000000000001e148 < d Initial program 70.4%
metadata-eval70.4%
unpow1/270.4%
metadata-eval70.4%
unpow1/270.4%
*-commutative70.4%
associate-*l*70.4%
times-frac70.4%
metadata-eval70.4%
Simplified70.4%
associate-*r*70.4%
frac-times70.4%
*-commutative70.4%
metadata-eval70.4%
associate-*r/74.0%
metadata-eval74.0%
*-commutative74.0%
frac-times74.0%
associate-*l/74.0%
associate-*r/74.0%
associate-/l/74.0%
*-commutative74.0%
Applied egg-rr74.0%
Taylor expanded in d around inf 70.0%
*-commutative70.0%
*-commutative70.0%
associate-/r*70.0%
Simplified70.0%
associate-/r*70.0%
associate-/l/70.0%
add-cbrt-cube62.1%
add-sqr-sqrt62.0%
pow162.0%
add-sqr-sqrt62.1%
add-cbrt-cube70.0%
associate-/l/70.0%
sqrt-div69.9%
metadata-eval69.9%
*-commutative69.9%
Applied egg-rr69.9%
unpow169.9%
associate-*r/70.0%
*-rgt-identity70.0%
Simplified70.0%
sqrt-prod84.4%
Applied egg-rr84.4%
Final simplification77.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) (sqrt h))) (t_1 (sqrt (/ d l))))
(if (<= d -1.26e-64)
(*
(* (sqrt (/ d h)) t_1)
(- 1.0 (/ (* h (* 0.5 (pow (* M (/ D (* d 2.0))) 2.0))) l)))
(if (<= d -5e-310)
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ -1.0 (* (* D (/ D l)) (* (* (/ M (/ d M)) (/ h d)) 0.125))))
(if (<= d 7e-226)
(*
t_0
(*
(/ (sqrt d) (sqrt l))
(-
1.0
(* 0.5 (* 0.25 (* (/ (* D D) (/ d (* M M))) (/ h (* d l))))))))
(*
t_0
(*
(- 1.0 (* 0.5 (* (pow (* (/ M 2.0) (/ D d)) 2.0) (/ h l))))
t_1)))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(d) / sqrt(h);
double t_1 = sqrt((d / l));
double tmp;
if (d <= -1.26e-64) {
tmp = (sqrt((d / h)) * t_1) * (1.0 - ((h * (0.5 * pow((M * (D / (d * 2.0))), 2.0))) / l));
} else if (d <= -5e-310) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125)));
} else if (d <= 7e-226) {
tmp = t_0 * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * (0.25 * (((D * D) / (d / (M * M))) * (h / (d * l)))))));
} else {
tmp = t_0 * ((1.0 - (0.5 * (pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) * t_1);
}
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) / sqrt(h)
t_1 = sqrt((d / l))
if (d <= (-1.26d-64)) then
tmp = (sqrt((d / h)) * t_1) * (1.0d0 - ((h * (0.5d0 * ((m * (d_1 / (d * 2.0d0))) ** 2.0d0))) / l))
else if (d <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + ((d_1 * (d_1 / l)) * (((m / (d / m)) * (h / d)) * 0.125d0)))
else if (d <= 7d-226) then
tmp = t_0 * ((sqrt(d) / sqrt(l)) * (1.0d0 - (0.5d0 * (0.25d0 * (((d_1 * d_1) / (d / (m * m))) * (h / (d * l)))))))
else
tmp = t_0 * ((1.0d0 - (0.5d0 * ((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (h / l)))) * t_1)
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) / Math.sqrt(h);
double t_1 = Math.sqrt((d / l));
double tmp;
if (d <= -1.26e-64) {
tmp = (Math.sqrt((d / h)) * t_1) * (1.0 - ((h * (0.5 * Math.pow((M * (D / (d * 2.0))), 2.0))) / l));
} else if (d <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125)));
} else if (d <= 7e-226) {
tmp = t_0 * ((Math.sqrt(d) / Math.sqrt(l)) * (1.0 - (0.5 * (0.25 * (((D * D) / (d / (M * M))) * (h / (d * l)))))));
} else {
tmp = t_0 * ((1.0 - (0.5 * (Math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) * t_1);
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt(d) / math.sqrt(h) t_1 = math.sqrt((d / l)) tmp = 0 if d <= -1.26e-64: tmp = (math.sqrt((d / h)) * t_1) * (1.0 - ((h * (0.5 * math.pow((M * (D / (d * 2.0))), 2.0))) / l)) elif d <= -5e-310: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125))) elif d <= 7e-226: tmp = t_0 * ((math.sqrt(d) / math.sqrt(l)) * (1.0 - (0.5 * (0.25 * (((D * D) / (d / (M * M))) * (h / (d * l))))))) else: tmp = t_0 * ((1.0 - (0.5 * (math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) * t_1) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(d) / sqrt(h)) t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (d <= -1.26e-64) tmp = Float64(Float64(sqrt(Float64(d / h)) * t_1) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(M * Float64(D / Float64(d * 2.0))) ^ 2.0))) / l))); elseif (d <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + Float64(Float64(D * Float64(D / l)) * Float64(Float64(Float64(M / Float64(d / M)) * Float64(h / d)) * 0.125)))); elseif (d <= 7e-226) tmp = Float64(t_0 * Float64(Float64(sqrt(d) / sqrt(l)) * Float64(1.0 - Float64(0.5 * Float64(0.25 * Float64(Float64(Float64(D * D) / Float64(d / Float64(M * M))) * Float64(h / Float64(d * l)))))))); else tmp = Float64(t_0 * Float64(Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(h / l)))) * t_1)); 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) / sqrt(h);
t_1 = sqrt((d / l));
tmp = 0.0;
if (d <= -1.26e-64)
tmp = (sqrt((d / h)) * t_1) * (1.0 - ((h * (0.5 * ((M * (D / (d * 2.0))) ^ 2.0))) / l));
elseif (d <= -5e-310)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125)));
elseif (d <= 7e-226)
tmp = t_0 * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * (0.25 * (((D * D) / (d / (M * M))) * (h / (d * l)))))));
else
tmp = t_0 * ((1.0 - (0.5 * ((((M / 2.0) * (D / d)) ^ 2.0) * (h / l)))) * t_1);
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[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.26e-64], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(M * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7e-226], N[(t$95$0 * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(0.25 * N[(N[(N[(D * D), $MachinePrecision] / N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * 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] * t$95$1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \frac{\sqrt{d}}{\sqrt{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -1.26 \cdot 10^{-64}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot t_1\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}\right)}{\ell}\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + \left(D \cdot \frac{D}{\ell}\right) \cdot \left(\left(\frac{M}{\frac{d}{M}} \cdot \frac{h}{d}\right) \cdot 0.125\right)\right)\\
\mathbf{elif}\;d \leq 7 \cdot 10^{-226}:\\
\;\;\;\;t_0 \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \frac{h}{d \cdot \ell}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(\left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot t_1\right)\\
\end{array}
\end{array}
if d < -1.2599999999999999e-64Initial program 80.9%
metadata-eval80.9%
unpow1/280.9%
metadata-eval80.9%
unpow1/280.9%
*-commutative80.9%
associate-*l*80.9%
times-frac80.9%
metadata-eval80.9%
Simplified80.9%
associate-*r*80.9%
frac-times80.9%
*-commutative80.9%
metadata-eval80.9%
associate-*r/82.2%
metadata-eval82.2%
*-commutative82.2%
frac-times82.2%
associate-*l/82.2%
associate-*r/82.2%
associate-/l/82.2%
*-commutative82.2%
Applied egg-rr82.2%
if -1.2599999999999999e-64 < d < -4.999999999999985e-310Initial program 53.6%
Applied egg-rr7.2%
expm1-def13.6%
expm1-log1p49.3%
*-commutative49.3%
*-commutative49.3%
associate-/l*49.3%
Simplified49.3%
Taylor expanded in d around -inf 78.1%
mul-1-neg78.1%
associate-/r*78.1%
distribute-rgt-neg-in78.1%
associate-/l/78.1%
Simplified78.1%
Taylor expanded in M around 0 53.7%
*-commutative53.7%
times-frac60.3%
unpow260.3%
times-frac62.5%
unpow262.5%
associate-*l*62.5%
unpow262.5%
associate-*l/66.9%
*-commutative66.9%
associate-/l*69.1%
Simplified69.1%
if -4.999999999999985e-310 < d < 7e-226Initial program 39.3%
associate-*l*39.3%
metadata-eval39.3%
unpow1/239.3%
metadata-eval39.3%
unpow1/239.3%
associate-*l*39.3%
metadata-eval39.3%
times-frac36.2%
Simplified36.2%
sqrt-div43.8%
Applied egg-rr43.8%
Taylor expanded in M around 0 21.6%
associate-*r/21.6%
*-commutative21.6%
associate-*r/21.6%
associate-*r*21.4%
unpow221.4%
associate-*l*25.4%
times-frac39.4%
associate-/l*39.5%
unpow239.5%
unpow239.5%
Simplified39.5%
sqrt-div58.1%
Applied egg-rr64.1%
if 7e-226 < d Initial program 70.4%
associate-*l*69.7%
metadata-eval69.7%
unpow1/269.7%
metadata-eval69.7%
unpow1/269.7%
associate-*l*69.7%
metadata-eval69.7%
times-frac69.6%
Simplified69.6%
sqrt-div77.4%
Applied egg-rr77.4%
Final simplification75.7%
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 (/ M (/ d M))))
(if (<= d -1.26e-64)
(*
(* t_0 (sqrt (/ d l)))
(- 1.0 (/ (* h (* 0.5 (pow (* M (/ D (* d 2.0))) 2.0))) l)))
(if (<= d -5e-310)
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ -1.0 (* (* D (/ D l)) (* (* t_1 (/ h d)) 0.125))))
(if (<= d 9.2e-226)
(* (sqrt (/ h (pow l 3.0))) (* -0.125 (* D (* D t_1))))
(if (or (<= d 5.7e+150) (not (<= d 7.5e+206)))
(*
t_0
(*
(/ (sqrt d) (sqrt l))
(- 1.0 (* 0.5 (* (pow (* (/ M 2.0) (/ D d)) 2.0) (/ h l))))))
(* 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));
double t_1 = M / (d / M);
double tmp;
if (d <= -1.26e-64) {
tmp = (t_0 * sqrt((d / l))) * (1.0 - ((h * (0.5 * pow((M * (D / (d * 2.0))), 2.0))) / l));
} else if (d <= -5e-310) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_1 * (h / d)) * 0.125)));
} else if (d <= 9.2e-226) {
tmp = sqrt((h / pow(l, 3.0))) * (-0.125 * (D * (D * t_1)));
} else if ((d <= 5.7e+150) || !(d <= 7.5e+206)) {
tmp = t_0 * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * (pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))));
} 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) :: t_1
real(8) :: tmp
t_0 = sqrt((d / h))
t_1 = m / (d / m)
if (d <= (-1.26d-64)) then
tmp = (t_0 * sqrt((d / l))) * (1.0d0 - ((h * (0.5d0 * ((m * (d_1 / (d * 2.0d0))) ** 2.0d0))) / l))
else if (d <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + ((d_1 * (d_1 / l)) * ((t_1 * (h / d)) * 0.125d0)))
else if (d <= 9.2d-226) then
tmp = sqrt((h / (l ** 3.0d0))) * ((-0.125d0) * (d_1 * (d_1 * t_1)))
else if ((d <= 5.7d+150) .or. (.not. (d <= 7.5d+206))) then
tmp = t_0 * ((sqrt(d) / sqrt(l)) * (1.0d0 - (0.5d0 * ((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (h / l)))))
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));
double t_1 = M / (d / M);
double tmp;
if (d <= -1.26e-64) {
tmp = (t_0 * Math.sqrt((d / l))) * (1.0 - ((h * (0.5 * Math.pow((M * (D / (d * 2.0))), 2.0))) / l));
} else if (d <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_1 * (h / d)) * 0.125)));
} else if (d <= 9.2e-226) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (-0.125 * (D * (D * t_1)));
} else if ((d <= 5.7e+150) || !(d <= 7.5e+206)) {
tmp = t_0 * ((Math.sqrt(d) / Math.sqrt(l)) * (1.0 - (0.5 * (Math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))));
} 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)) t_1 = M / (d / M) tmp = 0 if d <= -1.26e-64: tmp = (t_0 * math.sqrt((d / l))) * (1.0 - ((h * (0.5 * math.pow((M * (D / (d * 2.0))), 2.0))) / l)) elif d <= -5e-310: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_1 * (h / d)) * 0.125))) elif d <= 9.2e-226: tmp = math.sqrt((h / math.pow(l, 3.0))) * (-0.125 * (D * (D * t_1))) elif (d <= 5.7e+150) or not (d <= 7.5e+206): tmp = t_0 * ((math.sqrt(d) / math.sqrt(l)) * (1.0 - (0.5 * (math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l))))) 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 = sqrt(Float64(d / h)) t_1 = Float64(M / Float64(d / M)) tmp = 0.0 if (d <= -1.26e-64) tmp = Float64(Float64(t_0 * sqrt(Float64(d / l))) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(M * Float64(D / Float64(d * 2.0))) ^ 2.0))) / l))); elseif (d <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + Float64(Float64(D * Float64(D / l)) * Float64(Float64(t_1 * Float64(h / d)) * 0.125)))); elseif (d <= 9.2e-226) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(-0.125 * Float64(D * Float64(D * t_1)))); elseif ((d <= 5.7e+150) || !(d <= 7.5e+206)) tmp = Float64(t_0 * Float64(Float64(sqrt(d) / sqrt(l)) * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(h / l)))))); 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));
t_1 = M / (d / M);
tmp = 0.0;
if (d <= -1.26e-64)
tmp = (t_0 * sqrt((d / l))) * (1.0 - ((h * (0.5 * ((M * (D / (d * 2.0))) ^ 2.0))) / l));
elseif (d <= -5e-310)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_1 * (h / d)) * 0.125)));
elseif (d <= 9.2e-226)
tmp = sqrt((h / (l ^ 3.0))) * (-0.125 * (D * (D * t_1)));
elseif ((d <= 5.7e+150) || ~((d <= 7.5e+206)))
tmp = t_0 * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * ((((M / 2.0) * (D / d)) ^ 2.0) * (h / l)))));
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[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.26e-64], N[(N[(t$95$0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(M * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 * N[(h / d), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 9.2e-226], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(D * N[(D * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d, 5.7e+150], N[Not[LessEqual[d, 7.5e+206]], $MachinePrecision]], N[(t$95$0 * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $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]), $MachinePrecision], 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}}\\
t_1 := \frac{M}{\frac{d}{M}}\\
\mathbf{if}\;d \leq -1.26 \cdot 10^{-64}:\\
\;\;\;\;\left(t_0 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}\right)}{\ell}\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + \left(D \cdot \frac{D}{\ell}\right) \cdot \left(\left(t_1 \cdot \frac{h}{d}\right) \cdot 0.125\right)\right)\\
\mathbf{elif}\;d \leq 9.2 \cdot 10^{-226}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(D \cdot \left(D \cdot t_1\right)\right)\right)\\
\mathbf{elif}\;d \leq 5.7 \cdot 10^{+150} \lor \neg \left(d \leq 7.5 \cdot 10^{+206}\right):\\
\;\;\;\;t_0 \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -1.2599999999999999e-64Initial program 80.9%
metadata-eval80.9%
unpow1/280.9%
metadata-eval80.9%
unpow1/280.9%
*-commutative80.9%
associate-*l*80.9%
times-frac80.9%
metadata-eval80.9%
Simplified80.9%
associate-*r*80.9%
frac-times80.9%
*-commutative80.9%
metadata-eval80.9%
associate-*r/82.2%
metadata-eval82.2%
*-commutative82.2%
frac-times82.2%
associate-*l/82.2%
associate-*r/82.2%
associate-/l/82.2%
*-commutative82.2%
Applied egg-rr82.2%
if -1.2599999999999999e-64 < d < -4.999999999999985e-310Initial program 53.6%
Applied egg-rr7.2%
expm1-def13.6%
expm1-log1p49.3%
*-commutative49.3%
*-commutative49.3%
associate-/l*49.3%
Simplified49.3%
Taylor expanded in d around -inf 78.1%
mul-1-neg78.1%
associate-/r*78.1%
distribute-rgt-neg-in78.1%
associate-/l/78.1%
Simplified78.1%
Taylor expanded in M around 0 53.7%
*-commutative53.7%
times-frac60.3%
unpow260.3%
times-frac62.5%
unpow262.5%
associate-*l*62.5%
unpow262.5%
associate-*l/66.9%
*-commutative66.9%
associate-/l*69.1%
Simplified69.1%
if -4.999999999999985e-310 < d < 9.2000000000000001e-226Initial program 39.3%
metadata-eval39.3%
unpow1/239.3%
metadata-eval39.3%
unpow1/239.3%
*-commutative39.3%
associate-*l*39.3%
times-frac36.2%
metadata-eval36.2%
Simplified36.2%
associate-*r*36.2%
frac-times39.3%
*-commutative39.3%
metadata-eval39.3%
associate-*r/39.4%
metadata-eval39.4%
*-commutative39.4%
frac-times36.3%
associate-*l/36.3%
associate-*r/36.3%
associate-/l/36.3%
*-commutative36.3%
Applied egg-rr36.3%
Taylor expanded in d around 0 46.8%
associate-*r*46.8%
*-commutative46.8%
associate-*r/46.8%
unpow246.8%
unpow246.8%
associate-*l*50.5%
associate-/l*57.8%
Simplified57.8%
if 9.2000000000000001e-226 < d < 5.7000000000000002e150 or 7.49999999999999958e206 < d Initial program 73.2%
associate-*l*72.3%
metadata-eval72.3%
unpow1/272.3%
metadata-eval72.3%
unpow1/272.3%
associate-*l*72.3%
metadata-eval72.3%
times-frac72.3%
Simplified72.3%
sqrt-div85.2%
Applied egg-rr79.1%
if 5.7000000000000002e150 < d < 7.49999999999999958e206Initial program 47.3%
Taylor expanded in d around inf 62.2%
*-commutative62.2%
associate-/r*62.2%
Simplified62.2%
sqrt-div84.1%
Applied egg-rr84.1%
Final simplification76.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 (/ h (pow l 3.0))))
(t_1 (sqrt (/ d h)))
(t_2 (sqrt (/ d l)))
(t_3
(*
t_1
(* (- 1.0 (* 0.5 (* (pow (* (/ M 2.0) (/ D d)) 2.0) (/ h l)))) t_2)))
(t_4 (/ M (/ d M))))
(if (<= d -1.05e-63)
t_3
(if (<= d -5e-310)
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ -1.0 (* (* D (/ D l)) (* (* t_4 (/ h d)) 0.125))))
(if (<= d 1e-225)
(* t_0 (* -0.125 (* D (* D t_4))))
(if (<= d 3.9e-141)
t_3
(if (<= d 1.55e-107)
(* t_0 (* -0.125 (/ (pow (* M D) 2.0) d)))
(if (<= d 1.22e+149)
(*
(* t_1 t_2)
(- 1.0 (* 0.125 (/ D (/ (/ (* d d) (/ (* h M) (/ l M))) D)))))
(/ d (* (sqrt h) (sqrt l)))))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h / pow(l, 3.0)));
double t_1 = sqrt((d / h));
double t_2 = sqrt((d / l));
double t_3 = t_1 * ((1.0 - (0.5 * (pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) * t_2);
double t_4 = M / (d / M);
double tmp;
if (d <= -1.05e-63) {
tmp = t_3;
} else if (d <= -5e-310) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_4 * (h / d)) * 0.125)));
} else if (d <= 1e-225) {
tmp = t_0 * (-0.125 * (D * (D * t_4)));
} else if (d <= 3.9e-141) {
tmp = t_3;
} else if (d <= 1.55e-107) {
tmp = t_0 * (-0.125 * (pow((M * D), 2.0) / d));
} else if (d <= 1.22e+149) {
tmp = (t_1 * t_2) * (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D))));
} else {
tmp = d / (sqrt(h) * sqrt(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) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = sqrt((h / (l ** 3.0d0)))
t_1 = sqrt((d / h))
t_2 = sqrt((d / l))
t_3 = t_1 * ((1.0d0 - (0.5d0 * ((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (h / l)))) * t_2)
t_4 = m / (d / m)
if (d <= (-1.05d-63)) then
tmp = t_3
else if (d <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + ((d_1 * (d_1 / l)) * ((t_4 * (h / d)) * 0.125d0)))
else if (d <= 1d-225) then
tmp = t_0 * ((-0.125d0) * (d_1 * (d_1 * t_4)))
else if (d <= 3.9d-141) then
tmp = t_3
else if (d <= 1.55d-107) then
tmp = t_0 * ((-0.125d0) * (((m * d_1) ** 2.0d0) / d))
else if (d <= 1.22d+149) then
tmp = (t_1 * t_2) * (1.0d0 - (0.125d0 * (d_1 / (((d * d) / ((h * m) / (l / m))) / d_1))))
else
tmp = d / (sqrt(h) * sqrt(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((h / Math.pow(l, 3.0)));
double t_1 = Math.sqrt((d / h));
double t_2 = Math.sqrt((d / l));
double t_3 = t_1 * ((1.0 - (0.5 * (Math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) * t_2);
double t_4 = M / (d / M);
double tmp;
if (d <= -1.05e-63) {
tmp = t_3;
} else if (d <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_4 * (h / d)) * 0.125)));
} else if (d <= 1e-225) {
tmp = t_0 * (-0.125 * (D * (D * t_4)));
} else if (d <= 3.9e-141) {
tmp = t_3;
} else if (d <= 1.55e-107) {
tmp = t_0 * (-0.125 * (Math.pow((M * D), 2.0) / d));
} else if (d <= 1.22e+149) {
tmp = (t_1 * t_2) * (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D))));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((h / math.pow(l, 3.0))) t_1 = math.sqrt((d / h)) t_2 = math.sqrt((d / l)) t_3 = t_1 * ((1.0 - (0.5 * (math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) * t_2) t_4 = M / (d / M) tmp = 0 if d <= -1.05e-63: tmp = t_3 elif d <= -5e-310: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_4 * (h / d)) * 0.125))) elif d <= 1e-225: tmp = t_0 * (-0.125 * (D * (D * t_4))) elif d <= 3.9e-141: tmp = t_3 elif d <= 1.55e-107: tmp = t_0 * (-0.125 * (math.pow((M * D), 2.0) / d)) elif d <= 1.22e+149: tmp = (t_1 * t_2) * (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(h / (l ^ 3.0))) t_1 = sqrt(Float64(d / h)) t_2 = sqrt(Float64(d / l)) t_3 = Float64(t_1 * Float64(Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(h / l)))) * t_2)) t_4 = Float64(M / Float64(d / M)) tmp = 0.0 if (d <= -1.05e-63) tmp = t_3; elseif (d <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + Float64(Float64(D * Float64(D / l)) * Float64(Float64(t_4 * Float64(h / d)) * 0.125)))); elseif (d <= 1e-225) tmp = Float64(t_0 * Float64(-0.125 * Float64(D * Float64(D * t_4)))); elseif (d <= 3.9e-141) tmp = t_3; elseif (d <= 1.55e-107) tmp = Float64(t_0 * Float64(-0.125 * Float64((Float64(M * D) ^ 2.0) / d))); elseif (d <= 1.22e+149) tmp = Float64(Float64(t_1 * t_2) * Float64(1.0 - Float64(0.125 * Float64(D / Float64(Float64(Float64(d * d) / Float64(Float64(h * M) / Float64(l / M))) / D))))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(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((h / (l ^ 3.0)));
t_1 = sqrt((d / h));
t_2 = sqrt((d / l));
t_3 = t_1 * ((1.0 - (0.5 * ((((M / 2.0) * (D / d)) ^ 2.0) * (h / l)))) * t_2);
t_4 = M / (d / M);
tmp = 0.0;
if (d <= -1.05e-63)
tmp = t_3;
elseif (d <= -5e-310)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_4 * (h / d)) * 0.125)));
elseif (d <= 1e-225)
tmp = t_0 * (-0.125 * (D * (D * t_4)));
elseif (d <= 3.9e-141)
tmp = t_3;
elseif (d <= 1.55e-107)
tmp = t_0 * (-0.125 * (((M * D) ^ 2.0) / d));
elseif (d <= 1.22e+149)
tmp = (t_1 * t_2) * (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D))));
else
tmp = d / (sqrt(h) * sqrt(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[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * 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] * t$95$2), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.05e-63], t$95$3, If[LessEqual[d, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$4 * N[(h / d), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1e-225], N[(t$95$0 * N[(-0.125 * N[(D * N[(D * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.9e-141], t$95$3, If[LessEqual[d, 1.55e-107], N[(t$95$0 * N[(-0.125 * N[(N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.22e+149], N[(N[(t$95$1 * t$95$2), $MachinePrecision] * N[(1.0 - N[(0.125 * N[(D / N[(N[(N[(d * d), $MachinePrecision] / N[(N[(h * M), $MachinePrecision] / N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{{\ell}^{3}}}\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \sqrt{\frac{d}{\ell}}\\
t_3 := t_1 \cdot \left(\left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot t_2\right)\\
t_4 := \frac{M}{\frac{d}{M}}\\
\mathbf{if}\;d \leq -1.05 \cdot 10^{-63}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + \left(D \cdot \frac{D}{\ell}\right) \cdot \left(\left(t_4 \cdot \frac{h}{d}\right) \cdot 0.125\right)\right)\\
\mathbf{elif}\;d \leq 10^{-225}:\\
\;\;\;\;t_0 \cdot \left(-0.125 \cdot \left(D \cdot \left(D \cdot t_4\right)\right)\right)\\
\mathbf{elif}\;d \leq 3.9 \cdot 10^{-141}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;d \leq 1.55 \cdot 10^{-107}:\\
\;\;\;\;t_0 \cdot \left(-0.125 \cdot \frac{{\left(M \cdot D\right)}^{2}}{d}\right)\\
\mathbf{elif}\;d \leq 1.22 \cdot 10^{+149}:\\
\;\;\;\;\left(t_1 \cdot t_2\right) \cdot \left(1 - 0.125 \cdot \frac{D}{\frac{\frac{d \cdot d}{\frac{h \cdot M}{\frac{\ell}{M}}}}{D}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.05e-63 or 9.9999999999999996e-226 < d < 3.8999999999999997e-141Initial program 78.3%
associate-*l*77.2%
metadata-eval77.2%
unpow1/277.2%
metadata-eval77.2%
unpow1/277.2%
associate-*l*77.2%
metadata-eval77.2%
times-frac77.2%
Simplified77.2%
if -1.05e-63 < d < -4.999999999999985e-310Initial program 53.6%
Applied egg-rr7.2%
expm1-def13.6%
expm1-log1p49.3%
*-commutative49.3%
*-commutative49.3%
associate-/l*49.3%
Simplified49.3%
Taylor expanded in d around -inf 78.1%
mul-1-neg78.1%
associate-/r*78.1%
distribute-rgt-neg-in78.1%
associate-/l/78.1%
Simplified78.1%
Taylor expanded in M around 0 53.7%
*-commutative53.7%
times-frac60.3%
unpow260.3%
times-frac62.5%
unpow262.5%
associate-*l*62.5%
unpow262.5%
associate-*l/66.9%
*-commutative66.9%
associate-/l*69.1%
Simplified69.1%
if -4.999999999999985e-310 < d < 9.9999999999999996e-226Initial program 39.3%
metadata-eval39.3%
unpow1/239.3%
metadata-eval39.3%
unpow1/239.3%
*-commutative39.3%
associate-*l*39.3%
times-frac36.2%
metadata-eval36.2%
Simplified36.2%
associate-*r*36.2%
frac-times39.3%
*-commutative39.3%
metadata-eval39.3%
associate-*r/39.4%
metadata-eval39.4%
*-commutative39.4%
frac-times36.3%
associate-*l/36.3%
associate-*r/36.3%
associate-/l/36.3%
*-commutative36.3%
Applied egg-rr36.3%
Taylor expanded in d around 0 46.8%
associate-*r*46.8%
*-commutative46.8%
associate-*r/46.8%
unpow246.8%
unpow246.8%
associate-*l*50.5%
associate-/l*57.8%
Simplified57.8%
if 3.8999999999999997e-141 < d < 1.55000000000000011e-107Initial program 24.1%
metadata-eval24.1%
unpow1/224.1%
metadata-eval24.1%
unpow1/224.1%
*-commutative24.1%
associate-*l*24.1%
times-frac23.7%
metadata-eval23.7%
Simplified23.7%
associate-*r*23.7%
frac-times24.1%
*-commutative24.1%
metadata-eval24.1%
associate-*r/24.1%
metadata-eval24.1%
*-commutative24.1%
frac-times23.7%
associate-*l/23.7%
associate-*r/23.7%
associate-/l/23.7%
*-commutative23.7%
Applied egg-rr23.7%
Taylor expanded in M around 0 12.0%
associate-*r*23.3%
associate-/l*22.2%
unpow222.2%
unpow222.2%
unswap-sqr33.6%
unpow233.6%
associate-/l*33.6%
Simplified33.6%
Taylor expanded in d around 0 34.2%
associate-*r*34.2%
*-commutative34.2%
unpow234.2%
unpow234.2%
swap-sqr56.6%
unpow256.6%
Simplified56.6%
if 1.55000000000000011e-107 < d < 1.22e149Initial program 77.4%
metadata-eval77.4%
unpow1/277.4%
metadata-eval77.4%
unpow1/277.4%
*-commutative77.4%
associate-*l*77.4%
times-frac77.4%
metadata-eval77.4%
Simplified77.4%
Taylor expanded in M around 0 70.8%
associate-*r/70.8%
*-commutative70.8%
associate-*r/70.8%
*-commutative70.8%
times-frac75.7%
unpow275.7%
*-commutative75.7%
unpow275.7%
unpow275.7%
Simplified75.7%
Taylor expanded in D around 0 70.8%
associate-/l*72.4%
*-commutative72.4%
*-commutative72.4%
unpow272.4%
associate-/l*72.5%
*-commutative72.5%
associate-/l*75.8%
unpow275.8%
unpow275.8%
associate-*r*77.5%
associate-/l*82.3%
*-commutative82.3%
Simplified82.3%
if 1.22e149 < d Initial program 70.4%
metadata-eval70.4%
unpow1/270.4%
metadata-eval70.4%
unpow1/270.4%
*-commutative70.4%
associate-*l*70.4%
times-frac70.4%
metadata-eval70.4%
Simplified70.4%
associate-*r*70.4%
frac-times70.4%
*-commutative70.4%
metadata-eval70.4%
associate-*r/74.0%
metadata-eval74.0%
*-commutative74.0%
frac-times74.0%
associate-*l/74.0%
associate-*r/74.0%
associate-/l/74.0%
*-commutative74.0%
Applied egg-rr74.0%
Taylor expanded in d around inf 70.0%
*-commutative70.0%
*-commutative70.0%
associate-/r*70.0%
Simplified70.0%
associate-/r*70.0%
associate-/l/70.0%
add-cbrt-cube62.1%
add-sqr-sqrt62.0%
pow162.0%
add-sqr-sqrt62.1%
add-cbrt-cube70.0%
associate-/l/70.0%
sqrt-div69.9%
metadata-eval69.9%
*-commutative69.9%
Applied egg-rr69.9%
unpow169.9%
associate-*r/70.0%
*-rgt-identity70.0%
Simplified70.0%
sqrt-prod84.4%
Applied egg-rr84.4%
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
(let* ((t_0 (pow (* M (/ D (* d 2.0))) 2.0))
(t_1 (* (sqrt (/ d h)) (sqrt (/ d l))))
(t_2 (/ M (/ d M))))
(if (<= d -3.2e-64)
(* t_1 (- 1.0 (/ (* h (* 0.5 t_0)) l)))
(if (<= d -5e-310)
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ -1.0 (* (* D (/ D l)) (* (* t_2 (/ h d)) 0.125))))
(if (<= d 7e-226)
(* (sqrt (/ h (pow l 3.0))) (* -0.125 (* D (* D t_2))))
(if (<= d 2.2e-94)
(*
(/ (sqrt d) (sqrt (* h (/ l d))))
(+ 1.0 (/ (* t_0 (* h -0.5)) l)))
(if (<= d 1.3e+150)
(*
t_1
(- 1.0 (* 0.125 (/ D (/ (/ (* d d) (/ (* h M) (/ l M))) D)))))
(/ d (* (sqrt h) (sqrt l))))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((M * (D / (d * 2.0))), 2.0);
double t_1 = sqrt((d / h)) * sqrt((d / l));
double t_2 = M / (d / M);
double tmp;
if (d <= -3.2e-64) {
tmp = t_1 * (1.0 - ((h * (0.5 * t_0)) / l));
} else if (d <= -5e-310) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_2 * (h / d)) * 0.125)));
} else if (d <= 7e-226) {
tmp = sqrt((h / pow(l, 3.0))) * (-0.125 * (D * (D * t_2)));
} else if (d <= 2.2e-94) {
tmp = (sqrt(d) / sqrt((h * (l / d)))) * (1.0 + ((t_0 * (h * -0.5)) / l));
} else if (d <= 1.3e+150) {
tmp = t_1 * (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D))));
} else {
tmp = d / (sqrt(h) * sqrt(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) :: t_2
real(8) :: tmp
t_0 = (m * (d_1 / (d * 2.0d0))) ** 2.0d0
t_1 = sqrt((d / h)) * sqrt((d / l))
t_2 = m / (d / m)
if (d <= (-3.2d-64)) then
tmp = t_1 * (1.0d0 - ((h * (0.5d0 * t_0)) / l))
else if (d <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + ((d_1 * (d_1 / l)) * ((t_2 * (h / d)) * 0.125d0)))
else if (d <= 7d-226) then
tmp = sqrt((h / (l ** 3.0d0))) * ((-0.125d0) * (d_1 * (d_1 * t_2)))
else if (d <= 2.2d-94) then
tmp = (sqrt(d) / sqrt((h * (l / d)))) * (1.0d0 + ((t_0 * (h * (-0.5d0))) / l))
else if (d <= 1.3d+150) then
tmp = t_1 * (1.0d0 - (0.125d0 * (d_1 / (((d * d) / ((h * m) / (l / m))) / d_1))))
else
tmp = d / (sqrt(h) * sqrt(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.pow((M * (D / (d * 2.0))), 2.0);
double t_1 = Math.sqrt((d / h)) * Math.sqrt((d / l));
double t_2 = M / (d / M);
double tmp;
if (d <= -3.2e-64) {
tmp = t_1 * (1.0 - ((h * (0.5 * t_0)) / l));
} else if (d <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_2 * (h / d)) * 0.125)));
} else if (d <= 7e-226) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (-0.125 * (D * (D * t_2)));
} else if (d <= 2.2e-94) {
tmp = (Math.sqrt(d) / Math.sqrt((h * (l / d)))) * (1.0 + ((t_0 * (h * -0.5)) / l));
} else if (d <= 1.3e+150) {
tmp = t_1 * (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D))));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.pow((M * (D / (d * 2.0))), 2.0) t_1 = math.sqrt((d / h)) * math.sqrt((d / l)) t_2 = M / (d / M) tmp = 0 if d <= -3.2e-64: tmp = t_1 * (1.0 - ((h * (0.5 * t_0)) / l)) elif d <= -5e-310: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_2 * (h / d)) * 0.125))) elif d <= 7e-226: tmp = math.sqrt((h / math.pow(l, 3.0))) * (-0.125 * (D * (D * t_2))) elif d <= 2.2e-94: tmp = (math.sqrt(d) / math.sqrt((h * (l / d)))) * (1.0 + ((t_0 * (h * -0.5)) / l)) elif d <= 1.3e+150: tmp = t_1 * (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(M * Float64(D / Float64(d * 2.0))) ^ 2.0 t_1 = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) t_2 = Float64(M / Float64(d / M)) tmp = 0.0 if (d <= -3.2e-64) tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(h * Float64(0.5 * t_0)) / l))); elseif (d <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + Float64(Float64(D * Float64(D / l)) * Float64(Float64(t_2 * Float64(h / d)) * 0.125)))); elseif (d <= 7e-226) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(-0.125 * Float64(D * Float64(D * t_2)))); elseif (d <= 2.2e-94) tmp = Float64(Float64(sqrt(d) / sqrt(Float64(h * Float64(l / d)))) * Float64(1.0 + Float64(Float64(t_0 * Float64(h * -0.5)) / l))); elseif (d <= 1.3e+150) tmp = Float64(t_1 * Float64(1.0 - Float64(0.125 * Float64(D / Float64(Float64(Float64(d * d) / Float64(Float64(h * M) / Float64(l / M))) / D))))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(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 = (M * (D / (d * 2.0))) ^ 2.0;
t_1 = sqrt((d / h)) * sqrt((d / l));
t_2 = M / (d / M);
tmp = 0.0;
if (d <= -3.2e-64)
tmp = t_1 * (1.0 - ((h * (0.5 * t_0)) / l));
elseif (d <= -5e-310)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_2 * (h / d)) * 0.125)));
elseif (d <= 7e-226)
tmp = sqrt((h / (l ^ 3.0))) * (-0.125 * (D * (D * t_2)));
elseif (d <= 2.2e-94)
tmp = (sqrt(d) / sqrt((h * (l / d)))) * (1.0 + ((t_0 * (h * -0.5)) / l));
elseif (d <= 1.3e+150)
tmp = t_1 * (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D))));
else
tmp = d / (sqrt(h) * sqrt(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[Power[N[(M * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -3.2e-64], N[(t$95$1 * N[(1.0 - N[(N[(h * N[(0.5 * t$95$0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$2 * N[(h / d), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7e-226], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(D * N[(D * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.2e-94], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[N[(h * N[(l / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(t$95$0 * N[(h * -0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.3e+150], N[(t$95$1 * N[(1.0 - N[(0.125 * N[(D / N[(N[(N[(d * d), $MachinePrecision] / N[(N[(h * M), $MachinePrecision] / N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}\\
t_1 := \sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
t_2 := \frac{M}{\frac{d}{M}}\\
\mathbf{if}\;d \leq -3.2 \cdot 10^{-64}:\\
\;\;\;\;t_1 \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot t_0\right)}{\ell}\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + \left(D \cdot \frac{D}{\ell}\right) \cdot \left(\left(t_2 \cdot \frac{h}{d}\right) \cdot 0.125\right)\right)\\
\mathbf{elif}\;d \leq 7 \cdot 10^{-226}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(D \cdot \left(D \cdot t_2\right)\right)\right)\\
\mathbf{elif}\;d \leq 2.2 \cdot 10^{-94}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h \cdot \frac{\ell}{d}}} \cdot \left(1 + \frac{t_0 \cdot \left(h \cdot -0.5\right)}{\ell}\right)\\
\mathbf{elif}\;d \leq 1.3 \cdot 10^{+150}:\\
\;\;\;\;t_1 \cdot \left(1 - 0.125 \cdot \frac{D}{\frac{\frac{d \cdot d}{\frac{h \cdot M}{\frac{\ell}{M}}}}{D}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -3.19999999999999975e-64Initial program 80.9%
metadata-eval80.9%
unpow1/280.9%
metadata-eval80.9%
unpow1/280.9%
*-commutative80.9%
associate-*l*80.9%
times-frac80.9%
metadata-eval80.9%
Simplified80.9%
associate-*r*80.9%
frac-times80.9%
*-commutative80.9%
metadata-eval80.9%
associate-*r/82.2%
metadata-eval82.2%
*-commutative82.2%
frac-times82.2%
associate-*l/82.2%
associate-*r/82.2%
associate-/l/82.2%
*-commutative82.2%
Applied egg-rr82.2%
if -3.19999999999999975e-64 < d < -4.999999999999985e-310Initial program 53.6%
Applied egg-rr7.2%
expm1-def13.6%
expm1-log1p49.3%
*-commutative49.3%
*-commutative49.3%
associate-/l*49.3%
Simplified49.3%
Taylor expanded in d around -inf 78.1%
mul-1-neg78.1%
associate-/r*78.1%
distribute-rgt-neg-in78.1%
associate-/l/78.1%
Simplified78.1%
Taylor expanded in M around 0 53.7%
*-commutative53.7%
times-frac60.3%
unpow260.3%
times-frac62.5%
unpow262.5%
associate-*l*62.5%
unpow262.5%
associate-*l/66.9%
*-commutative66.9%
associate-/l*69.1%
Simplified69.1%
if -4.999999999999985e-310 < d < 7e-226Initial program 39.3%
metadata-eval39.3%
unpow1/239.3%
metadata-eval39.3%
unpow1/239.3%
*-commutative39.3%
associate-*l*39.3%
times-frac36.2%
metadata-eval36.2%
Simplified36.2%
associate-*r*36.2%
frac-times39.3%
*-commutative39.3%
metadata-eval39.3%
associate-*r/39.4%
metadata-eval39.4%
*-commutative39.4%
frac-times36.3%
associate-*l/36.3%
associate-*r/36.3%
associate-/l/36.3%
*-commutative36.3%
Applied egg-rr36.3%
Taylor expanded in d around 0 46.8%
associate-*r*46.8%
*-commutative46.8%
associate-*r/46.8%
unpow246.8%
unpow246.8%
associate-*l*50.5%
associate-/l*57.8%
Simplified57.8%
if 7e-226 < d < 2.20000000000000001e-94Initial program 53.9%
metadata-eval53.9%
unpow1/253.9%
metadata-eval53.9%
unpow1/253.9%
*-commutative53.9%
associate-*l*53.9%
times-frac53.7%
metadata-eval53.7%
Simplified53.7%
associate-*r*53.7%
frac-times53.9%
*-commutative53.9%
metadata-eval53.9%
associate-*r/59.6%
metadata-eval59.6%
*-commutative59.6%
frac-times59.4%
associate-*l/59.4%
associate-*r/59.4%
associate-/l/59.4%
*-commutative59.4%
Applied egg-rr59.4%
*-commutative59.4%
sqrt-prod48.3%
associate-/l*42.5%
associate-*r/42.6%
*-commutative42.6%
associate-*r/42.5%
associate-*r/42.5%
pow142.5%
Applied egg-rr42.7%
unpow142.7%
*-commutative42.7%
associate-/l*42.6%
cancel-sign-sub-inv42.6%
associate-*r/42.6%
associate-*r/48.4%
distribute-lft-neg-in48.4%
distribute-rgt-neg-in48.4%
*-commutative48.4%
*-commutative48.4%
distribute-rgt-neg-in48.4%
metadata-eval48.4%
Simplified48.4%
sqrt-div65.6%
associate-/r/56.7%
Applied egg-rr56.7%
associate-/r/65.6%
*-rgt-identity65.6%
associate-*r/65.6%
associate-/r/65.6%
associate-*l/65.5%
*-lft-identity65.5%
Simplified65.5%
if 2.20000000000000001e-94 < d < 1.30000000000000003e150Initial program 80.7%
metadata-eval80.7%
unpow1/280.7%
metadata-eval80.7%
unpow1/280.7%
*-commutative80.7%
associate-*l*80.7%
times-frac80.7%
metadata-eval80.7%
Simplified80.7%
Taylor expanded in M around 0 71.7%
associate-*r/71.7%
*-commutative71.7%
associate-*r/71.7%
*-commutative71.7%
times-frac75.3%
unpow275.3%
*-commutative75.3%
unpow275.3%
unpow275.3%
Simplified75.3%
Taylor expanded in D around 0 71.7%
associate-/l*73.5%
*-commutative73.5%
*-commutative73.5%
unpow273.5%
associate-/l*73.5%
*-commutative73.5%
associate-/l*77.2%
unpow277.2%
unpow277.2%
associate-*r*78.9%
associate-/l*84.2%
*-commutative84.2%
Simplified84.2%
if 1.30000000000000003e150 < d Initial program 70.4%
metadata-eval70.4%
unpow1/270.4%
metadata-eval70.4%
unpow1/270.4%
*-commutative70.4%
associate-*l*70.4%
times-frac70.4%
metadata-eval70.4%
Simplified70.4%
associate-*r*70.4%
frac-times70.4%
*-commutative70.4%
metadata-eval70.4%
associate-*r/74.0%
metadata-eval74.0%
*-commutative74.0%
frac-times74.0%
associate-*l/74.0%
associate-*r/74.0%
associate-/l/74.0%
*-commutative74.0%
Applied egg-rr74.0%
Taylor expanded in d around inf 70.0%
*-commutative70.0%
*-commutative70.0%
associate-/r*70.0%
Simplified70.0%
associate-/r*70.0%
associate-/l/70.0%
add-cbrt-cube62.1%
add-sqr-sqrt62.0%
pow162.0%
add-sqr-sqrt62.1%
add-cbrt-cube70.0%
associate-/l/70.0%
sqrt-div69.9%
metadata-eval69.9%
*-commutative69.9%
Applied egg-rr69.9%
unpow169.9%
associate-*r/70.0%
*-rgt-identity70.0%
Simplified70.0%
sqrt-prod84.4%
Applied egg-rr84.4%
Final simplification75.7%
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 (<= l -2.1e+120)
(*
t_0
(* (- 1.0 (* 0.5 (* (pow (* (/ M 2.0) (/ D d)) 2.0) (/ h l)))) t_1))
(if (<= l -2.15e-302)
(*
(fma (pow (* (/ M d) (/ D 2.0)) 2.0) (* (/ h l) -0.5) 1.0)
(/ (- d) (sqrt (* h l))))
(if (<= l 9.5e+152)
(*
t_0
(* t_1 (- 1.0 (* 0.5 (/ (* h (pow (* M (/ D (* d 2.0))) 2.0)) l)))))
(* d (/ (pow h -0.5) (sqrt 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 (l <= -2.1e+120) {
tmp = t_0 * ((1.0 - (0.5 * (pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) * t_1);
} else if (l <= -2.15e-302) {
tmp = fma(pow(((M / d) * (D / 2.0)), 2.0), ((h / l) * -0.5), 1.0) * (-d / sqrt((h * l)));
} else if (l <= 9.5e+152) {
tmp = t_0 * (t_1 * (1.0 - (0.5 * ((h * pow((M * (D / (d * 2.0))), 2.0)) / l))));
} else {
tmp = d * (pow(h, -0.5) / sqrt(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 (l <= -2.1e+120) tmp = Float64(t_0 * Float64(Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(h / l)))) * t_1)); elseif (l <= -2.15e-302) tmp = Float64(fma((Float64(Float64(M / d) * Float64(D / 2.0)) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0) * Float64(Float64(-d) / sqrt(Float64(h * l)))); elseif (l <= 9.5e+152) tmp = Float64(t_0 * Float64(t_1 * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M * Float64(D / Float64(d * 2.0))) ^ 2.0)) / l))))); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); 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[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -2.1e+120], N[(t$95$0 * 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] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2.15e-302], N[(N[(N[Power[N[(N[(M / d), $MachinePrecision] * N[(D / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] * N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 9.5e+152], N[(t$95$0 * N[(t$95$1 * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $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}\;\ell \leq -2.1 \cdot 10^{+120}:\\
\;\;\;\;t_0 \cdot \left(\left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot t_1\right)\\
\mathbf{elif}\;\ell \leq -2.15 \cdot 10^{-302}:\\
\;\;\;\;\mathsf{fma}\left({\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right) \cdot \frac{-d}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;\ell \leq 9.5 \cdot 10^{+152}:\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.1e120Initial program 68.3%
associate-*l*68.4%
metadata-eval68.4%
unpow1/268.4%
metadata-eval68.4%
unpow1/268.4%
associate-*l*68.4%
metadata-eval68.4%
times-frac68.5%
Simplified68.5%
if -2.1e120 < l < -2.1500000000000001e-302Initial program 69.3%
Applied egg-rr20.0%
expm1-def26.2%
expm1-log1p64.2%
*-commutative64.2%
*-commutative64.2%
associate-/l*64.2%
Simplified64.2%
Taylor expanded in d around -inf 84.4%
mul-1-neg84.4%
associate-/r*84.4%
distribute-rgt-neg-in84.4%
associate-/l/84.4%
Simplified84.4%
pow184.4%
Applied egg-rr84.4%
unpow184.4%
associate-*r*84.4%
*-commutative84.4%
Simplified82.9%
if -2.1500000000000001e-302 < l < 9.49999999999999916e152Initial program 67.9%
associate-*l*67.1%
metadata-eval67.1%
unpow1/267.1%
metadata-eval67.1%
unpow1/267.1%
associate-*l*67.1%
metadata-eval67.1%
times-frac66.3%
Simplified66.3%
associate-*r/70.9%
associate-*l/70.9%
associate-*r/70.9%
associate-/l/70.9%
*-commutative70.9%
Applied egg-rr70.9%
if 9.49999999999999916e152 < l Initial program 55.4%
metadata-eval55.4%
unpow1/255.4%
metadata-eval55.4%
unpow1/255.4%
*-commutative55.4%
associate-*l*55.4%
times-frac55.4%
metadata-eval55.4%
Simplified55.4%
associate-*r*55.4%
frac-times55.4%
*-commutative55.4%
metadata-eval55.4%
associate-*r/50.3%
metadata-eval50.3%
*-commutative50.3%
frac-times50.3%
associate-*l/50.3%
associate-*r/50.3%
associate-/l/50.3%
*-commutative50.3%
Applied egg-rr50.3%
Taylor expanded in d around inf 49.9%
*-commutative49.9%
*-commutative49.9%
associate-/r*49.9%
Simplified49.9%
sqrt-div62.6%
Applied egg-rr62.6%
div-inv62.5%
inv-pow62.5%
Applied egg-rr62.5%
associate-*r/62.6%
associate-/l*62.6%
sqr-pow62.7%
rem-sqrt-square62.7%
metadata-eval62.7%
sqr-pow62.7%
fabs-sqr62.7%
sqr-pow62.7%
/-rgt-identity62.7%
Simplified62.7%
Final simplification72.8%
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 (<= l -3.7e+113)
(*
(* t_0 t_1)
(- 1.0 (* (* 0.5 (/ h l)) (pow (/ (/ (* M D) 2.0) d) 2.0))))
(if (<= l -1.2e-303)
(*
(fma (pow (* (/ M d) (/ D 2.0)) 2.0) (* (/ h l) -0.5) 1.0)
(/ (- d) (sqrt (* h l))))
(if (<= l 5.6e+153)
(*
t_0
(* t_1 (- 1.0 (* 0.5 (/ (* h (pow (* M (/ D (* d 2.0))) 2.0)) l)))))
(* d (/ (pow h -0.5) (sqrt 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 (l <= -3.7e+113) {
tmp = (t_0 * t_1) * (1.0 - ((0.5 * (h / l)) * pow((((M * D) / 2.0) / d), 2.0)));
} else if (l <= -1.2e-303) {
tmp = fma(pow(((M / d) * (D / 2.0)), 2.0), ((h / l) * -0.5), 1.0) * (-d / sqrt((h * l)));
} else if (l <= 5.6e+153) {
tmp = t_0 * (t_1 * (1.0 - (0.5 * ((h * pow((M * (D / (d * 2.0))), 2.0)) / l))));
} else {
tmp = d * (pow(h, -0.5) / sqrt(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 (l <= -3.7e+113) tmp = Float64(Float64(t_0 * t_1) * Float64(1.0 - Float64(Float64(0.5 * Float64(h / l)) * (Float64(Float64(Float64(M * D) / 2.0) / d) ^ 2.0)))); elseif (l <= -1.2e-303) tmp = Float64(fma((Float64(Float64(M / d) * Float64(D / 2.0)) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0) * Float64(Float64(-d) / sqrt(Float64(h * l)))); elseif (l <= 5.6e+153) tmp = Float64(t_0 * Float64(t_1 * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M * Float64(D / Float64(d * 2.0))) ^ 2.0)) / l))))); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); 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[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -3.7e+113], N[(N[(t$95$0 * t$95$1), $MachinePrecision] * N[(1.0 - N[(N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(M * D), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1.2e-303], N[(N[(N[Power[N[(N[(M / d), $MachinePrecision] * N[(D / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] * N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.6e+153], N[(t$95$0 * N[(t$95$1 * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $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}\;\ell \leq -3.7 \cdot 10^{+113}:\\
\;\;\;\;\left(t_0 \cdot t_1\right) \cdot \left(1 - \left(0.5 \cdot \frac{h}{\ell}\right) \cdot {\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2}\right)\\
\mathbf{elif}\;\ell \leq -1.2 \cdot 10^{-303}:\\
\;\;\;\;\mathsf{fma}\left({\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right) \cdot \frac{-d}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;\ell \leq 5.6 \cdot 10^{+153}:\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -3.6999999999999998e113Initial program 68.3%
metadata-eval68.3%
unpow1/268.3%
metadata-eval68.3%
unpow1/268.3%
*-commutative68.3%
associate-*l*68.3%
times-frac68.4%
metadata-eval68.4%
Simplified68.4%
frac-times68.3%
associate-/r*68.3%
Applied egg-rr68.3%
if -3.6999999999999998e113 < l < -1.2e-303Initial program 69.3%
Applied egg-rr20.0%
expm1-def26.2%
expm1-log1p64.2%
*-commutative64.2%
*-commutative64.2%
associate-/l*64.2%
Simplified64.2%
Taylor expanded in d around -inf 84.4%
mul-1-neg84.4%
associate-/r*84.4%
distribute-rgt-neg-in84.4%
associate-/l/84.4%
Simplified84.4%
pow184.4%
Applied egg-rr84.4%
unpow184.4%
associate-*r*84.4%
*-commutative84.4%
Simplified82.9%
if -1.2e-303 < l < 5.5999999999999997e153Initial program 67.9%
associate-*l*67.1%
metadata-eval67.1%
unpow1/267.1%
metadata-eval67.1%
unpow1/267.1%
associate-*l*67.1%
metadata-eval67.1%
times-frac66.3%
Simplified66.3%
associate-*r/70.9%
associate-*l/70.9%
associate-*r/70.9%
associate-/l/70.9%
*-commutative70.9%
Applied egg-rr70.9%
if 5.5999999999999997e153 < l Initial program 55.4%
metadata-eval55.4%
unpow1/255.4%
metadata-eval55.4%
unpow1/255.4%
*-commutative55.4%
associate-*l*55.4%
times-frac55.4%
metadata-eval55.4%
Simplified55.4%
associate-*r*55.4%
frac-times55.4%
*-commutative55.4%
metadata-eval55.4%
associate-*r/50.3%
metadata-eval50.3%
*-commutative50.3%
frac-times50.3%
associate-*l/50.3%
associate-*r/50.3%
associate-/l/50.3%
*-commutative50.3%
Applied egg-rr50.3%
Taylor expanded in d around inf 49.9%
*-commutative49.9%
*-commutative49.9%
associate-/r*49.9%
Simplified49.9%
sqrt-div62.6%
Applied egg-rr62.6%
div-inv62.5%
inv-pow62.5%
Applied egg-rr62.5%
associate-*r/62.6%
associate-/l*62.6%
sqr-pow62.7%
rem-sqrt-square62.7%
metadata-eval62.7%
sqr-pow62.7%
fabs-sqr62.7%
sqr-pow62.7%
/-rgt-identity62.7%
Simplified62.7%
Final simplification72.8%
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 (<= l -2.65e+116)
(* t_0 (- 1.0 (* (* 0.5 (/ h l)) (pow (/ (/ (* M D) 2.0) d) 2.0))))
(if (<= l -4.2e-304)
(*
(fma (pow (* (/ M d) (/ D 2.0)) 2.0) (* (/ h l) -0.5) 1.0)
(/ (- d) (sqrt (* h l))))
(if (<= l 6.3e+153)
(* t_0 (- 1.0 (/ (* h (* 0.5 (pow (* M (/ D (* d 2.0))) 2.0))) l)))
(* d (/ (pow h -0.5) (sqrt 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)) * sqrt((d / l));
double tmp;
if (l <= -2.65e+116) {
tmp = t_0 * (1.0 - ((0.5 * (h / l)) * pow((((M * D) / 2.0) / d), 2.0)));
} else if (l <= -4.2e-304) {
tmp = fma(pow(((M / d) * (D / 2.0)), 2.0), ((h / l) * -0.5), 1.0) * (-d / sqrt((h * l)));
} else if (l <= 6.3e+153) {
tmp = t_0 * (1.0 - ((h * (0.5 * pow((M * (D / (d * 2.0))), 2.0))) / l));
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
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 (l <= -2.65e+116) tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(0.5 * Float64(h / l)) * (Float64(Float64(Float64(M * D) / 2.0) / d) ^ 2.0)))); elseif (l <= -4.2e-304) tmp = Float64(fma((Float64(Float64(M / d) * Float64(D / 2.0)) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0) * Float64(Float64(-d) / sqrt(Float64(h * l)))); elseif (l <= 6.3e+153) tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(M * Float64(D / Float64(d * 2.0))) ^ 2.0))) / l))); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); 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[l, -2.65e+116], N[(t$95$0 * N[(1.0 - N[(N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(M * D), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -4.2e-304], N[(N[(N[Power[N[(N[(M / d), $MachinePrecision] * N[(D / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] * N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.3e+153], N[(t$95$0 * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(M * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $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}\;\ell \leq -2.65 \cdot 10^{+116}:\\
\;\;\;\;t_0 \cdot \left(1 - \left(0.5 \cdot \frac{h}{\ell}\right) \cdot {\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2}\right)\\
\mathbf{elif}\;\ell \leq -4.2 \cdot 10^{-304}:\\
\;\;\;\;\mathsf{fma}\left({\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right) \cdot \frac{-d}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;\ell \leq 6.3 \cdot 10^{+153}:\\
\;\;\;\;t_0 \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}\right)}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.6500000000000001e116Initial program 68.3%
metadata-eval68.3%
unpow1/268.3%
metadata-eval68.3%
unpow1/268.3%
*-commutative68.3%
associate-*l*68.3%
times-frac68.4%
metadata-eval68.4%
Simplified68.4%
frac-times68.3%
associate-/r*68.3%
Applied egg-rr68.3%
if -2.6500000000000001e116 < l < -4.20000000000000016e-304Initial program 69.3%
Applied egg-rr20.0%
expm1-def26.2%
expm1-log1p64.2%
*-commutative64.2%
*-commutative64.2%
associate-/l*64.2%
Simplified64.2%
Taylor expanded in d around -inf 84.4%
mul-1-neg84.4%
associate-/r*84.4%
distribute-rgt-neg-in84.4%
associate-/l/84.4%
Simplified84.4%
pow184.4%
Applied egg-rr84.4%
unpow184.4%
associate-*r*84.4%
*-commutative84.4%
Simplified82.9%
if -4.20000000000000016e-304 < l < 6.3000000000000001e153Initial program 67.9%
metadata-eval67.9%
unpow1/267.9%
metadata-eval67.9%
unpow1/267.9%
*-commutative67.9%
associate-*l*67.9%
times-frac67.1%
metadata-eval67.1%
Simplified67.1%
associate-*r*67.1%
frac-times67.9%
*-commutative67.9%
metadata-eval67.9%
associate-*r/73.3%
metadata-eval73.3%
*-commutative73.3%
frac-times72.5%
associate-*l/72.5%
associate-*r/72.5%
associate-/l/72.5%
*-commutative72.5%
Applied egg-rr72.5%
if 6.3000000000000001e153 < l Initial program 55.4%
metadata-eval55.4%
unpow1/255.4%
metadata-eval55.4%
unpow1/255.4%
*-commutative55.4%
associate-*l*55.4%
times-frac55.4%
metadata-eval55.4%
Simplified55.4%
associate-*r*55.4%
frac-times55.4%
*-commutative55.4%
metadata-eval55.4%
associate-*r/50.3%
metadata-eval50.3%
*-commutative50.3%
frac-times50.3%
associate-*l/50.3%
associate-*r/50.3%
associate-/l/50.3%
*-commutative50.3%
Applied egg-rr50.3%
Taylor expanded in d around inf 49.9%
*-commutative49.9%
*-commutative49.9%
associate-/r*49.9%
Simplified49.9%
sqrt-div62.6%
Applied egg-rr62.6%
div-inv62.5%
inv-pow62.5%
Applied egg-rr62.5%
associate-*r/62.6%
associate-/l*62.6%
sqr-pow62.7%
rem-sqrt-square62.7%
metadata-eval62.7%
sqr-pow62.7%
fabs-sqr62.7%
sqr-pow62.7%
/-rgt-identity62.7%
Simplified62.7%
Final simplification73.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)) (sqrt (/ d l))))
(t_1 (* d (sqrt (/ 1.0 (* h l)))))
(t_2 (* 0.125 (/ D (/ (/ (* d d) (/ (* h M) (/ l M))) D))))
(t_3 (/ M (/ d M))))
(if (<= d -6.5e+80)
(*
(sqrt (/ (/ d h) (/ l d)))
(- 1.0 (* (pow (* D (/ M (* d 2.0))) 2.0) (* h (/ 0.5 l)))))
(if (<= d -2.8e-66)
(* t_0 (- 1.0 (/ (* 0.125 (/ (* (* M D) (* M D)) (/ d (/ h d)))) l)))
(if (<= d -4.5e-113)
(* t_1 (+ -1.0 t_2))
(if (<= d -5e-310)
(* t_1 (+ -1.0 (* (* D (/ D l)) (* (* t_3 (/ h d)) 0.125))))
(if (<= d 1.55e-107)
(* (sqrt (/ h (pow l 3.0))) (* -0.125 (* D (* D t_3))))
(if (<= d 1.38e+147)
(* t_0 (- 1.0 t_2))
(/ d (* (sqrt h) (sqrt 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)) * sqrt((d / l));
double t_1 = d * sqrt((1.0 / (h * l)));
double t_2 = 0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D));
double t_3 = M / (d / M);
double tmp;
if (d <= -6.5e+80) {
tmp = sqrt(((d / h) / (l / d))) * (1.0 - (pow((D * (M / (d * 2.0))), 2.0) * (h * (0.5 / l))));
} else if (d <= -2.8e-66) {
tmp = t_0 * (1.0 - ((0.125 * (((M * D) * (M * D)) / (d / (h / d)))) / l));
} else if (d <= -4.5e-113) {
tmp = t_1 * (-1.0 + t_2);
} else if (d <= -5e-310) {
tmp = t_1 * (-1.0 + ((D * (D / l)) * ((t_3 * (h / d)) * 0.125)));
} else if (d <= 1.55e-107) {
tmp = sqrt((h / pow(l, 3.0))) * (-0.125 * (D * (D * t_3)));
} else if (d <= 1.38e+147) {
tmp = t_0 * (1.0 - t_2);
} else {
tmp = d / (sqrt(h) * sqrt(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) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = sqrt((d / h)) * sqrt((d / l))
t_1 = d * sqrt((1.0d0 / (h * l)))
t_2 = 0.125d0 * (d_1 / (((d * d) / ((h * m) / (l / m))) / d_1))
t_3 = m / (d / m)
if (d <= (-6.5d+80)) then
tmp = sqrt(((d / h) / (l / d))) * (1.0d0 - (((d_1 * (m / (d * 2.0d0))) ** 2.0d0) * (h * (0.5d0 / l))))
else if (d <= (-2.8d-66)) then
tmp = t_0 * (1.0d0 - ((0.125d0 * (((m * d_1) * (m * d_1)) / (d / (h / d)))) / l))
else if (d <= (-4.5d-113)) then
tmp = t_1 * ((-1.0d0) + t_2)
else if (d <= (-5d-310)) then
tmp = t_1 * ((-1.0d0) + ((d_1 * (d_1 / l)) * ((t_3 * (h / d)) * 0.125d0)))
else if (d <= 1.55d-107) then
tmp = sqrt((h / (l ** 3.0d0))) * ((-0.125d0) * (d_1 * (d_1 * t_3)))
else if (d <= 1.38d+147) then
tmp = t_0 * (1.0d0 - t_2)
else
tmp = d / (sqrt(h) * sqrt(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)) * Math.sqrt((d / l));
double t_1 = d * Math.sqrt((1.0 / (h * l)));
double t_2 = 0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D));
double t_3 = M / (d / M);
double tmp;
if (d <= -6.5e+80) {
tmp = Math.sqrt(((d / h) / (l / d))) * (1.0 - (Math.pow((D * (M / (d * 2.0))), 2.0) * (h * (0.5 / l))));
} else if (d <= -2.8e-66) {
tmp = t_0 * (1.0 - ((0.125 * (((M * D) * (M * D)) / (d / (h / d)))) / l));
} else if (d <= -4.5e-113) {
tmp = t_1 * (-1.0 + t_2);
} else if (d <= -5e-310) {
tmp = t_1 * (-1.0 + ((D * (D / l)) * ((t_3 * (h / d)) * 0.125)));
} else if (d <= 1.55e-107) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (-0.125 * (D * (D * t_3)));
} else if (d <= 1.38e+147) {
tmp = t_0 * (1.0 - t_2);
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
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)) t_1 = d * math.sqrt((1.0 / (h * l))) t_2 = 0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)) t_3 = M / (d / M) tmp = 0 if d <= -6.5e+80: tmp = math.sqrt(((d / h) / (l / d))) * (1.0 - (math.pow((D * (M / (d * 2.0))), 2.0) * (h * (0.5 / l)))) elif d <= -2.8e-66: tmp = t_0 * (1.0 - ((0.125 * (((M * D) * (M * D)) / (d / (h / d)))) / l)) elif d <= -4.5e-113: tmp = t_1 * (-1.0 + t_2) elif d <= -5e-310: tmp = t_1 * (-1.0 + ((D * (D / l)) * ((t_3 * (h / d)) * 0.125))) elif d <= 1.55e-107: tmp = math.sqrt((h / math.pow(l, 3.0))) * (-0.125 * (D * (D * t_3))) elif d <= 1.38e+147: tmp = t_0 * (1.0 - t_2) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) 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))) t_1 = Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) t_2 = Float64(0.125 * Float64(D / Float64(Float64(Float64(d * d) / Float64(Float64(h * M) / Float64(l / M))) / D))) t_3 = Float64(M / Float64(d / M)) tmp = 0.0 if (d <= -6.5e+80) tmp = Float64(sqrt(Float64(Float64(d / h) / Float64(l / d))) * Float64(1.0 - Float64((Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0) * Float64(h * Float64(0.5 / l))))); elseif (d <= -2.8e-66) tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(0.125 * Float64(Float64(Float64(M * D) * Float64(M * D)) / Float64(d / Float64(h / d)))) / l))); elseif (d <= -4.5e-113) tmp = Float64(t_1 * Float64(-1.0 + t_2)); elseif (d <= -5e-310) tmp = Float64(t_1 * Float64(-1.0 + Float64(Float64(D * Float64(D / l)) * Float64(Float64(t_3 * Float64(h / d)) * 0.125)))); elseif (d <= 1.55e-107) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(-0.125 * Float64(D * Float64(D * t_3)))); elseif (d <= 1.38e+147) tmp = Float64(t_0 * Float64(1.0 - t_2)); else tmp = Float64(d / Float64(sqrt(h) * sqrt(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)) * sqrt((d / l));
t_1 = d * sqrt((1.0 / (h * l)));
t_2 = 0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D));
t_3 = M / (d / M);
tmp = 0.0;
if (d <= -6.5e+80)
tmp = sqrt(((d / h) / (l / d))) * (1.0 - (((D * (M / (d * 2.0))) ^ 2.0) * (h * (0.5 / l))));
elseif (d <= -2.8e-66)
tmp = t_0 * (1.0 - ((0.125 * (((M * D) * (M * D)) / (d / (h / d)))) / l));
elseif (d <= -4.5e-113)
tmp = t_1 * (-1.0 + t_2);
elseif (d <= -5e-310)
tmp = t_1 * (-1.0 + ((D * (D / l)) * ((t_3 * (h / d)) * 0.125)));
elseif (d <= 1.55e-107)
tmp = sqrt((h / (l ^ 3.0))) * (-0.125 * (D * (D * t_3)));
elseif (d <= 1.38e+147)
tmp = t_0 * (1.0 - t_2);
else
tmp = d / (sqrt(h) * sqrt(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[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.125 * N[(D / N[(N[(N[(d * d), $MachinePrecision] / N[(N[(h * M), $MachinePrecision] / N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -6.5e+80], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] / N[(l / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * N[(0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2.8e-66], N[(t$95$0 * N[(1.0 - N[(N[(0.125 * N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / N[(d / N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4.5e-113], N[(t$95$1 * N[(-1.0 + t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(t$95$1 * N[(-1.0 + N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$3 * N[(h / d), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.55e-107], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(D * N[(D * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.38e+147], N[(t$95$0 * N[(1.0 - t$95$2), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $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}}\\
t_1 := d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
t_2 := 0.125 \cdot \frac{D}{\frac{\frac{d \cdot d}{\frac{h \cdot M}{\frac{\ell}{M}}}}{D}}\\
t_3 := \frac{M}{\frac{d}{M}}\\
\mathbf{if}\;d \leq -6.5 \cdot 10^{+80}:\\
\;\;\;\;\sqrt{\frac{\frac{d}{h}}{\frac{\ell}{d}}} \cdot \left(1 - {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2} \cdot \left(h \cdot \frac{0.5}{\ell}\right)\right)\\
\mathbf{elif}\;d \leq -2.8 \cdot 10^{-66}:\\
\;\;\;\;t_0 \cdot \left(1 - \frac{0.125 \cdot \frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{\frac{d}{\frac{h}{d}}}}{\ell}\right)\\
\mathbf{elif}\;d \leq -4.5 \cdot 10^{-113}:\\
\;\;\;\;t_1 \cdot \left(-1 + t_2\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t_1 \cdot \left(-1 + \left(D \cdot \frac{D}{\ell}\right) \cdot \left(\left(t_3 \cdot \frac{h}{d}\right) \cdot 0.125\right)\right)\\
\mathbf{elif}\;d \leq 1.55 \cdot 10^{-107}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(D \cdot \left(D \cdot t_3\right)\right)\right)\\
\mathbf{elif}\;d \leq 1.38 \cdot 10^{+147}:\\
\;\;\;\;t_0 \cdot \left(1 - t_2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -6.4999999999999998e80Initial program 82.6%
Applied egg-rr46.8%
expm1-def54.2%
expm1-log1p79.1%
associate-*r/75.5%
associate-/l*79.1%
associate-*r/79.1%
associate-*l/79.1%
*-commutative79.1%
*-commutative79.1%
associate-/l*79.1%
associate-/r/79.1%
Simplified79.1%
if -6.4999999999999998e80 < d < -2.8e-66Initial program 80.3%
metadata-eval80.3%
unpow1/280.3%
metadata-eval80.3%
unpow1/280.3%
*-commutative80.3%
associate-*l*80.3%
times-frac80.3%
metadata-eval80.3%
Simplified80.3%
associate-*r*80.3%
frac-times80.3%
*-commutative80.3%
metadata-eval80.3%
associate-*r/85.0%
metadata-eval85.0%
*-commutative85.0%
frac-times85.1%
associate-*l/85.1%
associate-*r/85.1%
associate-/l/85.1%
*-commutative85.1%
Applied egg-rr85.1%
Taylor expanded in M around 0 63.3%
associate-*r*68.2%
associate-/l*64.4%
unpow264.4%
unpow264.4%
unswap-sqr80.7%
unpow280.7%
associate-/l*80.6%
Simplified80.6%
if -2.8e-66 < d < -4.5000000000000001e-113Initial program 78.2%
Applied egg-rr11.5%
expm1-def22.1%
expm1-log1p67.1%
*-commutative67.1%
*-commutative67.1%
associate-/l*67.1%
Simplified67.1%
Taylor expanded in d around -inf 78.2%
mul-1-neg78.2%
associate-/r*78.2%
distribute-rgt-neg-in78.2%
associate-/l/78.2%
Simplified78.2%
Taylor expanded in M around 0 56.2%
associate-/l*45.2%
*-commutative45.2%
unpow245.2%
associate-/l*55.7%
*-commutative55.7%
associate-/l*66.8%
unpow266.8%
unpow266.8%
associate-*r*66.8%
associate-/l*66.8%
*-commutative66.8%
Simplified77.9%
if -4.5000000000000001e-113 < d < -4.999999999999985e-310Initial program 45.9%
Applied egg-rr6.3%
expm1-def11.8%
expm1-log1p43.2%
*-commutative43.2%
*-commutative43.2%
associate-/l*43.2%
Simplified43.2%
Taylor expanded in d around -inf 77.4%
mul-1-neg77.4%
associate-/r*77.4%
distribute-rgt-neg-in77.4%
associate-/l/77.4%
Simplified77.4%
Taylor expanded in M around 0 51.8%
*-commutative51.8%
times-frac57.3%
unpow257.3%
times-frac60.2%
unpow260.2%
associate-*l*60.2%
unpow260.2%
associate-*l/63.2%
*-commutative63.2%
associate-/l*66.1%
Simplified66.1%
if -4.999999999999985e-310 < d < 1.55000000000000011e-107Initial program 47.9%
metadata-eval47.9%
unpow1/247.9%
metadata-eval47.9%
unpow1/247.9%
*-commutative47.9%
associate-*l*47.9%
times-frac46.2%
metadata-eval46.2%
Simplified46.2%
associate-*r*46.2%
frac-times47.9%
*-commutative47.9%
metadata-eval47.9%
associate-*r/47.9%
metadata-eval47.9%
*-commutative47.9%
frac-times46.3%
associate-*l/46.3%
associate-*r/46.3%
associate-/l/46.3%
*-commutative46.3%
Applied egg-rr46.3%
Taylor expanded in d around 0 39.5%
associate-*r*39.5%
*-commutative39.5%
associate-*r/37.9%
unpow237.9%
unpow237.9%
associate-*l*41.9%
associate-/l*48.9%
Simplified48.9%
if 1.55000000000000011e-107 < d < 1.37999999999999991e147Initial program 77.4%
metadata-eval77.4%
unpow1/277.4%
metadata-eval77.4%
unpow1/277.4%
*-commutative77.4%
associate-*l*77.4%
times-frac77.4%
metadata-eval77.4%
Simplified77.4%
Taylor expanded in M around 0 70.8%
associate-*r/70.8%
*-commutative70.8%
associate-*r/70.8%
*-commutative70.8%
times-frac75.7%
unpow275.7%
*-commutative75.7%
unpow275.7%
unpow275.7%
Simplified75.7%
Taylor expanded in D around 0 70.8%
associate-/l*72.4%
*-commutative72.4%
*-commutative72.4%
unpow272.4%
associate-/l*72.5%
*-commutative72.5%
associate-/l*75.8%
unpow275.8%
unpow275.8%
associate-*r*77.5%
associate-/l*82.3%
*-commutative82.3%
Simplified82.3%
if 1.37999999999999991e147 < d Initial program 70.4%
metadata-eval70.4%
unpow1/270.4%
metadata-eval70.4%
unpow1/270.4%
*-commutative70.4%
associate-*l*70.4%
times-frac70.4%
metadata-eval70.4%
Simplified70.4%
associate-*r*70.4%
frac-times70.4%
*-commutative70.4%
metadata-eval70.4%
associate-*r/74.0%
metadata-eval74.0%
*-commutative74.0%
frac-times74.0%
associate-*l/74.0%
associate-*r/74.0%
associate-/l/74.0%
*-commutative74.0%
Applied egg-rr74.0%
Taylor expanded in d around inf 70.0%
*-commutative70.0%
*-commutative70.0%
associate-/r*70.0%
Simplified70.0%
associate-/r*70.0%
associate-/l/70.0%
add-cbrt-cube62.1%
add-sqr-sqrt62.0%
pow162.0%
add-sqr-sqrt62.1%
add-cbrt-cube70.0%
associate-/l/70.0%
sqrt-div69.9%
metadata-eval69.9%
*-commutative69.9%
Applied egg-rr69.9%
unpow169.9%
associate-*r/70.0%
*-rgt-identity70.0%
Simplified70.0%
sqrt-prod84.4%
Applied egg-rr84.4%
Final simplification72.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 (/ M (/ d M))))
(if (<= d -2.4e-63)
(*
(+ 1.0 (/ (* (pow (* M (/ D (* d 2.0))) 2.0) (* h -0.5)) l))
(sqrt (/ d (/ h (/ d l)))))
(if (<= d -5e-310)
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ -1.0 (* (* D (/ D l)) (* (* t_0 (/ h d)) 0.125))))
(if (<= d 2.6e-94)
(* (sqrt (/ h (pow l 3.0))) (* -0.125 (* D (* D t_0))))
(if (<= d 7.5e+149)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(- 1.0 (* 0.125 (* (/ (* D D) l) (/ (* h (* M M)) (* d d))))))
(/ d (* (sqrt h) (sqrt l)))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = M / (d / M);
double tmp;
if (d <= -2.4e-63) {
tmp = (1.0 + ((pow((M * (D / (d * 2.0))), 2.0) * (h * -0.5)) / l)) * sqrt((d / (h / (d / l))));
} else if (d <= -5e-310) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_0 * (h / d)) * 0.125)));
} else if (d <= 2.6e-94) {
tmp = sqrt((h / pow(l, 3.0))) * (-0.125 * (D * (D * t_0)));
} else if (d <= 7.5e+149) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.125 * (((D * D) / l) * ((h * (M * M)) / (d * d)))));
} else {
tmp = d / (sqrt(h) * sqrt(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 = m / (d / m)
if (d <= (-2.4d-63)) then
tmp = (1.0d0 + ((((m * (d_1 / (d * 2.0d0))) ** 2.0d0) * (h * (-0.5d0))) / l)) * sqrt((d / (h / (d / l))))
else if (d <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + ((d_1 * (d_1 / l)) * ((t_0 * (h / d)) * 0.125d0)))
else if (d <= 2.6d-94) then
tmp = sqrt((h / (l ** 3.0d0))) * ((-0.125d0) * (d_1 * (d_1 * t_0)))
else if (d <= 7.5d+149) then
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0d0 - (0.125d0 * (((d_1 * d_1) / l) * ((h * (m * m)) / (d * d)))))
else
tmp = d / (sqrt(h) * sqrt(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 = M / (d / M);
double tmp;
if (d <= -2.4e-63) {
tmp = (1.0 + ((Math.pow((M * (D / (d * 2.0))), 2.0) * (h * -0.5)) / l)) * Math.sqrt((d / (h / (d / l))));
} else if (d <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_0 * (h / d)) * 0.125)));
} else if (d <= 2.6e-94) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (-0.125 * (D * (D * t_0)));
} else if (d <= 7.5e+149) {
tmp = (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - (0.125 * (((D * D) / l) * ((h * (M * M)) / (d * d)))));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = M / (d / M) tmp = 0 if d <= -2.4e-63: tmp = (1.0 + ((math.pow((M * (D / (d * 2.0))), 2.0) * (h * -0.5)) / l)) * math.sqrt((d / (h / (d / l)))) elif d <= -5e-310: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_0 * (h / d)) * 0.125))) elif d <= 2.6e-94: tmp = math.sqrt((h / math.pow(l, 3.0))) * (-0.125 * (D * (D * t_0))) elif d <= 7.5e+149: tmp = (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - (0.125 * (((D * D) / l) * ((h * (M * M)) / (d * d))))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(M / Float64(d / M)) tmp = 0.0 if (d <= -2.4e-63) tmp = Float64(Float64(1.0 + Float64(Float64((Float64(M * Float64(D / Float64(d * 2.0))) ^ 2.0) * Float64(h * -0.5)) / l)) * sqrt(Float64(d / Float64(h / Float64(d / l))))); elseif (d <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + Float64(Float64(D * Float64(D / l)) * Float64(Float64(t_0 * Float64(h / d)) * 0.125)))); elseif (d <= 2.6e-94) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(-0.125 * Float64(D * Float64(D * t_0)))); elseif (d <= 7.5e+149) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.125 * Float64(Float64(Float64(D * D) / l) * Float64(Float64(h * Float64(M * M)) / Float64(d * d)))))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(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 = M / (d / M);
tmp = 0.0;
if (d <= -2.4e-63)
tmp = (1.0 + ((((M * (D / (d * 2.0))) ^ 2.0) * (h * -0.5)) / l)) * sqrt((d / (h / (d / l))));
elseif (d <= -5e-310)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_0 * (h / d)) * 0.125)));
elseif (d <= 2.6e-94)
tmp = sqrt((h / (l ^ 3.0))) * (-0.125 * (D * (D * t_0)));
elseif (d <= 7.5e+149)
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.125 * (((D * D) / l) * ((h * (M * M)) / (d * d)))));
else
tmp = d / (sqrt(h) * sqrt(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[(M / N[(d / M), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.4e-63], N[(N[(1.0 + N[(N[(N[Power[N[(M * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * -0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / N[(h / N[(d / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 * N[(h / d), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.6e-94], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(D * N[(D * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7.5e+149], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.125 * N[(N[(N[(D * D), $MachinePrecision] / l), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \frac{M}{\frac{d}{M}}\\
\mathbf{if}\;d \leq -2.4 \cdot 10^{-63}:\\
\;\;\;\;\left(1 + \frac{{\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2} \cdot \left(h \cdot -0.5\right)}{\ell}\right) \cdot \sqrt{\frac{d}{\frac{h}{\frac{d}{\ell}}}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + \left(D \cdot \frac{D}{\ell}\right) \cdot \left(\left(t_0 \cdot \frac{h}{d}\right) \cdot 0.125\right)\right)\\
\mathbf{elif}\;d \leq 2.6 \cdot 10^{-94}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(D \cdot \left(D \cdot t_0\right)\right)\right)\\
\mathbf{elif}\;d \leq 7.5 \cdot 10^{+149}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.125 \cdot \left(\frac{D \cdot D}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -2.4000000000000001e-63Initial program 80.9%
metadata-eval80.9%
unpow1/280.9%
metadata-eval80.9%
unpow1/280.9%
*-commutative80.9%
associate-*l*80.9%
times-frac80.9%
metadata-eval80.9%
Simplified80.9%
associate-*r*80.9%
frac-times80.9%
*-commutative80.9%
metadata-eval80.9%
associate-*r/82.2%
metadata-eval82.2%
*-commutative82.2%
frac-times82.2%
associate-*l/82.2%
associate-*r/82.2%
associate-/l/82.2%
*-commutative82.2%
Applied egg-rr82.2%
*-commutative82.2%
sqrt-prod71.4%
associate-/l*68.7%
associate-*r/68.7%
*-commutative68.7%
associate-*r/68.7%
associate-*r/68.7%
pow168.7%
Applied egg-rr68.5%
unpow168.5%
*-commutative68.5%
associate-/l*67.3%
cancel-sign-sub-inv67.3%
associate-*r/67.3%
associate-*r/70.3%
distribute-lft-neg-in70.3%
distribute-rgt-neg-in70.3%
*-commutative70.3%
*-commutative70.3%
distribute-rgt-neg-in70.3%
metadata-eval70.3%
Simplified70.3%
if -2.4000000000000001e-63 < d < -4.999999999999985e-310Initial program 53.6%
Applied egg-rr7.2%
expm1-def13.6%
expm1-log1p49.3%
*-commutative49.3%
*-commutative49.3%
associate-/l*49.3%
Simplified49.3%
Taylor expanded in d around -inf 78.1%
mul-1-neg78.1%
associate-/r*78.1%
distribute-rgt-neg-in78.1%
associate-/l/78.1%
Simplified78.1%
Taylor expanded in M around 0 53.7%
*-commutative53.7%
times-frac60.3%
unpow260.3%
times-frac62.5%
unpow262.5%
associate-*l*62.5%
unpow262.5%
associate-*l/66.9%
*-commutative66.9%
associate-/l*69.1%
Simplified69.1%
if -4.999999999999985e-310 < d < 2.59999999999999994e-94Initial program 48.1%
metadata-eval48.1%
unpow1/248.1%
metadata-eval48.1%
unpow1/248.1%
*-commutative48.1%
associate-*l*48.1%
times-frac46.7%
metadata-eval46.7%
Simplified46.7%
associate-*r*46.7%
frac-times48.1%
*-commutative48.1%
metadata-eval48.1%
associate-*r/51.3%
metadata-eval51.3%
*-commutative51.3%
frac-times49.8%
associate-*l/49.8%
associate-*r/49.8%
associate-/l/49.8%
*-commutative49.8%
Applied egg-rr49.8%
Taylor expanded in d around 0 40.6%
associate-*r*40.6%
*-commutative40.6%
associate-*r/39.1%
unpow239.1%
unpow239.1%
associate-*l*42.7%
associate-/l*50.7%
Simplified50.7%
if 2.59999999999999994e-94 < d < 7.50000000000000031e149Initial program 80.3%
metadata-eval80.3%
unpow1/280.3%
metadata-eval80.3%
unpow1/280.3%
*-commutative80.3%
associate-*l*80.3%
times-frac80.3%
metadata-eval80.3%
Simplified80.3%
Taylor expanded in M around 0 73.0%
associate-*r/73.0%
*-commutative73.0%
associate-*r/73.0%
*-commutative73.0%
times-frac76.7%
unpow276.7%
*-commutative76.7%
unpow276.7%
unpow276.7%
Simplified76.7%
if 7.50000000000000031e149 < d Initial program 70.4%
metadata-eval70.4%
unpow1/270.4%
metadata-eval70.4%
unpow1/270.4%
*-commutative70.4%
associate-*l*70.4%
times-frac70.4%
metadata-eval70.4%
Simplified70.4%
associate-*r*70.4%
frac-times70.4%
*-commutative70.4%
metadata-eval70.4%
associate-*r/74.0%
metadata-eval74.0%
*-commutative74.0%
frac-times74.0%
associate-*l/74.0%
associate-*r/74.0%
associate-/l/74.0%
*-commutative74.0%
Applied egg-rr74.0%
Taylor expanded in d around inf 70.0%
*-commutative70.0%
*-commutative70.0%
associate-/r*70.0%
Simplified70.0%
associate-/r*70.0%
associate-/l/70.0%
add-cbrt-cube62.1%
add-sqr-sqrt62.0%
pow162.0%
add-sqr-sqrt62.1%
add-cbrt-cube70.0%
associate-/l/70.0%
sqrt-div69.9%
metadata-eval69.9%
*-commutative69.9%
Applied egg-rr69.9%
unpow169.9%
associate-*r/70.0%
*-rgt-identity70.0%
Simplified70.0%
sqrt-prod84.4%
Applied egg-rr84.4%
Final simplification68.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)))
(- 1.0 (* 0.125 (/ D (/ (/ (* d d) (/ (* h M) (/ l M))) D))))))
(t_1 (/ M (/ d M))))
(if (<= d -1.55e-109)
t_0
(if (<= d -5e-310)
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ -1.0 (* (* D (/ D l)) (* (* t_1 (/ h d)) 0.125))))
(if (<= d 1.55e-107)
(* (sqrt (/ h (pow l 3.0))) (* -0.125 (* D (* D t_1))))
(if (<= d 6.5e+149) t_0 (/ d (* (sqrt h) (sqrt 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)) * sqrt((d / l))) * (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D))));
double t_1 = M / (d / M);
double tmp;
if (d <= -1.55e-109) {
tmp = t_0;
} else if (d <= -5e-310) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_1 * (h / d)) * 0.125)));
} else if (d <= 1.55e-107) {
tmp = sqrt((h / pow(l, 3.0))) * (-0.125 * (D * (D * t_1)));
} else if (d <= 6.5e+149) {
tmp = t_0;
} else {
tmp = d / (sqrt(h) * sqrt(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)) * sqrt((d / l))) * (1.0d0 - (0.125d0 * (d_1 / (((d * d) / ((h * m) / (l / m))) / d_1))))
t_1 = m / (d / m)
if (d <= (-1.55d-109)) then
tmp = t_0
else if (d <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + ((d_1 * (d_1 / l)) * ((t_1 * (h / d)) * 0.125d0)))
else if (d <= 1.55d-107) then
tmp = sqrt((h / (l ** 3.0d0))) * ((-0.125d0) * (d_1 * (d_1 * t_1)))
else if (d <= 6.5d+149) then
tmp = t_0
else
tmp = d / (sqrt(h) * sqrt(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)) * Math.sqrt((d / l))) * (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D))));
double t_1 = M / (d / M);
double tmp;
if (d <= -1.55e-109) {
tmp = t_0;
} else if (d <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_1 * (h / d)) * 0.125)));
} else if (d <= 1.55e-107) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (-0.125 * (D * (D * t_1)));
} else if (d <= 6.5e+149) {
tmp = t_0;
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
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))) * (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) t_1 = M / (d / M) tmp = 0 if d <= -1.55e-109: tmp = t_0 elif d <= -5e-310: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_1 * (h / d)) * 0.125))) elif d <= 1.55e-107: tmp = math.sqrt((h / math.pow(l, 3.0))) * (-0.125 * (D * (D * t_1))) elif d <= 6.5e+149: tmp = t_0 else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.125 * Float64(D / Float64(Float64(Float64(d * d) / Float64(Float64(h * M) / Float64(l / M))) / D))))) t_1 = Float64(M / Float64(d / M)) tmp = 0.0 if (d <= -1.55e-109) tmp = t_0; elseif (d <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + Float64(Float64(D * Float64(D / l)) * Float64(Float64(t_1 * Float64(h / d)) * 0.125)))); elseif (d <= 1.55e-107) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(-0.125 * Float64(D * Float64(D * t_1)))); elseif (d <= 6.5e+149) tmp = t_0; else tmp = Float64(d / Float64(sqrt(h) * sqrt(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)) * sqrt((d / l))) * (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D))));
t_1 = M / (d / M);
tmp = 0.0;
if (d <= -1.55e-109)
tmp = t_0;
elseif (d <= -5e-310)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_1 * (h / d)) * 0.125)));
elseif (d <= 1.55e-107)
tmp = sqrt((h / (l ^ 3.0))) * (-0.125 * (D * (D * t_1)));
elseif (d <= 6.5e+149)
tmp = t_0;
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: 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[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.125 * N[(D / N[(N[(N[(d * d), $MachinePrecision] / N[(N[(h * M), $MachinePrecision] / N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.55e-109], t$95$0, If[LessEqual[d, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 * N[(h / d), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.55e-107], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(D * N[(D * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6.5e+149], t$95$0, N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.125 \cdot \frac{D}{\frac{\frac{d \cdot d}{\frac{h \cdot M}{\frac{\ell}{M}}}}{D}}\right)\\
t_1 := \frac{M}{\frac{d}{M}}\\
\mathbf{if}\;d \leq -1.55 \cdot 10^{-109}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + \left(D \cdot \frac{D}{\ell}\right) \cdot \left(\left(t_1 \cdot \frac{h}{d}\right) \cdot 0.125\right)\right)\\
\mathbf{elif}\;d \leq 1.55 \cdot 10^{-107}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(D \cdot \left(D \cdot t_1\right)\right)\right)\\
\mathbf{elif}\;d \leq 6.5 \cdot 10^{+149}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.55e-109 or 1.55000000000000011e-107 < d < 6.50000000000000015e149Initial program 79.3%
metadata-eval79.3%
unpow1/279.3%
metadata-eval79.3%
unpow1/279.3%
*-commutative79.3%
associate-*l*79.3%
times-frac79.3%
metadata-eval79.3%
Simplified79.3%
Taylor expanded in M around 0 66.1%
associate-*r/66.1%
*-commutative66.1%
associate-*r/66.1%
*-commutative66.1%
times-frac68.3%
unpow268.3%
*-commutative68.3%
unpow268.3%
unpow268.3%
Simplified68.3%
Taylor expanded in D around 0 66.1%
associate-/l*66.8%
*-commutative66.8%
*-commutative66.8%
unpow266.8%
associate-/l*67.7%
*-commutative67.7%
associate-/l*70.8%
unpow270.8%
unpow270.8%
associate-*r*72.4%
associate-/l*76.0%
*-commutative76.0%
Simplified76.0%
if -1.55e-109 < d < -4.999999999999985e-310Initial program 45.9%
Applied egg-rr6.3%
expm1-def11.8%
expm1-log1p43.2%
*-commutative43.2%
*-commutative43.2%
associate-/l*43.2%
Simplified43.2%
Taylor expanded in d around -inf 77.4%
mul-1-neg77.4%
associate-/r*77.4%
distribute-rgt-neg-in77.4%
associate-/l/77.4%
Simplified77.4%
Taylor expanded in M around 0 51.8%
*-commutative51.8%
times-frac57.3%
unpow257.3%
times-frac60.2%
unpow260.2%
associate-*l*60.2%
unpow260.2%
associate-*l/63.2%
*-commutative63.2%
associate-/l*66.1%
Simplified66.1%
if -4.999999999999985e-310 < d < 1.55000000000000011e-107Initial program 47.9%
metadata-eval47.9%
unpow1/247.9%
metadata-eval47.9%
unpow1/247.9%
*-commutative47.9%
associate-*l*47.9%
times-frac46.2%
metadata-eval46.2%
Simplified46.2%
associate-*r*46.2%
frac-times47.9%
*-commutative47.9%
metadata-eval47.9%
associate-*r/47.9%
metadata-eval47.9%
*-commutative47.9%
frac-times46.3%
associate-*l/46.3%
associate-*r/46.3%
associate-/l/46.3%
*-commutative46.3%
Applied egg-rr46.3%
Taylor expanded in d around 0 39.5%
associate-*r*39.5%
*-commutative39.5%
associate-*r/37.9%
unpow237.9%
unpow237.9%
associate-*l*41.9%
associate-/l*48.9%
Simplified48.9%
if 6.50000000000000015e149 < d Initial program 70.4%
metadata-eval70.4%
unpow1/270.4%
metadata-eval70.4%
unpow1/270.4%
*-commutative70.4%
associate-*l*70.4%
times-frac70.4%
metadata-eval70.4%
Simplified70.4%
associate-*r*70.4%
frac-times70.4%
*-commutative70.4%
metadata-eval70.4%
associate-*r/74.0%
metadata-eval74.0%
*-commutative74.0%
frac-times74.0%
associate-*l/74.0%
associate-*r/74.0%
associate-/l/74.0%
*-commutative74.0%
Applied egg-rr74.0%
Taylor expanded in d around inf 70.0%
*-commutative70.0%
*-commutative70.0%
associate-/r*70.0%
Simplified70.0%
associate-/r*70.0%
associate-/l/70.0%
add-cbrt-cube62.1%
add-sqr-sqrt62.0%
pow162.0%
add-sqr-sqrt62.1%
add-cbrt-cube70.0%
associate-/l/70.0%
sqrt-div69.9%
metadata-eval69.9%
*-commutative69.9%
Applied egg-rr69.9%
unpow169.9%
associate-*r/70.0%
*-rgt-identity70.0%
Simplified70.0%
sqrt-prod84.4%
Applied egg-rr84.4%
Final simplification69.7%
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 (/ (* (pow (* M (/ D (* d 2.0))) 2.0) (* h -0.5)) l))
(sqrt (/ d (/ h (/ d l))))))
(t_1 (/ M (/ d M))))
(if (<= d -1.8e-64)
t_0
(if (<= d -5e-310)
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ -1.0 (* (* D (/ D l)) (* (* t_1 (/ h d)) 0.125))))
(if (<= d 1.55e-107)
(* (sqrt (/ h (pow l 3.0))) (* -0.125 (* D (* D t_1))))
(if (<= d 8.5e+106) t_0 (* d (/ (pow h -0.5) (sqrt l)))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (1.0 + ((pow((M * (D / (d * 2.0))), 2.0) * (h * -0.5)) / l)) * sqrt((d / (h / (d / l))));
double t_1 = M / (d / M);
double tmp;
if (d <= -1.8e-64) {
tmp = t_0;
} else if (d <= -5e-310) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_1 * (h / d)) * 0.125)));
} else if (d <= 1.55e-107) {
tmp = sqrt((h / pow(l, 3.0))) * (-0.125 * (D * (D * t_1)));
} else if (d <= 8.5e+106) {
tmp = t_0;
} else {
tmp = d * (pow(h, -0.5) / sqrt(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 = (1.0d0 + ((((m * (d_1 / (d * 2.0d0))) ** 2.0d0) * (h * (-0.5d0))) / l)) * sqrt((d / (h / (d / l))))
t_1 = m / (d / m)
if (d <= (-1.8d-64)) then
tmp = t_0
else if (d <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + ((d_1 * (d_1 / l)) * ((t_1 * (h / d)) * 0.125d0)))
else if (d <= 1.55d-107) then
tmp = sqrt((h / (l ** 3.0d0))) * ((-0.125d0) * (d_1 * (d_1 * t_1)))
else if (d <= 8.5d+106) then
tmp = t_0
else
tmp = d * ((h ** (-0.5d0)) / sqrt(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 = (1.0 + ((Math.pow((M * (D / (d * 2.0))), 2.0) * (h * -0.5)) / l)) * Math.sqrt((d / (h / (d / l))));
double t_1 = M / (d / M);
double tmp;
if (d <= -1.8e-64) {
tmp = t_0;
} else if (d <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_1 * (h / d)) * 0.125)));
} else if (d <= 1.55e-107) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (-0.125 * (D * (D * t_1)));
} else if (d <= 8.5e+106) {
tmp = t_0;
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = (1.0 + ((math.pow((M * (D / (d * 2.0))), 2.0) * (h * -0.5)) / l)) * math.sqrt((d / (h / (d / l)))) t_1 = M / (d / M) tmp = 0 if d <= -1.8e-64: tmp = t_0 elif d <= -5e-310: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_1 * (h / d)) * 0.125))) elif d <= 1.55e-107: tmp = math.sqrt((h / math.pow(l, 3.0))) * (-0.125 * (D * (D * t_1))) elif d <= 8.5e+106: tmp = t_0 else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(1.0 + Float64(Float64((Float64(M * Float64(D / Float64(d * 2.0))) ^ 2.0) * Float64(h * -0.5)) / l)) * sqrt(Float64(d / Float64(h / Float64(d / l))))) t_1 = Float64(M / Float64(d / M)) tmp = 0.0 if (d <= -1.8e-64) tmp = t_0; elseif (d <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + Float64(Float64(D * Float64(D / l)) * Float64(Float64(t_1 * Float64(h / d)) * 0.125)))); elseif (d <= 1.55e-107) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(-0.125 * Float64(D * Float64(D * t_1)))); elseif (d <= 8.5e+106) tmp = t_0; else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(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 = (1.0 + ((((M * (D / (d * 2.0))) ^ 2.0) * (h * -0.5)) / l)) * sqrt((d / (h / (d / l))));
t_1 = M / (d / M);
tmp = 0.0;
if (d <= -1.8e-64)
tmp = t_0;
elseif (d <= -5e-310)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_1 * (h / d)) * 0.125)));
elseif (d <= 1.55e-107)
tmp = sqrt((h / (l ^ 3.0))) * (-0.125 * (D * (D * t_1)));
elseif (d <= 8.5e+106)
tmp = t_0;
else
tmp = d * ((h ^ -0.5) / sqrt(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[(N[(1.0 + N[(N[(N[Power[N[(M * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * -0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / N[(h / N[(d / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.8e-64], t$95$0, If[LessEqual[d, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 * N[(h / d), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.55e-107], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(D * N[(D * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 8.5e+106], t$95$0, N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \left(1 + \frac{{\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2} \cdot \left(h \cdot -0.5\right)}{\ell}\right) \cdot \sqrt{\frac{d}{\frac{h}{\frac{d}{\ell}}}}\\
t_1 := \frac{M}{\frac{d}{M}}\\
\mathbf{if}\;d \leq -1.8 \cdot 10^{-64}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + \left(D \cdot \frac{D}{\ell}\right) \cdot \left(\left(t_1 \cdot \frac{h}{d}\right) \cdot 0.125\right)\right)\\
\mathbf{elif}\;d \leq 1.55 \cdot 10^{-107}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(D \cdot \left(D \cdot t_1\right)\right)\right)\\
\mathbf{elif}\;d \leq 8.5 \cdot 10^{+106}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.7999999999999999e-64 or 1.55000000000000011e-107 < d < 8.4999999999999992e106Initial program 79.1%
metadata-eval79.1%
unpow1/279.1%
metadata-eval79.1%
unpow1/279.1%
*-commutative79.1%
associate-*l*79.1%
times-frac79.1%
metadata-eval79.1%
Simplified79.1%
associate-*r*79.1%
frac-times79.1%
*-commutative79.1%
metadata-eval79.1%
associate-*r/82.6%
metadata-eval82.6%
*-commutative82.6%
frac-times82.6%
associate-*l/82.6%
associate-*r/82.6%
associate-/l/82.6%
*-commutative82.6%
Applied egg-rr82.6%
*-commutative82.6%
sqrt-prod71.9%
associate-/l*66.0%
associate-*r/66.0%
*-commutative66.0%
associate-*r/66.0%
associate-*r/65.8%
pow165.8%
Applied egg-rr64.8%
unpow164.8%
*-commutative64.8%
associate-/l*65.8%
cancel-sign-sub-inv65.8%
associate-*r/65.8%
associate-*r/72.0%
distribute-lft-neg-in72.0%
distribute-rgt-neg-in72.0%
*-commutative72.0%
*-commutative72.0%
distribute-rgt-neg-in72.0%
metadata-eval72.0%
Simplified72.0%
if -1.7999999999999999e-64 < d < -4.999999999999985e-310Initial program 53.6%
Applied egg-rr7.2%
expm1-def13.6%
expm1-log1p49.3%
*-commutative49.3%
*-commutative49.3%
associate-/l*49.3%
Simplified49.3%
Taylor expanded in d around -inf 78.1%
mul-1-neg78.1%
associate-/r*78.1%
distribute-rgt-neg-in78.1%
associate-/l/78.1%
Simplified78.1%
Taylor expanded in M around 0 53.7%
*-commutative53.7%
times-frac60.3%
unpow260.3%
times-frac62.5%
unpow262.5%
associate-*l*62.5%
unpow262.5%
associate-*l/66.9%
*-commutative66.9%
associate-/l*69.1%
Simplified69.1%
if -4.999999999999985e-310 < d < 1.55000000000000011e-107Initial program 47.9%
metadata-eval47.9%
unpow1/247.9%
metadata-eval47.9%
unpow1/247.9%
*-commutative47.9%
associate-*l*47.9%
times-frac46.2%
metadata-eval46.2%
Simplified46.2%
associate-*r*46.2%
frac-times47.9%
*-commutative47.9%
metadata-eval47.9%
associate-*r/47.9%
metadata-eval47.9%
*-commutative47.9%
frac-times46.3%
associate-*l/46.3%
associate-*r/46.3%
associate-/l/46.3%
*-commutative46.3%
Applied egg-rr46.3%
Taylor expanded in d around 0 39.5%
associate-*r*39.5%
*-commutative39.5%
associate-*r/37.9%
unpow237.9%
unpow237.9%
associate-*l*41.9%
associate-/l*48.9%
Simplified48.9%
if 8.4999999999999992e106 < d Initial program 73.2%
metadata-eval73.2%
unpow1/273.2%
metadata-eval73.2%
unpow1/273.2%
*-commutative73.2%
associate-*l*73.2%
times-frac73.2%
metadata-eval73.2%
Simplified73.2%
associate-*r*73.2%
frac-times73.2%
*-commutative73.2%
metadata-eval73.2%
associate-*r/75.8%
metadata-eval75.8%
*-commutative75.8%
frac-times75.8%
associate-*l/75.8%
associate-*r/75.8%
associate-/l/75.8%
*-commutative75.8%
Applied egg-rr75.8%
Taylor expanded in d around inf 66.4%
*-commutative66.4%
*-commutative66.4%
associate-/r*66.4%
Simplified66.4%
sqrt-div78.3%
Applied egg-rr78.3%
div-inv78.3%
inv-pow78.3%
Applied egg-rr78.3%
associate-*r/78.3%
associate-/l*78.3%
sqr-pow78.4%
rem-sqrt-square78.4%
metadata-eval78.4%
sqr-pow78.2%
fabs-sqr78.2%
sqr-pow78.4%
/-rgt-identity78.4%
Simplified78.4%
Final simplification67.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)))) (t_1 (/ M (/ d M))))
(if (<= d -1.95e-63)
(* t_0 (- 1.0 (* (pow (* M (/ D (* d 2.0))) 2.0) (/ 0.5 (/ l h)))))
(if (<= d -5e-310)
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ -1.0 (* (* D (/ D l)) (* (* t_1 (/ h d)) 0.125))))
(if (<= d 1.55e-107)
(* (sqrt (/ h (pow l 3.0))) (* -0.125 (* D (* D t_1))))
(if (<= d 8e+104)
(*
(- 1.0 (* 0.125 (/ D (/ (/ (* d d) (/ (* h M) (/ l M))) D))))
t_0)
(* d (/ (pow h -0.5) (sqrt 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) * (d / l)));
double t_1 = M / (d / M);
double tmp;
if (d <= -1.95e-63) {
tmp = t_0 * (1.0 - (pow((M * (D / (d * 2.0))), 2.0) * (0.5 / (l / h))));
} else if (d <= -5e-310) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_1 * (h / d)) * 0.125)));
} else if (d <= 1.55e-107) {
tmp = sqrt((h / pow(l, 3.0))) * (-0.125 * (D * (D * t_1)));
} else if (d <= 8e+104) {
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_0;
} else {
tmp = d * (pow(h, -0.5) / sqrt(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) * (d / l)))
t_1 = m / (d / m)
if (d <= (-1.95d-63)) then
tmp = t_0 * (1.0d0 - (((m * (d_1 / (d * 2.0d0))) ** 2.0d0) * (0.5d0 / (l / h))))
else if (d <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + ((d_1 * (d_1 / l)) * ((t_1 * (h / d)) * 0.125d0)))
else if (d <= 1.55d-107) then
tmp = sqrt((h / (l ** 3.0d0))) * ((-0.125d0) * (d_1 * (d_1 * t_1)))
else if (d <= 8d+104) then
tmp = (1.0d0 - (0.125d0 * (d_1 / (((d * d) / ((h * m) / (l / m))) / d_1)))) * t_0
else
tmp = d * ((h ** (-0.5d0)) / sqrt(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) * (d / l)));
double t_1 = M / (d / M);
double tmp;
if (d <= -1.95e-63) {
tmp = t_0 * (1.0 - (Math.pow((M * (D / (d * 2.0))), 2.0) * (0.5 / (l / h))));
} else if (d <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_1 * (h / d)) * 0.125)));
} else if (d <= 1.55e-107) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (-0.125 * (D * (D * t_1)));
} else if (d <= 8e+104) {
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_0;
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
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))) t_1 = M / (d / M) tmp = 0 if d <= -1.95e-63: tmp = t_0 * (1.0 - (math.pow((M * (D / (d * 2.0))), 2.0) * (0.5 / (l / h)))) elif d <= -5e-310: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_1 * (h / d)) * 0.125))) elif d <= 1.55e-107: tmp = math.sqrt((h / math.pow(l, 3.0))) * (-0.125 * (D * (D * t_1))) elif d <= 8e+104: tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_0 else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(Float64(d / h) * Float64(d / l))) t_1 = Float64(M / Float64(d / M)) tmp = 0.0 if (d <= -1.95e-63) tmp = Float64(t_0 * Float64(1.0 - Float64((Float64(M * Float64(D / Float64(d * 2.0))) ^ 2.0) * Float64(0.5 / Float64(l / h))))); elseif (d <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + Float64(Float64(D * Float64(D / l)) * Float64(Float64(t_1 * Float64(h / d)) * 0.125)))); elseif (d <= 1.55e-107) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(-0.125 * Float64(D * Float64(D * t_1)))); elseif (d <= 8e+104) tmp = Float64(Float64(1.0 - Float64(0.125 * Float64(D / Float64(Float64(Float64(d * d) / Float64(Float64(h * M) / Float64(l / M))) / D)))) * t_0); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(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) * (d / l)));
t_1 = M / (d / M);
tmp = 0.0;
if (d <= -1.95e-63)
tmp = t_0 * (1.0 - (((M * (D / (d * 2.0))) ^ 2.0) * (0.5 / (l / h))));
elseif (d <= -5e-310)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_1 * (h / d)) * 0.125)));
elseif (d <= 1.55e-107)
tmp = sqrt((h / (l ^ 3.0))) * (-0.125 * (D * (D * t_1)));
elseif (d <= 8e+104)
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_0;
else
tmp = d * ((h ^ -0.5) / sqrt(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[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.95e-63], N[(t$95$0 * N[(1.0 - N[(N[Power[N[(M * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 * N[(h / d), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.55e-107], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(D * N[(D * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 8e+104], N[(N[(1.0 - N[(0.125 * N[(D / N[(N[(N[(d * d), $MachinePrecision] / N[(N[(h * M), $MachinePrecision] / N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $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}}\\
t_1 := \frac{M}{\frac{d}{M}}\\
\mathbf{if}\;d \leq -1.95 \cdot 10^{-63}:\\
\;\;\;\;t_0 \cdot \left(1 - {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2} \cdot \frac{0.5}{\frac{\ell}{h}}\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + \left(D \cdot \frac{D}{\ell}\right) \cdot \left(\left(t_1 \cdot \frac{h}{d}\right) \cdot 0.125\right)\right)\\
\mathbf{elif}\;d \leq 1.55 \cdot 10^{-107}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(D \cdot \left(D \cdot t_1\right)\right)\right)\\
\mathbf{elif}\;d \leq 8 \cdot 10^{+104}:\\
\;\;\;\;\left(1 - 0.125 \cdot \frac{D}{\frac{\frac{d \cdot d}{\frac{h \cdot M}{\frac{\ell}{M}}}}{D}}\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.95000000000000011e-63Initial program 80.9%
Applied egg-rr28.7%
expm1-def39.3%
expm1-log1p68.7%
*-commutative68.7%
*-commutative68.7%
associate-/l*68.7%
Simplified68.7%
if -1.95000000000000011e-63 < d < -4.999999999999985e-310Initial program 53.6%
Applied egg-rr7.2%
expm1-def13.6%
expm1-log1p49.3%
*-commutative49.3%
*-commutative49.3%
associate-/l*49.3%
Simplified49.3%
Taylor expanded in d around -inf 78.1%
mul-1-neg78.1%
associate-/r*78.1%
distribute-rgt-neg-in78.1%
associate-/l/78.1%
Simplified78.1%
Taylor expanded in M around 0 53.7%
*-commutative53.7%
times-frac60.3%
unpow260.3%
times-frac62.5%
unpow262.5%
associate-*l*62.5%
unpow262.5%
associate-*l/66.9%
*-commutative66.9%
associate-/l*69.1%
Simplified69.1%
if -4.999999999999985e-310 < d < 1.55000000000000011e-107Initial program 47.9%
metadata-eval47.9%
unpow1/247.9%
metadata-eval47.9%
unpow1/247.9%
*-commutative47.9%
associate-*l*47.9%
times-frac46.2%
metadata-eval46.2%
Simplified46.2%
associate-*r*46.2%
frac-times47.9%
*-commutative47.9%
metadata-eval47.9%
associate-*r/47.9%
metadata-eval47.9%
*-commutative47.9%
frac-times46.3%
associate-*l/46.3%
associate-*r/46.3%
associate-/l/46.3%
*-commutative46.3%
Applied egg-rr46.3%
Taylor expanded in d around 0 39.5%
associate-*r*39.5%
*-commutative39.5%
associate-*r/37.9%
unpow237.9%
unpow237.9%
associate-*l*41.9%
associate-/l*48.9%
Simplified48.9%
if 1.55000000000000011e-107 < d < 8e104Initial program 76.6%
Applied egg-rr7.6%
expm1-def22.2%
expm1-log1p62.1%
*-commutative62.1%
*-commutative62.1%
associate-/l*62.0%
Simplified62.0%
Taylor expanded in M around 0 61.9%
associate-/l*62.9%
*-commutative62.9%
unpow262.9%
associate-/l*62.9%
*-commutative62.9%
associate-/l*62.9%
unpow262.9%
unpow262.9%
associate-*r*65.1%
associate-/l*71.3%
*-commutative71.3%
Simplified71.3%
if 8e104 < d Initial program 73.2%
metadata-eval73.2%
unpow1/273.2%
metadata-eval73.2%
unpow1/273.2%
*-commutative73.2%
associate-*l*73.2%
times-frac73.2%
metadata-eval73.2%
Simplified73.2%
associate-*r*73.2%
frac-times73.2%
*-commutative73.2%
metadata-eval73.2%
associate-*r/75.8%
metadata-eval75.8%
*-commutative75.8%
frac-times75.8%
associate-*l/75.8%
associate-*r/75.8%
associate-/l/75.8%
*-commutative75.8%
Applied egg-rr75.8%
Taylor expanded in d around inf 66.4%
*-commutative66.4%
*-commutative66.4%
associate-/r*66.4%
Simplified66.4%
sqrt-div78.3%
Applied egg-rr78.3%
div-inv78.3%
inv-pow78.3%
Applied egg-rr78.3%
associate-*r/78.3%
associate-/l*78.3%
sqr-pow78.4%
rem-sqrt-square78.4%
metadata-eval78.4%
sqr-pow78.2%
fabs-sqr78.2%
sqr-pow78.4%
/-rgt-identity78.4%
Simplified78.4%
Final simplification66.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 (sqrt (* (/ d h) (/ d l)))) (t_1 (/ M (/ d M))))
(if (<= d -3.3e-92)
(* t_0 (- 1.0 (* (pow (/ (* D (* M 0.5)) d) 2.0) (/ 0.5 (/ l h)))))
(if (<= d -5e-310)
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ -1.0 (* (* D (/ D l)) (* (* t_1 (/ h d)) 0.125))))
(if (<= d 1.55e-107)
(* (sqrt (/ h (pow l 3.0))) (* -0.125 (* D (* D t_1))))
(if (<= d 2.8e+106)
(*
(- 1.0 (* 0.125 (/ D (/ (/ (* d d) (/ (* h M) (/ l M))) D))))
t_0)
(* d (/ (pow h -0.5) (sqrt 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) * (d / l)));
double t_1 = M / (d / M);
double tmp;
if (d <= -3.3e-92) {
tmp = t_0 * (1.0 - (pow(((D * (M * 0.5)) / d), 2.0) * (0.5 / (l / h))));
} else if (d <= -5e-310) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_1 * (h / d)) * 0.125)));
} else if (d <= 1.55e-107) {
tmp = sqrt((h / pow(l, 3.0))) * (-0.125 * (D * (D * t_1)));
} else if (d <= 2.8e+106) {
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_0;
} else {
tmp = d * (pow(h, -0.5) / sqrt(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) * (d / l)))
t_1 = m / (d / m)
if (d <= (-3.3d-92)) then
tmp = t_0 * (1.0d0 - ((((d_1 * (m * 0.5d0)) / d) ** 2.0d0) * (0.5d0 / (l / h))))
else if (d <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + ((d_1 * (d_1 / l)) * ((t_1 * (h / d)) * 0.125d0)))
else if (d <= 1.55d-107) then
tmp = sqrt((h / (l ** 3.0d0))) * ((-0.125d0) * (d_1 * (d_1 * t_1)))
else if (d <= 2.8d+106) then
tmp = (1.0d0 - (0.125d0 * (d_1 / (((d * d) / ((h * m) / (l / m))) / d_1)))) * t_0
else
tmp = d * ((h ** (-0.5d0)) / sqrt(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) * (d / l)));
double t_1 = M / (d / M);
double tmp;
if (d <= -3.3e-92) {
tmp = t_0 * (1.0 - (Math.pow(((D * (M * 0.5)) / d), 2.0) * (0.5 / (l / h))));
} else if (d <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_1 * (h / d)) * 0.125)));
} else if (d <= 1.55e-107) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (-0.125 * (D * (D * t_1)));
} else if (d <= 2.8e+106) {
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_0;
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
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))) t_1 = M / (d / M) tmp = 0 if d <= -3.3e-92: tmp = t_0 * (1.0 - (math.pow(((D * (M * 0.5)) / d), 2.0) * (0.5 / (l / h)))) elif d <= -5e-310: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_1 * (h / d)) * 0.125))) elif d <= 1.55e-107: tmp = math.sqrt((h / math.pow(l, 3.0))) * (-0.125 * (D * (D * t_1))) elif d <= 2.8e+106: tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_0 else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(Float64(d / h) * Float64(d / l))) t_1 = Float64(M / Float64(d / M)) tmp = 0.0 if (d <= -3.3e-92) tmp = Float64(t_0 * Float64(1.0 - Float64((Float64(Float64(D * Float64(M * 0.5)) / d) ^ 2.0) * Float64(0.5 / Float64(l / h))))); elseif (d <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + Float64(Float64(D * Float64(D / l)) * Float64(Float64(t_1 * Float64(h / d)) * 0.125)))); elseif (d <= 1.55e-107) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(-0.125 * Float64(D * Float64(D * t_1)))); elseif (d <= 2.8e+106) tmp = Float64(Float64(1.0 - Float64(0.125 * Float64(D / Float64(Float64(Float64(d * d) / Float64(Float64(h * M) / Float64(l / M))) / D)))) * t_0); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(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) * (d / l)));
t_1 = M / (d / M);
tmp = 0.0;
if (d <= -3.3e-92)
tmp = t_0 * (1.0 - ((((D * (M * 0.5)) / d) ^ 2.0) * (0.5 / (l / h))));
elseif (d <= -5e-310)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_1 * (h / d)) * 0.125)));
elseif (d <= 1.55e-107)
tmp = sqrt((h / (l ^ 3.0))) * (-0.125 * (D * (D * t_1)));
elseif (d <= 2.8e+106)
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_0;
else
tmp = d * ((h ^ -0.5) / sqrt(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[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -3.3e-92], N[(t$95$0 * N[(1.0 - N[(N[Power[N[(N[(D * N[(M * 0.5), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 * N[(h / d), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.55e-107], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(D * N[(D * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.8e+106], N[(N[(1.0 - N[(0.125 * N[(D / N[(N[(N[(d * d), $MachinePrecision] / N[(N[(h * M), $MachinePrecision] / N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $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}}\\
t_1 := \frac{M}{\frac{d}{M}}\\
\mathbf{if}\;d \leq -3.3 \cdot 10^{-92}:\\
\;\;\;\;t_0 \cdot \left(1 - {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2} \cdot \frac{0.5}{\frac{\ell}{h}}\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + \left(D \cdot \frac{D}{\ell}\right) \cdot \left(\left(t_1 \cdot \frac{h}{d}\right) \cdot 0.125\right)\right)\\
\mathbf{elif}\;d \leq 1.55 \cdot 10^{-107}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(D \cdot \left(D \cdot t_1\right)\right)\right)\\
\mathbf{elif}\;d \leq 2.8 \cdot 10^{+106}:\\
\;\;\;\;\left(1 - 0.125 \cdot \frac{D}{\frac{\frac{d \cdot d}{\frac{h \cdot M}{\frac{\ell}{M}}}}{D}}\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -3.29999999999999998e-92Initial program 81.1%
Applied egg-rr26.2%
expm1-def37.3%
expm1-log1p70.0%
*-commutative70.0%
*-commutative70.0%
associate-/l*70.0%
Simplified70.0%
associate-*r/70.0%
frac-times70.0%
associate-*r/70.0%
div-inv70.0%
metadata-eval70.0%
Applied egg-rr70.0%
if -3.29999999999999998e-92 < d < -4.999999999999985e-310Initial program 49.0%
Applied egg-rr8.2%
expm1-def13.2%
expm1-log1p44.0%
*-commutative44.0%
*-commutative44.0%
associate-/l*44.0%
Simplified44.0%
Taylor expanded in d around -inf 77.3%
mul-1-neg77.3%
associate-/r*77.3%
distribute-rgt-neg-in77.3%
associate-/l/77.3%
Simplified77.3%
Taylor expanded in M around 0 51.6%
*-commutative51.6%
times-frac59.2%
unpow259.2%
times-frac61.7%
unpow261.7%
associate-*l*61.7%
unpow261.7%
associate-*l/64.4%
*-commutative64.4%
associate-/l*67.0%
Simplified67.0%
if -4.999999999999985e-310 < d < 1.55000000000000011e-107Initial program 47.9%
metadata-eval47.9%
unpow1/247.9%
metadata-eval47.9%
unpow1/247.9%
*-commutative47.9%
associate-*l*47.9%
times-frac46.2%
metadata-eval46.2%
Simplified46.2%
associate-*r*46.2%
frac-times47.9%
*-commutative47.9%
metadata-eval47.9%
associate-*r/47.9%
metadata-eval47.9%
*-commutative47.9%
frac-times46.3%
associate-*l/46.3%
associate-*r/46.3%
associate-/l/46.3%
*-commutative46.3%
Applied egg-rr46.3%
Taylor expanded in d around 0 39.5%
associate-*r*39.5%
*-commutative39.5%
associate-*r/37.9%
unpow237.9%
unpow237.9%
associate-*l*41.9%
associate-/l*48.9%
Simplified48.9%
if 1.55000000000000011e-107 < d < 2.79999999999999993e106Initial program 76.6%
Applied egg-rr7.6%
expm1-def22.2%
expm1-log1p62.1%
*-commutative62.1%
*-commutative62.1%
associate-/l*62.0%
Simplified62.0%
Taylor expanded in M around 0 61.9%
associate-/l*62.9%
*-commutative62.9%
unpow262.9%
associate-/l*62.9%
*-commutative62.9%
associate-/l*62.9%
unpow262.9%
unpow262.9%
associate-*r*65.1%
associate-/l*71.3%
*-commutative71.3%
Simplified71.3%
if 2.79999999999999993e106 < d Initial program 73.2%
metadata-eval73.2%
unpow1/273.2%
metadata-eval73.2%
unpow1/273.2%
*-commutative73.2%
associate-*l*73.2%
times-frac73.2%
metadata-eval73.2%
Simplified73.2%
associate-*r*73.2%
frac-times73.2%
*-commutative73.2%
metadata-eval73.2%
associate-*r/75.8%
metadata-eval75.8%
*-commutative75.8%
frac-times75.8%
associate-*l/75.8%
associate-*r/75.8%
associate-/l/75.8%
*-commutative75.8%
Applied egg-rr75.8%
Taylor expanded in d around inf 66.4%
*-commutative66.4%
*-commutative66.4%
associate-/r*66.4%
Simplified66.4%
sqrt-div78.3%
Applied egg-rr78.3%
div-inv78.3%
inv-pow78.3%
Applied egg-rr78.3%
associate-*r/78.3%
associate-/l*78.3%
sqr-pow78.4%
rem-sqrt-square78.4%
metadata-eval78.4%
sqr-pow78.2%
fabs-sqr78.2%
sqr-pow78.4%
/-rgt-identity78.4%
Simplified78.4%
Final simplification66.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 (<= d -5e-310)
(*
(/ d (sqrt (* h l)))
(+ -1.0 (* (* 0.5 (/ h l)) (pow (* M (/ D (* d 2.0))) 2.0))))
(if (<= d 1.55e-107)
(* (sqrt (/ h (pow l 3.0))) (* -0.125 (* D (* D (/ M (/ d M))))))
(if (<= d 9e+104)
(*
(- 1.0 (* 0.125 (/ D (/ (/ (* d d) (/ (* h M) (/ l M))) D))))
(sqrt (* (/ d h) (/ d l))))
(* d (/ (pow h -0.5) (sqrt l)))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -5e-310) {
tmp = (d / sqrt((h * l))) * (-1.0 + ((0.5 * (h / l)) * pow((M * (D / (d * 2.0))), 2.0)));
} else if (d <= 1.55e-107) {
tmp = sqrt((h / pow(l, 3.0))) * (-0.125 * (D * (D * (M / (d / M)))));
} else if (d <= 9e+104) {
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * sqrt(((d / h) * (d / l)));
} else {
tmp = d * (pow(h, -0.5) / sqrt(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) :: tmp
if (d <= (-5d-310)) then
tmp = (d / sqrt((h * l))) * ((-1.0d0) + ((0.5d0 * (h / l)) * ((m * (d_1 / (d * 2.0d0))) ** 2.0d0)))
else if (d <= 1.55d-107) then
tmp = sqrt((h / (l ** 3.0d0))) * ((-0.125d0) * (d_1 * (d_1 * (m / (d / m)))))
else if (d <= 9d+104) then
tmp = (1.0d0 - (0.125d0 * (d_1 / (((d * d) / ((h * m) / (l / m))) / d_1)))) * sqrt(((d / h) * (d / l)))
else
tmp = d * ((h ** (-0.5d0)) / sqrt(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 tmp;
if (d <= -5e-310) {
tmp = (d / Math.sqrt((h * l))) * (-1.0 + ((0.5 * (h / l)) * Math.pow((M * (D / (d * 2.0))), 2.0)));
} else if (d <= 1.55e-107) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (-0.125 * (D * (D * (M / (d / M)))));
} else if (d <= 9e+104) {
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * Math.sqrt(((d / h) * (d / l)));
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= -5e-310: tmp = (d / math.sqrt((h * l))) * (-1.0 + ((0.5 * (h / l)) * math.pow((M * (D / (d * 2.0))), 2.0))) elif d <= 1.55e-107: tmp = math.sqrt((h / math.pow(l, 3.0))) * (-0.125 * (D * (D * (M / (d / M))))) elif d <= 9e+104: tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * math.sqrt(((d / h) * (d / l))) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -5e-310) tmp = Float64(Float64(d / sqrt(Float64(h * l))) * Float64(-1.0 + Float64(Float64(0.5 * Float64(h / l)) * (Float64(M * Float64(D / Float64(d * 2.0))) ^ 2.0)))); elseif (d <= 1.55e-107) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(-0.125 * Float64(D * Float64(D * Float64(M / Float64(d / M)))))); elseif (d <= 9e+104) tmp = Float64(Float64(1.0 - Float64(0.125 * Float64(D / Float64(Float64(Float64(d * d) / Float64(Float64(h * M) / Float64(l / M))) / D)))) * sqrt(Float64(Float64(d / h) * Float64(d / l)))); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); 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 (d <= -5e-310)
tmp = (d / sqrt((h * l))) * (-1.0 + ((0.5 * (h / l)) * ((M * (D / (d * 2.0))) ^ 2.0)));
elseif (d <= 1.55e-107)
tmp = sqrt((h / (l ^ 3.0))) * (-0.125 * (D * (D * (M / (d / M)))));
elseif (d <= 9e+104)
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * sqrt(((d / h) * (d / l)));
else
tmp = d * ((h ^ -0.5) / sqrt(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_] := If[LessEqual[d, -5e-310], N[(N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(M * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.55e-107], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(D * N[(D * N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 9e+104], N[(N[(1.0 - N[(0.125 * N[(D / N[(N[(N[(d * d), $MachinePrecision] / N[(N[(h * M), $MachinePrecision] / N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(-1 + \left(0.5 \cdot \frac{h}{\ell}\right) \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}\right)\\
\mathbf{elif}\;d \leq 1.55 \cdot 10^{-107}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(D \cdot \left(D \cdot \frac{M}{\frac{d}{M}}\right)\right)\right)\\
\mathbf{elif}\;d \leq 9 \cdot 10^{+104}:\\
\;\;\;\;\left(1 - 0.125 \cdot \frac{D}{\frac{\frac{d \cdot d}{\frac{h \cdot M}{\frac{\ell}{M}}}}{D}}\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -4.999999999999985e-310Initial program 69.3%
Applied egg-rr19.6%
expm1-def28.4%
expm1-log1p60.4%
*-commutative60.4%
*-commutative60.4%
associate-/l*60.4%
Simplified60.4%
Taylor expanded in d around -inf 71.6%
mul-1-neg71.6%
associate-/r*71.5%
distribute-rgt-neg-in71.5%
associate-/l/71.6%
Simplified71.6%
pow171.6%
Applied egg-rr71.6%
unpow171.6%
associate-*r*71.5%
*-commutative71.5%
distribute-neg-frac71.5%
metadata-eval71.5%
associate-*r/71.5%
*-commutative71.5%
mul-1-neg71.5%
Simplified71.5%
if -4.999999999999985e-310 < d < 1.55000000000000011e-107Initial program 47.9%
metadata-eval47.9%
unpow1/247.9%
metadata-eval47.9%
unpow1/247.9%
*-commutative47.9%
associate-*l*47.9%
times-frac46.2%
metadata-eval46.2%
Simplified46.2%
associate-*r*46.2%
frac-times47.9%
*-commutative47.9%
metadata-eval47.9%
associate-*r/47.9%
metadata-eval47.9%
*-commutative47.9%
frac-times46.3%
associate-*l/46.3%
associate-*r/46.3%
associate-/l/46.3%
*-commutative46.3%
Applied egg-rr46.3%
Taylor expanded in d around 0 39.5%
associate-*r*39.5%
*-commutative39.5%
associate-*r/37.9%
unpow237.9%
unpow237.9%
associate-*l*41.9%
associate-/l*48.9%
Simplified48.9%
if 1.55000000000000011e-107 < d < 8.9999999999999997e104Initial program 76.6%
Applied egg-rr7.6%
expm1-def22.2%
expm1-log1p62.1%
*-commutative62.1%
*-commutative62.1%
associate-/l*62.0%
Simplified62.0%
Taylor expanded in M around 0 61.9%
associate-/l*62.9%
*-commutative62.9%
unpow262.9%
associate-/l*62.9%
*-commutative62.9%
associate-/l*62.9%
unpow262.9%
unpow262.9%
associate-*r*65.1%
associate-/l*71.3%
*-commutative71.3%
Simplified71.3%
if 8.9999999999999997e104 < d Initial program 73.2%
metadata-eval73.2%
unpow1/273.2%
metadata-eval73.2%
unpow1/273.2%
*-commutative73.2%
associate-*l*73.2%
times-frac73.2%
metadata-eval73.2%
Simplified73.2%
associate-*r*73.2%
frac-times73.2%
*-commutative73.2%
metadata-eval73.2%
associate-*r/75.8%
metadata-eval75.8%
*-commutative75.8%
frac-times75.8%
associate-*l/75.8%
associate-*r/75.8%
associate-/l/75.8%
*-commutative75.8%
Applied egg-rr75.8%
Taylor expanded in d around inf 66.4%
*-commutative66.4%
*-commutative66.4%
associate-/r*66.4%
Simplified66.4%
sqrt-div78.3%
Applied egg-rr78.3%
div-inv78.3%
inv-pow78.3%
Applied egg-rr78.3%
associate-*r/78.3%
associate-/l*78.3%
sqr-pow78.4%
rem-sqrt-square78.4%
metadata-eval78.4%
sqr-pow78.2%
fabs-sqr78.2%
sqr-pow78.4%
/-rgt-identity78.4%
Simplified78.4%
Final simplification67.7%
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 (* (* D (/ D l)) (* (* (/ M (/ d M)) (/ h d)) 0.125)))
(t_1 (sqrt (* (/ d h) (/ d l)))))
(if (<= d -2e-92)
(* (- 1.0 (* 0.125 (/ D (/ (/ (* d d) (/ (* h M) (/ l M))) D)))) t_1)
(if (<= d -1e-309)
(* (* d (sqrt (/ 1.0 (* h l)))) (+ -1.0 t_0))
(if (<= d 2.8e-224)
(* -0.125 (* (/ (* D D) (/ d (* M M))) (sqrt (/ h (pow l 3.0)))))
(if (<= d 2.3e+106)
(* (- 1.0 t_0) t_1)
(* d (/ (pow h -0.5) (sqrt l)))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125);
double t_1 = sqrt(((d / h) * (d / l)));
double tmp;
if (d <= -2e-92) {
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_1;
} else if (d <= -1e-309) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
} else if (d <= 2.8e-224) {
tmp = -0.125 * (((D * D) / (d / (M * M))) * sqrt((h / pow(l, 3.0))));
} else if (d <= 2.3e+106) {
tmp = (1.0 - t_0) * t_1;
} else {
tmp = d * (pow(h, -0.5) / sqrt(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 = (d_1 * (d_1 / l)) * (((m / (d / m)) * (h / d)) * 0.125d0)
t_1 = sqrt(((d / h) * (d / l)))
if (d <= (-2d-92)) then
tmp = (1.0d0 - (0.125d0 * (d_1 / (((d * d) / ((h * m) / (l / m))) / d_1)))) * t_1
else if (d <= (-1d-309)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + t_0)
else if (d <= 2.8d-224) then
tmp = (-0.125d0) * (((d_1 * d_1) / (d / (m * m))) * sqrt((h / (l ** 3.0d0))))
else if (d <= 2.3d+106) then
tmp = (1.0d0 - t_0) * t_1
else
tmp = d * ((h ** (-0.5d0)) / sqrt(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 = (D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125);
double t_1 = Math.sqrt(((d / h) * (d / l)));
double tmp;
if (d <= -2e-92) {
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_1;
} else if (d <= -1e-309) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
} else if (d <= 2.8e-224) {
tmp = -0.125 * (((D * D) / (d / (M * M))) * Math.sqrt((h / Math.pow(l, 3.0))));
} else if (d <= 2.3e+106) {
tmp = (1.0 - t_0) * t_1;
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = (D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125) t_1 = math.sqrt(((d / h) * (d / l))) tmp = 0 if d <= -2e-92: tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_1 elif d <= -1e-309: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + t_0) elif d <= 2.8e-224: tmp = -0.125 * (((D * D) / (d / (M * M))) * math.sqrt((h / math.pow(l, 3.0)))) elif d <= 2.3e+106: tmp = (1.0 - t_0) * t_1 else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(D * Float64(D / l)) * Float64(Float64(Float64(M / Float64(d / M)) * Float64(h / d)) * 0.125)) t_1 = sqrt(Float64(Float64(d / h) * Float64(d / l))) tmp = 0.0 if (d <= -2e-92) tmp = Float64(Float64(1.0 - Float64(0.125 * Float64(D / Float64(Float64(Float64(d * d) / Float64(Float64(h * M) / Float64(l / M))) / D)))) * t_1); elseif (d <= -1e-309) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + t_0)); elseif (d <= 2.8e-224) tmp = Float64(-0.125 * Float64(Float64(Float64(D * D) / Float64(d / Float64(M * M))) * sqrt(Float64(h / (l ^ 3.0))))); elseif (d <= 2.3e+106) tmp = Float64(Float64(1.0 - t_0) * t_1); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(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 = (D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125);
t_1 = sqrt(((d / h) * (d / l)));
tmp = 0.0;
if (d <= -2e-92)
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_1;
elseif (d <= -1e-309)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
elseif (d <= 2.8e-224)
tmp = -0.125 * (((D * D) / (d / (M * M))) * sqrt((h / (l ^ 3.0))));
elseif (d <= 2.3e+106)
tmp = (1.0 - t_0) * t_1;
else
tmp = d * ((h ^ -0.5) / sqrt(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[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -2e-92], N[(N[(1.0 - N[(0.125 * N[(D / N[(N[(N[(d * d), $MachinePrecision] / N[(N[(h * M), $MachinePrecision] / N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[d, -1e-309], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.8e-224], N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.3e+106], N[(N[(1.0 - t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \left(D \cdot \frac{D}{\ell}\right) \cdot \left(\left(\frac{M}{\frac{d}{M}} \cdot \frac{h}{d}\right) \cdot 0.125\right)\\
t_1 := \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{if}\;d \leq -2 \cdot 10^{-92}:\\
\;\;\;\;\left(1 - 0.125 \cdot \frac{D}{\frac{\frac{d \cdot d}{\frac{h \cdot M}{\frac{\ell}{M}}}}{D}}\right) \cdot t_1\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + t_0\right)\\
\mathbf{elif}\;d \leq 2.8 \cdot 10^{-224}:\\
\;\;\;\;-0.125 \cdot \left(\frac{D \cdot D}{\frac{d}{M \cdot M}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)\\
\mathbf{elif}\;d \leq 2.3 \cdot 10^{+106}:\\
\;\;\;\;\left(1 - t_0\right) \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.99999999999999998e-92Initial program 81.1%
Applied egg-rr26.2%
expm1-def37.3%
expm1-log1p70.0%
*-commutative70.0%
*-commutative70.0%
associate-/l*70.0%
Simplified70.0%
Taylor expanded in M around 0 54.4%
associate-/l*54.3%
*-commutative54.3%
unpow254.3%
associate-/l*56.0%
*-commutative56.0%
associate-/l*57.6%
unpow257.6%
unpow257.6%
associate-*r*59.3%
associate-/l*62.0%
*-commutative62.0%
Simplified62.0%
if -1.99999999999999998e-92 < d < -1.000000000000002e-309Initial program 49.0%
Applied egg-rr8.2%
expm1-def13.2%
expm1-log1p44.0%
*-commutative44.0%
*-commutative44.0%
associate-/l*44.0%
Simplified44.0%
Taylor expanded in d around -inf 77.3%
mul-1-neg77.3%
associate-/r*77.3%
distribute-rgt-neg-in77.3%
associate-/l/77.3%
Simplified77.3%
Taylor expanded in M around 0 51.6%
*-commutative51.6%
times-frac59.2%
unpow259.2%
times-frac61.7%
unpow261.7%
associate-*l*61.7%
unpow261.7%
associate-*l/64.4%
*-commutative64.4%
associate-/l*67.0%
Simplified67.0%
if -1.000000000000002e-309 < d < 2.7999999999999998e-224Initial program 43.4%
Taylor expanded in d around 0 47.0%
associate-/l*47.0%
unpow247.0%
unpow247.0%
Simplified47.0%
if 2.7999999999999998e-224 < d < 2.3000000000000002e106Initial program 67.8%
Applied egg-rr6.6%
expm1-def18.5%
expm1-log1p54.8%
*-commutative54.8%
*-commutative54.8%
associate-/l*54.7%
Simplified54.7%
Taylor expanded in M around 0 41.9%
*-commutative0.7%
times-frac0.6%
unpow20.6%
times-frac1.1%
unpow21.1%
associate-*l*1.1%
unpow21.1%
associate-*l/1.0%
*-commutative1.0%
associate-/l*1.0%
Simplified60.4%
if 2.3000000000000002e106 < d Initial program 73.2%
metadata-eval73.2%
unpow1/273.2%
metadata-eval73.2%
unpow1/273.2%
*-commutative73.2%
associate-*l*73.2%
times-frac73.2%
metadata-eval73.2%
Simplified73.2%
associate-*r*73.2%
frac-times73.2%
*-commutative73.2%
metadata-eval73.2%
associate-*r/75.8%
metadata-eval75.8%
*-commutative75.8%
frac-times75.8%
associate-*l/75.8%
associate-*r/75.8%
associate-/l/75.8%
*-commutative75.8%
Applied egg-rr75.8%
Taylor expanded in d around inf 66.4%
*-commutative66.4%
*-commutative66.4%
associate-/r*66.4%
Simplified66.4%
sqrt-div78.3%
Applied egg-rr78.3%
div-inv78.3%
inv-pow78.3%
Applied egg-rr78.3%
associate-*r/78.3%
associate-/l*78.3%
sqr-pow78.4%
rem-sqrt-square78.4%
metadata-eval78.4%
sqr-pow78.2%
fabs-sqr78.2%
sqr-pow78.4%
/-rgt-identity78.4%
Simplified78.4%
Final simplification63.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 (* (* D (/ D l)) (* (* (/ M (/ d M)) (/ h d)) 0.125)))
(t_1 (sqrt (* (/ d h) (/ d l)))))
(if (<= d -4.8e-92)
(* (- 1.0 (* 0.125 (/ D (/ (/ (* d d) (/ (* h M) (/ l M))) D)))) t_1)
(if (<= d -5e-310)
(* (* d (sqrt (/ 1.0 (* h l)))) (+ -1.0 t_0))
(if (<= d 2.05e-224)
(* -0.125 (/ (* (* D D) (sqrt (/ h (pow l 3.0)))) (/ d (* M M))))
(if (<= d 1.7e+106)
(* (- 1.0 t_0) t_1)
(* d (/ (pow h -0.5) (sqrt l)))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125);
double t_1 = sqrt(((d / h) * (d / l)));
double tmp;
if (d <= -4.8e-92) {
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_1;
} else if (d <= -5e-310) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
} else if (d <= 2.05e-224) {
tmp = -0.125 * (((D * D) * sqrt((h / pow(l, 3.0)))) / (d / (M * M)));
} else if (d <= 1.7e+106) {
tmp = (1.0 - t_0) * t_1;
} else {
tmp = d * (pow(h, -0.5) / sqrt(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 = (d_1 * (d_1 / l)) * (((m / (d / m)) * (h / d)) * 0.125d0)
t_1 = sqrt(((d / h) * (d / l)))
if (d <= (-4.8d-92)) then
tmp = (1.0d0 - (0.125d0 * (d_1 / (((d * d) / ((h * m) / (l / m))) / d_1)))) * t_1
else if (d <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + t_0)
else if (d <= 2.05d-224) then
tmp = (-0.125d0) * (((d_1 * d_1) * sqrt((h / (l ** 3.0d0)))) / (d / (m * m)))
else if (d <= 1.7d+106) then
tmp = (1.0d0 - t_0) * t_1
else
tmp = d * ((h ** (-0.5d0)) / sqrt(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 = (D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125);
double t_1 = Math.sqrt(((d / h) * (d / l)));
double tmp;
if (d <= -4.8e-92) {
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_1;
} else if (d <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
} else if (d <= 2.05e-224) {
tmp = -0.125 * (((D * D) * Math.sqrt((h / Math.pow(l, 3.0)))) / (d / (M * M)));
} else if (d <= 1.7e+106) {
tmp = (1.0 - t_0) * t_1;
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = (D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125) t_1 = math.sqrt(((d / h) * (d / l))) tmp = 0 if d <= -4.8e-92: tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_1 elif d <= -5e-310: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + t_0) elif d <= 2.05e-224: tmp = -0.125 * (((D * D) * math.sqrt((h / math.pow(l, 3.0)))) / (d / (M * M))) elif d <= 1.7e+106: tmp = (1.0 - t_0) * t_1 else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(D * Float64(D / l)) * Float64(Float64(Float64(M / Float64(d / M)) * Float64(h / d)) * 0.125)) t_1 = sqrt(Float64(Float64(d / h) * Float64(d / l))) tmp = 0.0 if (d <= -4.8e-92) tmp = Float64(Float64(1.0 - Float64(0.125 * Float64(D / Float64(Float64(Float64(d * d) / Float64(Float64(h * M) / Float64(l / M))) / D)))) * t_1); elseif (d <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + t_0)); elseif (d <= 2.05e-224) tmp = Float64(-0.125 * Float64(Float64(Float64(D * D) * sqrt(Float64(h / (l ^ 3.0)))) / Float64(d / Float64(M * M)))); elseif (d <= 1.7e+106) tmp = Float64(Float64(1.0 - t_0) * t_1); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(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 = (D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125);
t_1 = sqrt(((d / h) * (d / l)));
tmp = 0.0;
if (d <= -4.8e-92)
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_1;
elseif (d <= -5e-310)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
elseif (d <= 2.05e-224)
tmp = -0.125 * (((D * D) * sqrt((h / (l ^ 3.0)))) / (d / (M * M)));
elseif (d <= 1.7e+106)
tmp = (1.0 - t_0) * t_1;
else
tmp = d * ((h ^ -0.5) / sqrt(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[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -4.8e-92], N[(N[(1.0 - N[(0.125 * N[(D / N[(N[(N[(d * d), $MachinePrecision] / N[(N[(h * M), $MachinePrecision] / N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.05e-224], N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.7e+106], N[(N[(1.0 - t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \left(D \cdot \frac{D}{\ell}\right) \cdot \left(\left(\frac{M}{\frac{d}{M}} \cdot \frac{h}{d}\right) \cdot 0.125\right)\\
t_1 := \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{if}\;d \leq -4.8 \cdot 10^{-92}:\\
\;\;\;\;\left(1 - 0.125 \cdot \frac{D}{\frac{\frac{d \cdot d}{\frac{h \cdot M}{\frac{\ell}{M}}}}{D}}\right) \cdot t_1\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + t_0\right)\\
\mathbf{elif}\;d \leq 2.05 \cdot 10^{-224}:\\
\;\;\;\;-0.125 \cdot \frac{\left(D \cdot D\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{\frac{d}{M \cdot M}}\\
\mathbf{elif}\;d \leq 1.7 \cdot 10^{+106}:\\
\;\;\;\;\left(1 - t_0\right) \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -4.8000000000000002e-92Initial program 81.1%
Applied egg-rr26.2%
expm1-def37.3%
expm1-log1p70.0%
*-commutative70.0%
*-commutative70.0%
associate-/l*70.0%
Simplified70.0%
Taylor expanded in M around 0 54.4%
associate-/l*54.3%
*-commutative54.3%
unpow254.3%
associate-/l*56.0%
*-commutative56.0%
associate-/l*57.6%
unpow257.6%
unpow257.6%
associate-*r*59.3%
associate-/l*62.0%
*-commutative62.0%
Simplified62.0%
if -4.8000000000000002e-92 < d < -4.999999999999985e-310Initial program 49.0%
Applied egg-rr8.2%
expm1-def13.2%
expm1-log1p44.0%
*-commutative44.0%
*-commutative44.0%
associate-/l*44.0%
Simplified44.0%
Taylor expanded in d around -inf 77.3%
mul-1-neg77.3%
associate-/r*77.3%
distribute-rgt-neg-in77.3%
associate-/l/77.3%
Simplified77.3%
Taylor expanded in M around 0 51.6%
*-commutative51.6%
times-frac59.2%
unpow259.2%
times-frac61.7%
unpow261.7%
associate-*l*61.7%
unpow261.7%
associate-*l/64.4%
*-commutative64.4%
associate-/l*67.0%
Simplified67.0%
if -4.999999999999985e-310 < d < 2.04999999999999993e-224Initial program 43.4%
Taylor expanded in d around 0 47.0%
associate-/l*47.0%
associate-*l/43.7%
unpow243.7%
unpow243.7%
Simplified43.7%
if 2.04999999999999993e-224 < d < 1.69999999999999997e106Initial program 67.8%
Applied egg-rr6.6%
expm1-def18.5%
expm1-log1p54.8%
*-commutative54.8%
*-commutative54.8%
associate-/l*54.7%
Simplified54.7%
Taylor expanded in M around 0 41.9%
*-commutative0.7%
times-frac0.6%
unpow20.6%
times-frac1.1%
unpow21.1%
associate-*l*1.1%
unpow21.1%
associate-*l/1.0%
*-commutative1.0%
associate-/l*1.0%
Simplified60.4%
if 1.69999999999999997e106 < d Initial program 73.2%
metadata-eval73.2%
unpow1/273.2%
metadata-eval73.2%
unpow1/273.2%
*-commutative73.2%
associate-*l*73.2%
times-frac73.2%
metadata-eval73.2%
Simplified73.2%
associate-*r*73.2%
frac-times73.2%
*-commutative73.2%
metadata-eval73.2%
associate-*r/75.8%
metadata-eval75.8%
*-commutative75.8%
frac-times75.8%
associate-*l/75.8%
associate-*r/75.8%
associate-/l/75.8%
*-commutative75.8%
Applied egg-rr75.8%
Taylor expanded in d around inf 66.4%
*-commutative66.4%
*-commutative66.4%
associate-/r*66.4%
Simplified66.4%
sqrt-div78.3%
Applied egg-rr78.3%
div-inv78.3%
inv-pow78.3%
Applied egg-rr78.3%
associate-*r/78.3%
associate-/l*78.3%
sqr-pow78.4%
rem-sqrt-square78.4%
metadata-eval78.4%
sqr-pow78.2%
fabs-sqr78.2%
sqr-pow78.4%
/-rgt-identity78.4%
Simplified78.4%
Final simplification63.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
(*
(- 1.0 (* 0.125 (/ D (/ (/ (* d d) (/ (* h M) (/ l M))) D))))
(sqrt (* (/ d h) (/ d l)))))
(t_1 (/ M (/ d M))))
(if (<= d -3.4e-91)
t_0
(if (<= d -5e-310)
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ -1.0 (* (* D (/ D l)) (* (* t_1 (/ h d)) 0.125))))
(if (<= d 1.55e-107)
(* (sqrt (/ h (pow l 3.0))) (* -0.125 (* D (* D t_1))))
(if (<= d 9.5e+105) t_0 (* d (/ (pow h -0.5) (sqrt l)))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * sqrt(((d / h) * (d / l)));
double t_1 = M / (d / M);
double tmp;
if (d <= -3.4e-91) {
tmp = t_0;
} else if (d <= -5e-310) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_1 * (h / d)) * 0.125)));
} else if (d <= 1.55e-107) {
tmp = sqrt((h / pow(l, 3.0))) * (-0.125 * (D * (D * t_1)));
} else if (d <= 9.5e+105) {
tmp = t_0;
} else {
tmp = d * (pow(h, -0.5) / sqrt(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 = (1.0d0 - (0.125d0 * (d_1 / (((d * d) / ((h * m) / (l / m))) / d_1)))) * sqrt(((d / h) * (d / l)))
t_1 = m / (d / m)
if (d <= (-3.4d-91)) then
tmp = t_0
else if (d <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + ((d_1 * (d_1 / l)) * ((t_1 * (h / d)) * 0.125d0)))
else if (d <= 1.55d-107) then
tmp = sqrt((h / (l ** 3.0d0))) * ((-0.125d0) * (d_1 * (d_1 * t_1)))
else if (d <= 9.5d+105) then
tmp = t_0
else
tmp = d * ((h ** (-0.5d0)) / sqrt(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 = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * Math.sqrt(((d / h) * (d / l)));
double t_1 = M / (d / M);
double tmp;
if (d <= -3.4e-91) {
tmp = t_0;
} else if (d <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_1 * (h / d)) * 0.125)));
} else if (d <= 1.55e-107) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (-0.125 * (D * (D * t_1)));
} else if (d <= 9.5e+105) {
tmp = t_0;
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * math.sqrt(((d / h) * (d / l))) t_1 = M / (d / M) tmp = 0 if d <= -3.4e-91: tmp = t_0 elif d <= -5e-310: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_1 * (h / d)) * 0.125))) elif d <= 1.55e-107: tmp = math.sqrt((h / math.pow(l, 3.0))) * (-0.125 * (D * (D * t_1))) elif d <= 9.5e+105: tmp = t_0 else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(1.0 - Float64(0.125 * Float64(D / Float64(Float64(Float64(d * d) / Float64(Float64(h * M) / Float64(l / M))) / D)))) * sqrt(Float64(Float64(d / h) * Float64(d / l)))) t_1 = Float64(M / Float64(d / M)) tmp = 0.0 if (d <= -3.4e-91) tmp = t_0; elseif (d <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + Float64(Float64(D * Float64(D / l)) * Float64(Float64(t_1 * Float64(h / d)) * 0.125)))); elseif (d <= 1.55e-107) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(-0.125 * Float64(D * Float64(D * t_1)))); elseif (d <= 9.5e+105) tmp = t_0; else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(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 = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * sqrt(((d / h) * (d / l)));
t_1 = M / (d / M);
tmp = 0.0;
if (d <= -3.4e-91)
tmp = t_0;
elseif (d <= -5e-310)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + ((D * (D / l)) * ((t_1 * (h / d)) * 0.125)));
elseif (d <= 1.55e-107)
tmp = sqrt((h / (l ^ 3.0))) * (-0.125 * (D * (D * t_1)));
elseif (d <= 9.5e+105)
tmp = t_0;
else
tmp = d * ((h ^ -0.5) / sqrt(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[(N[(1.0 - N[(0.125 * N[(D / N[(N[(N[(d * d), $MachinePrecision] / N[(N[(h * M), $MachinePrecision] / N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -3.4e-91], t$95$0, If[LessEqual[d, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 * N[(h / d), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.55e-107], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(D * N[(D * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 9.5e+105], t$95$0, N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \left(1 - 0.125 \cdot \frac{D}{\frac{\frac{d \cdot d}{\frac{h \cdot M}{\frac{\ell}{M}}}}{D}}\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
t_1 := \frac{M}{\frac{d}{M}}\\
\mathbf{if}\;d \leq -3.4 \cdot 10^{-91}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + \left(D \cdot \frac{D}{\ell}\right) \cdot \left(\left(t_1 \cdot \frac{h}{d}\right) \cdot 0.125\right)\right)\\
\mathbf{elif}\;d \leq 1.55 \cdot 10^{-107}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \left(D \cdot \left(D \cdot t_1\right)\right)\right)\\
\mathbf{elif}\;d \leq 9.5 \cdot 10^{+105}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -3.40000000000000027e-91 or 1.55000000000000011e-107 < d < 9.4999999999999995e105Initial program 79.3%
Applied egg-rr18.6%
expm1-def31.2%
expm1-log1p66.8%
*-commutative66.8%
*-commutative66.8%
associate-/l*66.7%
Simplified66.7%
Taylor expanded in M around 0 57.5%
associate-/l*57.8%
*-commutative57.8%
unpow257.8%
associate-/l*58.8%
*-commutative58.8%
associate-/l*59.8%
unpow259.8%
unpow259.8%
associate-*r*61.7%
associate-/l*65.8%
*-commutative65.8%
Simplified65.8%
if -3.40000000000000027e-91 < d < -4.999999999999985e-310Initial program 49.0%
Applied egg-rr8.2%
expm1-def13.2%
expm1-log1p44.0%
*-commutative44.0%
*-commutative44.0%
associate-/l*44.0%
Simplified44.0%
Taylor expanded in d around -inf 77.3%
mul-1-neg77.3%
associate-/r*77.3%
distribute-rgt-neg-in77.3%
associate-/l/77.3%
Simplified77.3%
Taylor expanded in M around 0 51.6%
*-commutative51.6%
times-frac59.2%
unpow259.2%
times-frac61.7%
unpow261.7%
associate-*l*61.7%
unpow261.7%
associate-*l/64.4%
*-commutative64.4%
associate-/l*67.0%
Simplified67.0%
if -4.999999999999985e-310 < d < 1.55000000000000011e-107Initial program 47.9%
metadata-eval47.9%
unpow1/247.9%
metadata-eval47.9%
unpow1/247.9%
*-commutative47.9%
associate-*l*47.9%
times-frac46.2%
metadata-eval46.2%
Simplified46.2%
associate-*r*46.2%
frac-times47.9%
*-commutative47.9%
metadata-eval47.9%
associate-*r/47.9%
metadata-eval47.9%
*-commutative47.9%
frac-times46.3%
associate-*l/46.3%
associate-*r/46.3%
associate-/l/46.3%
*-commutative46.3%
Applied egg-rr46.3%
Taylor expanded in d around 0 39.5%
associate-*r*39.5%
*-commutative39.5%
associate-*r/37.9%
unpow237.9%
unpow237.9%
associate-*l*41.9%
associate-/l*48.9%
Simplified48.9%
if 9.4999999999999995e105 < d Initial program 73.2%
metadata-eval73.2%
unpow1/273.2%
metadata-eval73.2%
unpow1/273.2%
*-commutative73.2%
associate-*l*73.2%
times-frac73.2%
metadata-eval73.2%
Simplified73.2%
associate-*r*73.2%
frac-times73.2%
*-commutative73.2%
metadata-eval73.2%
associate-*r/75.8%
metadata-eval75.8%
*-commutative75.8%
frac-times75.8%
associate-*l/75.8%
associate-*r/75.8%
associate-/l/75.8%
*-commutative75.8%
Applied egg-rr75.8%
Taylor expanded in d around inf 66.4%
*-commutative66.4%
*-commutative66.4%
associate-/r*66.4%
Simplified66.4%
sqrt-div78.3%
Applied egg-rr78.3%
div-inv78.3%
inv-pow78.3%
Applied egg-rr78.3%
associate-*r/78.3%
associate-/l*78.3%
sqr-pow78.4%
rem-sqrt-square78.4%
metadata-eval78.4%
sqr-pow78.2%
fabs-sqr78.2%
sqr-pow78.4%
/-rgt-identity78.4%
Simplified78.4%
Final simplification64.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 (* (* D (/ D l)) (* (* (/ M (/ d M)) (/ h d)) 0.125)))
(t_1 (sqrt (* (/ d h) (/ d l)))))
(if (<= d -4.3e-90)
(* (- 1.0 (* 0.125 (/ D (/ (/ (* d d) (/ (* h M) (/ l M))) D)))) t_1)
(if (<= d 3.1e-301)
(* (* d (sqrt (/ 1.0 (* h l)))) (+ -1.0 t_0))
(if (<= d 3.8e+106)
(* (- 1.0 t_0) t_1)
(* d (/ (pow h -0.5) (sqrt l))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125);
double t_1 = sqrt(((d / h) * (d / l)));
double tmp;
if (d <= -4.3e-90) {
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_1;
} else if (d <= 3.1e-301) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
} else if (d <= 3.8e+106) {
tmp = (1.0 - t_0) * t_1;
} else {
tmp = d * (pow(h, -0.5) / sqrt(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 = (d_1 * (d_1 / l)) * (((m / (d / m)) * (h / d)) * 0.125d0)
t_1 = sqrt(((d / h) * (d / l)))
if (d <= (-4.3d-90)) then
tmp = (1.0d0 - (0.125d0 * (d_1 / (((d * d) / ((h * m) / (l / m))) / d_1)))) * t_1
else if (d <= 3.1d-301) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + t_0)
else if (d <= 3.8d+106) then
tmp = (1.0d0 - t_0) * t_1
else
tmp = d * ((h ** (-0.5d0)) / sqrt(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 = (D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125);
double t_1 = Math.sqrt(((d / h) * (d / l)));
double tmp;
if (d <= -4.3e-90) {
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_1;
} else if (d <= 3.1e-301) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
} else if (d <= 3.8e+106) {
tmp = (1.0 - t_0) * t_1;
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = (D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125) t_1 = math.sqrt(((d / h) * (d / l))) tmp = 0 if d <= -4.3e-90: tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_1 elif d <= 3.1e-301: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + t_0) elif d <= 3.8e+106: tmp = (1.0 - t_0) * t_1 else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(D * Float64(D / l)) * Float64(Float64(Float64(M / Float64(d / M)) * Float64(h / d)) * 0.125)) t_1 = sqrt(Float64(Float64(d / h) * Float64(d / l))) tmp = 0.0 if (d <= -4.3e-90) tmp = Float64(Float64(1.0 - Float64(0.125 * Float64(D / Float64(Float64(Float64(d * d) / Float64(Float64(h * M) / Float64(l / M))) / D)))) * t_1); elseif (d <= 3.1e-301) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + t_0)); elseif (d <= 3.8e+106) tmp = Float64(Float64(1.0 - t_0) * t_1); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(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 = (D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125);
t_1 = sqrt(((d / h) * (d / l)));
tmp = 0.0;
if (d <= -4.3e-90)
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_1;
elseif (d <= 3.1e-301)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
elseif (d <= 3.8e+106)
tmp = (1.0 - t_0) * t_1;
else
tmp = d * ((h ^ -0.5) / sqrt(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[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -4.3e-90], N[(N[(1.0 - N[(0.125 * N[(D / N[(N[(N[(d * d), $MachinePrecision] / N[(N[(h * M), $MachinePrecision] / N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[d, 3.1e-301], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.8e+106], N[(N[(1.0 - t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \left(D \cdot \frac{D}{\ell}\right) \cdot \left(\left(\frac{M}{\frac{d}{M}} \cdot \frac{h}{d}\right) \cdot 0.125\right)\\
t_1 := \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{if}\;d \leq -4.3 \cdot 10^{-90}:\\
\;\;\;\;\left(1 - 0.125 \cdot \frac{D}{\frac{\frac{d \cdot d}{\frac{h \cdot M}{\frac{\ell}{M}}}}{D}}\right) \cdot t_1\\
\mathbf{elif}\;d \leq 3.1 \cdot 10^{-301}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + t_0\right)\\
\mathbf{elif}\;d \leq 3.8 \cdot 10^{+106}:\\
\;\;\;\;\left(1 - t_0\right) \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -4.3000000000000002e-90Initial program 81.1%
Applied egg-rr26.2%
expm1-def37.3%
expm1-log1p70.0%
*-commutative70.0%
*-commutative70.0%
associate-/l*70.0%
Simplified70.0%
Taylor expanded in M around 0 54.4%
associate-/l*54.3%
*-commutative54.3%
unpow254.3%
associate-/l*56.0%
*-commutative56.0%
associate-/l*57.6%
unpow257.6%
unpow257.6%
associate-*r*59.3%
associate-/l*62.0%
*-commutative62.0%
Simplified62.0%
if -4.3000000000000002e-90 < d < 3.10000000000000014e-301Initial program 47.9%
Applied egg-rr7.7%
expm1-def12.2%
expm1-log1p40.9%
*-commutative40.9%
*-commutative40.9%
associate-/l*40.9%
Simplified40.9%
Taylor expanded in d around -inf 71.8%
mul-1-neg71.8%
associate-/r*71.8%
distribute-rgt-neg-in71.8%
associate-/l/71.8%
Simplified71.8%
Taylor expanded in M around 0 47.9%
*-commutative47.9%
times-frac54.9%
unpow254.9%
times-frac57.3%
unpow257.3%
associate-*l*57.3%
unpow257.3%
associate-*l/59.8%
*-commutative59.8%
associate-/l*62.2%
Simplified62.2%
if 3.10000000000000014e-301 < d < 3.7999999999999998e106Initial program 61.5%
Applied egg-rr8.0%
expm1-def16.7%
expm1-log1p50.1%
*-commutative50.1%
*-commutative50.1%
associate-/l*50.1%
Simplified50.1%
Taylor expanded in M around 0 34.6%
*-commutative0.5%
times-frac0.5%
unpow20.5%
times-frac3.0%
unpow23.0%
associate-*l*3.0%
unpow23.0%
associate-*l/2.8%
*-commutative2.8%
associate-/l*2.9%
Simplified53.2%
if 3.7999999999999998e106 < d Initial program 73.2%
metadata-eval73.2%
unpow1/273.2%
metadata-eval73.2%
unpow1/273.2%
*-commutative73.2%
associate-*l*73.2%
times-frac73.2%
metadata-eval73.2%
Simplified73.2%
associate-*r*73.2%
frac-times73.2%
*-commutative73.2%
metadata-eval73.2%
associate-*r/75.8%
metadata-eval75.8%
*-commutative75.8%
frac-times75.8%
associate-*l/75.8%
associate-*r/75.8%
associate-/l/75.8%
*-commutative75.8%
Applied egg-rr75.8%
Taylor expanded in d around inf 66.4%
*-commutative66.4%
*-commutative66.4%
associate-/r*66.4%
Simplified66.4%
sqrt-div78.3%
Applied egg-rr78.3%
div-inv78.3%
inv-pow78.3%
Applied egg-rr78.3%
associate-*r/78.3%
associate-/l*78.3%
sqr-pow78.4%
rem-sqrt-square78.4%
metadata-eval78.4%
sqr-pow78.2%
fabs-sqr78.2%
sqr-pow78.4%
/-rgt-identity78.4%
Simplified78.4%
Final simplification61.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 (* (* D (/ D l)) (* (* (/ M (/ d M)) (/ h d)) 0.125)))
(t_1 (sqrt (* (/ d h) (/ d l)))))
(if (<= d -3.75e-90)
(* (- 1.0 (* 0.125 (/ D (/ (/ (* d d) (/ (* h M) (/ l M))) D)))) t_1)
(if (<= d 3.3e-301)
(* (* d (sqrt (/ 1.0 (* h l)))) (+ -1.0 t_0))
(if (<= d 5.5e+106) (* (- 1.0 t_0) t_1) (/ d (* (sqrt h) (sqrt l))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125);
double t_1 = sqrt(((d / h) * (d / l)));
double tmp;
if (d <= -3.75e-90) {
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_1;
} else if (d <= 3.3e-301) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
} else if (d <= 5.5e+106) {
tmp = (1.0 - t_0) * t_1;
} else {
tmp = d / (sqrt(h) * sqrt(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 = (d_1 * (d_1 / l)) * (((m / (d / m)) * (h / d)) * 0.125d0)
t_1 = sqrt(((d / h) * (d / l)))
if (d <= (-3.75d-90)) then
tmp = (1.0d0 - (0.125d0 * (d_1 / (((d * d) / ((h * m) / (l / m))) / d_1)))) * t_1
else if (d <= 3.3d-301) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + t_0)
else if (d <= 5.5d+106) then
tmp = (1.0d0 - t_0) * t_1
else
tmp = d / (sqrt(h) * sqrt(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 = (D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125);
double t_1 = Math.sqrt(((d / h) * (d / l)));
double tmp;
if (d <= -3.75e-90) {
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_1;
} else if (d <= 3.3e-301) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
} else if (d <= 5.5e+106) {
tmp = (1.0 - t_0) * t_1;
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = (D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125) t_1 = math.sqrt(((d / h) * (d / l))) tmp = 0 if d <= -3.75e-90: tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_1 elif d <= 3.3e-301: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + t_0) elif d <= 5.5e+106: tmp = (1.0 - t_0) * t_1 else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(D * Float64(D / l)) * Float64(Float64(Float64(M / Float64(d / M)) * Float64(h / d)) * 0.125)) t_1 = sqrt(Float64(Float64(d / h) * Float64(d / l))) tmp = 0.0 if (d <= -3.75e-90) tmp = Float64(Float64(1.0 - Float64(0.125 * Float64(D / Float64(Float64(Float64(d * d) / Float64(Float64(h * M) / Float64(l / M))) / D)))) * t_1); elseif (d <= 3.3e-301) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + t_0)); elseif (d <= 5.5e+106) tmp = Float64(Float64(1.0 - t_0) * t_1); else tmp = Float64(d / Float64(sqrt(h) * sqrt(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 = (D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125);
t_1 = sqrt(((d / h) * (d / l)));
tmp = 0.0;
if (d <= -3.75e-90)
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_1;
elseif (d <= 3.3e-301)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
elseif (d <= 5.5e+106)
tmp = (1.0 - t_0) * t_1;
else
tmp = d / (sqrt(h) * sqrt(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[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -3.75e-90], N[(N[(1.0 - N[(0.125 * N[(D / N[(N[(N[(d * d), $MachinePrecision] / N[(N[(h * M), $MachinePrecision] / N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[d, 3.3e-301], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.5e+106], N[(N[(1.0 - t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \left(D \cdot \frac{D}{\ell}\right) \cdot \left(\left(\frac{M}{\frac{d}{M}} \cdot \frac{h}{d}\right) \cdot 0.125\right)\\
t_1 := \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{if}\;d \leq -3.75 \cdot 10^{-90}:\\
\;\;\;\;\left(1 - 0.125 \cdot \frac{D}{\frac{\frac{d \cdot d}{\frac{h \cdot M}{\frac{\ell}{M}}}}{D}}\right) \cdot t_1\\
\mathbf{elif}\;d \leq 3.3 \cdot 10^{-301}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + t_0\right)\\
\mathbf{elif}\;d \leq 5.5 \cdot 10^{+106}:\\
\;\;\;\;\left(1 - t_0\right) \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -3.7499999999999999e-90Initial program 81.1%
Applied egg-rr26.2%
expm1-def37.3%
expm1-log1p70.0%
*-commutative70.0%
*-commutative70.0%
associate-/l*70.0%
Simplified70.0%
Taylor expanded in M around 0 54.4%
associate-/l*54.3%
*-commutative54.3%
unpow254.3%
associate-/l*56.0%
*-commutative56.0%
associate-/l*57.6%
unpow257.6%
unpow257.6%
associate-*r*59.3%
associate-/l*62.0%
*-commutative62.0%
Simplified62.0%
if -3.7499999999999999e-90 < d < 3.3e-301Initial program 47.9%
Applied egg-rr7.7%
expm1-def12.2%
expm1-log1p40.9%
*-commutative40.9%
*-commutative40.9%
associate-/l*40.9%
Simplified40.9%
Taylor expanded in d around -inf 71.8%
mul-1-neg71.8%
associate-/r*71.8%
distribute-rgt-neg-in71.8%
associate-/l/71.8%
Simplified71.8%
Taylor expanded in M around 0 47.9%
*-commutative47.9%
times-frac54.9%
unpow254.9%
times-frac57.3%
unpow257.3%
associate-*l*57.3%
unpow257.3%
associate-*l/59.8%
*-commutative59.8%
associate-/l*62.2%
Simplified62.2%
if 3.3e-301 < d < 5.5e106Initial program 61.5%
Applied egg-rr8.0%
expm1-def16.7%
expm1-log1p50.1%
*-commutative50.1%
*-commutative50.1%
associate-/l*50.1%
Simplified50.1%
Taylor expanded in M around 0 34.6%
*-commutative0.5%
times-frac0.5%
unpow20.5%
times-frac3.0%
unpow23.0%
associate-*l*3.0%
unpow23.0%
associate-*l/2.8%
*-commutative2.8%
associate-/l*2.9%
Simplified53.2%
if 5.5e106 < d Initial program 73.2%
metadata-eval73.2%
unpow1/273.2%
metadata-eval73.2%
unpow1/273.2%
*-commutative73.2%
associate-*l*73.2%
times-frac73.2%
metadata-eval73.2%
Simplified73.2%
associate-*r*73.2%
frac-times73.2%
*-commutative73.2%
metadata-eval73.2%
associate-*r/75.8%
metadata-eval75.8%
*-commutative75.8%
frac-times75.8%
associate-*l/75.8%
associate-*r/75.8%
associate-/l/75.8%
*-commutative75.8%
Applied egg-rr75.8%
Taylor expanded in d around inf 66.4%
*-commutative66.4%
*-commutative66.4%
associate-/r*66.4%
Simplified66.4%
associate-/r*66.4%
associate-/l/66.4%
add-cbrt-cube57.6%
add-sqr-sqrt57.6%
pow157.6%
add-sqr-sqrt57.6%
add-cbrt-cube66.4%
associate-/l/66.4%
sqrt-div66.3%
metadata-eval66.3%
*-commutative66.3%
Applied egg-rr66.3%
unpow166.3%
associate-*r/66.4%
*-rgt-identity66.4%
Simplified66.4%
sqrt-prod78.3%
Applied egg-rr78.3%
Final simplification61.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 (* (* D (/ D l)) (* (* (/ M (/ d M)) (/ h d)) 0.125)))
(t_1 (sqrt (* (/ d h) (/ d l)))))
(if (<= d -5.2e-92)
(* (- 1.0 (* 0.125 (/ D (/ (/ (* d d) (/ (* h M) (/ l M))) D)))) t_1)
(if (<= d 3.1e-301)
(* (* d (sqrt (/ 1.0 (* h l)))) (+ -1.0 t_0))
(if (<= d 2.1e+104) (* (- 1.0 t_0) t_1) (* d (pow (* h l) -0.5)))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125);
double t_1 = sqrt(((d / h) * (d / l)));
double tmp;
if (d <= -5.2e-92) {
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_1;
} else if (d <= 3.1e-301) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
} else if (d <= 2.1e+104) {
tmp = (1.0 - t_0) * t_1;
} else {
tmp = d * pow((h * l), -0.5);
}
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 = (d_1 * (d_1 / l)) * (((m / (d / m)) * (h / d)) * 0.125d0)
t_1 = sqrt(((d / h) * (d / l)))
if (d <= (-5.2d-92)) then
tmp = (1.0d0 - (0.125d0 * (d_1 / (((d * d) / ((h * m) / (l / m))) / d_1)))) * t_1
else if (d <= 3.1d-301) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + t_0)
else if (d <= 2.1d+104) then
tmp = (1.0d0 - t_0) * t_1
else
tmp = d * ((h * l) ** (-0.5d0))
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 = (D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125);
double t_1 = Math.sqrt(((d / h) * (d / l)));
double tmp;
if (d <= -5.2e-92) {
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_1;
} else if (d <= 3.1e-301) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
} else if (d <= 2.1e+104) {
tmp = (1.0 - t_0) * t_1;
} else {
tmp = d * Math.pow((h * l), -0.5);
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = (D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125) t_1 = math.sqrt(((d / h) * (d / l))) tmp = 0 if d <= -5.2e-92: tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_1 elif d <= 3.1e-301: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + t_0) elif d <= 2.1e+104: tmp = (1.0 - t_0) * t_1 else: tmp = d * math.pow((h * l), -0.5) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(D * Float64(D / l)) * Float64(Float64(Float64(M / Float64(d / M)) * Float64(h / d)) * 0.125)) t_1 = sqrt(Float64(Float64(d / h) * Float64(d / l))) tmp = 0.0 if (d <= -5.2e-92) tmp = Float64(Float64(1.0 - Float64(0.125 * Float64(D / Float64(Float64(Float64(d * d) / Float64(Float64(h * M) / Float64(l / M))) / D)))) * t_1); elseif (d <= 3.1e-301) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + t_0)); elseif (d <= 2.1e+104) tmp = Float64(Float64(1.0 - t_0) * t_1); else tmp = Float64(d * (Float64(h * l) ^ -0.5)); 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 * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125);
t_1 = sqrt(((d / h) * (d / l)));
tmp = 0.0;
if (d <= -5.2e-92)
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_1;
elseif (d <= 3.1e-301)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
elseif (d <= 2.1e+104)
tmp = (1.0 - t_0) * t_1;
else
tmp = d * ((h * l) ^ -0.5);
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[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -5.2e-92], N[(N[(1.0 - N[(0.125 * N[(D / N[(N[(N[(d * d), $MachinePrecision] / N[(N[(h * M), $MachinePrecision] / N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[d, 3.1e-301], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.1e+104], N[(N[(1.0 - t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision], N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \left(D \cdot \frac{D}{\ell}\right) \cdot \left(\left(\frac{M}{\frac{d}{M}} \cdot \frac{h}{d}\right) \cdot 0.125\right)\\
t_1 := \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{if}\;d \leq -5.2 \cdot 10^{-92}:\\
\;\;\;\;\left(1 - 0.125 \cdot \frac{D}{\frac{\frac{d \cdot d}{\frac{h \cdot M}{\frac{\ell}{M}}}}{D}}\right) \cdot t_1\\
\mathbf{elif}\;d \leq 3.1 \cdot 10^{-301}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + t_0\right)\\
\mathbf{elif}\;d \leq 2.1 \cdot 10^{+104}:\\
\;\;\;\;\left(1 - t_0\right) \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\end{array}
\end{array}
if d < -5.2e-92Initial program 81.1%
Applied egg-rr26.2%
expm1-def37.3%
expm1-log1p70.0%
*-commutative70.0%
*-commutative70.0%
associate-/l*70.0%
Simplified70.0%
Taylor expanded in M around 0 54.4%
associate-/l*54.3%
*-commutative54.3%
unpow254.3%
associate-/l*56.0%
*-commutative56.0%
associate-/l*57.6%
unpow257.6%
unpow257.6%
associate-*r*59.3%
associate-/l*62.0%
*-commutative62.0%
Simplified62.0%
if -5.2e-92 < d < 3.10000000000000014e-301Initial program 47.9%
Applied egg-rr7.7%
expm1-def12.2%
expm1-log1p40.9%
*-commutative40.9%
*-commutative40.9%
associate-/l*40.9%
Simplified40.9%
Taylor expanded in d around -inf 71.8%
mul-1-neg71.8%
associate-/r*71.8%
distribute-rgt-neg-in71.8%
associate-/l/71.8%
Simplified71.8%
Taylor expanded in M around 0 47.9%
*-commutative47.9%
times-frac54.9%
unpow254.9%
times-frac57.3%
unpow257.3%
associate-*l*57.3%
unpow257.3%
associate-*l/59.8%
*-commutative59.8%
associate-/l*62.2%
Simplified62.2%
if 3.10000000000000014e-301 < d < 2.0999999999999998e104Initial program 61.5%
Applied egg-rr8.0%
expm1-def16.7%
expm1-log1p50.1%
*-commutative50.1%
*-commutative50.1%
associate-/l*50.1%
Simplified50.1%
Taylor expanded in M around 0 34.6%
*-commutative0.5%
times-frac0.5%
unpow20.5%
times-frac3.0%
unpow23.0%
associate-*l*3.0%
unpow23.0%
associate-*l/2.8%
*-commutative2.8%
associate-/l*2.9%
Simplified53.2%
if 2.0999999999999998e104 < d Initial program 73.2%
metadata-eval73.2%
unpow1/273.2%
metadata-eval73.2%
unpow1/273.2%
*-commutative73.2%
associate-*l*73.2%
times-frac73.2%
metadata-eval73.2%
Simplified73.2%
pow1/273.2%
sqr-pow73.1%
pow273.1%
metadata-eval73.1%
Applied egg-rr73.1%
Taylor expanded in d around inf 66.4%
*-commutative66.4%
unpow-166.4%
sqr-pow66.5%
rem-sqrt-square66.5%
sqr-pow66.1%
fabs-sqr66.1%
sqr-pow66.5%
metadata-eval66.5%
Simplified66.5%
Final simplification59.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) (/ d l)))))
(if (<= d -9.8e-110)
(* (- 1.0 (* 0.125 (/ D (/ (/ (* d d) (/ (* h M) (/ l M))) D)))) t_0)
(if (<= d 4.8e+105)
(* (- 1.0 (* (* D (/ D l)) (* (* (/ M (/ d M)) (/ h d)) 0.125))) t_0)
(* d (pow (* h l) -0.5))))))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)));
double tmp;
if (d <= -9.8e-110) {
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_0;
} else if (d <= 4.8e+105) {
tmp = (1.0 - ((D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125))) * t_0;
} else {
tmp = d * pow((h * l), -0.5);
}
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)))
if (d <= (-9.8d-110)) then
tmp = (1.0d0 - (0.125d0 * (d_1 / (((d * d) / ((h * m) / (l / m))) / d_1)))) * t_0
else if (d <= 4.8d+105) then
tmp = (1.0d0 - ((d_1 * (d_1 / l)) * (((m / (d / m)) * (h / d)) * 0.125d0))) * t_0
else
tmp = d * ((h * l) ** (-0.5d0))
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)));
double tmp;
if (d <= -9.8e-110) {
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_0;
} else if (d <= 4.8e+105) {
tmp = (1.0 - ((D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125))) * t_0;
} else {
tmp = d * Math.pow((h * l), -0.5);
}
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))) tmp = 0 if d <= -9.8e-110: tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_0 elif d <= 4.8e+105: tmp = (1.0 - ((D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125))) * t_0 else: tmp = d * math.pow((h * l), -0.5) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(Float64(d / h) * Float64(d / l))) tmp = 0.0 if (d <= -9.8e-110) tmp = Float64(Float64(1.0 - Float64(0.125 * Float64(D / Float64(Float64(Float64(d * d) / Float64(Float64(h * M) / Float64(l / M))) / D)))) * t_0); elseif (d <= 4.8e+105) tmp = Float64(Float64(1.0 - Float64(Float64(D * Float64(D / l)) * Float64(Float64(Float64(M / Float64(d / M)) * Float64(h / d)) * 0.125))) * t_0); else tmp = Float64(d * (Float64(h * l) ^ -0.5)); 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)));
tmp = 0.0;
if (d <= -9.8e-110)
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * t_0;
elseif (d <= 4.8e+105)
tmp = (1.0 - ((D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125))) * t_0;
else
tmp = d * ((h * l) ^ -0.5);
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[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -9.8e-110], N[(N[(1.0 - N[(0.125 * N[(D / N[(N[(N[(d * d), $MachinePrecision] / N[(N[(h * M), $MachinePrecision] / N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[d, 4.8e+105], N[(N[(1.0 - N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $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}}\\
\mathbf{if}\;d \leq -9.8 \cdot 10^{-110}:\\
\;\;\;\;\left(1 - 0.125 \cdot \frac{D}{\frac{\frac{d \cdot d}{\frac{h \cdot M}{\frac{\ell}{M}}}}{D}}\right) \cdot t_0\\
\mathbf{elif}\;d \leq 4.8 \cdot 10^{+105}:\\
\;\;\;\;\left(1 - \left(D \cdot \frac{D}{\ell}\right) \cdot \left(\left(\frac{M}{\frac{d}{M}} \cdot \frac{h}{d}\right) \cdot 0.125\right)\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\end{array}
\end{array}
if d < -9.7999999999999995e-110Initial program 80.9%
Applied egg-rr26.2%
expm1-def36.6%
expm1-log1p68.9%
*-commutative68.9%
*-commutative68.9%
associate-/l*68.9%
Simplified68.9%
Taylor expanded in M around 0 52.7%
associate-/l*52.7%
*-commutative52.7%
unpow252.7%
associate-/l*54.3%
*-commutative54.3%
associate-/l*57.2%
unpow257.2%
unpow257.2%
associate-*r*58.8%
associate-/l*61.3%
*-commutative61.3%
Simplified61.3%
if -9.7999999999999995e-110 < d < 4.7999999999999995e105Initial program 57.0%
Applied egg-rr7.4%
expm1-def15.1%
expm1-log1p47.3%
*-commutative47.3%
*-commutative47.3%
associate-/l*47.2%
Simplified47.2%
Taylor expanded in M around 0 31.6%
*-commutative13.5%
times-frac14.9%
unpow214.9%
times-frac17.4%
unpow217.4%
associate-*l*17.4%
unpow217.4%
associate-*l/18.1%
*-commutative18.1%
associate-/l*18.8%
Simplified47.3%
if 4.7999999999999995e105 < d Initial program 73.2%
metadata-eval73.2%
unpow1/273.2%
metadata-eval73.2%
unpow1/273.2%
*-commutative73.2%
associate-*l*73.2%
times-frac73.2%
metadata-eval73.2%
Simplified73.2%
pow1/273.2%
sqr-pow73.1%
pow273.1%
metadata-eval73.1%
Applied egg-rr73.1%
Taylor expanded in d around inf 66.4%
*-commutative66.4%
unpow-166.4%
sqr-pow66.5%
rem-sqrt-square66.5%
sqr-pow66.1%
fabs-sqr66.1%
sqr-pow66.5%
metadata-eval66.5%
Simplified66.5%
Final simplification54.7%
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 (<= d 2.45e-301)
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ -1.0 (* 0.125 (/ D (/ (/ (* d d) (/ (* h M) (/ l M))) D)))))
(if (<= d 4.5e+106)
(*
(- 1.0 (* (* D (/ D l)) (* (* (/ M (/ d M)) (/ h d)) 0.125)))
(sqrt (* (/ d h) (/ d l))))
(* d (pow (* h l) -0.5)))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 2.45e-301) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D))));
} else if (d <= 4.5e+106) {
tmp = (1.0 - ((D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125))) * sqrt(((d / h) * (d / l)));
} else {
tmp = d * pow((h * l), -0.5);
}
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 (d <= 2.45d-301) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + (0.125d0 * (d_1 / (((d * d) / ((h * m) / (l / m))) / d_1))))
else if (d <= 4.5d+106) then
tmp = (1.0d0 - ((d_1 * (d_1 / l)) * (((m / (d / m)) * (h / d)) * 0.125d0))) * sqrt(((d / h) * (d / l)))
else
tmp = d * ((h * l) ** (-0.5d0))
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 (d <= 2.45e-301) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D))));
} else if (d <= 4.5e+106) {
tmp = (1.0 - ((D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125))) * Math.sqrt(((d / h) * (d / l)));
} else {
tmp = d * Math.pow((h * l), -0.5);
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= 2.45e-301: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) elif d <= 4.5e+106: tmp = (1.0 - ((D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125))) * math.sqrt(((d / h) * (d / l))) else: tmp = d * math.pow((h * l), -0.5) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= 2.45e-301) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + Float64(0.125 * Float64(D / Float64(Float64(Float64(d * d) / Float64(Float64(h * M) / Float64(l / M))) / D))))); elseif (d <= 4.5e+106) tmp = Float64(Float64(1.0 - Float64(Float64(D * Float64(D / l)) * Float64(Float64(Float64(M / Float64(d / M)) * Float64(h / d)) * 0.125))) * sqrt(Float64(Float64(d / h) * Float64(d / l)))); else tmp = Float64(d * (Float64(h * l) ^ -0.5)); 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 (d <= 2.45e-301)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D))));
elseif (d <= 4.5e+106)
tmp = (1.0 - ((D * (D / l)) * (((M / (d / M)) * (h / d)) * 0.125))) * sqrt(((d / h) * (d / l)));
else
tmp = d * ((h * l) ^ -0.5);
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[d, 2.45e-301], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.125 * N[(D / N[(N[(N[(d * d), $MachinePrecision] / N[(N[(h * M), $MachinePrecision] / N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4.5e+106], N[(N[(1.0 - N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 2.45 \cdot 10^{-301}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + 0.125 \cdot \frac{D}{\frac{\frac{d \cdot d}{\frac{h \cdot M}{\frac{\ell}{M}}}}{D}}\right)\\
\mathbf{elif}\;d \leq 4.5 \cdot 10^{+106}:\\
\;\;\;\;\left(1 - \left(D \cdot \frac{D}{\ell}\right) \cdot \left(\left(\frac{M}{\frac{d}{M}} \cdot \frac{h}{d}\right) \cdot 0.125\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\end{array}
\end{array}
if d < 2.45e-301Initial program 69.0%
Applied egg-rr19.3%
expm1-def27.9%
expm1-log1p59.3%
*-commutative59.3%
*-commutative59.3%
associate-/l*59.3%
Simplified59.3%
Taylor expanded in d around -inf 70.2%
mul-1-neg70.2%
associate-/r*70.2%
distribute-rgt-neg-in70.2%
associate-/l/70.2%
Simplified70.2%
Taylor expanded in M around 0 52.4%
associate-/l*43.9%
*-commutative43.9%
unpow243.9%
associate-/l*45.0%
*-commutative45.0%
associate-/l*47.8%
unpow247.8%
unpow247.8%
associate-*r*48.9%
associate-/l*50.5%
*-commutative50.5%
Simplified61.1%
if 2.45e-301 < d < 4.4999999999999997e106Initial program 60.9%
Applied egg-rr7.9%
expm1-def16.5%
expm1-log1p49.6%
*-commutative49.6%
*-commutative49.6%
associate-/l*49.6%
Simplified49.6%
Taylor expanded in M around 0 34.2%
*-commutative0.5%
times-frac0.5%
unpow20.5%
times-frac2.9%
unpow22.9%
associate-*l*2.9%
unpow22.9%
associate-*l/2.8%
*-commutative2.8%
associate-/l*2.8%
Simplified52.6%
if 4.4999999999999997e106 < d Initial program 73.2%
metadata-eval73.2%
unpow1/273.2%
metadata-eval73.2%
unpow1/273.2%
*-commutative73.2%
associate-*l*73.2%
times-frac73.2%
metadata-eval73.2%
Simplified73.2%
pow1/273.2%
sqr-pow73.1%
pow273.1%
metadata-eval73.1%
Applied egg-rr73.1%
Taylor expanded in d around inf 66.4%
*-commutative66.4%
unpow-166.4%
sqr-pow66.5%
rem-sqrt-square66.5%
sqr-pow66.1%
fabs-sqr66.1%
sqr-pow66.5%
metadata-eval66.5%
Simplified66.5%
Final simplification58.7%
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 (<= l 9.5e+29)
(*
(- 1.0 (* 0.125 (/ D (/ (/ (* d d) (/ (* h M) (/ l M))) D))))
(sqrt (* (/ d h) (/ d l))))
(* d (pow (* h l) -0.5))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 9.5e+29) {
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * sqrt(((d / h) * (d / l)));
} else {
tmp = d * pow((h * l), -0.5);
}
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 (l <= 9.5d+29) then
tmp = (1.0d0 - (0.125d0 * (d_1 / (((d * d) / ((h * m) / (l / m))) / d_1)))) * sqrt(((d / h) * (d / l)))
else
tmp = d * ((h * l) ** (-0.5d0))
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 (l <= 9.5e+29) {
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * Math.sqrt(((d / h) * (d / l)));
} else {
tmp = d * Math.pow((h * l), -0.5);
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 9.5e+29: tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * math.sqrt(((d / h) * (d / l))) else: tmp = d * math.pow((h * l), -0.5) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 9.5e+29) tmp = Float64(Float64(1.0 - Float64(0.125 * Float64(D / Float64(Float64(Float64(d * d) / Float64(Float64(h * M) / Float64(l / M))) / D)))) * sqrt(Float64(Float64(d / h) * Float64(d / l)))); else tmp = Float64(d * (Float64(h * l) ^ -0.5)); 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 (l <= 9.5e+29)
tmp = (1.0 - (0.125 * (D / (((d * d) / ((h * M) / (l / M))) / D)))) * sqrt(((d / h) * (d / l)));
else
tmp = d * ((h * l) ^ -0.5);
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[l, 9.5e+29], N[(N[(1.0 - N[(0.125 * N[(D / N[(N[(N[(d * d), $MachinePrecision] / N[(N[(h * M), $MachinePrecision] / N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 9.5 \cdot 10^{+29}:\\
\;\;\;\;\left(1 - 0.125 \cdot \frac{D}{\frac{\frac{d \cdot d}{\frac{h \cdot M}{\frac{\ell}{M}}}}{D}}\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\end{array}
\end{array}
if l < 9.5000000000000003e29Initial program 69.8%
Applied egg-rr16.1%
expm1-def22.3%
expm1-log1p59.6%
*-commutative59.6%
*-commutative59.6%
associate-/l*59.5%
Simplified59.5%
Taylor expanded in M around 0 41.8%
associate-/l*42.9%
*-commutative42.9%
unpow242.9%
associate-/l*44.1%
*-commutative44.1%
associate-/l*46.1%
unpow246.1%
unpow246.1%
associate-*r*48.8%
associate-/l*51.6%
*-commutative51.6%
Simplified51.6%
if 9.5000000000000003e29 < l Initial program 56.4%
metadata-eval56.4%
unpow1/256.4%
metadata-eval56.4%
unpow1/256.4%
*-commutative56.4%
associate-*l*56.4%
times-frac54.9%
metadata-eval54.9%
Simplified54.9%
pow1/254.9%
sqr-pow54.8%
pow254.8%
metadata-eval54.8%
Applied egg-rr54.8%
Taylor expanded in d around inf 48.5%
*-commutative48.5%
unpow-148.5%
sqr-pow48.5%
rem-sqrt-square48.5%
sqr-pow48.3%
fabs-sqr48.3%
sqr-pow48.5%
metadata-eval48.5%
Simplified48.5%
Final simplification50.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 (if (<= h -7e-179) (* (- d) (pow (* h l) -0.5)) (* d (sqrt (/ 1.0 (* h l))))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -7e-179) {
tmp = -d * pow((h * l), -0.5);
} else {
tmp = d * sqrt((1.0 / (h * 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) :: tmp
if (h <= (-7d-179)) then
tmp = -d * ((h * l) ** (-0.5d0))
else
tmp = d * sqrt((1.0d0 / (h * 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 tmp;
if (h <= -7e-179) {
tmp = -d * Math.pow((h * l), -0.5);
} else {
tmp = d * Math.sqrt((1.0 / (h * l)));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if h <= -7e-179: tmp = -d * math.pow((h * l), -0.5) else: tmp = d * math.sqrt((1.0 / (h * l))) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= -7e-179) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); else tmp = Float64(d * sqrt(Float64(1.0 / Float64(h * l)))); 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 (h <= -7e-179)
tmp = -d * ((h * l) ^ -0.5);
else
tmp = d * sqrt((1.0 / (h * 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_] := If[LessEqual[h, -7e-179], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -7 \cdot 10^{-179}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\end{array}
\end{array}
if h < -7.00000000000000049e-179Initial program 68.1%
Applied egg-rr19.9%
expm1-def31.0%
expm1-log1p56.9%
*-commutative56.9%
*-commutative56.9%
associate-/l*56.9%
Simplified56.9%
Taylor expanded in d around -inf 69.8%
mul-1-neg69.8%
associate-/r*69.8%
distribute-rgt-neg-in69.8%
associate-/l/69.8%
Simplified69.8%
Taylor expanded in d around inf 33.6%
mul-1-neg33.6%
*-commutative33.6%
distribute-rgt-neg-in33.6%
unpow-133.6%
sqr-pow33.6%
rem-sqrt-square33.6%
sqr-pow33.5%
fabs-sqr33.5%
sqr-pow33.6%
metadata-eval33.6%
Simplified33.6%
if -7.00000000000000049e-179 < h Initial program 65.8%
Taylor expanded in d around inf 38.2%
Final simplification36.7%
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 h) l))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * sqrt(((1.0 / h) / 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 = d * sqrt(((1.0d0 / h) / 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 d * Math.sqrt(((1.0 / h) / l));
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.sqrt(((1.0 / h) / l))
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * sqrt(Float64(Float64(1.0 / h) / l))) end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * sqrt(((1.0 / h) / 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[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}
\end{array}
Initial program 66.6%
metadata-eval66.6%
unpow1/266.6%
metadata-eval66.6%
unpow1/266.6%
*-commutative66.6%
associate-*l*66.6%
times-frac66.2%
metadata-eval66.2%
Simplified66.2%
associate-*r*66.2%
frac-times66.6%
*-commutative66.6%
metadata-eval66.6%
associate-*r/68.5%
metadata-eval68.5%
*-commutative68.5%
frac-times68.2%
associate-*l/68.2%
associate-*r/68.2%
associate-/l/68.2%
*-commutative68.2%
Applied egg-rr68.2%
Taylor expanded in d around inf 28.4%
*-commutative28.4%
*-commutative28.4%
associate-/r*28.4%
Simplified28.4%
Final simplification28.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 (/ 1.0 (* h l)))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * sqrt((1.0 / (h * 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 = d * sqrt((1.0d0 / (h * 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 d * Math.sqrt((1.0 / (h * l)));
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.sqrt((1.0 / (h * l)))
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * sqrt((1.0 / (h * 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[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot \sqrt{\frac{1}{h \cdot \ell}}
\end{array}
Initial program 66.6%
Taylor expanded in d around inf 28.4%
Final simplification28.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 (* h l) -0.5)))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * pow((h * l), -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 * ((h * l) ** (-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((h * l), -0.5);
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.pow((h * l), -0.5)
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * (Float64(h * l) ^ -0.5)) end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * ((h * l) ^ -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[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot {\left(h \cdot \ell\right)}^{-0.5}
\end{array}
Initial program 66.6%
metadata-eval66.6%
unpow1/266.6%
metadata-eval66.6%
unpow1/266.6%
*-commutative66.6%
associate-*l*66.6%
times-frac66.2%
metadata-eval66.2%
Simplified66.2%
pow1/266.2%
sqr-pow66.2%
pow266.2%
metadata-eval66.2%
Applied egg-rr66.2%
Taylor expanded in d around inf 28.4%
*-commutative28.4%
unpow-128.4%
sqr-pow28.4%
rem-sqrt-square28.1%
sqr-pow28.0%
fabs-sqr28.0%
sqr-pow28.1%
metadata-eval28.1%
Simplified28.1%
Final simplification28.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 (/ d (sqrt (* h l))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d / sqrt((h * l));
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = d / sqrt((h * l))
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d / Math.sqrt((h * l));
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d / math.sqrt((h * l))
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d / sqrt(Float64(h * l))) end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d / sqrt((h * l));
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Initial program 66.6%
metadata-eval66.6%
unpow1/266.6%
metadata-eval66.6%
unpow1/266.6%
*-commutative66.6%
associate-*l*66.6%
times-frac66.2%
metadata-eval66.2%
Simplified66.2%
associate-*r*66.2%
frac-times66.6%
*-commutative66.6%
metadata-eval66.6%
associate-*r/68.5%
metadata-eval68.5%
*-commutative68.5%
frac-times68.2%
associate-*l/68.2%
associate-*r/68.2%
associate-/l/68.2%
*-commutative68.2%
Applied egg-rr68.2%
Taylor expanded in d around inf 28.4%
*-commutative28.4%
*-commutative28.4%
associate-/r*28.4%
Simplified28.4%
associate-/r*28.4%
associate-/l/28.4%
add-cbrt-cube26.3%
add-sqr-sqrt26.3%
pow126.3%
add-sqr-sqrt26.3%
add-cbrt-cube28.4%
associate-/l/28.4%
sqrt-div28.1%
metadata-eval28.1%
*-commutative28.1%
Applied egg-rr28.1%
unpow128.1%
associate-*r/28.1%
*-rgt-identity28.1%
Simplified28.1%
Final simplification28.1%
herbie shell --seed 2023207
(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)))))