
(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 24 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}
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (- d))))
(if (<= l -2.4e+245)
(*
(* (sqrt (/ d h)) (/ t_0 (sqrt (- l))))
(- 1.0 (* 0.5 (pow (* D_m (* (* M_m (/ 0.5 d)) (sqrt (/ h l)))) 2.0))))
(if (<= l -4e-310)
(*
(* (/ t_0 (sqrt (- h))) (sqrt (/ d l)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0)))))
(*
d
(/
(fma -0.125 (* (/ h l) (pow (* D_m (/ M_m d)) 2.0)) 1.0)
(* (sqrt h) (sqrt l))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt(-d);
double tmp;
if (l <= -2.4e+245) {
tmp = (sqrt((d / h)) * (t_0 / sqrt(-l))) * (1.0 - (0.5 * pow((D_m * ((M_m * (0.5 / d)) * sqrt((h / l)))), 2.0)));
} else if (l <= -4e-310) {
tmp = ((t_0 / sqrt(-h)) * sqrt((d / l))) * (1.0 - (0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0))));
} else {
tmp = d * (fma(-0.125, ((h / l) * pow((D_m * (M_m / d)), 2.0)), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -2.4e+245) tmp = Float64(Float64(sqrt(Float64(d / h)) * Float64(t_0 / sqrt(Float64(-l)))) * Float64(1.0 - Float64(0.5 * (Float64(D_m * Float64(Float64(M_m * Float64(0.5 / d)) * sqrt(Float64(h / l)))) ^ 2.0)))); elseif (l <= -4e-310) tmp = Float64(Float64(Float64(t_0 / sqrt(Float64(-h))) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0))))); else tmp = Float64(d * Float64(fma(-0.125, Float64(Float64(h / l) * (Float64(D_m * Float64(M_m / d)) ^ 2.0)), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -2.4e+245], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(D$95$m * N[(N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -4e-310], N[(N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -2.4 \cdot 10^{+245}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \frac{t\_0}{\sqrt{-\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(D\_m \cdot \left(\left(M\_m \cdot \frac{0.5}{d}\right) \cdot \sqrt{\frac{h}{\ell}}\right)\right)}^{2}\right)\\
\mathbf{elif}\;\ell \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{t\_0}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.125, \frac{h}{\ell} \cdot {\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.3999999999999998e245Initial program 28.2%
Simplified28.2%
add-sqr-sqrt28.2%
pow228.2%
sqrt-prod28.2%
sqrt-pow128.7%
metadata-eval28.7%
frac-times28.7%
associate-/l*28.7%
pow128.7%
*-un-lft-identity28.7%
times-frac28.7%
metadata-eval28.7%
Applied egg-rr28.7%
associate-*r*28.7%
associate-/l*28.7%
*-commutative28.7%
associate-/l*16.3%
associate-*l*16.3%
associate-/l*16.3%
Simplified16.3%
frac-2neg16.3%
sqrt-div75.4%
Applied egg-rr75.4%
if -2.3999999999999998e245 < l < -3.999999999999988e-310Initial program 64.2%
Simplified65.0%
frac-2neg65.0%
sqrt-div81.4%
Applied egg-rr81.4%
if -3.999999999999988e-310 < l Initial program 63.9%
Applied egg-rr79.3%
Simplified86.6%
Final simplification83.7%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -1.45e+240)
(* d (- (sqrt (/ (/ 1.0 h) l))))
(if (<= l -4.2e-305)
(*
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0)))))
(*
d
(/
(fma -0.125 (* (/ h l) (pow (* D_m (/ M_m d)) 2.0)) 1.0)
(* (sqrt h) (sqrt l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -1.45e+240) {
tmp = d * -sqrt(((1.0 / h) / l));
} else if (l <= -4.2e-305) {
tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * (1.0 - (0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0))));
} else {
tmp = d * (fma(-0.125, ((h / l) * pow((D_m * (M_m / d)), 2.0)), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -1.45e+240) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); elseif (l <= -4.2e-305) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0))))); else tmp = Float64(d * Float64(fma(-0.125, Float64(Float64(h / l) * (Float64(D_m * Float64(M_m / d)) ^ 2.0)), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -1.45e+240], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, -4.2e-305], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.45 \cdot 10^{+240}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{elif}\;\ell \leq -4.2 \cdot 10^{-305}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.125, \frac{h}{\ell} \cdot {\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.44999999999999999e240Initial program 28.2%
Simplified28.2%
Taylor expanded in M around 0 15.1%
*-commutative15.1%
associate-*r*14.6%
times-frac14.6%
*-commutative14.6%
associate-/l*14.6%
unpow214.6%
unpow214.6%
unpow214.6%
times-frac15.9%
swap-sqr28.2%
unpow228.2%
associate-*r/28.2%
*-commutative28.2%
associate-/l*15.9%
Simplified15.9%
Taylor expanded in D around 0 28.2%
clear-num28.2%
sqrt-div28.2%
metadata-eval28.2%
Applied egg-rr28.2%
Taylor expanded in d around -inf 75.6%
associate-*r*75.6%
neg-mul-175.6%
associate-/r*86.6%
Simplified86.6%
if -1.44999999999999999e240 < l < -4.2e-305Initial program 63.9%
Simplified64.7%
frac-2neg64.7%
sqrt-div81.2%
Applied egg-rr81.2%
if -4.2e-305 < l Initial program 64.2%
Applied egg-rr78.7%
Simplified85.9%
Final simplification83.7%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (/ h l) (pow (* D_m (/ M_m d)) 2.0))))
(if (<= h -7.6e+253)
(* (/ (sqrt (- d)) (sqrt (- h))) (* (sqrt (/ d l)) (* -0.125 t_0)))
(if (<= h -4.5e-300)
(*
(/ d (sqrt (* l h)))
(- -1.0 (* (* (/ h l) -0.5) (pow (* D_m (/ (* 0.5 M_m) d)) 2.0))))
(* d (/ (fma -0.125 t_0 1.0) (* (sqrt h) (sqrt l))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (h / l) * pow((D_m * (M_m / d)), 2.0);
double tmp;
if (h <= -7.6e+253) {
tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (-0.125 * t_0));
} else if (h <= -4.5e-300) {
tmp = (d / sqrt((l * h))) * (-1.0 - (((h / l) * -0.5) * pow((D_m * ((0.5 * M_m) / d)), 2.0)));
} else {
tmp = d * (fma(-0.125, t_0, 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(h / l) * (Float64(D_m * Float64(M_m / d)) ^ 2.0)) tmp = 0.0 if (h <= -7.6e+253) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * Float64(-0.125 * t_0))); elseif (h <= -4.5e-300) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(-1.0 - Float64(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(Float64(0.5 * M_m) / d)) ^ 2.0)))); else tmp = Float64(d * Float64(fma(-0.125, t_0, 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -7.6e+253], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -4.5e-300], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(N[(0.5 * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(-0.125 * t$95$0 + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{h}{\ell} \cdot {\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}\\
\mathbf{if}\;h \leq -7.6 \cdot 10^{+253}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(-0.125 \cdot t\_0\right)\right)\\
\mathbf{elif}\;h \leq -4.5 \cdot 10^{-300}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(-1 - \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{0.5 \cdot M\_m}{d}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.125, t\_0, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -7.59999999999999978e253Initial program 34.7%
Simplified45.1%
Taylor expanded in M around inf 23.6%
associate-*r*23.6%
times-frac23.6%
*-commutative23.6%
associate-/l*23.6%
unpow223.6%
unpow223.6%
unpow223.6%
times-frac34.6%
swap-sqr34.7%
unpow234.7%
associate-*r/24.3%
*-commutative24.3%
associate-/l*34.7%
Simplified34.7%
frac-2neg45.1%
sqrt-div77.3%
Applied egg-rr79.0%
if -7.59999999999999978e253 < h < -4.5e-300Initial program 64.2%
Simplified64.3%
add-sqr-sqrt64.3%
pow264.3%
sqrt-prod64.3%
sqrt-pow164.3%
metadata-eval64.3%
frac-times64.2%
associate-/l*64.3%
pow164.3%
*-un-lft-identity64.3%
times-frac64.3%
metadata-eval64.3%
Applied egg-rr64.3%
*-commutative64.3%
associate-*r/64.3%
associate-*r/64.2%
Simplified64.2%
Taylor expanded in M around 0 64.2%
associate-*r/63.5%
*-commutative63.5%
associate-*l*63.5%
associate-*l/63.5%
*-commutative63.5%
Simplified63.5%
pow163.5%
sqrt-unprod54.8%
cancel-sign-sub-inv54.8%
metadata-eval54.8%
unpow-prod-down54.8%
pow254.8%
add-sqr-sqrt54.8%
associate-/l*54.8%
Applied egg-rr54.8%
unpow154.8%
associate-*r*54.8%
associate-*r/54.8%
Simplified54.8%
frac-times43.6%
add-exp-log42.5%
add-sqr-sqrt15.1%
sqrt-unprod26.3%
sqr-neg26.3%
sqrt-unprod11.2%
add-sqr-sqrt21.5%
add-sqr-sqrt21.5%
unpow1/221.5%
exp-prod21.5%
unpow1/221.5%
exp-prod21.5%
frac-times20.9%
Applied egg-rr76.6%
if -4.5e-300 < h Initial program 63.7%
Applied egg-rr78.1%
Simplified85.2%
Final simplification81.0%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -4e-310)
(*
(/ d (sqrt (* l h)))
(- -1.0 (* (* (/ h l) -0.5) (pow (* D_m (/ (* 0.5 M_m) d)) 2.0))))
(*
d
(/
(fma -0.125 (* (/ h l) (pow (* D_m (/ M_m d)) 2.0)) 1.0)
(* (sqrt h) (sqrt l))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -4e-310) {
tmp = (d / sqrt((l * h))) * (-1.0 - (((h / l) * -0.5) * pow((D_m * ((0.5 * M_m) / d)), 2.0)));
} else {
tmp = d * (fma(-0.125, ((h / l) * pow((D_m * (M_m / d)), 2.0)), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -4e-310) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(-1.0 - Float64(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(Float64(0.5 * M_m) / d)) ^ 2.0)))); else tmp = Float64(d * Float64(fma(-0.125, Float64(Float64(h / l) * (Float64(D_m * Float64(M_m / d)) ^ 2.0)), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -4e-310], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(N[(0.5 * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(-1 - \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{0.5 \cdot M\_m}{d}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.125, \frac{h}{\ell} \cdot {\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -3.999999999999988e-310Initial program 62.0%
Simplified62.8%
add-sqr-sqrt62.8%
pow262.8%
sqrt-prod62.8%
sqrt-pow162.8%
metadata-eval62.8%
frac-times62.0%
associate-/l*62.8%
pow162.8%
*-un-lft-identity62.8%
times-frac62.8%
metadata-eval62.8%
Applied egg-rr62.8%
*-commutative62.8%
associate-*r/62.8%
associate-*r/62.0%
Simplified62.0%
Taylor expanded in M around 0 62.0%
associate-*r/62.1%
*-commutative62.1%
associate-*l*62.1%
associate-*l/62.1%
*-commutative62.1%
Simplified62.1%
pow162.1%
sqrt-unprod53.4%
cancel-sign-sub-inv53.4%
metadata-eval53.4%
unpow-prod-down53.4%
pow253.4%
add-sqr-sqrt53.4%
associate-/l*53.4%
Applied egg-rr53.4%
unpow153.4%
associate-*r*53.4%
associate-*r/53.4%
Simplified53.4%
frac-times41.6%
add-exp-log40.6%
add-sqr-sqrt15.4%
sqrt-unprod25.7%
sqr-neg25.7%
sqrt-unprod10.3%
add-sqr-sqrt22.9%
add-sqr-sqrt22.9%
unpow1/222.9%
exp-prod22.9%
unpow1/222.9%
exp-prod22.9%
frac-times23.8%
Applied egg-rr73.4%
if -3.999999999999988e-310 < l Initial program 63.9%
Applied egg-rr79.3%
Simplified86.6%
Final simplification79.8%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= h -5.2e+180)
(*
(/ (pow (* D_m M_m) 2.0) d)
(* 0.125 (pow (pow (* h (pow l -3.0)) 0.25) 2.0)))
(if (<= h -5e-310)
(*
(/ d (sqrt (* l h)))
(- -1.0 (* (* (/ h l) -0.5) (pow (* D_m (/ (* 0.5 M_m) d)) 2.0))))
(*
(/ d (* (sqrt h) (sqrt l)))
(+ 1.0 (* -0.5 (* (pow (* D_m (/ M_m d)) 2.0) (* (/ h l) 0.25))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (h <= -5.2e+180) {
tmp = (pow((D_m * M_m), 2.0) / d) * (0.125 * pow(pow((h * pow(l, -3.0)), 0.25), 2.0));
} else if (h <= -5e-310) {
tmp = (d / sqrt((l * h))) * (-1.0 - (((h / l) * -0.5) * pow((D_m * ((0.5 * M_m) / d)), 2.0)));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (-0.5 * (pow((D_m * (M_m / d)), 2.0) * ((h / l) * 0.25))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (h <= (-5.2d+180)) then
tmp = (((d_m * m_m) ** 2.0d0) / d) * (0.125d0 * (((h * (l ** (-3.0d0))) ** 0.25d0) ** 2.0d0))
else if (h <= (-5d-310)) then
tmp = (d / sqrt((l * h))) * ((-1.0d0) - (((h / l) * (-0.5d0)) * ((d_m * ((0.5d0 * m_m) / d)) ** 2.0d0)))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + ((-0.5d0) * (((d_m * (m_m / d)) ** 2.0d0) * ((h / l) * 0.25d0))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (h <= -5.2e+180) {
tmp = (Math.pow((D_m * M_m), 2.0) / d) * (0.125 * Math.pow(Math.pow((h * Math.pow(l, -3.0)), 0.25), 2.0));
} else if (h <= -5e-310) {
tmp = (d / Math.sqrt((l * h))) * (-1.0 - (((h / l) * -0.5) * Math.pow((D_m * ((0.5 * M_m) / d)), 2.0)));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + (-0.5 * (Math.pow((D_m * (M_m / d)), 2.0) * ((h / l) * 0.25))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if h <= -5.2e+180: tmp = (math.pow((D_m * M_m), 2.0) / d) * (0.125 * math.pow(math.pow((h * math.pow(l, -3.0)), 0.25), 2.0)) elif h <= -5e-310: tmp = (d / math.sqrt((l * h))) * (-1.0 - (((h / l) * -0.5) * math.pow((D_m * ((0.5 * M_m) / d)), 2.0))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + (-0.5 * (math.pow((D_m * (M_m / d)), 2.0) * ((h / l) * 0.25)))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (h <= -5.2e+180) tmp = Float64(Float64((Float64(D_m * M_m) ^ 2.0) / d) * Float64(0.125 * ((Float64(h * (l ^ -3.0)) ^ 0.25) ^ 2.0))); elseif (h <= -5e-310) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(-1.0 - Float64(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(Float64(0.5 * M_m) / d)) ^ 2.0)))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(-0.5 * Float64((Float64(D_m * Float64(M_m / d)) ^ 2.0) * Float64(Float64(h / l) * 0.25))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (h <= -5.2e+180)
tmp = (((D_m * M_m) ^ 2.0) / d) * (0.125 * (((h * (l ^ -3.0)) ^ 0.25) ^ 2.0));
elseif (h <= -5e-310)
tmp = (d / sqrt((l * h))) * (-1.0 - (((h / l) * -0.5) * ((D_m * ((0.5 * M_m) / d)) ^ 2.0)));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (-0.5 * (((D_m * (M_m / d)) ^ 2.0) * ((h / l) * 0.25))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[h, -5.2e+180], N[(N[(N[Power[N[(D$95$m * M$95$m), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision] * N[(0.125 * N[Power[N[Power[N[(h * N[Power[l, -3.0], $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-310], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(N[(0.5 * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -5.2 \cdot 10^{+180}:\\
\;\;\;\;\frac{{\left(D\_m \cdot M\_m\right)}^{2}}{d} \cdot \left(0.125 \cdot {\left({\left(h \cdot {\ell}^{-3}\right)}^{0.25}\right)}^{2}\right)\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(-1 - \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{0.5 \cdot M\_m}{d}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left({\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.25\right)\right)\right)\\
\end{array}
\end{array}
if h < -5.20000000000000042e180Initial program 48.1%
Simplified52.2%
Taylor expanded in M around inf 18.6%
associate-*r*18.6%
times-frac18.7%
*-commutative18.7%
associate-/l*18.7%
unpow218.7%
unpow218.7%
unpow218.7%
times-frac27.4%
swap-sqr27.6%
unpow227.6%
associate-*r/23.5%
*-commutative23.5%
associate-/l*27.5%
Simplified27.5%
frac-2neg52.2%
sqrt-div77.9%
Applied egg-rr58.0%
Taylor expanded in d around -inf 45.0%
*-commutative45.0%
associate-*l*45.0%
associate-/l*44.8%
Simplified44.8%
pow144.8%
associate-*r/45.0%
pow-prod-down57.9%
div-inv57.9%
pow-flip57.9%
metadata-eval57.9%
Applied egg-rr57.9%
unpow157.9%
*-commutative57.9%
Simplified57.9%
add-sqr-sqrt57.9%
pow257.9%
pow1/257.9%
sqrt-pow157.9%
metadata-eval57.9%
Applied egg-rr57.9%
if -5.20000000000000042e180 < h < -4.999999999999985e-310Initial program 64.9%
Simplified65.0%
add-sqr-sqrt65.0%
pow265.0%
sqrt-prod65.0%
sqrt-pow165.0%
metadata-eval65.0%
frac-times65.0%
associate-/l*65.0%
pow165.0%
*-un-lft-identity65.0%
times-frac65.0%
metadata-eval65.0%
Applied egg-rr65.0%
*-commutative65.0%
associate-*r/65.0%
associate-*r/65.0%
Simplified65.0%
Taylor expanded in M around 0 65.0%
associate-*r/64.2%
*-commutative64.2%
associate-*l*64.2%
associate-*l/64.2%
*-commutative64.2%
Simplified64.2%
pow164.2%
sqrt-unprod55.4%
cancel-sign-sub-inv55.4%
metadata-eval55.4%
unpow-prod-down55.3%
pow255.3%
add-sqr-sqrt55.3%
associate-/l*55.3%
Applied egg-rr55.3%
unpow155.3%
associate-*r*55.3%
associate-*r/55.3%
Simplified55.3%
frac-times45.6%
add-exp-log44.3%
add-sqr-sqrt13.8%
sqrt-unprod26.3%
sqr-neg26.3%
sqrt-unprod12.4%
add-sqr-sqrt21.1%
add-sqr-sqrt21.1%
unpow1/221.1%
exp-prod21.1%
unpow1/221.1%
exp-prod21.1%
frac-times21.2%
Applied egg-rr81.2%
if -4.999999999999985e-310 < h Initial program 63.9%
Applied egg-rr79.3%
unpow179.3%
cancel-sign-sub-inv79.3%
metadata-eval79.3%
associate-*r*79.3%
associate-*r/82.5%
*-commutative82.5%
associate-/l*81.8%
Simplified81.8%
Final simplification79.4%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= h -1.2e+179)
(* (/ (pow (* D_m M_m) 2.0) d) (* 0.125 (sqrt (* h (pow l -3.0)))))
(if (<= h -5e-310)
(*
(/ d (sqrt (* l h)))
(- -1.0 (* (* (/ h l) -0.5) (pow (* D_m (/ (* 0.5 M_m) d)) 2.0))))
(*
(/ d (* (sqrt h) (sqrt l)))
(+ 1.0 (* -0.5 (* (pow (* D_m (/ M_m d)) 2.0) (* (/ h l) 0.25))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (h <= -1.2e+179) {
tmp = (pow((D_m * M_m), 2.0) / d) * (0.125 * sqrt((h * pow(l, -3.0))));
} else if (h <= -5e-310) {
tmp = (d / sqrt((l * h))) * (-1.0 - (((h / l) * -0.5) * pow((D_m * ((0.5 * M_m) / d)), 2.0)));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (-0.5 * (pow((D_m * (M_m / d)), 2.0) * ((h / l) * 0.25))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (h <= (-1.2d+179)) then
tmp = (((d_m * m_m) ** 2.0d0) / d) * (0.125d0 * sqrt((h * (l ** (-3.0d0)))))
else if (h <= (-5d-310)) then
tmp = (d / sqrt((l * h))) * ((-1.0d0) - (((h / l) * (-0.5d0)) * ((d_m * ((0.5d0 * m_m) / d)) ** 2.0d0)))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + ((-0.5d0) * (((d_m * (m_m / d)) ** 2.0d0) * ((h / l) * 0.25d0))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (h <= -1.2e+179) {
tmp = (Math.pow((D_m * M_m), 2.0) / d) * (0.125 * Math.sqrt((h * Math.pow(l, -3.0))));
} else if (h <= -5e-310) {
tmp = (d / Math.sqrt((l * h))) * (-1.0 - (((h / l) * -0.5) * Math.pow((D_m * ((0.5 * M_m) / d)), 2.0)));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + (-0.5 * (Math.pow((D_m * (M_m / d)), 2.0) * ((h / l) * 0.25))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if h <= -1.2e+179: tmp = (math.pow((D_m * M_m), 2.0) / d) * (0.125 * math.sqrt((h * math.pow(l, -3.0)))) elif h <= -5e-310: tmp = (d / math.sqrt((l * h))) * (-1.0 - (((h / l) * -0.5) * math.pow((D_m * ((0.5 * M_m) / d)), 2.0))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + (-0.5 * (math.pow((D_m * (M_m / d)), 2.0) * ((h / l) * 0.25)))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (h <= -1.2e+179) tmp = Float64(Float64((Float64(D_m * M_m) ^ 2.0) / d) * Float64(0.125 * sqrt(Float64(h * (l ^ -3.0))))); elseif (h <= -5e-310) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(-1.0 - Float64(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(Float64(0.5 * M_m) / d)) ^ 2.0)))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(-0.5 * Float64((Float64(D_m * Float64(M_m / d)) ^ 2.0) * Float64(Float64(h / l) * 0.25))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (h <= -1.2e+179)
tmp = (((D_m * M_m) ^ 2.0) / d) * (0.125 * sqrt((h * (l ^ -3.0))));
elseif (h <= -5e-310)
tmp = (d / sqrt((l * h))) * (-1.0 - (((h / l) * -0.5) * ((D_m * ((0.5 * M_m) / d)) ^ 2.0)));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (-0.5 * (((D_m * (M_m / d)) ^ 2.0) * ((h / l) * 0.25))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[h, -1.2e+179], N[(N[(N[Power[N[(D$95$m * M$95$m), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision] * N[(0.125 * N[Sqrt[N[(h * N[Power[l, -3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-310], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(N[(0.5 * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1.2 \cdot 10^{+179}:\\
\;\;\;\;\frac{{\left(D\_m \cdot M\_m\right)}^{2}}{d} \cdot \left(0.125 \cdot \sqrt{h \cdot {\ell}^{-3}}\right)\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(-1 - \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{0.5 \cdot M\_m}{d}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left({\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot 0.25\right)\right)\right)\\
\end{array}
\end{array}
if h < -1.20000000000000006e179Initial program 48.1%
Simplified52.2%
Taylor expanded in M around inf 18.6%
associate-*r*18.6%
times-frac18.7%
*-commutative18.7%
associate-/l*18.7%
unpow218.7%
unpow218.7%
unpow218.7%
times-frac27.4%
swap-sqr27.6%
unpow227.6%
associate-*r/23.5%
*-commutative23.5%
associate-/l*27.5%
Simplified27.5%
frac-2neg52.2%
sqrt-div77.9%
Applied egg-rr58.0%
Taylor expanded in d around -inf 45.0%
*-commutative45.0%
associate-*l*45.0%
associate-/l*44.8%
Simplified44.8%
pow144.8%
associate-*r/45.0%
pow-prod-down57.9%
div-inv57.9%
pow-flip57.9%
metadata-eval57.9%
Applied egg-rr57.9%
unpow157.9%
*-commutative57.9%
Simplified57.9%
if -1.20000000000000006e179 < h < -4.999999999999985e-310Initial program 64.9%
Simplified65.0%
add-sqr-sqrt65.0%
pow265.0%
sqrt-prod65.0%
sqrt-pow165.0%
metadata-eval65.0%
frac-times65.0%
associate-/l*65.0%
pow165.0%
*-un-lft-identity65.0%
times-frac65.0%
metadata-eval65.0%
Applied egg-rr65.0%
*-commutative65.0%
associate-*r/65.0%
associate-*r/65.0%
Simplified65.0%
Taylor expanded in M around 0 65.0%
associate-*r/64.2%
*-commutative64.2%
associate-*l*64.2%
associate-*l/64.2%
*-commutative64.2%
Simplified64.2%
pow164.2%
sqrt-unprod55.4%
cancel-sign-sub-inv55.4%
metadata-eval55.4%
unpow-prod-down55.3%
pow255.3%
add-sqr-sqrt55.3%
associate-/l*55.3%
Applied egg-rr55.3%
unpow155.3%
associate-*r*55.3%
associate-*r/55.3%
Simplified55.3%
frac-times45.6%
add-exp-log44.3%
add-sqr-sqrt13.8%
sqrt-unprod26.3%
sqr-neg26.3%
sqrt-unprod12.4%
add-sqr-sqrt21.1%
add-sqr-sqrt21.1%
unpow1/221.1%
exp-prod21.1%
unpow1/221.1%
exp-prod21.1%
frac-times21.2%
Applied egg-rr81.2%
if -4.999999999999985e-310 < h Initial program 63.9%
Applied egg-rr79.3%
unpow179.3%
cancel-sign-sub-inv79.3%
metadata-eval79.3%
associate-*r*79.3%
associate-*r/82.5%
*-commutative82.5%
associate-/l*81.8%
Simplified81.8%
Final simplification79.4%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (* (/ h l) -0.5) (pow (* D_m (/ (* 0.5 M_m) d)) 2.0)))
(t_1 (/ d (sqrt (* l h)))))
(if (<= d -1.75e-301)
(* t_1 (- -1.0 t_0))
(if (<= d 2.4e-152)
(* (pow (* D_m M_m) 2.0) (/ (* -0.125 (* (sqrt h) (pow l -1.5))) d))
(* (+ 1.0 t_0) t_1)))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = ((h / l) * -0.5) * pow((D_m * ((0.5 * M_m) / d)), 2.0);
double t_1 = d / sqrt((l * h));
double tmp;
if (d <= -1.75e-301) {
tmp = t_1 * (-1.0 - t_0);
} else if (d <= 2.4e-152) {
tmp = pow((D_m * M_m), 2.0) * ((-0.125 * (sqrt(h) * pow(l, -1.5))) / d);
} else {
tmp = (1.0 + t_0) * t_1;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ((h / l) * (-0.5d0)) * ((d_m * ((0.5d0 * m_m) / d)) ** 2.0d0)
t_1 = d / sqrt((l * h))
if (d <= (-1.75d-301)) then
tmp = t_1 * ((-1.0d0) - t_0)
else if (d <= 2.4d-152) then
tmp = ((d_m * m_m) ** 2.0d0) * (((-0.125d0) * (sqrt(h) * (l ** (-1.5d0)))) / d)
else
tmp = (1.0d0 + t_0) * t_1
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = ((h / l) * -0.5) * Math.pow((D_m * ((0.5 * M_m) / d)), 2.0);
double t_1 = d / Math.sqrt((l * h));
double tmp;
if (d <= -1.75e-301) {
tmp = t_1 * (-1.0 - t_0);
} else if (d <= 2.4e-152) {
tmp = Math.pow((D_m * M_m), 2.0) * ((-0.125 * (Math.sqrt(h) * Math.pow(l, -1.5))) / d);
} else {
tmp = (1.0 + t_0) * t_1;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = ((h / l) * -0.5) * math.pow((D_m * ((0.5 * M_m) / d)), 2.0) t_1 = d / math.sqrt((l * h)) tmp = 0 if d <= -1.75e-301: tmp = t_1 * (-1.0 - t_0) elif d <= 2.4e-152: tmp = math.pow((D_m * M_m), 2.0) * ((-0.125 * (math.sqrt(h) * math.pow(l, -1.5))) / d) else: tmp = (1.0 + t_0) * t_1 return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(Float64(0.5 * M_m) / d)) ^ 2.0)) t_1 = Float64(d / sqrt(Float64(l * h))) tmp = 0.0 if (d <= -1.75e-301) tmp = Float64(t_1 * Float64(-1.0 - t_0)); elseif (d <= 2.4e-152) tmp = Float64((Float64(D_m * M_m) ^ 2.0) * Float64(Float64(-0.125 * Float64(sqrt(h) * (l ^ -1.5))) / d)); else tmp = Float64(Float64(1.0 + t_0) * t_1); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = ((h / l) * -0.5) * ((D_m * ((0.5 * M_m) / d)) ^ 2.0);
t_1 = d / sqrt((l * h));
tmp = 0.0;
if (d <= -1.75e-301)
tmp = t_1 * (-1.0 - t_0);
elseif (d <= 2.4e-152)
tmp = ((D_m * M_m) ^ 2.0) * ((-0.125 * (sqrt(h) * (l ^ -1.5))) / d);
else
tmp = (1.0 + t_0) * t_1;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(N[(0.5 * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.75e-301], N[(t$95$1 * N[(-1.0 - t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.4e-152], N[(N[Power[N[(D$95$m * M$95$m), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(-0.125 * N[(N[Sqrt[h], $MachinePrecision] * N[Power[l, -1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{0.5 \cdot M\_m}{d}\right)}^{2}\\
t_1 := \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;d \leq -1.75 \cdot 10^{-301}:\\
\;\;\;\;t\_1 \cdot \left(-1 - t\_0\right)\\
\mathbf{elif}\;d \leq 2.4 \cdot 10^{-152}:\\
\;\;\;\;{\left(D\_m \cdot M\_m\right)}^{2} \cdot \frac{-0.125 \cdot \left(\sqrt{h} \cdot {\ell}^{-1.5}\right)}{d}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + t\_0\right) \cdot t\_1\\
\end{array}
\end{array}
if d < -1.74999999999999996e-301Initial program 62.5%
Simplified63.3%
add-sqr-sqrt63.3%
pow263.3%
sqrt-prod63.3%
sqrt-pow163.3%
metadata-eval63.3%
frac-times62.5%
associate-/l*63.3%
pow163.3%
*-un-lft-identity63.3%
times-frac63.3%
metadata-eval63.3%
Applied egg-rr63.3%
*-commutative63.3%
associate-*r/63.3%
associate-*r/62.5%
Simplified62.5%
Taylor expanded in M around 0 62.5%
associate-*r/62.5%
*-commutative62.5%
associate-*l*62.5%
associate-*l/62.5%
*-commutative62.5%
Simplified62.5%
pow162.5%
sqrt-unprod53.8%
cancel-sign-sub-inv53.8%
metadata-eval53.8%
unpow-prod-down53.8%
pow253.8%
add-sqr-sqrt53.8%
associate-/l*53.8%
Applied egg-rr53.8%
unpow153.8%
associate-*r*53.8%
associate-*r/53.8%
Simplified53.8%
frac-times42.0%
add-exp-log40.9%
add-sqr-sqrt15.5%
sqrt-unprod25.9%
sqr-neg25.9%
sqrt-unprod10.3%
add-sqr-sqrt23.1%
add-sqr-sqrt23.1%
unpow1/223.1%
exp-prod23.1%
unpow1/223.1%
exp-prod23.1%
frac-times24.0%
Applied egg-rr73.9%
if -1.74999999999999996e-301 < d < 2.4e-152Initial program 35.9%
Simplified31.3%
Taylor expanded in M around inf 14.3%
associate-*r*16.6%
times-frac16.6%
*-commutative16.6%
associate-/l*16.7%
unpow216.7%
unpow216.7%
unpow216.7%
times-frac24.0%
swap-sqr29.1%
unpow229.1%
associate-*r/33.7%
*-commutative33.7%
associate-/l*33.8%
Simplified33.8%
frac-2neg31.3%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around -inf 8.3%
*-commutative8.3%
associate-*l*8.3%
associate-/l*8.1%
Simplified8.1%
pow18.1%
associate-*r/8.3%
pow-prod-down10.6%
div-inv10.6%
pow-flip10.6%
metadata-eval10.6%
Applied egg-rr10.6%
unpow110.6%
*-commutative10.6%
Simplified10.6%
associate-*l/10.8%
frac-2neg10.8%
*-commutative10.8%
sqrt-prod8.5%
sqrt-pow18.3%
metadata-eval8.3%
add-sqr-sqrt0.0%
sqrt-unprod51.9%
sqr-neg51.9%
sqrt-unprod73.2%
add-sqr-sqrt73.2%
Applied egg-rr73.2%
distribute-rgt-neg-in73.2%
associate-/l*74.7%
*-commutative74.7%
distribute-lft-neg-in74.7%
metadata-eval74.7%
Simplified74.7%
if 2.4e-152 < d Initial program 77.6%
Simplified75.2%
add-sqr-sqrt75.2%
pow275.2%
sqrt-prod75.2%
sqrt-pow176.4%
metadata-eval76.4%
frac-times78.8%
associate-/l*76.4%
pow176.4%
*-un-lft-identity76.4%
times-frac76.4%
metadata-eval76.4%
Applied egg-rr76.4%
*-commutative76.4%
associate-*r/76.4%
associate-*r/78.8%
Simplified78.8%
Taylor expanded in M around 0 78.8%
associate-*r/77.7%
*-commutative77.7%
associate-*l*77.7%
associate-*l/77.7%
*-commutative77.7%
Simplified77.7%
pow177.7%
sqrt-unprod67.7%
cancel-sign-sub-inv67.7%
metadata-eval67.7%
unpow-prod-down66.4%
pow266.4%
add-sqr-sqrt66.4%
associate-/l*66.4%
Applied egg-rr66.4%
unpow166.4%
associate-*r*66.4%
associate-*r/66.4%
Simplified66.4%
frac-times58.2%
add-exp-log56.8%
add-sqr-sqrt20.8%
sqrt-unprod35.3%
sqr-neg35.3%
sqrt-unprod14.4%
add-sqr-sqrt30.6%
add-sqr-sqrt30.6%
unpow1/230.6%
exp-prod30.6%
unpow1/230.6%
exp-prod30.6%
frac-times28.4%
Applied egg-rr78.1%
times-frac78.1%
unpow278.1%
rem-3cbrt-lft78.7%
*-lft-identity78.7%
Simplified78.7%
Final simplification75.6%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(* 0.125 (sqrt (* h (pow l -3.0))))
(* (* D_m M_m) (/ (* D_m M_m) d))))
(t_1 (sqrt (* l h)))
(t_2 (/ d (- t_1)))
(t_3 (pow (* l h) -0.5)))
(if (<= d -1.8e+16)
(* d (- (sqrt (/ (/ 1.0 h) l))))
(if (<= d -5e-37)
t_0
(if (<= d -5.4e-68)
t_2
(if (<= d -1.7e-193)
t_0
(if (<= d -9.2e-208)
(* d (- t_3))
(if (<= d -1.75e-301)
t_0
(if (<= d 8e-148)
(*
(/ h l)
(/ (* (* d -0.125) (pow (* M_m (/ D_m d)) 2.0)) t_1))
(if (<= d 1.5e-87)
(* d t_3)
(if (<= d 1.0)
(*
(* -0.125 (* (/ h l) (pow (* D_m (/ M_m d)) 2.0)))
(/ d t_1))
(if (<= d 1.6e+244)
(/ d (* (sqrt h) (sqrt l)))
(if (<= d 1.65e+244)
t_2
(* d (* (pow h -0.5) (sqrt (/ 1.0 l)))))))))))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (0.125 * sqrt((h * pow(l, -3.0)))) * ((D_m * M_m) * ((D_m * M_m) / d));
double t_1 = sqrt((l * h));
double t_2 = d / -t_1;
double t_3 = pow((l * h), -0.5);
double tmp;
if (d <= -1.8e+16) {
tmp = d * -sqrt(((1.0 / h) / l));
} else if (d <= -5e-37) {
tmp = t_0;
} else if (d <= -5.4e-68) {
tmp = t_2;
} else if (d <= -1.7e-193) {
tmp = t_0;
} else if (d <= -9.2e-208) {
tmp = d * -t_3;
} else if (d <= -1.75e-301) {
tmp = t_0;
} else if (d <= 8e-148) {
tmp = (h / l) * (((d * -0.125) * pow((M_m * (D_m / d)), 2.0)) / t_1);
} else if (d <= 1.5e-87) {
tmp = d * t_3;
} else if (d <= 1.0) {
tmp = (-0.125 * ((h / l) * pow((D_m * (M_m / d)), 2.0))) * (d / t_1);
} else if (d <= 1.6e+244) {
tmp = d / (sqrt(h) * sqrt(l));
} else if (d <= 1.65e+244) {
tmp = t_2;
} else {
tmp = d * (pow(h, -0.5) * sqrt((1.0 / l)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = (0.125d0 * sqrt((h * (l ** (-3.0d0))))) * ((d_m * m_m) * ((d_m * m_m) / d))
t_1 = sqrt((l * h))
t_2 = d / -t_1
t_3 = (l * h) ** (-0.5d0)
if (d <= (-1.8d+16)) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else if (d <= (-5d-37)) then
tmp = t_0
else if (d <= (-5.4d-68)) then
tmp = t_2
else if (d <= (-1.7d-193)) then
tmp = t_0
else if (d <= (-9.2d-208)) then
tmp = d * -t_3
else if (d <= (-1.75d-301)) then
tmp = t_0
else if (d <= 8d-148) then
tmp = (h / l) * (((d * (-0.125d0)) * ((m_m * (d_m / d)) ** 2.0d0)) / t_1)
else if (d <= 1.5d-87) then
tmp = d * t_3
else if (d <= 1.0d0) then
tmp = ((-0.125d0) * ((h / l) * ((d_m * (m_m / d)) ** 2.0d0))) * (d / t_1)
else if (d <= 1.6d+244) then
tmp = d / (sqrt(h) * sqrt(l))
else if (d <= 1.65d+244) then
tmp = t_2
else
tmp = d * ((h ** (-0.5d0)) * sqrt((1.0d0 / l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (0.125 * Math.sqrt((h * Math.pow(l, -3.0)))) * ((D_m * M_m) * ((D_m * M_m) / d));
double t_1 = Math.sqrt((l * h));
double t_2 = d / -t_1;
double t_3 = Math.pow((l * h), -0.5);
double tmp;
if (d <= -1.8e+16) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else if (d <= -5e-37) {
tmp = t_0;
} else if (d <= -5.4e-68) {
tmp = t_2;
} else if (d <= -1.7e-193) {
tmp = t_0;
} else if (d <= -9.2e-208) {
tmp = d * -t_3;
} else if (d <= -1.75e-301) {
tmp = t_0;
} else if (d <= 8e-148) {
tmp = (h / l) * (((d * -0.125) * Math.pow((M_m * (D_m / d)), 2.0)) / t_1);
} else if (d <= 1.5e-87) {
tmp = d * t_3;
} else if (d <= 1.0) {
tmp = (-0.125 * ((h / l) * Math.pow((D_m * (M_m / d)), 2.0))) * (d / t_1);
} else if (d <= 1.6e+244) {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
} else if (d <= 1.65e+244) {
tmp = t_2;
} else {
tmp = d * (Math.pow(h, -0.5) * Math.sqrt((1.0 / l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = (0.125 * math.sqrt((h * math.pow(l, -3.0)))) * ((D_m * M_m) * ((D_m * M_m) / d)) t_1 = math.sqrt((l * h)) t_2 = d / -t_1 t_3 = math.pow((l * h), -0.5) tmp = 0 if d <= -1.8e+16: tmp = d * -math.sqrt(((1.0 / h) / l)) elif d <= -5e-37: tmp = t_0 elif d <= -5.4e-68: tmp = t_2 elif d <= -1.7e-193: tmp = t_0 elif d <= -9.2e-208: tmp = d * -t_3 elif d <= -1.75e-301: tmp = t_0 elif d <= 8e-148: tmp = (h / l) * (((d * -0.125) * math.pow((M_m * (D_m / d)), 2.0)) / t_1) elif d <= 1.5e-87: tmp = d * t_3 elif d <= 1.0: tmp = (-0.125 * ((h / l) * math.pow((D_m * (M_m / d)), 2.0))) * (d / t_1) elif d <= 1.6e+244: tmp = d / (math.sqrt(h) * math.sqrt(l)) elif d <= 1.65e+244: tmp = t_2 else: tmp = d * (math.pow(h, -0.5) * math.sqrt((1.0 / l))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(0.125 * sqrt(Float64(h * (l ^ -3.0)))) * Float64(Float64(D_m * M_m) * Float64(Float64(D_m * M_m) / d))) t_1 = sqrt(Float64(l * h)) t_2 = Float64(d / Float64(-t_1)) t_3 = Float64(l * h) ^ -0.5 tmp = 0.0 if (d <= -1.8e+16) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); elseif (d <= -5e-37) tmp = t_0; elseif (d <= -5.4e-68) tmp = t_2; elseif (d <= -1.7e-193) tmp = t_0; elseif (d <= -9.2e-208) tmp = Float64(d * Float64(-t_3)); elseif (d <= -1.75e-301) tmp = t_0; elseif (d <= 8e-148) tmp = Float64(Float64(h / l) * Float64(Float64(Float64(d * -0.125) * (Float64(M_m * Float64(D_m / d)) ^ 2.0)) / t_1)); elseif (d <= 1.5e-87) tmp = Float64(d * t_3); elseif (d <= 1.0) tmp = Float64(Float64(-0.125 * Float64(Float64(h / l) * (Float64(D_m * Float64(M_m / d)) ^ 2.0))) * Float64(d / t_1)); elseif (d <= 1.6e+244) tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); elseif (d <= 1.65e+244) tmp = t_2; else tmp = Float64(d * Float64((h ^ -0.5) * sqrt(Float64(1.0 / l)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (0.125 * sqrt((h * (l ^ -3.0)))) * ((D_m * M_m) * ((D_m * M_m) / d));
t_1 = sqrt((l * h));
t_2 = d / -t_1;
t_3 = (l * h) ^ -0.5;
tmp = 0.0;
if (d <= -1.8e+16)
tmp = d * -sqrt(((1.0 / h) / l));
elseif (d <= -5e-37)
tmp = t_0;
elseif (d <= -5.4e-68)
tmp = t_2;
elseif (d <= -1.7e-193)
tmp = t_0;
elseif (d <= -9.2e-208)
tmp = d * -t_3;
elseif (d <= -1.75e-301)
tmp = t_0;
elseif (d <= 8e-148)
tmp = (h / l) * (((d * -0.125) * ((M_m * (D_m / d)) ^ 2.0)) / t_1);
elseif (d <= 1.5e-87)
tmp = d * t_3;
elseif (d <= 1.0)
tmp = (-0.125 * ((h / l) * ((D_m * (M_m / d)) ^ 2.0))) * (d / t_1);
elseif (d <= 1.6e+244)
tmp = d / (sqrt(h) * sqrt(l));
elseif (d <= 1.65e+244)
tmp = t_2;
else
tmp = d * ((h ^ -0.5) * sqrt((1.0 / l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(0.125 * N[Sqrt[N[(h * N[Power[l, -3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(D$95$m * M$95$m), $MachinePrecision] * N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(d / (-t$95$1)), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[d, -1.8e+16], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -5e-37], t$95$0, If[LessEqual[d, -5.4e-68], t$95$2, If[LessEqual[d, -1.7e-193], t$95$0, If[LessEqual[d, -9.2e-208], N[(d * (-t$95$3)), $MachinePrecision], If[LessEqual[d, -1.75e-301], t$95$0, If[LessEqual[d, 8e-148], N[(N[(h / l), $MachinePrecision] * N[(N[(N[(d * -0.125), $MachinePrecision] * N[Power[N[(M$95$m * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.5e-87], N[(d * t$95$3), $MachinePrecision], If[LessEqual[d, 1.0], N[(N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.6e+244], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.65e+244], t$95$2, N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(0.125 \cdot \sqrt{h \cdot {\ell}^{-3}}\right) \cdot \left(\left(D\_m \cdot M\_m\right) \cdot \frac{D\_m \cdot M\_m}{d}\right)\\
t_1 := \sqrt{\ell \cdot h}\\
t_2 := \frac{d}{-t\_1}\\
t_3 := {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;d \leq -1.8 \cdot 10^{+16}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-37}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq -5.4 \cdot 10^{-68}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d \leq -1.7 \cdot 10^{-193}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq -9.2 \cdot 10^{-208}:\\
\;\;\;\;d \cdot \left(-t\_3\right)\\
\mathbf{elif}\;d \leq -1.75 \cdot 10^{-301}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq 8 \cdot 10^{-148}:\\
\;\;\;\;\frac{h}{\ell} \cdot \frac{\left(d \cdot -0.125\right) \cdot {\left(M\_m \cdot \frac{D\_m}{d}\right)}^{2}}{t\_1}\\
\mathbf{elif}\;d \leq 1.5 \cdot 10^{-87}:\\
\;\;\;\;d \cdot t\_3\\
\mathbf{elif}\;d \leq 1:\\
\;\;\;\;\left(-0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}\right)\right) \cdot \frac{d}{t\_1}\\
\mathbf{elif}\;d \leq 1.6 \cdot 10^{+244}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\mathbf{elif}\;d \leq 1.65 \cdot 10^{+244}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot \sqrt{\frac{1}{\ell}}\right)\\
\end{array}
\end{array}
if d < -1.8e16Initial program 69.3%
Simplified71.3%
Taylor expanded in M around 0 47.9%
*-commutative47.9%
associate-*r*47.9%
times-frac47.9%
*-commutative47.9%
associate-/l*48.0%
unpow248.0%
unpow248.0%
unpow248.0%
times-frac61.5%
swap-sqr71.3%
unpow271.3%
associate-*r/69.3%
*-commutative69.3%
associate-/l*71.3%
Simplified71.3%
Taylor expanded in D around 0 69.3%
clear-num69.3%
sqrt-div69.7%
metadata-eval69.7%
Applied egg-rr69.7%
Taylor expanded in d around -inf 66.2%
associate-*r*66.2%
neg-mul-166.2%
associate-/r*66.6%
Simplified66.6%
if -1.8e16 < d < -4.9999999999999997e-37 or -5.4000000000000003e-68 < d < -1.7000000000000001e-193 or -9.19999999999999986e-208 < d < -1.74999999999999996e-301Initial program 57.5%
Simplified57.4%
Taylor expanded in M around inf 36.4%
associate-*r*36.5%
times-frac36.5%
*-commutative36.5%
associate-/l*35.0%
unpow235.0%
unpow235.0%
unpow235.0%
times-frac38.5%
swap-sqr44.6%
unpow244.6%
associate-*r/44.6%
*-commutative44.6%
associate-/l*44.6%
Simplified44.6%
frac-2neg57.4%
sqrt-div73.8%
Applied egg-rr62.6%
Taylor expanded in d around -inf 48.8%
*-commutative48.8%
associate-*l*48.8%
associate-/l*47.2%
Simplified47.2%
pow147.2%
associate-*r/48.8%
pow-prod-down54.9%
div-inv54.9%
pow-flip54.9%
metadata-eval54.9%
Applied egg-rr54.9%
unpow154.9%
*-commutative54.9%
Simplified54.9%
unpow254.9%
*-un-lft-identity54.9%
times-frac54.9%
Applied egg-rr54.9%
if -4.9999999999999997e-37 < d < -5.4000000000000003e-68 or 1.6000000000000001e244 < d < 1.6499999999999999e244Initial program 77.5%
Simplified77.5%
add-sqr-sqrt77.5%
pow277.5%
sqrt-prod77.5%
sqrt-pow178.0%
metadata-eval78.0%
frac-times78.0%
associate-/l*78.0%
pow178.0%
*-un-lft-identity78.0%
times-frac78.0%
metadata-eval78.0%
Applied egg-rr78.0%
associate-*r*78.0%
associate-/l*78.0%
*-commutative78.0%
associate-/l*78.0%
associate-*l*78.0%
associate-/l*78.0%
Simplified78.0%
Taylor expanded in d around inf 2.3%
unpow-12.3%
metadata-eval2.3%
pow-sqr2.3%
rem-sqrt-square2.3%
rem-square-sqrt2.3%
fabs-sqr2.3%
rem-square-sqrt2.3%
Simplified2.3%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt78.4%
unpow-178.4%
metadata-eval78.4%
pow-sqr78.4%
rem-sqrt-square78.4%
metadata-eval78.4%
pow-sqr78.3%
fabs-sqr78.3%
pow-sqr78.4%
metadata-eval78.4%
associate-*l*78.4%
mul-1-neg78.4%
metadata-eval78.4%
pow-sqr78.3%
pow-sqr78.4%
metadata-eval78.4%
exp-to-pow73.4%
metadata-eval73.4%
distribute-rgt-neg-in73.4%
Simplified78.6%
if -1.7000000000000001e-193 < d < -9.19999999999999986e-208Initial program 0.0%
Simplified0.0%
add-sqr-sqrt0.0%
pow20.0%
sqrt-prod0.0%
sqrt-pow10.0%
metadata-eval0.0%
frac-times0.0%
associate-/l*0.0%
pow10.0%
*-un-lft-identity0.0%
times-frac0.0%
metadata-eval0.0%
Applied egg-rr0.0%
associate-*r*0.0%
associate-/l*0.0%
*-commutative0.0%
associate-/l*0.0%
associate-*l*0.0%
associate-/l*0.0%
Simplified0.0%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt50.2%
neg-mul-150.2%
unpow-150.2%
metadata-eval50.2%
pow-sqr51.0%
rem-sqrt-square51.0%
rem-square-sqrt50.2%
fabs-sqr50.2%
rem-square-sqrt51.0%
Simplified51.0%
if -1.74999999999999996e-301 < d < 7.99999999999999949e-148Initial program 35.2%
Simplified31.0%
Taylor expanded in M around inf 15.4%
associate-*r*17.5%
times-frac17.5%
*-commutative17.5%
associate-/l*17.4%
unpow217.4%
unpow217.4%
unpow217.4%
times-frac24.1%
swap-sqr28.9%
unpow228.9%
associate-*r/33.2%
*-commutative33.2%
associate-/l*33.2%
Simplified33.2%
frac-2neg31.0%
sqrt-div0.0%
Applied egg-rr0.0%
pow10.0%
Applied egg-rr56.7%
unpow156.7%
associate-*r*54.6%
associate-*r*54.6%
associate-*l/54.6%
associate-*l/65.3%
associate-*r/65.3%
*-commutative65.3%
associate-/l*61.1%
Simplified61.1%
if 7.99999999999999949e-148 < d < 1.50000000000000008e-87Initial program 53.9%
Simplified46.4%
add-sqr-sqrt46.3%
pow246.3%
sqrt-prod46.3%
sqrt-pow146.3%
metadata-eval46.3%
frac-times53.8%
associate-/l*46.3%
pow146.3%
*-un-lft-identity46.3%
times-frac46.3%
metadata-eval46.3%
Applied egg-rr46.3%
associate-*r*46.3%
associate-/l*53.8%
*-commutative53.8%
associate-/l*46.5%
associate-*l*46.5%
associate-/l*46.5%
Simplified46.5%
Taylor expanded in d around inf 62.1%
unpow-162.1%
metadata-eval62.1%
pow-sqr62.1%
rem-sqrt-square62.1%
rem-square-sqrt61.9%
fabs-sqr61.9%
rem-square-sqrt62.1%
Simplified62.1%
if 1.50000000000000008e-87 < d < 1Initial program 100.0%
Simplified99.9%
Taylor expanded in M around inf 75.2%
associate-*r*83.2%
times-frac83.2%
*-commutative83.2%
associate-/l*83.2%
unpow283.2%
unpow283.2%
unpow283.2%
times-frac91.6%
swap-sqr91.6%
unpow291.6%
associate-*r/91.6%
*-commutative91.6%
associate-/l*91.6%
Simplified91.6%
frac-2neg99.9%
sqrt-div0.0%
Applied egg-rr0.0%
pow10.0%
Applied egg-rr83.8%
unpow183.8%
Simplified83.8%
if 1 < d < 1.6000000000000001e244Initial program 83.8%
Simplified83.8%
add-sqr-sqrt83.8%
pow283.8%
sqrt-prod83.8%
sqrt-pow186.6%
metadata-eval86.6%
frac-times86.8%
associate-/l*86.6%
pow186.6%
*-un-lft-identity86.6%
times-frac86.6%
metadata-eval86.6%
Applied egg-rr86.6%
associate-*r*86.6%
associate-/l*86.8%
*-commutative86.8%
associate-/l*86.8%
associate-*l*86.8%
associate-/l*86.8%
Simplified86.8%
Taylor expanded in d around inf 57.0%
unpow-157.0%
metadata-eval57.0%
pow-sqr57.0%
rem-sqrt-square57.0%
rem-square-sqrt56.6%
fabs-sqr56.6%
rem-square-sqrt57.0%
Simplified57.0%
Taylor expanded in d around 0 57.0%
unpow-157.0%
metadata-eval57.0%
pow-sqr57.0%
rem-sqrt-square57.0%
metadata-eval57.0%
pow-sqr56.8%
fabs-sqr56.8%
pow-sqr57.0%
metadata-eval57.0%
exp-to-pow54.0%
metadata-eval54.0%
distribute-rgt-neg-in54.0%
exp-neg54.0%
associate-*r/54.0%
*-rgt-identity54.0%
exp-to-pow57.1%
unpow1/257.1%
Simplified57.1%
*-commutative57.1%
sqrt-prod67.3%
Applied egg-rr67.3%
if 1.6499999999999999e244 < d Initial program 76.7%
Simplified70.6%
add-sqr-sqrt70.6%
pow270.6%
sqrt-prod70.6%
sqrt-pow170.6%
metadata-eval70.6%
frac-times76.7%
associate-/l*70.6%
pow170.6%
*-un-lft-identity70.6%
times-frac70.6%
metadata-eval70.6%
Applied egg-rr70.6%
associate-*r*70.6%
associate-/l*76.7%
*-commutative76.7%
associate-/l*76.7%
associate-*l*76.7%
associate-/l*76.7%
Simplified76.7%
Taylor expanded in d around inf 69.4%
unpow-169.4%
metadata-eval69.4%
pow-sqr69.4%
rem-sqrt-square69.4%
rem-square-sqrt69.1%
fabs-sqr69.1%
rem-square-sqrt69.4%
Simplified69.4%
add-sqr-sqrt69.1%
sqrt-unprod69.4%
pow-prod-up69.4%
metadata-eval69.4%
inv-pow69.4%
*-commutative69.4%
associate-/l/69.3%
pow1/269.3%
div-inv69.2%
unpow-prod-down87.4%
pow1/287.4%
inv-pow87.4%
sqrt-pow187.4%
metadata-eval87.4%
Applied egg-rr87.4%
unpow1/287.4%
Simplified87.4%
Final simplification64.8%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(* 0.125 (sqrt (* h (pow l -3.0))))
(* (* D_m M_m) (/ (* D_m M_m) d))))
(t_1 (sqrt (* l h)))
(t_2 (* (* -0.125 (* (/ h l) (pow (* D_m (/ M_m d)) 2.0))) (/ d t_1)))
(t_3 (pow (* l h) -0.5)))
(if (<= d -530000000.0)
(* d (- (sqrt (/ (/ 1.0 h) l))))
(if (<= d -6.7e-37)
t_0
(if (<= d -1.5e-65)
(/ d (- t_1))
(if (<= d -1.65e-193)
t_0
(if (<= d -3.8e-208)
(* d (- t_3))
(if (<= d -1.75e-301)
t_0
(if (<= d 4.8e-141)
t_2
(if (<= d 9e-87)
(* d t_3)
(if (<= d 1.82e-31)
t_2
(* d (/ (pow h -0.5) (sqrt l))))))))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (0.125 * sqrt((h * pow(l, -3.0)))) * ((D_m * M_m) * ((D_m * M_m) / d));
double t_1 = sqrt((l * h));
double t_2 = (-0.125 * ((h / l) * pow((D_m * (M_m / d)), 2.0))) * (d / t_1);
double t_3 = pow((l * h), -0.5);
double tmp;
if (d <= -530000000.0) {
tmp = d * -sqrt(((1.0 / h) / l));
} else if (d <= -6.7e-37) {
tmp = t_0;
} else if (d <= -1.5e-65) {
tmp = d / -t_1;
} else if (d <= -1.65e-193) {
tmp = t_0;
} else if (d <= -3.8e-208) {
tmp = d * -t_3;
} else if (d <= -1.75e-301) {
tmp = t_0;
} else if (d <= 4.8e-141) {
tmp = t_2;
} else if (d <= 9e-87) {
tmp = d * t_3;
} else if (d <= 1.82e-31) {
tmp = t_2;
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = (0.125d0 * sqrt((h * (l ** (-3.0d0))))) * ((d_m * m_m) * ((d_m * m_m) / d))
t_1 = sqrt((l * h))
t_2 = ((-0.125d0) * ((h / l) * ((d_m * (m_m / d)) ** 2.0d0))) * (d / t_1)
t_3 = (l * h) ** (-0.5d0)
if (d <= (-530000000.0d0)) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else if (d <= (-6.7d-37)) then
tmp = t_0
else if (d <= (-1.5d-65)) then
tmp = d / -t_1
else if (d <= (-1.65d-193)) then
tmp = t_0
else if (d <= (-3.8d-208)) then
tmp = d * -t_3
else if (d <= (-1.75d-301)) then
tmp = t_0
else if (d <= 4.8d-141) then
tmp = t_2
else if (d <= 9d-87) then
tmp = d * t_3
else if (d <= 1.82d-31) then
tmp = t_2
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (0.125 * Math.sqrt((h * Math.pow(l, -3.0)))) * ((D_m * M_m) * ((D_m * M_m) / d));
double t_1 = Math.sqrt((l * h));
double t_2 = (-0.125 * ((h / l) * Math.pow((D_m * (M_m / d)), 2.0))) * (d / t_1);
double t_3 = Math.pow((l * h), -0.5);
double tmp;
if (d <= -530000000.0) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else if (d <= -6.7e-37) {
tmp = t_0;
} else if (d <= -1.5e-65) {
tmp = d / -t_1;
} else if (d <= -1.65e-193) {
tmp = t_0;
} else if (d <= -3.8e-208) {
tmp = d * -t_3;
} else if (d <= -1.75e-301) {
tmp = t_0;
} else if (d <= 4.8e-141) {
tmp = t_2;
} else if (d <= 9e-87) {
tmp = d * t_3;
} else if (d <= 1.82e-31) {
tmp = t_2;
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = (0.125 * math.sqrt((h * math.pow(l, -3.0)))) * ((D_m * M_m) * ((D_m * M_m) / d)) t_1 = math.sqrt((l * h)) t_2 = (-0.125 * ((h / l) * math.pow((D_m * (M_m / d)), 2.0))) * (d / t_1) t_3 = math.pow((l * h), -0.5) tmp = 0 if d <= -530000000.0: tmp = d * -math.sqrt(((1.0 / h) / l)) elif d <= -6.7e-37: tmp = t_0 elif d <= -1.5e-65: tmp = d / -t_1 elif d <= -1.65e-193: tmp = t_0 elif d <= -3.8e-208: tmp = d * -t_3 elif d <= -1.75e-301: tmp = t_0 elif d <= 4.8e-141: tmp = t_2 elif d <= 9e-87: tmp = d * t_3 elif d <= 1.82e-31: tmp = t_2 else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(0.125 * sqrt(Float64(h * (l ^ -3.0)))) * Float64(Float64(D_m * M_m) * Float64(Float64(D_m * M_m) / d))) t_1 = sqrt(Float64(l * h)) t_2 = Float64(Float64(-0.125 * Float64(Float64(h / l) * (Float64(D_m * Float64(M_m / d)) ^ 2.0))) * Float64(d / t_1)) t_3 = Float64(l * h) ^ -0.5 tmp = 0.0 if (d <= -530000000.0) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); elseif (d <= -6.7e-37) tmp = t_0; elseif (d <= -1.5e-65) tmp = Float64(d / Float64(-t_1)); elseif (d <= -1.65e-193) tmp = t_0; elseif (d <= -3.8e-208) tmp = Float64(d * Float64(-t_3)); elseif (d <= -1.75e-301) tmp = t_0; elseif (d <= 4.8e-141) tmp = t_2; elseif (d <= 9e-87) tmp = Float64(d * t_3); elseif (d <= 1.82e-31) tmp = t_2; else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (0.125 * sqrt((h * (l ^ -3.0)))) * ((D_m * M_m) * ((D_m * M_m) / d));
t_1 = sqrt((l * h));
t_2 = (-0.125 * ((h / l) * ((D_m * (M_m / d)) ^ 2.0))) * (d / t_1);
t_3 = (l * h) ^ -0.5;
tmp = 0.0;
if (d <= -530000000.0)
tmp = d * -sqrt(((1.0 / h) / l));
elseif (d <= -6.7e-37)
tmp = t_0;
elseif (d <= -1.5e-65)
tmp = d / -t_1;
elseif (d <= -1.65e-193)
tmp = t_0;
elseif (d <= -3.8e-208)
tmp = d * -t_3;
elseif (d <= -1.75e-301)
tmp = t_0;
elseif (d <= 4.8e-141)
tmp = t_2;
elseif (d <= 9e-87)
tmp = d * t_3;
elseif (d <= 1.82e-31)
tmp = t_2;
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(0.125 * N[Sqrt[N[(h * N[Power[l, -3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(D$95$m * M$95$m), $MachinePrecision] * N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[d, -530000000.0], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -6.7e-37], t$95$0, If[LessEqual[d, -1.5e-65], N[(d / (-t$95$1)), $MachinePrecision], If[LessEqual[d, -1.65e-193], t$95$0, If[LessEqual[d, -3.8e-208], N[(d * (-t$95$3)), $MachinePrecision], If[LessEqual[d, -1.75e-301], t$95$0, If[LessEqual[d, 4.8e-141], t$95$2, If[LessEqual[d, 9e-87], N[(d * t$95$3), $MachinePrecision], If[LessEqual[d, 1.82e-31], t$95$2, N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(0.125 \cdot \sqrt{h \cdot {\ell}^{-3}}\right) \cdot \left(\left(D\_m \cdot M\_m\right) \cdot \frac{D\_m \cdot M\_m}{d}\right)\\
t_1 := \sqrt{\ell \cdot h}\\
t_2 := \left(-0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}\right)\right) \cdot \frac{d}{t\_1}\\
t_3 := {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;d \leq -530000000:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{elif}\;d \leq -6.7 \cdot 10^{-37}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq -1.5 \cdot 10^{-65}:\\
\;\;\;\;\frac{d}{-t\_1}\\
\mathbf{elif}\;d \leq -1.65 \cdot 10^{-193}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq -3.8 \cdot 10^{-208}:\\
\;\;\;\;d \cdot \left(-t\_3\right)\\
\mathbf{elif}\;d \leq -1.75 \cdot 10^{-301}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq 4.8 \cdot 10^{-141}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d \leq 9 \cdot 10^{-87}:\\
\;\;\;\;d \cdot t\_3\\
\mathbf{elif}\;d \leq 1.82 \cdot 10^{-31}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -5.3e8Initial program 69.3%
Simplified71.3%
Taylor expanded in M around 0 47.9%
*-commutative47.9%
associate-*r*47.9%
times-frac47.9%
*-commutative47.9%
associate-/l*48.0%
unpow248.0%
unpow248.0%
unpow248.0%
times-frac61.5%
swap-sqr71.3%
unpow271.3%
associate-*r/69.3%
*-commutative69.3%
associate-/l*71.3%
Simplified71.3%
Taylor expanded in D around 0 69.3%
clear-num69.3%
sqrt-div69.7%
metadata-eval69.7%
Applied egg-rr69.7%
Taylor expanded in d around -inf 66.2%
associate-*r*66.2%
neg-mul-166.2%
associate-/r*66.6%
Simplified66.6%
if -5.3e8 < d < -6.70000000000000001e-37 or -1.49999999999999999e-65 < d < -1.6499999999999999e-193 or -3.80000000000000011e-208 < d < -1.74999999999999996e-301Initial program 57.5%
Simplified57.4%
Taylor expanded in M around inf 36.4%
associate-*r*36.5%
times-frac36.5%
*-commutative36.5%
associate-/l*35.0%
unpow235.0%
unpow235.0%
unpow235.0%
times-frac38.5%
swap-sqr44.6%
unpow244.6%
associate-*r/44.6%
*-commutative44.6%
associate-/l*44.6%
Simplified44.6%
frac-2neg57.4%
sqrt-div73.8%
Applied egg-rr62.6%
Taylor expanded in d around -inf 48.8%
*-commutative48.8%
associate-*l*48.8%
associate-/l*47.2%
Simplified47.2%
pow147.2%
associate-*r/48.8%
pow-prod-down54.9%
div-inv54.9%
pow-flip54.9%
metadata-eval54.9%
Applied egg-rr54.9%
unpow154.9%
*-commutative54.9%
Simplified54.9%
unpow254.9%
*-un-lft-identity54.9%
times-frac54.9%
Applied egg-rr54.9%
if -6.70000000000000001e-37 < d < -1.49999999999999999e-65Initial program 74.7%
Simplified74.7%
add-sqr-sqrt74.7%
pow274.7%
sqrt-prod74.7%
sqrt-pow175.2%
metadata-eval75.2%
frac-times75.2%
associate-/l*75.2%
pow175.2%
*-un-lft-identity75.2%
times-frac75.2%
metadata-eval75.2%
Applied egg-rr75.2%
associate-*r*75.2%
associate-/l*75.2%
*-commutative75.2%
associate-/l*75.2%
associate-*l*75.2%
associate-/l*75.2%
Simplified75.2%
Taylor expanded in d around inf 2.5%
unpow-12.5%
metadata-eval2.5%
pow-sqr2.5%
rem-sqrt-square2.5%
rem-square-sqrt2.5%
fabs-sqr2.5%
rem-square-sqrt2.5%
Simplified2.5%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt75.7%
unpow-175.7%
metadata-eval75.7%
pow-sqr75.7%
rem-sqrt-square75.7%
metadata-eval75.7%
pow-sqr75.6%
fabs-sqr75.6%
pow-sqr75.7%
metadata-eval75.7%
associate-*l*75.7%
mul-1-neg75.7%
metadata-eval75.7%
pow-sqr75.6%
pow-sqr75.7%
metadata-eval75.7%
exp-to-pow70.0%
metadata-eval70.0%
distribute-rgt-neg-in70.0%
Simplified75.9%
if -1.6499999999999999e-193 < d < -3.80000000000000011e-208Initial program 0.0%
Simplified0.0%
add-sqr-sqrt0.0%
pow20.0%
sqrt-prod0.0%
sqrt-pow10.0%
metadata-eval0.0%
frac-times0.0%
associate-/l*0.0%
pow10.0%
*-un-lft-identity0.0%
times-frac0.0%
metadata-eval0.0%
Applied egg-rr0.0%
associate-*r*0.0%
associate-/l*0.0%
*-commutative0.0%
associate-/l*0.0%
associate-*l*0.0%
associate-/l*0.0%
Simplified0.0%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt50.2%
neg-mul-150.2%
unpow-150.2%
metadata-eval50.2%
pow-sqr51.0%
rem-sqrt-square51.0%
rem-square-sqrt50.2%
fabs-sqr50.2%
rem-square-sqrt51.0%
Simplified51.0%
if -1.74999999999999996e-301 < d < 4.8000000000000002e-141 or 8.99999999999999915e-87 < d < 1.8199999999999999e-31Initial program 46.6%
Simplified43.1%
Taylor expanded in M around inf 25.0%
associate-*r*28.4%
times-frac28.4%
*-commutative28.4%
associate-/l*28.3%
unpow228.3%
unpow228.3%
unpow228.3%
times-frac35.7%
swap-sqr41.4%
unpow241.4%
associate-*r/44.9%
*-commutative44.9%
associate-/l*43.2%
Simplified43.2%
frac-2neg43.0%
sqrt-div0.0%
Applied egg-rr0.0%
pow10.0%
Applied egg-rr61.0%
unpow161.0%
Simplified61.0%
if 4.8000000000000002e-141 < d < 8.99999999999999915e-87Initial program 50.1%
Simplified41.9%
add-sqr-sqrt41.9%
pow241.9%
sqrt-prod41.9%
sqrt-pow141.9%
metadata-eval41.9%
frac-times50.1%
associate-/l*41.9%
pow141.9%
*-un-lft-identity41.9%
times-frac41.9%
metadata-eval41.9%
Applied egg-rr41.9%
associate-*r*41.9%
associate-/l*50.1%
*-commutative50.1%
associate-/l*50.1%
associate-*l*50.1%
associate-/l*50.1%
Simplified50.1%
Taylor expanded in d around inf 67.1%
unpow-167.1%
metadata-eval67.1%
pow-sqr67.1%
rem-sqrt-square67.1%
rem-square-sqrt66.9%
fabs-sqr66.9%
rem-square-sqrt67.1%
Simplified67.1%
if 1.8199999999999999e-31 < d Initial program 83.0%
Simplified81.3%
add-sqr-sqrt81.3%
pow281.3%
sqrt-prod81.3%
sqrt-pow183.1%
metadata-eval83.1%
frac-times84.9%
associate-/l*83.1%
pow183.1%
*-un-lft-identity83.1%
times-frac83.1%
metadata-eval83.1%
Applied egg-rr83.1%
associate-*r*83.1%
associate-/l*84.9%
*-commutative84.9%
associate-/l*84.9%
associate-*l*84.9%
associate-/l*84.9%
Simplified84.9%
Taylor expanded in d around inf 56.6%
unpow-156.6%
metadata-eval56.6%
pow-sqr56.6%
rem-sqrt-square57.7%
rem-square-sqrt57.4%
fabs-sqr57.4%
rem-square-sqrt57.7%
Simplified57.7%
add-sqr-sqrt57.4%
sqrt-unprod56.6%
pow-prod-up56.6%
metadata-eval56.6%
inv-pow56.6%
*-commutative56.6%
associate-/l/56.8%
sqrt-div69.4%
inv-pow69.4%
sqrt-pow169.5%
metadata-eval69.5%
Applied egg-rr69.5%
Final simplification63.1%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(* 0.125 (sqrt (* h (pow l -3.0))))
(* (* D_m M_m) (/ (* D_m M_m) d)))))
(if (<= h -1.15e+63)
t_0
(if (<= h -1.15e+33)
(* (- d) (sqrt (/ (/ 1.0 l) h)))
(if (<= h -8e+20)
t_0
(if (<= h -2.4e-56)
(* d (- (sqrt (/ (/ 1.0 h) l))))
(if (<= h -3.3e-57)
(* d (pow (pow (* l h) -3.0) 0.16666666666666666))
(if (<= h -5.4e-301)
(* d (- (pow (* l h) -0.5)))
(*
(+
1.0
(* (* (/ h l) -0.5) (pow (* D_m (/ (* 0.5 M_m) d)) 2.0)))
(/ d (sqrt (* l h))))))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (0.125 * sqrt((h * pow(l, -3.0)))) * ((D_m * M_m) * ((D_m * M_m) / d));
double tmp;
if (h <= -1.15e+63) {
tmp = t_0;
} else if (h <= -1.15e+33) {
tmp = -d * sqrt(((1.0 / l) / h));
} else if (h <= -8e+20) {
tmp = t_0;
} else if (h <= -2.4e-56) {
tmp = d * -sqrt(((1.0 / h) / l));
} else if (h <= -3.3e-57) {
tmp = d * pow(pow((l * h), -3.0), 0.16666666666666666);
} else if (h <= -5.4e-301) {
tmp = d * -pow((l * h), -0.5);
} else {
tmp = (1.0 + (((h / l) * -0.5) * pow((D_m * ((0.5 * M_m) / d)), 2.0))) * (d / sqrt((l * h)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = (0.125d0 * sqrt((h * (l ** (-3.0d0))))) * ((d_m * m_m) * ((d_m * m_m) / d))
if (h <= (-1.15d+63)) then
tmp = t_0
else if (h <= (-1.15d+33)) then
tmp = -d * sqrt(((1.0d0 / l) / h))
else if (h <= (-8d+20)) then
tmp = t_0
else if (h <= (-2.4d-56)) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else if (h <= (-3.3d-57)) then
tmp = d * (((l * h) ** (-3.0d0)) ** 0.16666666666666666d0)
else if (h <= (-5.4d-301)) then
tmp = d * -((l * h) ** (-0.5d0))
else
tmp = (1.0d0 + (((h / l) * (-0.5d0)) * ((d_m * ((0.5d0 * m_m) / d)) ** 2.0d0))) * (d / sqrt((l * h)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (0.125 * Math.sqrt((h * Math.pow(l, -3.0)))) * ((D_m * M_m) * ((D_m * M_m) / d));
double tmp;
if (h <= -1.15e+63) {
tmp = t_0;
} else if (h <= -1.15e+33) {
tmp = -d * Math.sqrt(((1.0 / l) / h));
} else if (h <= -8e+20) {
tmp = t_0;
} else if (h <= -2.4e-56) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else if (h <= -3.3e-57) {
tmp = d * Math.pow(Math.pow((l * h), -3.0), 0.16666666666666666);
} else if (h <= -5.4e-301) {
tmp = d * -Math.pow((l * h), -0.5);
} else {
tmp = (1.0 + (((h / l) * -0.5) * Math.pow((D_m * ((0.5 * M_m) / d)), 2.0))) * (d / Math.sqrt((l * h)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = (0.125 * math.sqrt((h * math.pow(l, -3.0)))) * ((D_m * M_m) * ((D_m * M_m) / d)) tmp = 0 if h <= -1.15e+63: tmp = t_0 elif h <= -1.15e+33: tmp = -d * math.sqrt(((1.0 / l) / h)) elif h <= -8e+20: tmp = t_0 elif h <= -2.4e-56: tmp = d * -math.sqrt(((1.0 / h) / l)) elif h <= -3.3e-57: tmp = d * math.pow(math.pow((l * h), -3.0), 0.16666666666666666) elif h <= -5.4e-301: tmp = d * -math.pow((l * h), -0.5) else: tmp = (1.0 + (((h / l) * -0.5) * math.pow((D_m * ((0.5 * M_m) / d)), 2.0))) * (d / math.sqrt((l * h))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(0.125 * sqrt(Float64(h * (l ^ -3.0)))) * Float64(Float64(D_m * M_m) * Float64(Float64(D_m * M_m) / d))) tmp = 0.0 if (h <= -1.15e+63) tmp = t_0; elseif (h <= -1.15e+33) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h))); elseif (h <= -8e+20) tmp = t_0; elseif (h <= -2.4e-56) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); elseif (h <= -3.3e-57) tmp = Float64(d * ((Float64(l * h) ^ -3.0) ^ 0.16666666666666666)); elseif (h <= -5.4e-301) tmp = Float64(d * Float64(-(Float64(l * h) ^ -0.5))); else tmp = Float64(Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(Float64(0.5 * M_m) / d)) ^ 2.0))) * Float64(d / sqrt(Float64(l * h)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (0.125 * sqrt((h * (l ^ -3.0)))) * ((D_m * M_m) * ((D_m * M_m) / d));
tmp = 0.0;
if (h <= -1.15e+63)
tmp = t_0;
elseif (h <= -1.15e+33)
tmp = -d * sqrt(((1.0 / l) / h));
elseif (h <= -8e+20)
tmp = t_0;
elseif (h <= -2.4e-56)
tmp = d * -sqrt(((1.0 / h) / l));
elseif (h <= -3.3e-57)
tmp = d * (((l * h) ^ -3.0) ^ 0.16666666666666666);
elseif (h <= -5.4e-301)
tmp = d * -((l * h) ^ -0.5);
else
tmp = (1.0 + (((h / l) * -0.5) * ((D_m * ((0.5 * M_m) / d)) ^ 2.0))) * (d / sqrt((l * h)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(0.125 * N[Sqrt[N[(h * N[Power[l, -3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(D$95$m * M$95$m), $MachinePrecision] * N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1.15e+63], t$95$0, If[LessEqual[h, -1.15e+33], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -8e+20], t$95$0, If[LessEqual[h, -2.4e-56], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[h, -3.3e-57], N[(d * N[Power[N[Power[N[(l * h), $MachinePrecision], -3.0], $MachinePrecision], 0.16666666666666666], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5.4e-301], N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(N[(0.5 * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(0.125 \cdot \sqrt{h \cdot {\ell}^{-3}}\right) \cdot \left(\left(D\_m \cdot M\_m\right) \cdot \frac{D\_m \cdot M\_m}{d}\right)\\
\mathbf{if}\;h \leq -1.15 \cdot 10^{+63}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;h \leq -1.15 \cdot 10^{+33}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{elif}\;h \leq -8 \cdot 10^{+20}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;h \leq -2.4 \cdot 10^{-56}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{elif}\;h \leq -3.3 \cdot 10^{-57}:\\
\;\;\;\;d \cdot {\left({\left(\ell \cdot h\right)}^{-3}\right)}^{0.16666666666666666}\\
\mathbf{elif}\;h \leq -5.4 \cdot 10^{-301}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{0.5 \cdot M\_m}{d}\right)}^{2}\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if h < -1.14999999999999997e63 or -1.15000000000000005e33 < h < -8e20Initial program 51.5%
Simplified53.3%
Taylor expanded in M around inf 22.4%
associate-*r*22.4%
times-frac22.6%
*-commutative22.6%
associate-/l*22.6%
unpow222.6%
unpow222.6%
unpow222.6%
times-frac32.5%
swap-sqr38.4%
unpow238.4%
associate-*r/36.6%
*-commutative36.6%
associate-/l*38.4%
Simplified38.4%
frac-2neg53.3%
sqrt-div74.6%
Applied egg-rr62.1%
Taylor expanded in d around -inf 49.7%
*-commutative49.7%
associate-*l*49.7%
associate-/l*49.6%
Simplified49.6%
pow149.6%
associate-*r/49.7%
pow-prod-down59.5%
div-inv59.5%
pow-flip59.6%
metadata-eval59.6%
Applied egg-rr59.6%
unpow159.6%
*-commutative59.6%
Simplified59.6%
unpow259.6%
*-un-lft-identity59.6%
times-frac59.7%
Applied egg-rr59.7%
if -1.14999999999999997e63 < h < -1.15000000000000005e33Initial program 64.0%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt62.2%
neg-mul-162.2%
Simplified62.2%
if -8e20 < h < -2.40000000000000001e-56Initial program 79.5%
Simplified79.5%
Taylor expanded in M around 0 49.7%
*-commutative49.7%
associate-*r*49.7%
times-frac56.7%
*-commutative56.7%
associate-/l*49.7%
unpow249.7%
unpow249.7%
unpow249.7%
times-frac58.3%
swap-sqr79.5%
unpow279.5%
associate-*r/79.5%
*-commutative79.5%
associate-/l*72.5%
Simplified72.5%
Taylor expanded in D around 0 79.5%
clear-num79.6%
sqrt-div79.4%
metadata-eval79.4%
Applied egg-rr79.4%
Taylor expanded in d around -inf 78.2%
associate-*r*78.2%
neg-mul-178.2%
associate-/r*78.5%
Simplified78.5%
if -2.40000000000000001e-56 < h < -3.2999999999999998e-57Initial program 100.0%
Taylor expanded in d around inf 2.1%
log1p-expm1-u100.0%
pow1/2100.0%
inv-pow100.0%
pow-pow100.0%
metadata-eval100.0%
Applied egg-rr100.0%
log1p-expm1-u2.1%
metadata-eval2.1%
pow-pow2.1%
sqr-pow2.1%
pow-prod-down100.0%
pow-prod-up100.0%
metadata-eval100.0%
metadata-eval100.0%
Applied egg-rr100.0%
if -3.2999999999999998e-57 < h < -5.3999999999999999e-301Initial program 65.5%
Simplified65.7%
add-sqr-sqrt65.7%
pow265.7%
sqrt-prod65.7%
sqrt-pow165.8%
metadata-eval65.8%
frac-times65.6%
associate-/l*65.8%
pow165.8%
*-un-lft-identity65.8%
times-frac65.8%
metadata-eval65.8%
Applied egg-rr65.8%
associate-*r*65.8%
associate-/l*65.6%
*-commutative65.6%
associate-/l*65.8%
associate-*l*65.8%
associate-/l*65.9%
Simplified65.9%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt57.4%
neg-mul-157.4%
unpow-157.4%
metadata-eval57.4%
pow-sqr57.4%
rem-sqrt-square58.3%
rem-square-sqrt58.1%
fabs-sqr58.1%
rem-square-sqrt58.3%
Simplified58.3%
if -5.3999999999999999e-301 < h Initial program 64.2%
Simplified61.0%
add-sqr-sqrt61.0%
pow261.0%
sqrt-prod61.0%
sqrt-pow161.9%
metadata-eval61.9%
frac-times65.9%
associate-/l*61.9%
pow161.9%
*-un-lft-identity61.9%
times-frac61.9%
metadata-eval61.9%
Applied egg-rr61.9%
*-commutative61.9%
associate-*r/61.9%
associate-*r/65.9%
Simplified65.9%
Taylor expanded in M around 0 65.9%
associate-*r/65.0%
*-commutative65.0%
associate-*l*65.0%
associate-*l/65.0%
*-commutative65.0%
Simplified65.0%
pow165.0%
sqrt-unprod56.8%
cancel-sign-sub-inv56.8%
metadata-eval56.8%
unpow-prod-down55.2%
pow255.2%
add-sqr-sqrt55.2%
associate-/l*55.2%
Applied egg-rr55.2%
unpow155.2%
associate-*r*55.2%
associate-*r/55.2%
Simplified55.2%
frac-times41.8%
add-exp-log40.9%
add-sqr-sqrt16.2%
sqrt-unprod25.9%
sqr-neg25.9%
sqrt-unprod9.7%
add-sqr-sqrt23.6%
add-sqr-sqrt23.6%
unpow1/223.6%
exp-prod23.6%
unpow1/223.6%
exp-prod23.6%
frac-times26.3%
Applied egg-rr73.0%
times-frac73.0%
unpow273.0%
rem-3cbrt-lft73.5%
*-lft-identity73.5%
Simplified73.5%
Final simplification67.5%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(* 0.125 (sqrt (* h (pow l -3.0))))
(* (* D_m M_m) (/ (* D_m M_m) d)))))
(if (<= d -2050000000000.0)
(* d (- (sqrt (/ (/ 1.0 h) l))))
(if (<= d -1.02e-38)
t_0
(if (<= d -1.12e-72)
(/ d (- (sqrt (* l h))))
(if (<= d -2.1e-193)
t_0
(if (<= d -2.15e-207)
(* d (- (pow (* l h) -0.5)))
(if (<= d -1.75e-301) t_0 (* d (/ (pow h -0.5) (sqrt l)))))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (0.125 * sqrt((h * pow(l, -3.0)))) * ((D_m * M_m) * ((D_m * M_m) / d));
double tmp;
if (d <= -2050000000000.0) {
tmp = d * -sqrt(((1.0 / h) / l));
} else if (d <= -1.02e-38) {
tmp = t_0;
} else if (d <= -1.12e-72) {
tmp = d / -sqrt((l * h));
} else if (d <= -2.1e-193) {
tmp = t_0;
} else if (d <= -2.15e-207) {
tmp = d * -pow((l * h), -0.5);
} else if (d <= -1.75e-301) {
tmp = t_0;
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = (0.125d0 * sqrt((h * (l ** (-3.0d0))))) * ((d_m * m_m) * ((d_m * m_m) / d))
if (d <= (-2050000000000.0d0)) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else if (d <= (-1.02d-38)) then
tmp = t_0
else if (d <= (-1.12d-72)) then
tmp = d / -sqrt((l * h))
else if (d <= (-2.1d-193)) then
tmp = t_0
else if (d <= (-2.15d-207)) then
tmp = d * -((l * h) ** (-0.5d0))
else if (d <= (-1.75d-301)) then
tmp = t_0
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (0.125 * Math.sqrt((h * Math.pow(l, -3.0)))) * ((D_m * M_m) * ((D_m * M_m) / d));
double tmp;
if (d <= -2050000000000.0) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else if (d <= -1.02e-38) {
tmp = t_0;
} else if (d <= -1.12e-72) {
tmp = d / -Math.sqrt((l * h));
} else if (d <= -2.1e-193) {
tmp = t_0;
} else if (d <= -2.15e-207) {
tmp = d * -Math.pow((l * h), -0.5);
} else if (d <= -1.75e-301) {
tmp = t_0;
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = (0.125 * math.sqrt((h * math.pow(l, -3.0)))) * ((D_m * M_m) * ((D_m * M_m) / d)) tmp = 0 if d <= -2050000000000.0: tmp = d * -math.sqrt(((1.0 / h) / l)) elif d <= -1.02e-38: tmp = t_0 elif d <= -1.12e-72: tmp = d / -math.sqrt((l * h)) elif d <= -2.1e-193: tmp = t_0 elif d <= -2.15e-207: tmp = d * -math.pow((l * h), -0.5) elif d <= -1.75e-301: tmp = t_0 else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(0.125 * sqrt(Float64(h * (l ^ -3.0)))) * Float64(Float64(D_m * M_m) * Float64(Float64(D_m * M_m) / d))) tmp = 0.0 if (d <= -2050000000000.0) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); elseif (d <= -1.02e-38) tmp = t_0; elseif (d <= -1.12e-72) tmp = Float64(d / Float64(-sqrt(Float64(l * h)))); elseif (d <= -2.1e-193) tmp = t_0; elseif (d <= -2.15e-207) tmp = Float64(d * Float64(-(Float64(l * h) ^ -0.5))); elseif (d <= -1.75e-301) tmp = t_0; else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (0.125 * sqrt((h * (l ^ -3.0)))) * ((D_m * M_m) * ((D_m * M_m) / d));
tmp = 0.0;
if (d <= -2050000000000.0)
tmp = d * -sqrt(((1.0 / h) / l));
elseif (d <= -1.02e-38)
tmp = t_0;
elseif (d <= -1.12e-72)
tmp = d / -sqrt((l * h));
elseif (d <= -2.1e-193)
tmp = t_0;
elseif (d <= -2.15e-207)
tmp = d * -((l * h) ^ -0.5);
elseif (d <= -1.75e-301)
tmp = t_0;
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(0.125 * N[Sqrt[N[(h * N[Power[l, -3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(D$95$m * M$95$m), $MachinePrecision] * N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2050000000000.0], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -1.02e-38], t$95$0, If[LessEqual[d, -1.12e-72], N[(d / (-N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -2.1e-193], t$95$0, If[LessEqual[d, -2.15e-207], N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -1.75e-301], t$95$0, N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(0.125 \cdot \sqrt{h \cdot {\ell}^{-3}}\right) \cdot \left(\left(D\_m \cdot M\_m\right) \cdot \frac{D\_m \cdot M\_m}{d}\right)\\
\mathbf{if}\;d \leq -2050000000000:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{elif}\;d \leq -1.02 \cdot 10^{-38}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq -1.12 \cdot 10^{-72}:\\
\;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\
\mathbf{elif}\;d \leq -2.1 \cdot 10^{-193}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq -2.15 \cdot 10^{-207}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{elif}\;d \leq -1.75 \cdot 10^{-301}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -2.05e12Initial program 69.3%
Simplified71.3%
Taylor expanded in M around 0 47.9%
*-commutative47.9%
associate-*r*47.9%
times-frac47.9%
*-commutative47.9%
associate-/l*48.0%
unpow248.0%
unpow248.0%
unpow248.0%
times-frac61.5%
swap-sqr71.3%
unpow271.3%
associate-*r/69.3%
*-commutative69.3%
associate-/l*71.3%
Simplified71.3%
Taylor expanded in D around 0 69.3%
clear-num69.3%
sqrt-div69.7%
metadata-eval69.7%
Applied egg-rr69.7%
Taylor expanded in d around -inf 66.2%
associate-*r*66.2%
neg-mul-166.2%
associate-/r*66.6%
Simplified66.6%
if -2.05e12 < d < -1.01999999999999998e-38 or -1.12000000000000005e-72 < d < -2.0999999999999999e-193 or -2.1500000000000001e-207 < d < -1.74999999999999996e-301Initial program 57.5%
Simplified57.4%
Taylor expanded in M around inf 36.4%
associate-*r*36.5%
times-frac36.5%
*-commutative36.5%
associate-/l*35.0%
unpow235.0%
unpow235.0%
unpow235.0%
times-frac38.5%
swap-sqr44.6%
unpow244.6%
associate-*r/44.6%
*-commutative44.6%
associate-/l*44.6%
Simplified44.6%
frac-2neg57.4%
sqrt-div73.8%
Applied egg-rr62.6%
Taylor expanded in d around -inf 48.8%
*-commutative48.8%
associate-*l*48.8%
associate-/l*47.2%
Simplified47.2%
pow147.2%
associate-*r/48.8%
pow-prod-down54.9%
div-inv54.9%
pow-flip54.9%
metadata-eval54.9%
Applied egg-rr54.9%
unpow154.9%
*-commutative54.9%
Simplified54.9%
unpow254.9%
*-un-lft-identity54.9%
times-frac54.9%
Applied egg-rr54.9%
if -1.01999999999999998e-38 < d < -1.12000000000000005e-72Initial program 74.7%
Simplified74.7%
add-sqr-sqrt74.7%
pow274.7%
sqrt-prod74.7%
sqrt-pow175.2%
metadata-eval75.2%
frac-times75.2%
associate-/l*75.2%
pow175.2%
*-un-lft-identity75.2%
times-frac75.2%
metadata-eval75.2%
Applied egg-rr75.2%
associate-*r*75.2%
associate-/l*75.2%
*-commutative75.2%
associate-/l*75.2%
associate-*l*75.2%
associate-/l*75.2%
Simplified75.2%
Taylor expanded in d around inf 2.5%
unpow-12.5%
metadata-eval2.5%
pow-sqr2.5%
rem-sqrt-square2.5%
rem-square-sqrt2.5%
fabs-sqr2.5%
rem-square-sqrt2.5%
Simplified2.5%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt75.7%
unpow-175.7%
metadata-eval75.7%
pow-sqr75.7%
rem-sqrt-square75.7%
metadata-eval75.7%
pow-sqr75.6%
fabs-sqr75.6%
pow-sqr75.7%
metadata-eval75.7%
associate-*l*75.7%
mul-1-neg75.7%
metadata-eval75.7%
pow-sqr75.6%
pow-sqr75.7%
metadata-eval75.7%
exp-to-pow70.0%
metadata-eval70.0%
distribute-rgt-neg-in70.0%
Simplified75.9%
if -2.0999999999999999e-193 < d < -2.1500000000000001e-207Initial program 0.0%
Simplified0.0%
add-sqr-sqrt0.0%
pow20.0%
sqrt-prod0.0%
sqrt-pow10.0%
metadata-eval0.0%
frac-times0.0%
associate-/l*0.0%
pow10.0%
*-un-lft-identity0.0%
times-frac0.0%
metadata-eval0.0%
Applied egg-rr0.0%
associate-*r*0.0%
associate-/l*0.0%
*-commutative0.0%
associate-/l*0.0%
associate-*l*0.0%
associate-/l*0.0%
Simplified0.0%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt50.2%
neg-mul-150.2%
unpow-150.2%
metadata-eval50.2%
pow-sqr51.0%
rem-sqrt-square51.0%
rem-square-sqrt50.2%
fabs-sqr50.2%
rem-square-sqrt51.0%
Simplified51.0%
if -1.74999999999999996e-301 < d Initial program 63.4%
Simplified60.2%
add-sqr-sqrt60.2%
pow260.2%
sqrt-prod60.2%
sqrt-pow161.1%
metadata-eval61.1%
frac-times65.1%
associate-/l*61.1%
pow161.1%
*-un-lft-identity61.1%
times-frac61.1%
metadata-eval61.1%
Applied egg-rr61.1%
associate-*r*61.1%
associate-/l*65.1%
*-commutative65.1%
associate-/l*64.2%
associate-*l*64.2%
associate-/l*64.2%
Simplified64.2%
Taylor expanded in d around inf 39.5%
unpow-139.5%
metadata-eval39.5%
pow-sqr39.5%
rem-sqrt-square40.1%
rem-square-sqrt39.9%
fabs-sqr39.9%
rem-square-sqrt40.1%
Simplified40.1%
add-sqr-sqrt39.9%
sqrt-unprod39.5%
pow-prod-up39.5%
metadata-eval39.5%
inv-pow39.5%
*-commutative39.5%
associate-/l/39.7%
sqrt-div45.3%
inv-pow45.3%
sqrt-pow145.4%
metadata-eval45.4%
Applied egg-rr45.4%
Final simplification53.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (* (/ h l) -0.5) (pow (* D_m (/ (* 0.5 M_m) d)) 2.0)))
(t_1 (/ d (sqrt (* l h)))))
(if (<= l -4e-310)
(* t_1 (- -1.0 t_0))
(if (<= l 9.2e-295)
(* d (- (pow (* l h) -0.5)))
(if (<= l 3.4e+128)
(* (+ 1.0 t_0) t_1)
(* d (* (pow h -0.5) (sqrt (/ 1.0 l)))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = ((h / l) * -0.5) * pow((D_m * ((0.5 * M_m) / d)), 2.0);
double t_1 = d / sqrt((l * h));
double tmp;
if (l <= -4e-310) {
tmp = t_1 * (-1.0 - t_0);
} else if (l <= 9.2e-295) {
tmp = d * -pow((l * h), -0.5);
} else if (l <= 3.4e+128) {
tmp = (1.0 + t_0) * t_1;
} else {
tmp = d * (pow(h, -0.5) * sqrt((1.0 / l)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ((h / l) * (-0.5d0)) * ((d_m * ((0.5d0 * m_m) / d)) ** 2.0d0)
t_1 = d / sqrt((l * h))
if (l <= (-4d-310)) then
tmp = t_1 * ((-1.0d0) - t_0)
else if (l <= 9.2d-295) then
tmp = d * -((l * h) ** (-0.5d0))
else if (l <= 3.4d+128) then
tmp = (1.0d0 + t_0) * t_1
else
tmp = d * ((h ** (-0.5d0)) * sqrt((1.0d0 / l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = ((h / l) * -0.5) * Math.pow((D_m * ((0.5 * M_m) / d)), 2.0);
double t_1 = d / Math.sqrt((l * h));
double tmp;
if (l <= -4e-310) {
tmp = t_1 * (-1.0 - t_0);
} else if (l <= 9.2e-295) {
tmp = d * -Math.pow((l * h), -0.5);
} else if (l <= 3.4e+128) {
tmp = (1.0 + t_0) * t_1;
} else {
tmp = d * (Math.pow(h, -0.5) * Math.sqrt((1.0 / l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = ((h / l) * -0.5) * math.pow((D_m * ((0.5 * M_m) / d)), 2.0) t_1 = d / math.sqrt((l * h)) tmp = 0 if l <= -4e-310: tmp = t_1 * (-1.0 - t_0) elif l <= 9.2e-295: tmp = d * -math.pow((l * h), -0.5) elif l <= 3.4e+128: tmp = (1.0 + t_0) * t_1 else: tmp = d * (math.pow(h, -0.5) * math.sqrt((1.0 / l))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(Float64(0.5 * M_m) / d)) ^ 2.0)) t_1 = Float64(d / sqrt(Float64(l * h))) tmp = 0.0 if (l <= -4e-310) tmp = Float64(t_1 * Float64(-1.0 - t_0)); elseif (l <= 9.2e-295) tmp = Float64(d * Float64(-(Float64(l * h) ^ -0.5))); elseif (l <= 3.4e+128) tmp = Float64(Float64(1.0 + t_0) * t_1); else tmp = Float64(d * Float64((h ^ -0.5) * sqrt(Float64(1.0 / l)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = ((h / l) * -0.5) * ((D_m * ((0.5 * M_m) / d)) ^ 2.0);
t_1 = d / sqrt((l * h));
tmp = 0.0;
if (l <= -4e-310)
tmp = t_1 * (-1.0 - t_0);
elseif (l <= 9.2e-295)
tmp = d * -((l * h) ^ -0.5);
elseif (l <= 3.4e+128)
tmp = (1.0 + t_0) * t_1;
else
tmp = d * ((h ^ -0.5) * sqrt((1.0 / l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(N[(0.5 * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -4e-310], N[(t$95$1 * N[(-1.0 - t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 9.2e-295], N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 3.4e+128], N[(N[(1.0 + t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{0.5 \cdot M\_m}{d}\right)}^{2}\\
t_1 := \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;\ell \leq -4 \cdot 10^{-310}:\\
\;\;\;\;t\_1 \cdot \left(-1 - t\_0\right)\\
\mathbf{elif}\;\ell \leq 9.2 \cdot 10^{-295}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{elif}\;\ell \leq 3.4 \cdot 10^{+128}:\\
\;\;\;\;\left(1 + t\_0\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot \sqrt{\frac{1}{\ell}}\right)\\
\end{array}
\end{array}
if l < -3.999999999999988e-310Initial program 62.0%
Simplified62.8%
add-sqr-sqrt62.8%
pow262.8%
sqrt-prod62.8%
sqrt-pow162.8%
metadata-eval62.8%
frac-times62.0%
associate-/l*62.8%
pow162.8%
*-un-lft-identity62.8%
times-frac62.8%
metadata-eval62.8%
Applied egg-rr62.8%
*-commutative62.8%
associate-*r/62.8%
associate-*r/62.0%
Simplified62.0%
Taylor expanded in M around 0 62.0%
associate-*r/62.1%
*-commutative62.1%
associate-*l*62.1%
associate-*l/62.1%
*-commutative62.1%
Simplified62.1%
pow162.1%
sqrt-unprod53.4%
cancel-sign-sub-inv53.4%
metadata-eval53.4%
unpow-prod-down53.4%
pow253.4%
add-sqr-sqrt53.4%
associate-/l*53.4%
Applied egg-rr53.4%
unpow153.4%
associate-*r*53.4%
associate-*r/53.4%
Simplified53.4%
frac-times41.6%
add-exp-log40.6%
add-sqr-sqrt15.4%
sqrt-unprod25.7%
sqr-neg25.7%
sqrt-unprod10.3%
add-sqr-sqrt22.9%
add-sqr-sqrt22.9%
unpow1/222.9%
exp-prod22.9%
unpow1/222.9%
exp-prod22.9%
frac-times23.8%
Applied egg-rr73.4%
if -3.999999999999988e-310 < l < 9.1999999999999999e-295Initial program 80.0%
Simplified80.0%
add-sqr-sqrt80.0%
pow280.0%
sqrt-prod80.0%
sqrt-pow180.8%
metadata-eval80.8%
frac-times80.8%
associate-/l*80.8%
pow180.8%
*-un-lft-identity80.8%
times-frac80.8%
metadata-eval80.8%
Applied egg-rr80.8%
associate-*r*80.8%
associate-/l*80.8%
*-commutative80.8%
associate-/l*80.8%
associate-*l*80.8%
associate-/l*80.8%
Simplified80.8%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt81.5%
neg-mul-181.5%
unpow-181.5%
metadata-eval81.5%
pow-sqr81.5%
rem-sqrt-square81.5%
rem-square-sqrt81.5%
fabs-sqr81.5%
rem-square-sqrt81.5%
Simplified81.5%
if 9.1999999999999999e-295 < l < 3.3999999999999999e128Initial program 68.4%
Simplified65.0%
add-sqr-sqrt65.0%
pow265.0%
sqrt-prod65.0%
sqrt-pow165.1%
metadata-eval65.1%
frac-times69.6%
associate-/l*65.1%
pow165.1%
*-un-lft-identity65.1%
times-frac65.1%
metadata-eval65.1%
Applied egg-rr65.1%
*-commutative65.1%
associate-*r/65.1%
associate-*r/69.6%
Simplified69.6%
Taylor expanded in M around 0 69.6%
associate-*r/68.5%
*-commutative68.5%
associate-*l*68.5%
associate-*l/68.5%
*-commutative68.5%
Simplified68.5%
pow168.5%
sqrt-unprod58.8%
cancel-sign-sub-inv58.8%
metadata-eval58.8%
unpow-prod-down57.6%
pow257.6%
add-sqr-sqrt57.6%
associate-/l*57.6%
Applied egg-rr57.6%
unpow157.6%
associate-*r*57.6%
associate-*r/57.6%
Simplified57.6%
frac-times49.5%
add-exp-log48.3%
add-sqr-sqrt14.9%
sqrt-unprod28.9%
sqr-neg28.9%
sqrt-unprod14.0%
add-sqr-sqrt28.7%
add-sqr-sqrt28.7%
unpow1/228.7%
exp-prod28.7%
unpow1/228.7%
exp-prod28.7%
frac-times31.2%
Applied egg-rr84.7%
times-frac84.8%
unpow284.8%
rem-3cbrt-lft85.2%
*-lft-identity85.2%
Simplified85.2%
if 3.3999999999999999e128 < l Initial program 49.6%
Simplified46.3%
add-sqr-sqrt46.3%
pow246.3%
sqrt-prod46.3%
sqrt-pow149.5%
metadata-eval49.5%
frac-times52.8%
associate-/l*49.5%
pow149.5%
*-un-lft-identity49.5%
times-frac49.5%
metadata-eval49.5%
Applied egg-rr49.5%
associate-*r*49.5%
associate-/l*52.8%
*-commutative52.8%
associate-/l*52.4%
associate-*l*52.5%
associate-/l*52.5%
Simplified52.5%
Taylor expanded in d around inf 38.2%
unpow-138.2%
metadata-eval38.2%
pow-sqr38.2%
rem-sqrt-square38.2%
rem-square-sqrt38.1%
fabs-sqr38.1%
rem-square-sqrt38.2%
Simplified38.2%
add-sqr-sqrt38.1%
sqrt-unprod38.2%
pow-prod-up38.2%
metadata-eval38.2%
inv-pow38.2%
*-commutative38.2%
associate-/l/38.7%
pow1/238.7%
div-inv38.7%
unpow-prod-down58.5%
pow1/258.5%
inv-pow58.5%
sqrt-pow158.6%
metadata-eval58.6%
Applied egg-rr58.6%
unpow1/258.6%
Simplified58.6%
Final simplification75.6%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -1.95e-208)
(* (- d) (sqrt (/ (/ 1.0 l) h)))
(if (<= d -1.3e-300)
(* d (pow (pow (* l h) -3.0) 0.16666666666666666))
(* d (/ (pow h -0.5) (sqrt l))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -1.95e-208) {
tmp = -d * sqrt(((1.0 / l) / h));
} else if (d <= -1.3e-300) {
tmp = d * pow(pow((l * h), -3.0), 0.16666666666666666);
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (d <= (-1.95d-208)) then
tmp = -d * sqrt(((1.0d0 / l) / h))
else if (d <= (-1.3d-300)) then
tmp = d * (((l * h) ** (-3.0d0)) ** 0.16666666666666666d0)
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -1.95e-208) {
tmp = -d * Math.sqrt(((1.0 / l) / h));
} else if (d <= -1.3e-300) {
tmp = d * Math.pow(Math.pow((l * h), -3.0), 0.16666666666666666);
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if d <= -1.95e-208: tmp = -d * math.sqrt(((1.0 / l) / h)) elif d <= -1.3e-300: tmp = d * math.pow(math.pow((l * h), -3.0), 0.16666666666666666) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -1.95e-208) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h))); elseif (d <= -1.3e-300) tmp = Float64(d * ((Float64(l * h) ^ -3.0) ^ 0.16666666666666666)); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (d <= -1.95e-208)
tmp = -d * sqrt(((1.0 / l) / h));
elseif (d <= -1.3e-300)
tmp = d * (((l * h) ^ -3.0) ^ 0.16666666666666666);
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -1.95e-208], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.3e-300], N[(d * N[Power[N[Power[N[(l * h), $MachinePrecision], -3.0], $MachinePrecision], 0.16666666666666666], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.95 \cdot 10^{-208}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{elif}\;d \leq -1.3 \cdot 10^{-300}:\\
\;\;\;\;d \cdot {\left({\left(\ell \cdot h\right)}^{-3}\right)}^{0.16666666666666666}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.95000000000000002e-208Initial program 67.7%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt49.8%
neg-mul-149.8%
Simplified49.8%
if -1.95000000000000002e-208 < d < -1.29999999999999998e-300Initial program 45.1%
Taylor expanded in d around inf 13.4%
log1p-expm1-u38.7%
pow1/238.7%
inv-pow38.7%
pow-pow38.7%
metadata-eval38.7%
Applied egg-rr38.7%
log1p-expm1-u13.4%
metadata-eval13.4%
pow-pow27.8%
sqr-pow27.8%
pow-prod-down35.1%
pow-prod-up35.1%
metadata-eval35.1%
metadata-eval35.1%
Applied egg-rr35.1%
if -1.29999999999999998e-300 < d Initial program 62.9%
Simplified59.8%
add-sqr-sqrt59.7%
pow259.7%
sqrt-prod59.7%
sqrt-pow160.7%
metadata-eval60.7%
frac-times64.6%
associate-/l*60.7%
pow160.7%
*-un-lft-identity60.7%
times-frac60.7%
metadata-eval60.7%
Applied egg-rr60.7%
associate-*r*60.7%
associate-/l*64.6%
*-commutative64.6%
associate-/l*63.7%
associate-*l*63.7%
associate-/l*63.7%
Simplified63.7%
Taylor expanded in d around inf 39.2%
unpow-139.2%
metadata-eval39.2%
pow-sqr39.2%
rem-sqrt-square39.8%
rem-square-sqrt39.6%
fabs-sqr39.6%
rem-square-sqrt39.8%
Simplified39.8%
add-sqr-sqrt39.6%
sqrt-unprod39.2%
pow-prod-up39.2%
metadata-eval39.2%
inv-pow39.2%
*-commutative39.2%
associate-/l/39.4%
sqrt-div45.0%
inv-pow45.0%
sqrt-pow145.0%
metadata-eval45.0%
Applied egg-rr45.0%
Final simplification45.9%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= d 8.7e-297) (* d (- (sqrt (/ (/ 1.0 h) l)))) (* d (/ (pow h -0.5) (sqrt l)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= 8.7e-297) {
tmp = d * -sqrt(((1.0 / h) / l));
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (d <= 8.7d-297) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= 8.7e-297) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if d <= 8.7e-297: tmp = d * -math.sqrt(((1.0 / h) / l)) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= 8.7e-297) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (d <= 8.7e-297)
tmp = d * -sqrt(((1.0 / h) / l));
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, 8.7e-297], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $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 = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 8.7 \cdot 10^{-297}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < 8.7e-297Initial program 61.3%
Simplified62.1%
Taylor expanded in M around 0 43.8%
*-commutative43.8%
associate-*r*43.8%
times-frac45.2%
*-commutative45.2%
associate-/l*43.8%
unpow243.8%
unpow243.8%
unpow243.8%
times-frac52.4%
swap-sqr62.1%
unpow262.1%
associate-*r/61.3%
*-commutative61.3%
associate-/l*61.4%
Simplified61.4%
Taylor expanded in D around 0 61.3%
clear-num60.6%
sqrt-div60.8%
metadata-eval60.8%
Applied egg-rr60.8%
Taylor expanded in d around -inf 41.8%
associate-*r*41.8%
neg-mul-141.8%
associate-/r*42.6%
Simplified42.6%
if 8.7e-297 < d Initial program 64.6%
Simplified61.4%
add-sqr-sqrt61.4%
pow261.4%
sqrt-prod61.4%
sqrt-pow162.3%
metadata-eval62.3%
frac-times66.4%
associate-/l*62.3%
pow162.3%
*-un-lft-identity62.3%
times-frac62.3%
metadata-eval62.3%
Applied egg-rr62.3%
associate-*r*62.3%
associate-/l*66.4%
*-commutative66.4%
associate-/l*65.5%
associate-*l*65.5%
associate-/l*65.5%
Simplified65.5%
Taylor expanded in d around inf 40.8%
unpow-140.8%
metadata-eval40.8%
pow-sqr40.8%
rem-sqrt-square41.3%
rem-square-sqrt41.2%
fabs-sqr41.2%
rem-square-sqrt41.3%
Simplified41.3%
add-sqr-sqrt41.2%
sqrt-unprod40.8%
pow-prod-up40.8%
metadata-eval40.8%
inv-pow40.8%
*-commutative40.8%
associate-/l/40.9%
sqrt-div46.8%
inv-pow46.8%
sqrt-pow146.9%
metadata-eval46.9%
Applied egg-rr46.9%
Final simplification44.7%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= d 3.8e-297) (* d (- (sqrt (/ (/ 1.0 h) l)))) (/ d (* (sqrt h) (sqrt l)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= 3.8e-297) {
tmp = d * -sqrt(((1.0 / h) / l));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (d <= 3.8d-297) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= 3.8e-297) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if d <= 3.8e-297: tmp = d * -math.sqrt(((1.0 / h) / l)) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= 3.8e-297) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (d <= 3.8e-297)
tmp = d * -sqrt(((1.0 / h) / l));
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, 3.8e-297], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 3.8 \cdot 10^{-297}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < 3.80000000000000005e-297Initial program 61.3%
Simplified62.1%
Taylor expanded in M around 0 43.8%
*-commutative43.8%
associate-*r*43.8%
times-frac45.2%
*-commutative45.2%
associate-/l*43.8%
unpow243.8%
unpow243.8%
unpow243.8%
times-frac52.4%
swap-sqr62.1%
unpow262.1%
associate-*r/61.3%
*-commutative61.3%
associate-/l*61.4%
Simplified61.4%
Taylor expanded in D around 0 61.3%
clear-num60.6%
sqrt-div60.8%
metadata-eval60.8%
Applied egg-rr60.8%
Taylor expanded in d around -inf 41.8%
associate-*r*41.8%
neg-mul-141.8%
associate-/r*42.6%
Simplified42.6%
if 3.80000000000000005e-297 < d Initial program 64.6%
Simplified61.4%
add-sqr-sqrt61.4%
pow261.4%
sqrt-prod61.4%
sqrt-pow162.3%
metadata-eval62.3%
frac-times66.4%
associate-/l*62.3%
pow162.3%
*-un-lft-identity62.3%
times-frac62.3%
metadata-eval62.3%
Applied egg-rr62.3%
associate-*r*62.3%
associate-/l*66.4%
*-commutative66.4%
associate-/l*65.5%
associate-*l*65.5%
associate-/l*65.5%
Simplified65.5%
Taylor expanded in d around inf 40.8%
unpow-140.8%
metadata-eval40.8%
pow-sqr40.8%
rem-sqrt-square41.3%
rem-square-sqrt41.2%
fabs-sqr41.2%
rem-square-sqrt41.3%
Simplified41.3%
Taylor expanded in d around 0 40.8%
unpow-140.8%
metadata-eval40.8%
pow-sqr40.8%
rem-sqrt-square41.3%
metadata-eval41.3%
pow-sqr41.2%
fabs-sqr41.2%
pow-sqr41.3%
metadata-eval41.3%
exp-to-pow39.5%
metadata-eval39.5%
distribute-rgt-neg-in39.5%
exp-neg39.5%
associate-*r/39.5%
*-rgt-identity39.5%
exp-to-pow41.3%
unpow1/241.3%
Simplified41.3%
*-commutative41.3%
sqrt-prod46.8%
Applied egg-rr46.8%
Final simplification44.6%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (* l h))))
(if (<= l 9e-268)
(* d (- (pow (* l h) -0.5)))
(if (<= l 1.1e-43)
(/ 1.0 (/ t_0 d))
(if (<= l 1.12e-43)
(/ d (- t_0))
(if (<= l 1.32e+286)
(* d (sqrt (/ 1.0 (* l h))))
(sqrt (* (/ d h) (/ d l)))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((l * h));
double tmp;
if (l <= 9e-268) {
tmp = d * -pow((l * h), -0.5);
} else if (l <= 1.1e-43) {
tmp = 1.0 / (t_0 / d);
} else if (l <= 1.12e-43) {
tmp = d / -t_0;
} else if (l <= 1.32e+286) {
tmp = d * sqrt((1.0 / (l * h)));
} else {
tmp = sqrt(((d / h) * (d / l)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((l * h))
if (l <= 9d-268) then
tmp = d * -((l * h) ** (-0.5d0))
else if (l <= 1.1d-43) then
tmp = 1.0d0 / (t_0 / d)
else if (l <= 1.12d-43) then
tmp = d / -t_0
else if (l <= 1.32d+286) then
tmp = d * sqrt((1.0d0 / (l * h)))
else
tmp = sqrt(((d / h) * (d / l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt((l * h));
double tmp;
if (l <= 9e-268) {
tmp = d * -Math.pow((l * h), -0.5);
} else if (l <= 1.1e-43) {
tmp = 1.0 / (t_0 / d);
} else if (l <= 1.12e-43) {
tmp = d / -t_0;
} else if (l <= 1.32e+286) {
tmp = d * Math.sqrt((1.0 / (l * h)));
} else {
tmp = Math.sqrt(((d / h) * (d / l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt((l * h)) tmp = 0 if l <= 9e-268: tmp = d * -math.pow((l * h), -0.5) elif l <= 1.1e-43: tmp = 1.0 / (t_0 / d) elif l <= 1.12e-43: tmp = d / -t_0 elif l <= 1.32e+286: tmp = d * math.sqrt((1.0 / (l * h))) else: tmp = math.sqrt(((d / h) * (d / l))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(l * h)) tmp = 0.0 if (l <= 9e-268) tmp = Float64(d * Float64(-(Float64(l * h) ^ -0.5))); elseif (l <= 1.1e-43) tmp = Float64(1.0 / Float64(t_0 / d)); elseif (l <= 1.12e-43) tmp = Float64(d / Float64(-t_0)); elseif (l <= 1.32e+286) tmp = Float64(d * sqrt(Float64(1.0 / Float64(l * h)))); else tmp = sqrt(Float64(Float64(d / h) * Float64(d / l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt((l * h));
tmp = 0.0;
if (l <= 9e-268)
tmp = d * -((l * h) ^ -0.5);
elseif (l <= 1.1e-43)
tmp = 1.0 / (t_0 / d);
elseif (l <= 1.12e-43)
tmp = d / -t_0;
elseif (l <= 1.32e+286)
tmp = d * sqrt((1.0 / (l * h)));
else
tmp = sqrt(((d / h) * (d / l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, 9e-268], N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 1.1e-43], N[(1.0 / N[(t$95$0 / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.12e-43], N[(d / (-t$95$0)), $MachinePrecision], If[LessEqual[l, 1.32e+286], N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;\ell \leq 9 \cdot 10^{-268}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{elif}\;\ell \leq 1.1 \cdot 10^{-43}:\\
\;\;\;\;\frac{1}{\frac{t\_0}{d}}\\
\mathbf{elif}\;\ell \leq 1.12 \cdot 10^{-43}:\\
\;\;\;\;\frac{d}{-t\_0}\\
\mathbf{elif}\;\ell \leq 1.32 \cdot 10^{+286}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\end{array}
\end{array}
if l < 9.0000000000000003e-268Initial program 62.3%
Simplified63.0%
add-sqr-sqrt63.0%
pow263.0%
sqrt-prod63.0%
sqrt-pow163.1%
metadata-eval63.1%
frac-times62.3%
associate-/l*63.1%
pow163.1%
*-un-lft-identity63.1%
times-frac63.1%
metadata-eval63.1%
Applied egg-rr63.1%
associate-*r*63.1%
associate-/l*62.3%
*-commutative62.3%
associate-/l*62.4%
associate-*l*61.7%
associate-/l*61.7%
Simplified61.7%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt43.0%
neg-mul-143.0%
unpow-143.0%
metadata-eval43.0%
pow-sqr43.1%
rem-sqrt-square43.4%
rem-square-sqrt43.3%
fabs-sqr43.3%
rem-square-sqrt43.4%
Simplified43.4%
if 9.0000000000000003e-268 < l < 1.09999999999999999e-43Initial program 64.3%
Taylor expanded in d around inf 32.4%
add-cbrt-cube30.3%
pow1/329.1%
add-sqr-sqrt29.1%
pow129.1%
pow1/229.1%
pow-prod-up29.1%
associate-/r*29.1%
metadata-eval29.1%
Applied egg-rr29.1%
*-un-lft-identity29.1%
Applied egg-rr29.1%
*-lft-identity29.1%
associate-/r*29.1%
rem-exp-log29.3%
exp-neg29.3%
exp-prod29.2%
distribute-lft-neg-out29.2%
distribute-rgt-neg-in29.2%
exp-to-pow29.1%
metadata-eval29.1%
Simplified29.1%
pow-pow33.9%
metadata-eval33.9%
metadata-eval33.9%
pow-flip33.8%
pow1/233.8%
div-inv33.9%
clear-num33.9%
Applied egg-rr33.9%
if 1.09999999999999999e-43 < l < 1.12e-43Initial program 100.0%
Simplified100.0%
add-sqr-sqrt100.0%
pow2100.0%
sqrt-prod100.0%
sqrt-pow1100.0%
metadata-eval100.0%
frac-times100.0%
associate-/l*100.0%
pow1100.0%
*-un-lft-identity100.0%
times-frac100.0%
metadata-eval100.0%
Applied egg-rr100.0%
associate-*r*100.0%
associate-/l*100.0%
*-commutative100.0%
associate-/l*100.0%
associate-*l*100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in d around inf 0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
Simplified0.0%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt100.0%
unpow-1100.0%
metadata-eval100.0%
pow-sqr100.0%
rem-sqrt-square100.0%
metadata-eval100.0%
pow-sqr100.0%
fabs-sqr100.0%
pow-sqr100.0%
metadata-eval100.0%
associate-*l*100.0%
mul-1-neg100.0%
metadata-eval100.0%
pow-sqr100.0%
pow-sqr100.0%
metadata-eval100.0%
exp-to-pow100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
if 1.12e-43 < l < 1.3199999999999999e286Initial program 60.8%
Taylor expanded in d around inf 53.8%
if 1.3199999999999999e286 < l Initial program 82.6%
Simplified82.6%
Taylor expanded in M around 0 83.4%
pow183.4%
*-rgt-identity83.4%
*-commutative83.4%
pow1/283.4%
pow1/283.4%
pow-prod-down83.9%
Applied egg-rr83.9%
unpow183.9%
unpow1/283.9%
*-commutative83.9%
Simplified83.9%
Final simplification45.4%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (pow (* l h) -0.5)))
(if (<= l 4.8e-265)
(* d (- t_0))
(if (<= l 1.1e-43)
(* d t_0)
(if (<= l 1.12e-43)
(/ d (- (sqrt (* l h))))
(if (<= l 2.4e+281)
(* d (sqrt (/ 1.0 (* l h))))
(sqrt (* (/ d h) (/ d l)))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = pow((l * h), -0.5);
double tmp;
if (l <= 4.8e-265) {
tmp = d * -t_0;
} else if (l <= 1.1e-43) {
tmp = d * t_0;
} else if (l <= 1.12e-43) {
tmp = d / -sqrt((l * h));
} else if (l <= 2.4e+281) {
tmp = d * sqrt((1.0 / (l * h)));
} else {
tmp = sqrt(((d / h) * (d / l)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = (l * h) ** (-0.5d0)
if (l <= 4.8d-265) then
tmp = d * -t_0
else if (l <= 1.1d-43) then
tmp = d * t_0
else if (l <= 1.12d-43) then
tmp = d / -sqrt((l * h))
else if (l <= 2.4d+281) then
tmp = d * sqrt((1.0d0 / (l * h)))
else
tmp = sqrt(((d / h) * (d / l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.pow((l * h), -0.5);
double tmp;
if (l <= 4.8e-265) {
tmp = d * -t_0;
} else if (l <= 1.1e-43) {
tmp = d * t_0;
} else if (l <= 1.12e-43) {
tmp = d / -Math.sqrt((l * h));
} else if (l <= 2.4e+281) {
tmp = d * Math.sqrt((1.0 / (l * h)));
} else {
tmp = Math.sqrt(((d / h) * (d / l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.pow((l * h), -0.5) tmp = 0 if l <= 4.8e-265: tmp = d * -t_0 elif l <= 1.1e-43: tmp = d * t_0 elif l <= 1.12e-43: tmp = d / -math.sqrt((l * h)) elif l <= 2.4e+281: tmp = d * math.sqrt((1.0 / (l * h))) else: tmp = math.sqrt(((d / h) * (d / l))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(l * h) ^ -0.5 tmp = 0.0 if (l <= 4.8e-265) tmp = Float64(d * Float64(-t_0)); elseif (l <= 1.1e-43) tmp = Float64(d * t_0); elseif (l <= 1.12e-43) tmp = Float64(d / Float64(-sqrt(Float64(l * h)))); elseif (l <= 2.4e+281) tmp = Float64(d * sqrt(Float64(1.0 / Float64(l * h)))); else tmp = sqrt(Float64(Float64(d / h) * Float64(d / l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (l * h) ^ -0.5;
tmp = 0.0;
if (l <= 4.8e-265)
tmp = d * -t_0;
elseif (l <= 1.1e-43)
tmp = d * t_0;
elseif (l <= 1.12e-43)
tmp = d / -sqrt((l * h));
elseif (l <= 2.4e+281)
tmp = d * sqrt((1.0 / (l * h)));
else
tmp = sqrt(((d / h) * (d / l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[l, 4.8e-265], N[(d * (-t$95$0)), $MachinePrecision], If[LessEqual[l, 1.1e-43], N[(d * t$95$0), $MachinePrecision], If[LessEqual[l, 1.12e-43], N[(d / (-N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 2.4e+281], N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq 4.8 \cdot 10^{-265}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\
\mathbf{elif}\;\ell \leq 1.1 \cdot 10^{-43}:\\
\;\;\;\;d \cdot t\_0\\
\mathbf{elif}\;\ell \leq 1.12 \cdot 10^{-43}:\\
\;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\
\mathbf{elif}\;\ell \leq 2.4 \cdot 10^{+281}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\end{array}
\end{array}
if l < 4.7999999999999999e-265Initial program 62.3%
Simplified63.0%
add-sqr-sqrt63.0%
pow263.0%
sqrt-prod63.0%
sqrt-pow163.1%
metadata-eval63.1%
frac-times62.3%
associate-/l*63.1%
pow163.1%
*-un-lft-identity63.1%
times-frac63.1%
metadata-eval63.1%
Applied egg-rr63.1%
associate-*r*63.1%
associate-/l*62.3%
*-commutative62.3%
associate-/l*62.4%
associate-*l*61.7%
associate-/l*61.7%
Simplified61.7%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt43.0%
neg-mul-143.0%
unpow-143.0%
metadata-eval43.0%
pow-sqr43.1%
rem-sqrt-square43.4%
rem-square-sqrt43.3%
fabs-sqr43.3%
rem-square-sqrt43.4%
Simplified43.4%
if 4.7999999999999999e-265 < l < 1.09999999999999999e-43Initial program 64.3%
Simplified62.2%
add-sqr-sqrt62.2%
pow262.2%
sqrt-prod62.2%
sqrt-pow162.3%
metadata-eval62.3%
frac-times66.5%
associate-/l*62.3%
pow162.3%
*-un-lft-identity62.3%
times-frac62.3%
metadata-eval62.3%
Applied egg-rr62.3%
associate-*r*62.3%
associate-/l*66.5%
*-commutative66.5%
associate-/l*64.5%
associate-*l*64.5%
associate-/l*64.5%
Simplified64.5%
Taylor expanded in d around inf 32.4%
unpow-132.4%
metadata-eval32.4%
pow-sqr32.4%
rem-sqrt-square33.9%
rem-square-sqrt33.8%
fabs-sqr33.8%
rem-square-sqrt33.9%
Simplified33.9%
if 1.09999999999999999e-43 < l < 1.12e-43Initial program 100.0%
Simplified100.0%
add-sqr-sqrt100.0%
pow2100.0%
sqrt-prod100.0%
sqrt-pow1100.0%
metadata-eval100.0%
frac-times100.0%
associate-/l*100.0%
pow1100.0%
*-un-lft-identity100.0%
times-frac100.0%
metadata-eval100.0%
Applied egg-rr100.0%
associate-*r*100.0%
associate-/l*100.0%
*-commutative100.0%
associate-/l*100.0%
associate-*l*100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in d around inf 0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
Simplified0.0%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt100.0%
unpow-1100.0%
metadata-eval100.0%
pow-sqr100.0%
rem-sqrt-square100.0%
metadata-eval100.0%
pow-sqr100.0%
fabs-sqr100.0%
pow-sqr100.0%
metadata-eval100.0%
associate-*l*100.0%
mul-1-neg100.0%
metadata-eval100.0%
pow-sqr100.0%
pow-sqr100.0%
metadata-eval100.0%
exp-to-pow100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
if 1.12e-43 < l < 2.4000000000000001e281Initial program 60.8%
Taylor expanded in d around inf 53.8%
if 2.4000000000000001e281 < l Initial program 82.6%
Simplified82.6%
Taylor expanded in M around 0 83.4%
pow183.4%
*-rgt-identity83.4%
*-commutative83.4%
pow1/283.4%
pow1/283.4%
pow-prod-down83.9%
Applied egg-rr83.9%
unpow183.9%
unpow1/283.9%
*-commutative83.9%
Simplified83.9%
Final simplification45.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (pow (* l h) -0.5)) (t_1 (* d t_0)))
(if (<= l 3e-268)
(* d (- t_0))
(if (<= l 1.1e-43)
t_1
(if (<= l 1.12e-43)
(/ d (- (sqrt (* l h))))
(if (<= l 1.82e+282) t_1 (sqrt (* (/ d h) (/ d l)))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = pow((l * h), -0.5);
double t_1 = d * t_0;
double tmp;
if (l <= 3e-268) {
tmp = d * -t_0;
} else if (l <= 1.1e-43) {
tmp = t_1;
} else if (l <= 1.12e-43) {
tmp = d / -sqrt((l * h));
} else if (l <= 1.82e+282) {
tmp = t_1;
} else {
tmp = sqrt(((d / h) * (d / l)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (l * h) ** (-0.5d0)
t_1 = d * t_0
if (l <= 3d-268) then
tmp = d * -t_0
else if (l <= 1.1d-43) then
tmp = t_1
else if (l <= 1.12d-43) then
tmp = d / -sqrt((l * h))
else if (l <= 1.82d+282) then
tmp = t_1
else
tmp = sqrt(((d / h) * (d / l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.pow((l * h), -0.5);
double t_1 = d * t_0;
double tmp;
if (l <= 3e-268) {
tmp = d * -t_0;
} else if (l <= 1.1e-43) {
tmp = t_1;
} else if (l <= 1.12e-43) {
tmp = d / -Math.sqrt((l * h));
} else if (l <= 1.82e+282) {
tmp = t_1;
} else {
tmp = Math.sqrt(((d / h) * (d / l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.pow((l * h), -0.5) t_1 = d * t_0 tmp = 0 if l <= 3e-268: tmp = d * -t_0 elif l <= 1.1e-43: tmp = t_1 elif l <= 1.12e-43: tmp = d / -math.sqrt((l * h)) elif l <= 1.82e+282: tmp = t_1 else: tmp = math.sqrt(((d / h) * (d / l))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(l * h) ^ -0.5 t_1 = Float64(d * t_0) tmp = 0.0 if (l <= 3e-268) tmp = Float64(d * Float64(-t_0)); elseif (l <= 1.1e-43) tmp = t_1; elseif (l <= 1.12e-43) tmp = Float64(d / Float64(-sqrt(Float64(l * h)))); elseif (l <= 1.82e+282) tmp = t_1; else tmp = sqrt(Float64(Float64(d / h) * Float64(d / l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (l * h) ^ -0.5;
t_1 = d * t_0;
tmp = 0.0;
if (l <= 3e-268)
tmp = d * -t_0;
elseif (l <= 1.1e-43)
tmp = t_1;
elseif (l <= 1.12e-43)
tmp = d / -sqrt((l * h));
elseif (l <= 1.82e+282)
tmp = t_1;
else
tmp = sqrt(((d / h) * (d / l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]}, Block[{t$95$1 = N[(d * t$95$0), $MachinePrecision]}, If[LessEqual[l, 3e-268], N[(d * (-t$95$0)), $MachinePrecision], If[LessEqual[l, 1.1e-43], t$95$1, If[LessEqual[l, 1.12e-43], N[(d / (-N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 1.82e+282], t$95$1, N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{-0.5}\\
t_1 := d \cdot t\_0\\
\mathbf{if}\;\ell \leq 3 \cdot 10^{-268}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\
\mathbf{elif}\;\ell \leq 1.1 \cdot 10^{-43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq 1.12 \cdot 10^{-43}:\\
\;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\
\mathbf{elif}\;\ell \leq 1.82 \cdot 10^{+282}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\end{array}
\end{array}
if l < 2.9999999999999997e-268Initial program 62.3%
Simplified63.0%
add-sqr-sqrt63.0%
pow263.0%
sqrt-prod63.0%
sqrt-pow163.1%
metadata-eval63.1%
frac-times62.3%
associate-/l*63.1%
pow163.1%
*-un-lft-identity63.1%
times-frac63.1%
metadata-eval63.1%
Applied egg-rr63.1%
associate-*r*63.1%
associate-/l*62.3%
*-commutative62.3%
associate-/l*62.4%
associate-*l*61.7%
associate-/l*61.7%
Simplified61.7%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt43.0%
neg-mul-143.0%
unpow-143.0%
metadata-eval43.0%
pow-sqr43.1%
rem-sqrt-square43.4%
rem-square-sqrt43.3%
fabs-sqr43.3%
rem-square-sqrt43.4%
Simplified43.4%
if 2.9999999999999997e-268 < l < 1.09999999999999999e-43 or 1.12e-43 < l < 1.82e282Initial program 62.3%
Simplified58.7%
add-sqr-sqrt58.6%
pow258.6%
sqrt-prod58.6%
sqrt-pow159.6%
metadata-eval59.6%
frac-times64.2%
associate-/l*59.6%
pow159.6%
*-un-lft-identity59.6%
times-frac59.6%
metadata-eval59.6%
Applied egg-rr59.6%
associate-*r*59.6%
associate-/l*64.2%
*-commutative64.2%
associate-/l*63.2%
associate-*l*63.2%
associate-/l*63.3%
Simplified63.3%
Taylor expanded in d around inf 44.6%
unpow-144.6%
metadata-eval44.6%
pow-sqr44.6%
rem-sqrt-square45.2%
rem-square-sqrt45.0%
fabs-sqr45.0%
rem-square-sqrt45.2%
Simplified45.2%
if 1.09999999999999999e-43 < l < 1.12e-43Initial program 100.0%
Simplified100.0%
add-sqr-sqrt100.0%
pow2100.0%
sqrt-prod100.0%
sqrt-pow1100.0%
metadata-eval100.0%
frac-times100.0%
associate-/l*100.0%
pow1100.0%
*-un-lft-identity100.0%
times-frac100.0%
metadata-eval100.0%
Applied egg-rr100.0%
associate-*r*100.0%
associate-/l*100.0%
*-commutative100.0%
associate-/l*100.0%
associate-*l*100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in d around inf 0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
Simplified0.0%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt100.0%
unpow-1100.0%
metadata-eval100.0%
pow-sqr100.0%
rem-sqrt-square100.0%
metadata-eval100.0%
pow-sqr100.0%
fabs-sqr100.0%
pow-sqr100.0%
metadata-eval100.0%
associate-*l*100.0%
mul-1-neg100.0%
metadata-eval100.0%
pow-sqr100.0%
pow-sqr100.0%
metadata-eval100.0%
exp-to-pow100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
if 1.82e282 < l Initial program 82.6%
Simplified82.6%
Taylor expanded in M around 0 83.4%
pow183.4%
*-rgt-identity83.4%
*-commutative83.4%
pow1/283.4%
pow1/283.4%
pow-prod-down83.9%
Applied egg-rr83.9%
unpow183.9%
unpow1/283.9%
*-commutative83.9%
Simplified83.9%
Final simplification45.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* d (pow (* l h) -0.5))) (t_1 (/ d (- (sqrt (* l h))))))
(if (<= l 8.5e-263)
t_1
(if (<= l 3.35e-49)
t_0
(if (<= l 2.3e-43)
t_1
(if (<= l 3.9e+284) t_0 (sqrt (* (/ d h) (/ d l)))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = d * pow((l * h), -0.5);
double t_1 = d / -sqrt((l * h));
double tmp;
if (l <= 8.5e-263) {
tmp = t_1;
} else if (l <= 3.35e-49) {
tmp = t_0;
} else if (l <= 2.3e-43) {
tmp = t_1;
} else if (l <= 3.9e+284) {
tmp = t_0;
} else {
tmp = sqrt(((d / h) * (d / l)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d * ((l * h) ** (-0.5d0))
t_1 = d / -sqrt((l * h))
if (l <= 8.5d-263) then
tmp = t_1
else if (l <= 3.35d-49) then
tmp = t_0
else if (l <= 2.3d-43) then
tmp = t_1
else if (l <= 3.9d+284) then
tmp = t_0
else
tmp = sqrt(((d / h) * (d / l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = d * Math.pow((l * h), -0.5);
double t_1 = d / -Math.sqrt((l * h));
double tmp;
if (l <= 8.5e-263) {
tmp = t_1;
} else if (l <= 3.35e-49) {
tmp = t_0;
} else if (l <= 2.3e-43) {
tmp = t_1;
} else if (l <= 3.9e+284) {
tmp = t_0;
} else {
tmp = Math.sqrt(((d / h) * (d / l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = d * math.pow((l * h), -0.5) t_1 = d / -math.sqrt((l * h)) tmp = 0 if l <= 8.5e-263: tmp = t_1 elif l <= 3.35e-49: tmp = t_0 elif l <= 2.3e-43: tmp = t_1 elif l <= 3.9e+284: tmp = t_0 else: tmp = math.sqrt(((d / h) * (d / l))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(d * (Float64(l * h) ^ -0.5)) t_1 = Float64(d / Float64(-sqrt(Float64(l * h)))) tmp = 0.0 if (l <= 8.5e-263) tmp = t_1; elseif (l <= 3.35e-49) tmp = t_0; elseif (l <= 2.3e-43) tmp = t_1; elseif (l <= 3.9e+284) tmp = t_0; else tmp = sqrt(Float64(Float64(d / h) * Float64(d / l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = d * ((l * h) ^ -0.5);
t_1 = d / -sqrt((l * h));
tmp = 0.0;
if (l <= 8.5e-263)
tmp = t_1;
elseif (l <= 3.35e-49)
tmp = t_0;
elseif (l <= 2.3e-43)
tmp = t_1;
elseif (l <= 3.9e+284)
tmp = t_0;
else
tmp = sqrt(((d / h) * (d / l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d / (-N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[l, 8.5e-263], t$95$1, If[LessEqual[l, 3.35e-49], t$95$0, If[LessEqual[l, 2.3e-43], t$95$1, If[LessEqual[l, 3.9e+284], t$95$0, N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
t_1 := \frac{d}{-\sqrt{\ell \cdot h}}\\
\mathbf{if}\;\ell \leq 8.5 \cdot 10^{-263}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq 3.35 \cdot 10^{-49}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 2.3 \cdot 10^{-43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq 3.9 \cdot 10^{+284}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\end{array}
\end{array}
if l < 8.49999999999999975e-263 or 3.35e-49 < l < 2.2999999999999999e-43Initial program 62.6%
Simplified63.3%
add-sqr-sqrt63.3%
pow263.3%
sqrt-prod63.3%
sqrt-pow163.3%
metadata-eval63.3%
frac-times62.6%
associate-/l*63.3%
pow163.3%
*-un-lft-identity63.3%
times-frac63.3%
metadata-eval63.3%
Applied egg-rr63.3%
associate-*r*63.3%
associate-/l*62.6%
*-commutative62.6%
associate-/l*62.7%
associate-*l*62.0%
associate-/l*62.0%
Simplified62.0%
Taylor expanded in d around inf 8.5%
unpow-18.5%
metadata-eval8.5%
pow-sqr8.5%
rem-sqrt-square8.5%
rem-square-sqrt8.5%
fabs-sqr8.5%
rem-square-sqrt8.5%
Simplified8.5%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt43.4%
unpow-143.4%
metadata-eval43.4%
pow-sqr43.5%
rem-sqrt-square43.8%
metadata-eval43.8%
pow-sqr43.7%
fabs-sqr43.7%
pow-sqr43.8%
metadata-eval43.8%
associate-*l*43.8%
mul-1-neg43.8%
metadata-eval43.8%
pow-sqr43.7%
pow-sqr43.8%
metadata-eval43.8%
exp-to-pow41.8%
metadata-eval41.8%
distribute-rgt-neg-in41.8%
Simplified43.7%
if 8.49999999999999975e-263 < l < 3.35e-49 or 2.2999999999999999e-43 < l < 3.89999999999999976e284Initial program 62.3%
Simplified58.7%
add-sqr-sqrt58.6%
pow258.6%
sqrt-prod58.6%
sqrt-pow159.6%
metadata-eval59.6%
frac-times64.2%
associate-/l*59.6%
pow159.6%
*-un-lft-identity59.6%
times-frac59.6%
metadata-eval59.6%
Applied egg-rr59.6%
associate-*r*59.6%
associate-/l*64.2%
*-commutative64.2%
associate-/l*63.2%
associate-*l*63.2%
associate-/l*63.3%
Simplified63.3%
Taylor expanded in d around inf 44.6%
unpow-144.6%
metadata-eval44.6%
pow-sqr44.6%
rem-sqrt-square45.2%
rem-square-sqrt45.0%
fabs-sqr45.0%
rem-square-sqrt45.2%
Simplified45.2%
if 3.89999999999999976e284 < l Initial program 82.6%
Simplified82.6%
Taylor expanded in M around 0 83.4%
pow183.4%
*-rgt-identity83.4%
*-commutative83.4%
pow1/283.4%
pow1/283.4%
pow-prod-down83.9%
Applied egg-rr83.9%
unpow183.9%
unpow1/283.9%
*-commutative83.9%
Simplified83.9%
Final simplification45.3%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= l 4.8e-264) (* d (- (sqrt (/ (/ 1.0 h) l)))) (if (<= l 2.4e+266) (* d (pow (* l h) -0.5)) (sqrt (* (/ d h) (/ d l))))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 4.8e-264) {
tmp = d * -sqrt(((1.0 / h) / l));
} else if (l <= 2.4e+266) {
tmp = d * pow((l * h), -0.5);
} else {
tmp = sqrt(((d / h) * (d / l)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= 4.8d-264) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else if (l <= 2.4d+266) then
tmp = d * ((l * h) ** (-0.5d0))
else
tmp = sqrt(((d / h) * (d / l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 4.8e-264) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else if (l <= 2.4e+266) {
tmp = d * Math.pow((l * h), -0.5);
} else {
tmp = Math.sqrt(((d / h) * (d / l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= 4.8e-264: tmp = d * -math.sqrt(((1.0 / h) / l)) elif l <= 2.4e+266: tmp = d * math.pow((l * h), -0.5) else: tmp = math.sqrt(((d / h) * (d / l))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= 4.8e-264) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); elseif (l <= 2.4e+266) tmp = Float64(d * (Float64(l * h) ^ -0.5)); else tmp = sqrt(Float64(Float64(d / h) * Float64(d / l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= 4.8e-264)
tmp = d * -sqrt(((1.0 / h) / l));
elseif (l <= 2.4e+266)
tmp = d * ((l * h) ^ -0.5);
else
tmp = sqrt(((d / h) * (d / l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, 4.8e-264], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 2.4e+266], N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 4.8 \cdot 10^{-264}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{elif}\;\ell \leq 2.4 \cdot 10^{+266}:\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\end{array}
\end{array}
if l < 4.7999999999999997e-264Initial program 62.3%
Simplified63.0%
Taylor expanded in M around 0 42.7%
*-commutative42.7%
associate-*r*44.0%
times-frac45.4%
*-commutative45.4%
associate-/l*44.1%
unpow244.1%
unpow244.1%
unpow244.1%
times-frac53.0%
swap-sqr63.0%
unpow263.0%
associate-*r/62.3%
*-commutative62.3%
associate-/l*62.3%
Simplified62.3%
Taylor expanded in D around 0 62.3%
clear-num61.6%
sqrt-div61.7%
metadata-eval61.7%
Applied egg-rr61.7%
Taylor expanded in d around -inf 43.0%
associate-*r*43.0%
neg-mul-143.0%
associate-/r*43.8%
Simplified43.8%
if 4.7999999999999997e-264 < l < 2.40000000000000002e266Initial program 64.3%
Simplified60.5%
add-sqr-sqrt60.5%
pow260.5%
sqrt-prod60.5%
sqrt-pow161.5%
metadata-eval61.5%
frac-times66.3%
associate-/l*61.5%
pow161.5%
*-un-lft-identity61.5%
times-frac61.5%
metadata-eval61.5%
Applied egg-rr61.5%
associate-*r*61.5%
associate-/l*66.3%
*-commutative66.3%
associate-/l*65.3%
associate-*l*65.3%
associate-/l*65.3%
Simplified65.3%
Taylor expanded in d around inf 44.7%
unpow-144.7%
metadata-eval44.7%
pow-sqr44.7%
rem-sqrt-square45.3%
rem-square-sqrt45.2%
fabs-sqr45.2%
rem-square-sqrt45.3%
Simplified45.3%
if 2.40000000000000002e266 < l Initial program 58.2%
Simplified58.2%
Taylor expanded in M around 0 59.2%
pow159.2%
*-rgt-identity59.2%
*-commutative59.2%
pow1/259.2%
pow1/259.2%
pow-prod-down59.6%
Applied egg-rr59.6%
unpow159.6%
unpow1/259.6%
*-commutative59.6%
Simplified59.6%
Final simplification45.2%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= l 3.4e-264) (/ d (- (sqrt (* l h)))) (* d (pow (* l h) -0.5))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 3.4e-264) {
tmp = d / -sqrt((l * h));
} else {
tmp = d * pow((l * h), -0.5);
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= 3.4d-264) then
tmp = d / -sqrt((l * h))
else
tmp = d * ((l * h) ** (-0.5d0))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 3.4e-264) {
tmp = d / -Math.sqrt((l * h));
} else {
tmp = d * Math.pow((l * h), -0.5);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= 3.4e-264: tmp = d / -math.sqrt((l * h)) else: tmp = d * math.pow((l * h), -0.5) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= 3.4e-264) tmp = Float64(d / Float64(-sqrt(Float64(l * h)))); else tmp = Float64(d * (Float64(l * h) ^ -0.5)); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= 3.4e-264)
tmp = d / -sqrt((l * h));
else
tmp = d * ((l * h) ^ -0.5);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, 3.4e-264], N[(d / (-N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 3.4 \cdot 10^{-264}:\\
\;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\end{array}
\end{array}
if l < 3.3999999999999999e-264Initial program 62.3%
Simplified63.0%
add-sqr-sqrt63.0%
pow263.0%
sqrt-prod63.0%
sqrt-pow163.1%
metadata-eval63.1%
frac-times62.3%
associate-/l*63.1%
pow163.1%
*-un-lft-identity63.1%
times-frac63.1%
metadata-eval63.1%
Applied egg-rr63.1%
associate-*r*63.1%
associate-/l*62.3%
*-commutative62.3%
associate-/l*62.4%
associate-*l*61.7%
associate-/l*61.7%
Simplified61.7%
Taylor expanded in d around inf 8.5%
unpow-18.5%
metadata-eval8.5%
pow-sqr8.5%
rem-sqrt-square8.5%
rem-square-sqrt8.5%
fabs-sqr8.5%
rem-square-sqrt8.5%
Simplified8.5%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt43.0%
unpow-143.0%
metadata-eval43.0%
pow-sqr43.1%
rem-sqrt-square43.4%
metadata-eval43.4%
pow-sqr43.3%
fabs-sqr43.3%
pow-sqr43.4%
metadata-eval43.4%
associate-*l*43.4%
mul-1-neg43.4%
metadata-eval43.4%
pow-sqr43.3%
pow-sqr43.4%
metadata-eval43.4%
exp-to-pow41.4%
metadata-eval41.4%
distribute-rgt-neg-in41.4%
Simplified43.3%
if 3.3999999999999999e-264 < l Initial program 63.7%
Simplified60.2%
add-sqr-sqrt60.2%
pow260.2%
sqrt-prod60.2%
sqrt-pow161.2%
metadata-eval61.2%
frac-times65.5%
associate-/l*61.2%
pow161.2%
*-un-lft-identity61.2%
times-frac61.2%
metadata-eval61.2%
Applied egg-rr61.2%
associate-*r*61.2%
associate-/l*65.5%
*-commutative65.5%
associate-/l*64.5%
associate-*l*64.6%
associate-/l*64.6%
Simplified64.6%
Taylor expanded in d around inf 42.9%
unpow-142.9%
metadata-eval42.9%
pow-sqr42.9%
rem-sqrt-square43.5%
rem-square-sqrt43.3%
fabs-sqr43.3%
rem-square-sqrt43.5%
Simplified43.5%
Final simplification43.4%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (let* ((t_0 (sqrt (* l h)))) (if (<= l 3.15e-264) (/ d (- t_0)) (/ d t_0))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((l * h));
double tmp;
if (l <= 3.15e-264) {
tmp = d / -t_0;
} else {
tmp = d / t_0;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((l * h))
if (l <= 3.15d-264) then
tmp = d / -t_0
else
tmp = d / t_0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt((l * h));
double tmp;
if (l <= 3.15e-264) {
tmp = d / -t_0;
} else {
tmp = d / t_0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt((l * h)) tmp = 0 if l <= 3.15e-264: tmp = d / -t_0 else: tmp = d / t_0 return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(l * h)) tmp = 0.0 if (l <= 3.15e-264) tmp = Float64(d / Float64(-t_0)); else tmp = Float64(d / t_0); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt((l * h));
tmp = 0.0;
if (l <= 3.15e-264)
tmp = d / -t_0;
else
tmp = d / t_0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, 3.15e-264], N[(d / (-t$95$0)), $MachinePrecision], N[(d / t$95$0), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;\ell \leq 3.15 \cdot 10^{-264}:\\
\;\;\;\;\frac{d}{-t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_0}\\
\end{array}
\end{array}
if l < 3.1499999999999999e-264Initial program 62.3%
Simplified63.0%
add-sqr-sqrt63.0%
pow263.0%
sqrt-prod63.0%
sqrt-pow163.1%
metadata-eval63.1%
frac-times62.3%
associate-/l*63.1%
pow163.1%
*-un-lft-identity63.1%
times-frac63.1%
metadata-eval63.1%
Applied egg-rr63.1%
associate-*r*63.1%
associate-/l*62.3%
*-commutative62.3%
associate-/l*62.4%
associate-*l*61.7%
associate-/l*61.7%
Simplified61.7%
Taylor expanded in d around inf 8.5%
unpow-18.5%
metadata-eval8.5%
pow-sqr8.5%
rem-sqrt-square8.5%
rem-square-sqrt8.5%
fabs-sqr8.5%
rem-square-sqrt8.5%
Simplified8.5%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt43.0%
unpow-143.0%
metadata-eval43.0%
pow-sqr43.1%
rem-sqrt-square43.4%
metadata-eval43.4%
pow-sqr43.3%
fabs-sqr43.3%
pow-sqr43.4%
metadata-eval43.4%
associate-*l*43.4%
mul-1-neg43.4%
metadata-eval43.4%
pow-sqr43.3%
pow-sqr43.4%
metadata-eval43.4%
exp-to-pow41.4%
metadata-eval41.4%
distribute-rgt-neg-in41.4%
Simplified43.3%
if 3.1499999999999999e-264 < l Initial program 63.7%
Simplified60.2%
add-sqr-sqrt60.2%
pow260.2%
sqrt-prod60.2%
sqrt-pow161.2%
metadata-eval61.2%
frac-times65.5%
associate-/l*61.2%
pow161.2%
*-un-lft-identity61.2%
times-frac61.2%
metadata-eval61.2%
Applied egg-rr61.2%
associate-*r*61.2%
associate-/l*65.5%
*-commutative65.5%
associate-/l*64.5%
associate-*l*64.6%
associate-/l*64.6%
Simplified64.6%
Taylor expanded in d around inf 42.9%
unpow-142.9%
metadata-eval42.9%
pow-sqr42.9%
rem-sqrt-square43.5%
rem-square-sqrt43.3%
fabs-sqr43.3%
rem-square-sqrt43.5%
Simplified43.5%
Taylor expanded in d around 0 42.9%
unpow-142.9%
metadata-eval42.9%
pow-sqr42.9%
rem-sqrt-square43.5%
metadata-eval43.5%
pow-sqr43.3%
fabs-sqr43.3%
pow-sqr43.5%
metadata-eval43.5%
exp-to-pow41.6%
metadata-eval41.6%
distribute-rgt-neg-in41.6%
exp-neg41.6%
associate-*r/41.6%
*-rgt-identity41.6%
exp-to-pow43.5%
unpow1/243.5%
Simplified43.5%
Final simplification43.4%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (let* ((t_0 (sqrt (* l h)))) (if (<= h -1.85e+82) (* d t_0) (/ d t_0))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((l * h));
double tmp;
if (h <= -1.85e+82) {
tmp = d * t_0;
} else {
tmp = d / t_0;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((l * h))
if (h <= (-1.85d+82)) then
tmp = d * t_0
else
tmp = d / t_0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt((l * h));
double tmp;
if (h <= -1.85e+82) {
tmp = d * t_0;
} else {
tmp = d / t_0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt((l * h)) tmp = 0 if h <= -1.85e+82: tmp = d * t_0 else: tmp = d / t_0 return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(l * h)) tmp = 0.0 if (h <= -1.85e+82) tmp = Float64(d * t_0); else tmp = Float64(d / t_0); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt((l * h));
tmp = 0.0;
if (h <= -1.85e+82)
tmp = d * t_0;
else
tmp = d / t_0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -1.85e+82], N[(d * t$95$0), $MachinePrecision], N[(d / t$95$0), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;h \leq -1.85 \cdot 10^{+82}:\\
\;\;\;\;d \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_0}\\
\end{array}
\end{array}
if h < -1.8500000000000001e82Initial program 46.1%
Simplified48.2%
add-sqr-sqrt48.2%
pow248.2%
sqrt-prod48.2%
sqrt-pow148.2%
metadata-eval48.2%
frac-times46.1%
associate-/l*48.2%
pow148.2%
*-un-lft-identity48.2%
times-frac48.2%
metadata-eval48.2%
Applied egg-rr48.2%
associate-*r*48.2%
associate-/l*46.1%
*-commutative46.1%
associate-/l*48.2%
associate-*l*48.2%
associate-/l*48.2%
Simplified48.2%
Taylor expanded in d around inf 5.2%
unpow-15.2%
metadata-eval5.2%
pow-sqr5.2%
rem-sqrt-square5.2%
rem-square-sqrt5.2%
fabs-sqr5.2%
rem-square-sqrt5.2%
Simplified5.2%
Taylor expanded in d around 0 5.2%
unpow-15.2%
metadata-eval5.2%
pow-sqr5.2%
rem-sqrt-square5.2%
metadata-eval5.2%
pow-sqr5.2%
fabs-sqr5.2%
pow-sqr5.2%
metadata-eval5.2%
exp-to-pow5.2%
metadata-eval5.2%
distribute-rgt-neg-in5.2%
exp-neg5.2%
associate-*r/5.2%
*-rgt-identity5.2%
exp-to-pow5.2%
unpow1/25.2%
Simplified5.2%
add-cbrt-cube5.1%
pow1/35.1%
add-sqr-sqrt5.1%
pow15.1%
pow1/25.1%
pow-prod-up5.1%
metadata-eval5.1%
Applied egg-rr5.1%
unpow1/35.1%
Simplified5.1%
clear-num5.1%
pow1/35.1%
pow-pow5.2%
metadata-eval5.2%
pow1/25.2%
rem-log-exp15.9%
associate-/r/15.9%
Applied egg-rr16.5%
if -1.8500000000000001e82 < h Initial program 66.4%
Simplified64.6%
add-sqr-sqrt64.6%
pow264.6%
sqrt-prod64.6%
sqrt-pow165.1%
metadata-eval65.1%
frac-times67.4%
associate-/l*65.1%
pow165.1%
*-un-lft-identity65.1%
times-frac65.1%
metadata-eval65.1%
Applied egg-rr65.1%
associate-*r*65.1%
associate-/l*67.4%
*-commutative67.4%
associate-/l*66.5%
associate-*l*66.1%
associate-/l*66.1%
Simplified66.1%
Taylor expanded in d around inf 28.0%
unpow-128.0%
metadata-eval28.0%
pow-sqr28.0%
rem-sqrt-square28.3%
rem-square-sqrt28.2%
fabs-sqr28.2%
rem-square-sqrt28.3%
Simplified28.3%
Taylor expanded in d around 0 28.0%
unpow-128.0%
metadata-eval28.0%
pow-sqr28.0%
rem-sqrt-square28.3%
metadata-eval28.3%
pow-sqr28.2%
fabs-sqr28.2%
pow-sqr28.3%
metadata-eval28.3%
exp-to-pow27.3%
metadata-eval27.3%
distribute-rgt-neg-in27.3%
exp-neg27.3%
associate-*r/27.3%
*-rgt-identity27.3%
exp-to-pow28.3%
unpow1/228.3%
Simplified28.3%
Final simplification26.3%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (* d (sqrt (* l h))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
return d * sqrt((l * h));
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
code = d * sqrt((l * h))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
return d * Math.sqrt((l * h));
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): return d * math.sqrt((l * h))
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) return Float64(d * sqrt(Float64(l * h))) end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp = code(d, h, l, M_m, D_m)
tmp = d * sqrt((l * h));
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := N[(d * N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
d \cdot \sqrt{\ell \cdot h}
\end{array}
Initial program 62.9%
Simplified61.8%
add-sqr-sqrt61.8%
pow261.8%
sqrt-prod61.8%
sqrt-pow162.2%
metadata-eval62.2%
frac-times63.8%
associate-/l*62.2%
pow162.2%
*-un-lft-identity62.2%
times-frac62.2%
metadata-eval62.2%
Applied egg-rr62.2%
associate-*r*62.2%
associate-/l*63.8%
*-commutative63.8%
associate-/l*63.4%
associate-*l*63.0%
associate-/l*63.0%
Simplified63.0%
Taylor expanded in d around inf 24.1%
unpow-124.1%
metadata-eval24.1%
pow-sqr24.1%
rem-sqrt-square24.4%
rem-square-sqrt24.3%
fabs-sqr24.3%
rem-square-sqrt24.4%
Simplified24.4%
Taylor expanded in d around 0 24.1%
unpow-124.1%
metadata-eval24.1%
pow-sqr24.1%
rem-sqrt-square24.4%
metadata-eval24.4%
pow-sqr24.3%
fabs-sqr24.3%
pow-sqr24.4%
metadata-eval24.4%
exp-to-pow23.5%
metadata-eval23.5%
distribute-rgt-neg-in23.5%
exp-neg23.5%
associate-*r/23.5%
*-rgt-identity23.5%
exp-to-pow24.4%
unpow1/224.4%
Simplified24.4%
add-cbrt-cube22.9%
pow1/322.2%
add-sqr-sqrt22.2%
pow122.2%
pow1/222.2%
pow-prod-up22.2%
metadata-eval22.2%
Applied egg-rr22.2%
unpow1/322.9%
Simplified22.9%
clear-num22.9%
pow1/322.2%
pow-pow24.3%
metadata-eval24.3%
pow1/224.3%
rem-log-exp18.4%
associate-/r/18.4%
Applied egg-rr4.9%
Final simplification4.9%
herbie shell --seed 2024105
(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)))))