
(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 25 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)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (- d))) (t_1 (/ t_0 (sqrt (- l)))) (t_2 (* D (/ M_m d))))
(if (<= l -6e-116)
(*
t_1
(*
(/ t_0 (sqrt (- h)))
(+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M_m 2.0) d)) 2.0) -0.5)))))
(if (<= l -5e-311)
(*
t_1
(*
(sqrt (/ d h))
(+
1.0
(/ 1.0 (/ l (* (* h -0.5) (pow (/ (* D M_m) (* d 2.0)) 2.0)))))))
(if (<= l 9.5e+139)
(*
(/ (sqrt d) (sqrt h))
(*
(sqrt (/ d l))
(* (- h) (fma (* t_2 (/ t_2 l)) 0.125 (/ -1.0 h)))))
(*
d
(/
(fma (* (/ h l) -0.5) (pow (* (/ M_m 2.0) (/ D d)) 2.0) 1.0)
(* (sqrt h) (sqrt l)))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt(-d);
double t_1 = t_0 / sqrt(-l);
double t_2 = D * (M_m / d);
double tmp;
if (l <= -6e-116) {
tmp = t_1 * ((t_0 / sqrt(-h)) * (1.0 + ((h / l) * (pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))));
} else if (l <= -5e-311) {
tmp = t_1 * (sqrt((d / h)) * (1.0 + (1.0 / (l / ((h * -0.5) * pow(((D * M_m) / (d * 2.0)), 2.0))))));
} else if (l <= 9.5e+139) {
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (-h * fma((t_2 * (t_2 / l)), 0.125, (-1.0 / h))));
} else {
tmp = d * (fma(((h / l) * -0.5), pow(((M_m / 2.0) * (D / d)), 2.0), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(-d)) t_1 = Float64(t_0 / sqrt(Float64(-l))) t_2 = Float64(D * Float64(M_m / d)) tmp = 0.0 if (l <= -6e-116) tmp = Float64(t_1 * Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5))))); elseif (l <= -5e-311) tmp = Float64(t_1 * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(1.0 / Float64(l / Float64(Float64(h * -0.5) * (Float64(Float64(D * M_m) / Float64(d * 2.0)) ^ 2.0))))))); elseif (l <= 9.5e+139) tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(sqrt(Float64(d / l)) * Float64(Float64(-h) * fma(Float64(t_2 * Float64(t_2 / l)), 0.125, Float64(-1.0 / h))))); else tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -6e-116], N[(t$95$1 * N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-311], N[(t$95$1 * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(1.0 / N[(l / N[(N[(h * -0.5), $MachinePrecision] * N[Power[N[(N[(D * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 9.5e+139], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[((-h) * N[(N[(t$95$2 * N[(t$95$2 / l), $MachinePrecision]), $MachinePrecision] * 0.125 + N[(-1.0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $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, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
t_1 := \frac{t\_0}{\sqrt{-\ell}}\\
t_2 := D \cdot \frac{M\_m}{d}\\
\mathbf{if}\;\ell \leq -6 \cdot 10^{-116}:\\
\;\;\;\;t\_1 \cdot \left(\frac{t\_0}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-311}:\\
\;\;\;\;t\_1 \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{1}{\frac{\ell}{\left(h \cdot -0.5\right) \cdot {\left(\frac{D \cdot M\_m}{d \cdot 2}\right)}^{2}}}\right)\right)\\
\mathbf{elif}\;\ell \leq 9.5 \cdot 10^{+139}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\left(-h\right) \cdot \mathsf{fma}\left(t\_2 \cdot \frac{t\_2}{\ell}, 0.125, \frac{-1}{h}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -6.00000000000000053e-116Initial program 58.6%
Simplified59.6%
frac-2neg59.6%
sqrt-div75.8%
Applied egg-rr75.8%
frac-2neg75.8%
sqrt-div82.8%
Applied egg-rr82.8%
if -6.00000000000000053e-116 < l < -5.00000000000023e-311Initial program 74.0%
Simplified71.7%
associate-*r/74.0%
div-inv74.0%
metadata-eval74.0%
Applied egg-rr74.0%
metadata-eval74.0%
div-inv74.0%
associate-*r/71.7%
associate-/l/71.7%
associate-/l/71.7%
associate-*l/82.9%
associate-/l/82.9%
*-commutative82.9%
clear-num82.9%
Applied egg-rr85.2%
frac-2neg74.1%
sqrt-div76.3%
Applied egg-rr94.2%
if -5.00000000000023e-311 < l < 9.5000000000000002e139Initial program 72.9%
Simplified71.9%
Taylor expanded in h around -inf 45.4%
mul-1-neg45.4%
*-commutative45.4%
distribute-rgt-neg-in45.4%
Simplified72.1%
unpow272.1%
*-un-lft-identity72.1%
times-frac72.1%
Applied egg-rr72.1%
sqrt-div83.9%
Applied egg-rr83.9%
if 9.5000000000000002e139 < l Initial program 44.4%
Simplified44.4%
Applied egg-rr73.1%
unpow173.1%
associate-*l/83.5%
associate-/l*83.3%
+-commutative83.3%
associate-*r*83.3%
fma-define83.3%
*-commutative83.3%
associate-*r/83.3%
*-commutative83.3%
times-frac83.3%
Simplified83.3%
Final simplification85.1%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (- d)))
(t_1 (* D (/ M_m d)))
(t_2 (* (- h) (fma (* t_1 (/ t_1 l)) 0.125 (/ -1.0 h))))
(t_3 (sqrt (/ d l))))
(if (<= l -5e+99)
(* (sqrt (/ d h)) (* (/ t_0 (sqrt (- l))) t_2))
(if (<= l -5e-311)
(*
t_3
(*
(/ t_0 (sqrt (- h)))
(+ 1.0 (/ (* (* h -0.5) (pow (/ (* D M_m) (* d 2.0)) 2.0)) l))))
(if (<= l 1.22e+140)
(* (/ (sqrt d) (sqrt h)) (* t_3 t_2))
(*
d
(/
(fma (* (/ h l) -0.5) (pow (* (/ M_m 2.0) (/ D d)) 2.0) 1.0)
(* (sqrt h) (sqrt l)))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt(-d);
double t_1 = D * (M_m / d);
double t_2 = -h * fma((t_1 * (t_1 / l)), 0.125, (-1.0 / h));
double t_3 = sqrt((d / l));
double tmp;
if (l <= -5e+99) {
tmp = sqrt((d / h)) * ((t_0 / sqrt(-l)) * t_2);
} else if (l <= -5e-311) {
tmp = t_3 * ((t_0 / sqrt(-h)) * (1.0 + (((h * -0.5) * pow(((D * M_m) / (d * 2.0)), 2.0)) / l)));
} else if (l <= 1.22e+140) {
tmp = (sqrt(d) / sqrt(h)) * (t_3 * t_2);
} else {
tmp = d * (fma(((h / l) * -0.5), pow(((M_m / 2.0) * (D / d)), 2.0), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(-d)) t_1 = Float64(D * Float64(M_m / d)) t_2 = Float64(Float64(-h) * fma(Float64(t_1 * Float64(t_1 / l)), 0.125, Float64(-1.0 / h))) t_3 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -5e+99) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(t_0 / sqrt(Float64(-l))) * t_2)); elseif (l <= -5e-311) tmp = Float64(t_3 * Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(Float64(h * -0.5) * (Float64(Float64(D * M_m) / Float64(d * 2.0)) ^ 2.0)) / l)))); elseif (l <= 1.22e+140) tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_3 * t_2)); else tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$1 = N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-h) * N[(N[(t$95$1 * N[(t$95$1 / l), $MachinePrecision]), $MachinePrecision] * 0.125 + N[(-1.0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -5e+99], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-311], N[(t$95$3 * N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h * -0.5), $MachinePrecision] * N[Power[N[(N[(D * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.22e+140], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$3 * t$95$2), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $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, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
t_1 := D \cdot \frac{M\_m}{d}\\
t_2 := \left(-h\right) \cdot \mathsf{fma}\left(t\_1 \cdot \frac{t\_1}{\ell}, 0.125, \frac{-1}{h}\right)\\
t_3 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{+99}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t\_0}{\sqrt{-\ell}} \cdot t\_2\right)\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-311}:\\
\;\;\;\;t\_3 \cdot \left(\frac{t\_0}{\sqrt{-h}} \cdot \left(1 + \frac{\left(h \cdot -0.5\right) \cdot {\left(\frac{D \cdot M\_m}{d \cdot 2}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{elif}\;\ell \leq 1.22 \cdot 10^{+140}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_3 \cdot t\_2\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -5.00000000000000008e99Initial program 47.6%
Simplified49.7%
Taylor expanded in h around -inf 35.7%
mul-1-neg35.7%
*-commutative35.7%
distribute-rgt-neg-in35.7%
Simplified51.8%
unpow251.8%
*-un-lft-identity51.8%
times-frac58.5%
Applied egg-rr58.5%
frac-2neg60.2%
sqrt-div70.9%
Applied egg-rr77.8%
if -5.00000000000000008e99 < l < -5.00000000000023e-311Initial program 71.0%
Simplified70.0%
associate-*r/71.1%
div-inv71.1%
metadata-eval71.1%
Applied egg-rr71.1%
frac-2neg70.0%
sqrt-div82.9%
Applied egg-rr84.0%
associate-*l/89.1%
Applied egg-rr89.1%
if -5.00000000000023e-311 < l < 1.22e140Initial program 72.9%
Simplified71.9%
Taylor expanded in h around -inf 45.4%
mul-1-neg45.4%
*-commutative45.4%
distribute-rgt-neg-in45.4%
Simplified72.1%
unpow272.1%
*-un-lft-identity72.1%
times-frac72.1%
Applied egg-rr72.1%
sqrt-div83.9%
Applied egg-rr83.9%
if 1.22e140 < l Initial program 44.4%
Simplified44.4%
Applied egg-rr73.1%
unpow173.1%
associate-*l/83.5%
associate-/l*83.3%
+-commutative83.3%
associate-*r*83.3%
fma-define83.3%
*-commutative83.3%
associate-*r/83.3%
*-commutative83.3%
times-frac83.3%
Simplified83.3%
Final simplification84.6%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (* D (/ M_m d)))
(t_1 (sqrt (/ d l)))
(t_2
(*
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M_m 2.0) d)) 2.0) -0.5))))
t_1)))
(if (<= d -1.85e+121)
t_2
(if (<= d -1.72e-119)
(*
(sqrt (/ d h))
(* t_1 (* (- h) (fma (* t_0 (/ t_0 l)) 0.125 (/ -1.0 h)))))
(if (<= d -3.2e-299)
t_2
(*
d
(/
(fma (* (/ h l) -0.5) (pow (* (/ M_m 2.0) (/ D d)) 2.0) 1.0)
(* (sqrt h) (sqrt l)))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = D * (M_m / d);
double t_1 = sqrt((d / l));
double t_2 = ((sqrt(-d) / sqrt(-h)) * (1.0 + ((h / l) * (pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5)))) * t_1;
double tmp;
if (d <= -1.85e+121) {
tmp = t_2;
} else if (d <= -1.72e-119) {
tmp = sqrt((d / h)) * (t_1 * (-h * fma((t_0 * (t_0 / l)), 0.125, (-1.0 / h))));
} else if (d <= -3.2e-299) {
tmp = t_2;
} else {
tmp = d * (fma(((h / l) * -0.5), pow(((M_m / 2.0) * (D / d)), 2.0), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(D * Float64(M_m / d)) t_1 = sqrt(Float64(d / l)) t_2 = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5)))) * t_1) tmp = 0.0 if (d <= -1.85e+121) tmp = t_2; elseif (d <= -1.72e-119) tmp = Float64(sqrt(Float64(d / h)) * Float64(t_1 * Float64(Float64(-h) * fma(Float64(t_0 * Float64(t_0 / l)), 0.125, Float64(-1.0 / h))))); elseif (d <= -3.2e-299) tmp = t_2; else tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[d, -1.85e+121], t$95$2, If[LessEqual[d, -1.72e-119], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 * N[((-h) * N[(N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision] * 0.125 + N[(-1.0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -3.2e-299], t$95$2, N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $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, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := D \cdot \frac{M\_m}{d}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\right)\right) \cdot t\_1\\
\mathbf{if}\;d \leq -1.85 \cdot 10^{+121}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d \leq -1.72 \cdot 10^{-119}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t\_1 \cdot \left(\left(-h\right) \cdot \mathsf{fma}\left(t\_0 \cdot \frac{t\_0}{\ell}, 0.125, \frac{-1}{h}\right)\right)\right)\\
\mathbf{elif}\;d \leq -3.2 \cdot 10^{-299}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.85000000000000006e121 or -1.71999999999999993e-119 < d < -3.20000000000000008e-299Initial program 54.7%
Simplified54.7%
frac-2neg54.7%
sqrt-div74.3%
Applied egg-rr74.3%
if -1.85000000000000006e121 < d < -1.71999999999999993e-119Initial program 76.6%
Simplified76.6%
Taylor expanded in h around -inf 65.7%
mul-1-neg65.7%
*-commutative65.7%
distribute-rgt-neg-in65.7%
Simplified83.2%
unpow283.2%
*-un-lft-identity83.2%
times-frac88.9%
Applied egg-rr88.9%
if -3.20000000000000008e-299 < d Initial program 65.3%
Simplified64.5%
Applied egg-rr78.0%
unpow178.0%
associate-*l/81.4%
associate-/l*80.6%
+-commutative80.6%
associate-*r*80.6%
fma-define80.6%
*-commutative80.6%
associate-*r/80.6%
*-commutative80.6%
times-frac80.6%
Simplified80.6%
Final simplification80.4%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1 (/ (sqrt (- d)) (sqrt (- h))))
(t_2 (* D (/ M_m d))))
(if (<= d -2.8e+123)
(*
(* t_1 (+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M_m 2.0) d)) 2.0) -0.5))))
t_0)
(if (<= d -1.4e-119)
(*
(sqrt (/ d h))
(* t_0 (* (- h) (fma (* t_2 (/ t_2 l)) 0.125 (/ -1.0 h)))))
(if (<= d -3.2e-299)
(*
t_0
(*
t_1
(+ 1.0 (* (/ h l) (* -0.5 (pow (/ (* D (* M_m 0.5)) d) 2.0))))))
(*
d
(/
(fma (* (/ h l) -0.5) (pow (* (/ M_m 2.0) (/ D d)) 2.0) 1.0)
(* (sqrt h) (sqrt l)))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt((d / l));
double t_1 = sqrt(-d) / sqrt(-h);
double t_2 = D * (M_m / d);
double tmp;
if (d <= -2.8e+123) {
tmp = (t_1 * (1.0 + ((h / l) * (pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5)))) * t_0;
} else if (d <= -1.4e-119) {
tmp = sqrt((d / h)) * (t_0 * (-h * fma((t_2 * (t_2 / l)), 0.125, (-1.0 / h))));
} else if (d <= -3.2e-299) {
tmp = t_0 * (t_1 * (1.0 + ((h / l) * (-0.5 * pow(((D * (M_m * 0.5)) / d), 2.0)))));
} else {
tmp = d * (fma(((h / l) * -0.5), pow(((M_m / 2.0) * (D / d)), 2.0), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) t_2 = Float64(D * Float64(M_m / d)) tmp = 0.0 if (d <= -2.8e+123) tmp = Float64(Float64(t_1 * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5)))) * t_0); elseif (d <= -1.4e-119) tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * Float64(Float64(-h) * fma(Float64(t_2 * Float64(t_2 / l)), 0.125, Float64(-1.0 / h))))); elseif (d <= -3.2e-299) tmp = Float64(t_0 * Float64(t_1 * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(D * Float64(M_m * 0.5)) / d) ^ 2.0)))))); else tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.8e+123], N[(N[(t$95$1 * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[d, -1.4e-119], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[((-h) * N[(N[(t$95$2 * N[(t$95$2 / l), $MachinePrecision]), $MachinePrecision] * 0.125 + N[(-1.0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -3.2e-299], N[(t$95$0 * N[(t$95$1 * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(D * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $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, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \frac{\sqrt{-d}}{\sqrt{-h}}\\
t_2 := D \cdot \frac{M\_m}{d}\\
\mathbf{if}\;d \leq -2.8 \cdot 10^{+123}:\\
\;\;\;\;\left(t\_1 \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\right)\right) \cdot t\_0\\
\mathbf{elif}\;d \leq -1.4 \cdot 10^{-119}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t\_0 \cdot \left(\left(-h\right) \cdot \mathsf{fma}\left(t\_2 \cdot \frac{t\_2}{\ell}, 0.125, \frac{-1}{h}\right)\right)\right)\\
\mathbf{elif}\;d \leq -3.2 \cdot 10^{-299}:\\
\;\;\;\;t\_0 \cdot \left(t\_1 \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{D \cdot \left(M\_m \cdot 0.5\right)}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -2.80000000000000011e123Initial program 66.2%
Simplified68.6%
frac-2neg68.6%
sqrt-div85.0%
Applied egg-rr85.0%
if -2.80000000000000011e123 < d < -1.4e-119Initial program 76.6%
Simplified76.6%
Taylor expanded in h around -inf 65.7%
mul-1-neg65.7%
*-commutative65.7%
distribute-rgt-neg-in65.7%
Simplified83.2%
unpow283.2%
*-un-lft-identity83.2%
times-frac88.9%
Applied egg-rr88.9%
if -1.4e-119 < d < -3.20000000000000008e-299Initial program 43.6%
Simplified41.3%
associate-*r/43.6%
div-inv43.6%
metadata-eval43.6%
Applied egg-rr43.6%
frac-2neg41.3%
sqrt-div63.8%
Applied egg-rr66.2%
if -3.20000000000000008e-299 < d Initial program 65.3%
Simplified64.5%
Applied egg-rr78.0%
unpow178.0%
associate-*l/81.4%
associate-/l*80.6%
+-commutative80.6%
associate-*r*80.6%
fma-define80.6%
*-commutative80.6%
associate-*r/80.6%
*-commutative80.6%
times-frac80.6%
Simplified80.6%
Final simplification80.8%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))) (t_1 (* D (/ M_m d))))
(if (<= l -5e-311)
(*
t_0
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (/ (* h (* -0.5 (pow (* D (/ M_m (* d 2.0))) 2.0))) l))))
(if (<= l 7.1e+140)
(*
(/ (sqrt d) (sqrt h))
(* t_0 (* (- h) (fma (* t_1 (/ t_1 l)) 0.125 (/ -1.0 h)))))
(*
d
(/
(fma (* (/ h l) -0.5) (pow (* (/ M_m 2.0) (/ D d)) 2.0) 1.0)
(* (sqrt h) (sqrt l))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt((d / l));
double t_1 = D * (M_m / d);
double tmp;
if (l <= -5e-311) {
tmp = t_0 * ((sqrt(-d) / sqrt(-h)) * (1.0 + ((h * (-0.5 * pow((D * (M_m / (d * 2.0))), 2.0))) / l)));
} else if (l <= 7.1e+140) {
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (-h * fma((t_1 * (t_1 / l)), 0.125, (-1.0 / h))));
} else {
tmp = d * (fma(((h / l) * -0.5), pow(((M_m / 2.0) * (D / d)), 2.0), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(D * Float64(M_m / d)) tmp = 0.0 if (l <= -5e-311) tmp = Float64(t_0 * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(D * Float64(M_m / Float64(d * 2.0))) ^ 2.0))) / l)))); elseif (l <= 7.1e+140) tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_0 * Float64(Float64(-h) * fma(Float64(t_1 * Float64(t_1 / l)), 0.125, Float64(-1.0 / h))))); else tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5e-311], N[(t$95$0 * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(D * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.1e+140], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[((-h) * N[(N[(t$95$1 * N[(t$95$1 / l), $MachinePrecision]), $MachinePrecision] * 0.125 + N[(-1.0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $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, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := D \cdot \frac{M\_m}{d}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-311}:\\
\;\;\;\;t\_0 \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(D \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}\right)}{\ell}\right)\right)\\
\mathbf{elif}\;\ell \leq 7.1 \cdot 10^{+140}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_0 \cdot \left(\left(-h\right) \cdot \mathsf{fma}\left(t\_1 \cdot \frac{t\_1}{\ell}, 0.125, \frac{-1}{h}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -5.00000000000023e-311Initial program 63.2%
Simplified63.2%
associate-*l/67.4%
*-commutative67.4%
add-sqr-sqrt67.4%
pow267.4%
sqrt-pow167.4%
metadata-eval67.4%
pow167.4%
associate-/l/67.4%
Applied egg-rr67.4%
frac-2neg63.2%
sqrt-div75.3%
Applied egg-rr79.5%
if -5.00000000000023e-311 < l < 7.10000000000000027e140Initial program 72.9%
Simplified71.9%
Taylor expanded in h around -inf 45.4%
mul-1-neg45.4%
*-commutative45.4%
distribute-rgt-neg-in45.4%
Simplified72.1%
unpow272.1%
*-un-lft-identity72.1%
times-frac72.1%
Applied egg-rr72.1%
sqrt-div83.9%
Applied egg-rr83.9%
if 7.10000000000000027e140 < l Initial program 44.4%
Simplified44.4%
Applied egg-rr73.1%
unpow173.1%
associate-*l/83.5%
associate-/l*83.3%
+-commutative83.3%
associate-*r*83.3%
fma-define83.3%
*-commutative83.3%
associate-*r/83.3%
*-commutative83.3%
times-frac83.3%
Simplified83.3%
Final simplification81.5%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l -5e-311)
(*
(sqrt (/ d l))
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (/ (* h (* -0.5 (pow (* D (/ M_m (* d 2.0))) 2.0))) l))))
(*
d
(/
(fma (* (/ h l) -0.5) (pow (* (/ M_m 2.0) (/ D d)) 2.0) 1.0)
(* (sqrt h) (sqrt l))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -5e-311) {
tmp = sqrt((d / l)) * ((sqrt(-d) / sqrt(-h)) * (1.0 + ((h * (-0.5 * pow((D * (M_m / (d * 2.0))), 2.0))) / l)));
} else {
tmp = d * (fma(((h / l) * -0.5), pow(((M_m / 2.0) * (D / d)), 2.0), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -5e-311) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(D * Float64(M_m / Float64(d * 2.0))) ^ 2.0))) / l)))); else tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -5e-311], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(D * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $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, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(D \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -5.00000000000023e-311Initial program 63.2%
Simplified63.2%
associate-*l/67.4%
*-commutative67.4%
add-sqr-sqrt67.4%
pow267.4%
sqrt-pow167.4%
metadata-eval67.4%
pow167.4%
associate-/l/67.4%
Applied egg-rr67.4%
frac-2neg63.2%
sqrt-div75.3%
Applied egg-rr79.5%
if -5.00000000000023e-311 < l Initial program 65.8%
Simplified65.1%
Applied egg-rr78.6%
unpow178.6%
associate-*l/82.1%
associate-/l*81.2%
+-commutative81.2%
associate-*r*81.2%
fma-define81.2%
*-commutative81.2%
associate-*r/81.2%
*-commutative81.2%
times-frac81.2%
Simplified81.2%
Final simplification80.3%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l -2.05e+181)
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(if (<= l 6.8e-305)
(*
(/ 1.0 (sqrt (/ l d)))
(*
(sqrt (/ d h))
(+ 1.0 (/ (* h (* -0.5 (pow (* D (/ M_m (* d 2.0))) 2.0))) l))))
(*
d
(/
(fma (* (/ h l) -0.5) (pow (* (/ M_m 2.0) (/ D d)) 2.0) 1.0)
(* (sqrt h) (sqrt l)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -2.05e+181) {
tmp = -d * sqrt(((1.0 / h) / l));
} else if (l <= 6.8e-305) {
tmp = (1.0 / sqrt((l / d))) * (sqrt((d / h)) * (1.0 + ((h * (-0.5 * pow((D * (M_m / (d * 2.0))), 2.0))) / l)));
} else {
tmp = d * (fma(((h / l) * -0.5), pow(((M_m / 2.0) * (D / d)), 2.0), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -2.05e+181) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); elseif (l <= 6.8e-305) tmp = Float64(Float64(1.0 / sqrt(Float64(l / d))) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(D * Float64(M_m / Float64(d * 2.0))) ^ 2.0))) / l)))); else tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -2.05e+181], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.8e-305], N[(N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(D * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $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, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.05 \cdot 10^{+181}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{elif}\;\ell \leq 6.8 \cdot 10^{-305}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(D \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.05000000000000009e181Initial program 33.4%
Simplified33.4%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt58.3%
neg-mul-158.3%
Simplified58.3%
if -2.05000000000000009e181 < l < 6.8000000000000001e-305Initial program 70.4%
Simplified70.4%
associate-*l/76.5%
*-commutative76.5%
add-sqr-sqrt76.5%
pow276.5%
sqrt-pow176.5%
metadata-eval76.5%
pow176.5%
associate-/l/76.5%
Applied egg-rr76.5%
clear-num76.5%
sqrt-div76.6%
metadata-eval76.6%
Applied egg-rr76.6%
if 6.8000000000000001e-305 < l Initial program 66.4%
Simplified65.6%
Applied egg-rr79.3%
unpow179.3%
associate-*l/82.7%
associate-/l*81.9%
+-commutative81.9%
associate-*r*81.9%
fma-define81.9%
*-commutative81.9%
associate-*r/81.9%
*-commutative81.9%
times-frac81.9%
Simplified81.9%
Final simplification77.1%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l -2.4e+174)
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(if (<= l 1.5e-264)
(*
(*
(sqrt (/ d h))
(+ 1.0 (/ 1.0 (/ l (* (* h -0.5) (pow (/ (* D M_m) (* d 2.0)) 2.0))))))
(sqrt (/ d l)))
(*
(/ d (* (sqrt h) (sqrt l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D (/ (/ M_m d) 2.0)) 2.0)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -2.4e+174) {
tmp = -d * sqrt(((1.0 / h) / l));
} else if (l <= 1.5e-264) {
tmp = (sqrt((d / h)) * (1.0 + (1.0 / (l / ((h * -0.5) * pow(((D * M_m) / (d * 2.0)), 2.0)))))) * sqrt((d / l));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * pow((D * ((M_m / d) / 2.0)), 2.0)));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
real(8) :: tmp
if (l <= (-2.4d+174)) then
tmp = -d * sqrt(((1.0d0 / h) / l))
else if (l <= 1.5d-264) then
tmp = (sqrt((d / h)) * (1.0d0 + (1.0d0 / (l / ((h * (-0.5d0)) * (((d_1 * m_m) / (d * 2.0d0)) ** 2.0d0)))))) * sqrt((d / l))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((d_1 * ((m_m / d) / 2.0d0)) ** 2.0d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -2.4e+174) {
tmp = -d * Math.sqrt(((1.0 / h) / l));
} else if (l <= 1.5e-264) {
tmp = (Math.sqrt((d / h)) * (1.0 + (1.0 / (l / ((h * -0.5) * Math.pow(((D * M_m) / (d * 2.0)), 2.0)))))) * Math.sqrt((d / l));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * Math.pow((D * ((M_m / d) / 2.0)), 2.0)));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -2.4e+174: tmp = -d * math.sqrt(((1.0 / h) / l)) elif l <= 1.5e-264: tmp = (math.sqrt((d / h)) * (1.0 + (1.0 / (l / ((h * -0.5) * math.pow(((D * M_m) / (d * 2.0)), 2.0)))))) * math.sqrt((d / l)) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * math.pow((D * ((M_m / d) / 2.0)), 2.0))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -2.4e+174) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); elseif (l <= 1.5e-264) tmp = Float64(Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(1.0 / Float64(l / Float64(Float64(h * -0.5) * (Float64(Float64(D * M_m) / Float64(d * 2.0)) ^ 2.0)))))) * sqrt(Float64(d / l))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D * Float64(Float64(M_m / d) / 2.0)) ^ 2.0)))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= -2.4e+174)
tmp = -d * sqrt(((1.0 / h) / l));
elseif (l <= 1.5e-264)
tmp = (sqrt((d / h)) * (1.0 + (1.0 / (l / ((h * -0.5) * (((D * M_m) / (d * 2.0)) ^ 2.0)))))) * sqrt((d / l));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * ((D * ((M_m / d) / 2.0)) ^ 2.0)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -2.4e+174], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.5e-264], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(1.0 / N[(l / N[(N[(h * -0.5), $MachinePrecision] * N[Power[N[(N[(D * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D * N[(N[(M$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.4 \cdot 10^{+174}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{elif}\;\ell \leq 1.5 \cdot 10^{-264}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{1}{\frac{\ell}{\left(h \cdot -0.5\right) \cdot {\left(\frac{D \cdot M\_m}{d \cdot 2}\right)}^{2}}}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D \cdot \frac{\frac{M\_m}{d}}{2}\right)}^{2}\right)\\
\end{array}
\end{array}
if l < -2.3999999999999998e174Initial program 33.4%
Simplified33.4%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt58.3%
neg-mul-158.3%
Simplified58.3%
if -2.3999999999999998e174 < l < 1.5e-264Initial program 71.2%
Simplified70.4%
associate-*r/71.2%
div-inv71.2%
metadata-eval71.2%
Applied egg-rr71.2%
metadata-eval71.2%
div-inv71.2%
associate-*r/70.4%
associate-/l/70.4%
associate-/l/70.4%
associate-*l/76.0%
associate-/l/76.0%
*-commutative76.0%
clear-num76.0%
Applied egg-rr76.9%
if 1.5e-264 < l Initial program 65.1%
Simplified64.3%
Applied egg-rr79.2%
unpow179.2%
associate-*r*79.2%
*-commutative79.2%
associate-*r/80.1%
*-commutative80.1%
associate-*r/79.2%
associate-*r*79.2%
associate-*r*79.2%
associate-/r*79.2%
Simplified79.2%
Final simplification75.9%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= d -1.45e-111)
(* d (- (pow (* l h) -0.5)))
(if (<= d -6.1e-221)
(* d (sqrt (log1p (expm1 (/ 1.0 (* l h))))))
(if (<= d -4e-310)
(* d (sqrt (log1p (expm1 (* l h)))))
(*
d
(/
(fma h (* (pow (/ (* M_m (/ D d)) 2.0) 2.0) (/ -0.5 l)) 1.0)
(sqrt (* l h))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -1.45e-111) {
tmp = d * -pow((l * h), -0.5);
} else if (d <= -6.1e-221) {
tmp = d * sqrt(log1p(expm1((1.0 / (l * h)))));
} else if (d <= -4e-310) {
tmp = d * sqrt(log1p(expm1((l * h))));
} else {
tmp = d * (fma(h, (pow(((M_m * (D / d)) / 2.0), 2.0) * (-0.5 / l)), 1.0) / sqrt((l * h)));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (d <= -1.45e-111) tmp = Float64(d * Float64(-(Float64(l * h) ^ -0.5))); elseif (d <= -6.1e-221) tmp = Float64(d * sqrt(log1p(expm1(Float64(1.0 / Float64(l * h)))))); elseif (d <= -4e-310) tmp = Float64(d * sqrt(log1p(expm1(Float64(l * h))))); else tmp = Float64(d * Float64(fma(h, Float64((Float64(Float64(M_m * Float64(D / d)) / 2.0) ^ 2.0) * Float64(-0.5 / l)), 1.0) / sqrt(Float64(l * h)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -1.45e-111], N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -6.1e-221], N[(d * N[Sqrt[N[Log[1 + N[(Exp[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(d * N[Sqrt[N[Log[1 + N[(Exp[N[(l * h), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(h * N[(N[Power[N[(N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.45 \cdot 10^{-111}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{elif}\;d \leq -6.1 \cdot 10^{-221}:\\
\;\;\;\;d \cdot \sqrt{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{\ell \cdot h}\right)\right)}\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\mathsf{log1p}\left(\mathsf{expm1}\left(\ell \cdot h\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, {\left(\frac{M\_m \cdot \frac{D}{d}}{2}\right)}^{2} \cdot \frac{-0.5}{\ell}, 1\right)}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if d < -1.45000000000000001e-111Initial program 73.8%
Simplified74.8%
Taylor expanded in d around inf 4.6%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt57.5%
neg-mul-157.5%
Simplified57.5%
if -1.45000000000000001e-111 < d < -6.10000000000000009e-221Initial program 51.8%
Simplified51.8%
Taylor expanded in d around inf 11.5%
log1p-expm1-u36.3%
Applied egg-rr36.3%
if -6.10000000000000009e-221 < d < -3.999999999999988e-310Initial program 26.7%
Simplified26.7%
Taylor expanded in d around inf 7.3%
add-exp-log7.3%
log-rec7.3%
Applied egg-rr7.3%
add-sqr-sqrt0.8%
sqrt-unprod7.6%
sqr-neg7.6%
sqrt-unprod6.8%
add-sqr-sqrt7.7%
log1p-expm1-u43.8%
add-exp-log43.8%
*-commutative43.8%
Applied egg-rr43.8%
if -3.999999999999988e-310 < d Initial program 65.8%
Simplified64.2%
associate-*l/66.0%
*-commutative66.0%
add-sqr-sqrt66.0%
pow266.0%
sqrt-pow166.0%
metadata-eval66.0%
pow166.0%
associate-/l/66.0%
Applied egg-rr66.0%
frac-2neg0.0%
sqrt-div0.0%
Applied egg-rr0.0%
Applied egg-rr69.4%
unpow169.4%
associate-*l/70.2%
associate-/l*70.3%
*-commutative70.3%
associate-/l*70.3%
*-commutative70.3%
associate-*l/70.3%
Simplified70.3%
Final simplification60.5%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l -5.5e+181)
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(if (<= l -5e-309)
(*
(sqrt (/ d l))
(*
(+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M_m 2.0) d)) 2.0) -0.5)))
(sqrt (/ d h))))
(*
(/ d (* (sqrt h) (sqrt l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D (/ (/ M_m d) 2.0)) 2.0)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -5.5e+181) {
tmp = -d * sqrt(((1.0 / h) / l));
} else if (l <= -5e-309) {
tmp = sqrt((d / l)) * ((1.0 + ((h / l) * (pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))) * sqrt((d / h)));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * pow((D * ((M_m / d) / 2.0)), 2.0)));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
real(8) :: tmp
if (l <= (-5.5d+181)) then
tmp = -d * sqrt(((1.0d0 / h) / l))
else if (l <= (-5d-309)) then
tmp = sqrt((d / l)) * ((1.0d0 + ((h / l) * (((d_1 * ((m_m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))) * sqrt((d / h)))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((d_1 * ((m_m / d) / 2.0d0)) ** 2.0d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -5.5e+181) {
tmp = -d * Math.sqrt(((1.0 / h) / l));
} else if (l <= -5e-309) {
tmp = Math.sqrt((d / l)) * ((1.0 + ((h / l) * (Math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))) * Math.sqrt((d / h)));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * Math.pow((D * ((M_m / d) / 2.0)), 2.0)));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -5.5e+181: tmp = -d * math.sqrt(((1.0 / h) / l)) elif l <= -5e-309: tmp = math.sqrt((d / l)) * ((1.0 + ((h / l) * (math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))) * math.sqrt((d / h))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * math.pow((D * ((M_m / d) / 2.0)), 2.0))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -5.5e+181) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); elseif (l <= -5e-309) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5))) * sqrt(Float64(d / h)))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D * Float64(Float64(M_m / d) / 2.0)) ^ 2.0)))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= -5.5e+181)
tmp = -d * sqrt(((1.0 / h) / l));
elseif (l <= -5e-309)
tmp = sqrt((d / l)) * ((1.0 + ((h / l) * (((D * ((M_m / 2.0) / d)) ^ 2.0) * -0.5))) * sqrt((d / h)));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * ((D * ((M_m / d) / 2.0)) ^ 2.0)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -5.5e+181], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-309], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D * N[(N[(M$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.5 \cdot 10^{+181}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-309}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\right) \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D \cdot \frac{\frac{M\_m}{d}}{2}\right)}^{2}\right)\\
\end{array}
\end{array}
if l < -5.49999999999999991e181Initial program 33.4%
Simplified33.4%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt58.3%
neg-mul-158.3%
Simplified58.3%
if -5.49999999999999991e181 < l < -4.9999999999999995e-309Initial program 71.1%
Simplified71.1%
if -4.9999999999999995e-309 < l Initial program 65.8%
Simplified65.1%
Applied egg-rr78.6%
unpow178.6%
associate-*r*78.6%
*-commutative78.6%
associate-*r/79.4%
*-commutative79.4%
associate-*r/77.8%
associate-*r*77.8%
associate-*r*77.8%
associate-/r*77.8%
Simplified77.8%
Final simplification72.9%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l -6.5e+179)
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(if (<= l 2.2e-297)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (* (/ h l) (* -0.5 (pow (/ (* D (* M_m 0.5)) d) 2.0))))))
(*
(/ d (* (sqrt h) (sqrt l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D (/ (/ M_m d) 2.0)) 2.0)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -6.5e+179) {
tmp = -d * sqrt(((1.0 / h) / l));
} else if (l <= 2.2e-297) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * pow(((D * (M_m * 0.5)) / d), 2.0)))));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * pow((D * ((M_m / d) / 2.0)), 2.0)));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
real(8) :: tmp
if (l <= (-6.5d+179)) then
tmp = -d * sqrt(((1.0d0 / h) / l))
else if (l <= 2.2d-297) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((h / l) * ((-0.5d0) * (((d_1 * (m_m * 0.5d0)) / d) ** 2.0d0)))))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((d_1 * ((m_m / d) / 2.0d0)) ** 2.0d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -6.5e+179) {
tmp = -d * Math.sqrt(((1.0 / h) / l));
} else if (l <= 2.2e-297) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * Math.pow(((D * (M_m * 0.5)) / d), 2.0)))));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * Math.pow((D * ((M_m / d) / 2.0)), 2.0)));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -6.5e+179: tmp = -d * math.sqrt(((1.0 / h) / l)) elif l <= 2.2e-297: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * math.pow(((D * (M_m * 0.5)) / d), 2.0))))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * math.pow((D * ((M_m / d) / 2.0)), 2.0))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -6.5e+179) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); elseif (l <= 2.2e-297) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(D * Float64(M_m * 0.5)) / d) ^ 2.0)))))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D * Float64(Float64(M_m / d) / 2.0)) ^ 2.0)))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= -6.5e+179)
tmp = -d * sqrt(((1.0 / h) / l));
elseif (l <= 2.2e-297)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * (((D * (M_m * 0.5)) / d) ^ 2.0)))));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * ((D * ((M_m / d) / 2.0)) ^ 2.0)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -6.5e+179], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.2e-297], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(D * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D * N[(N[(M$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.5 \cdot 10^{+179}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{elif}\;\ell \leq 2.2 \cdot 10^{-297}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{D \cdot \left(M\_m \cdot 0.5\right)}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D \cdot \frac{\frac{M\_m}{d}}{2}\right)}^{2}\right)\\
\end{array}
\end{array}
if l < -6.50000000000000052e179Initial program 33.4%
Simplified33.4%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt58.3%
neg-mul-158.3%
Simplified58.3%
if -6.50000000000000052e179 < l < 2.1999999999999998e-297Initial program 70.7%
Simplified69.8%
associate-*r/70.7%
div-inv70.7%
metadata-eval70.7%
Applied egg-rr70.7%
if 2.1999999999999998e-297 < l Initial program 66.1%
Simplified65.3%
Applied egg-rr79.1%
unpow179.1%
associate-*r*79.1%
*-commutative79.1%
associate-*r/79.9%
*-commutative79.9%
associate-*r/79.1%
associate-*r*79.1%
associate-*r*79.1%
associate-/r*79.1%
Simplified79.1%
Final simplification73.2%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l -1.25e+177)
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(if (<= l 1.7e-263)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (/ (* h (* -0.5 (pow (* D (* M_m (/ 0.5 d))) 2.0))) l))))
(*
(/ d (* (sqrt h) (sqrt l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D (/ (/ M_m d) 2.0)) 2.0)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -1.25e+177) {
tmp = -d * sqrt(((1.0 / h) / l));
} else if (l <= 1.7e-263) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * (-0.5 * pow((D * (M_m * (0.5 / d))), 2.0))) / l)));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * pow((D * ((M_m / d) / 2.0)), 2.0)));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
real(8) :: tmp
if (l <= (-1.25d+177)) then
tmp = -d * sqrt(((1.0d0 / h) / l))
else if (l <= 1.7d-263) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((h * ((-0.5d0) * ((d_1 * (m_m * (0.5d0 / d))) ** 2.0d0))) / l)))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((d_1 * ((m_m / d) / 2.0d0)) ** 2.0d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -1.25e+177) {
tmp = -d * Math.sqrt(((1.0 / h) / l));
} else if (l <= 1.7e-263) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h * (-0.5 * Math.pow((D * (M_m * (0.5 / d))), 2.0))) / l)));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * Math.pow((D * ((M_m / d) / 2.0)), 2.0)));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -1.25e+177: tmp = -d * math.sqrt(((1.0 / h) / l)) elif l <= 1.7e-263: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((h * (-0.5 * math.pow((D * (M_m * (0.5 / d))), 2.0))) / l))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * math.pow((D * ((M_m / d) / 2.0)), 2.0))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -1.25e+177) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); elseif (l <= 1.7e-263) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(D * Float64(M_m * Float64(0.5 / d))) ^ 2.0))) / l)))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D * Float64(Float64(M_m / d) / 2.0)) ^ 2.0)))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= -1.25e+177)
tmp = -d * sqrt(((1.0 / h) / l));
elseif (l <= 1.7e-263)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * (-0.5 * ((D * (M_m * (0.5 / d))) ^ 2.0))) / l)));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * ((D * ((M_m / d) / 2.0)) ^ 2.0)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -1.25e+177], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.7e-263], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(D * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D * N[(N[(M$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.25 \cdot 10^{+177}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{elif}\;\ell \leq 1.7 \cdot 10^{-263}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(D \cdot \left(M\_m \cdot \frac{0.5}{d}\right)\right)}^{2}\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D \cdot \frac{\frac{M\_m}{d}}{2}\right)}^{2}\right)\\
\end{array}
\end{array}
if l < -1.2500000000000001e177Initial program 33.4%
Simplified33.4%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt58.3%
neg-mul-158.3%
Simplified58.3%
if -1.2500000000000001e177 < l < 1.70000000000000002e-263Initial program 71.2%
Simplified70.4%
associate-*l/76.0%
*-commutative76.0%
add-sqr-sqrt76.0%
pow276.0%
sqrt-pow176.0%
metadata-eval76.0%
pow176.0%
associate-/l/76.0%
Applied egg-rr76.0%
Taylor expanded in D around 0 76.9%
associate-*r/76.9%
associate-*l/76.9%
*-commutative76.9%
associate-*l*76.0%
Simplified76.0%
if 1.70000000000000002e-263 < l Initial program 65.1%
Simplified64.3%
Applied egg-rr79.2%
unpow179.2%
associate-*r*79.2%
*-commutative79.2%
associate-*r/80.1%
*-commutative80.1%
associate-*r/79.2%
associate-*r*79.2%
associate-*r*79.2%
associate-/r*79.2%
Simplified79.2%
Final simplification75.4%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l -2.6e+182)
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(if (<= l 1.5e-264)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (/ (* h (* -0.5 (pow (* D (/ M_m (* d 2.0))) 2.0))) l))))
(*
(/ d (* (sqrt h) (sqrt l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D (/ (/ M_m d) 2.0)) 2.0)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -2.6e+182) {
tmp = -d * sqrt(((1.0 / h) / l));
} else if (l <= 1.5e-264) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * (-0.5 * pow((D * (M_m / (d * 2.0))), 2.0))) / l)));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * pow((D * ((M_m / d) / 2.0)), 2.0)));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
real(8) :: tmp
if (l <= (-2.6d+182)) then
tmp = -d * sqrt(((1.0d0 / h) / l))
else if (l <= 1.5d-264) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((h * ((-0.5d0) * ((d_1 * (m_m / (d * 2.0d0))) ** 2.0d0))) / l)))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((d_1 * ((m_m / d) / 2.0d0)) ** 2.0d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -2.6e+182) {
tmp = -d * Math.sqrt(((1.0 / h) / l));
} else if (l <= 1.5e-264) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h * (-0.5 * Math.pow((D * (M_m / (d * 2.0))), 2.0))) / l)));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * Math.pow((D * ((M_m / d) / 2.0)), 2.0)));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -2.6e+182: tmp = -d * math.sqrt(((1.0 / h) / l)) elif l <= 1.5e-264: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((h * (-0.5 * math.pow((D * (M_m / (d * 2.0))), 2.0))) / l))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * math.pow((D * ((M_m / d) / 2.0)), 2.0))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -2.6e+182) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); elseif (l <= 1.5e-264) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(D * Float64(M_m / Float64(d * 2.0))) ^ 2.0))) / l)))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D * Float64(Float64(M_m / d) / 2.0)) ^ 2.0)))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= -2.6e+182)
tmp = -d * sqrt(((1.0 / h) / l));
elseif (l <= 1.5e-264)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * (-0.5 * ((D * (M_m / (d * 2.0))) ^ 2.0))) / l)));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * ((D * ((M_m / d) / 2.0)) ^ 2.0)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -2.6e+182], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.5e-264], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(D * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D * N[(N[(M$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.6 \cdot 10^{+182}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{elif}\;\ell \leq 1.5 \cdot 10^{-264}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(D \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D \cdot \frac{\frac{M\_m}{d}}{2}\right)}^{2}\right)\\
\end{array}
\end{array}
if l < -2.6e182Initial program 33.4%
Simplified33.4%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt58.3%
neg-mul-158.3%
Simplified58.3%
if -2.6e182 < l < 1.5e-264Initial program 71.2%
Simplified70.4%
associate-*l/76.0%
*-commutative76.0%
add-sqr-sqrt76.0%
pow276.0%
sqrt-pow176.0%
metadata-eval76.0%
pow176.0%
associate-/l/76.0%
Applied egg-rr76.0%
if 1.5e-264 < l Initial program 65.1%
Simplified64.3%
Applied egg-rr79.2%
unpow179.2%
associate-*r*79.2%
*-commutative79.2%
associate-*r/80.1%
*-commutative80.1%
associate-*r/79.2%
associate-*r*79.2%
associate-*r*79.2%
associate-/r*79.2%
Simplified79.2%
Final simplification75.5%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l -8e-27)
(* d (- (pow (* l h) -0.5)))
(if (<= l -5e-311)
(*
(sqrt (/ d h))
(* (sqrt (/ d l)) (* -0.125 (* (/ h l) (pow (* D (/ M_m d)) 2.0)))))
(*
(/ d (* (sqrt h) (sqrt l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D (/ (/ M_m d) 2.0)) 2.0)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -8e-27) {
tmp = d * -pow((l * h), -0.5);
} else if (l <= -5e-311) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (-0.125 * ((h / l) * pow((D * (M_m / d)), 2.0))));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * pow((D * ((M_m / d) / 2.0)), 2.0)));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
real(8) :: tmp
if (l <= (-8d-27)) then
tmp = d * -((l * h) ** (-0.5d0))
else if (l <= (-5d-311)) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * ((-0.125d0) * ((h / l) * ((d_1 * (m_m / d)) ** 2.0d0))))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((d_1 * ((m_m / d) / 2.0d0)) ** 2.0d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -8e-27) {
tmp = d * -Math.pow((l * h), -0.5);
} else if (l <= -5e-311) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (-0.125 * ((h / l) * Math.pow((D * (M_m / d)), 2.0))));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * Math.pow((D * ((M_m / d) / 2.0)), 2.0)));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -8e-27: tmp = d * -math.pow((l * h), -0.5) elif l <= -5e-311: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (-0.125 * ((h / l) * math.pow((D * (M_m / d)), 2.0)))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * math.pow((D * ((M_m / d) / 2.0)), 2.0))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -8e-27) tmp = Float64(d * Float64(-(Float64(l * h) ^ -0.5))); elseif (l <= -5e-311) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(-0.125 * Float64(Float64(h / l) * (Float64(D * Float64(M_m / d)) ^ 2.0))))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D * Float64(Float64(M_m / d) / 2.0)) ^ 2.0)))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= -8e-27)
tmp = d * -((l * h) ^ -0.5);
elseif (l <= -5e-311)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (-0.125 * ((h / l) * ((D * (M_m / d)) ^ 2.0))));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * ((D * ((M_m / d) / 2.0)) ^ 2.0)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -8e-27], N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, -5e-311], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D * N[(N[(M$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -8 \cdot 10^{-27}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(-0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M\_m}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D \cdot \frac{\frac{M\_m}{d}}{2}\right)}^{2}\right)\\
\end{array}
\end{array}
if l < -8.0000000000000003e-27Initial program 55.0%
Simplified56.4%
Taylor expanded in d around inf 4.1%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt55.7%
neg-mul-155.7%
Simplified55.7%
if -8.0000000000000003e-27 < l < -5.00000000000023e-311Initial program 71.3%
Simplified71.3%
Taylor expanded in M around inf 31.4%
associate-*r*33.0%
times-frac32.9%
*-commutative32.9%
associate-/l*31.4%
unpow231.4%
unpow231.4%
unpow231.4%
times-frac41.7%
swap-sqr46.7%
unpow246.7%
associate-*r/46.7%
*-commutative46.7%
associate-/l*45.3%
Simplified45.3%
if -5.00000000000023e-311 < l Initial program 65.8%
Simplified65.1%
Applied egg-rr78.6%
unpow178.6%
associate-*r*78.6%
*-commutative78.6%
associate-*r/79.4%
*-commutative79.4%
associate-*r/77.8%
associate-*r*77.8%
associate-*r*77.8%
associate-/r*77.8%
Simplified77.8%
Final simplification63.4%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (/ d h))) (t_1 (sqrt (/ d l))))
(if (<= M_m 1.2e-66)
(* t_0 t_1)
(* t_0 (* t_1 (* -0.125 (* (/ h l) (pow (* D (/ M_m d)) 2.0))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt((d / h));
double t_1 = sqrt((d / l));
double tmp;
if (M_m <= 1.2e-66) {
tmp = t_0 * t_1;
} else {
tmp = t_0 * (t_1 * (-0.125 * ((h / l) * pow((D * (M_m / d)), 2.0))));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((d / h))
t_1 = sqrt((d / l))
if (m_m <= 1.2d-66) then
tmp = t_0 * t_1
else
tmp = t_0 * (t_1 * ((-0.125d0) * ((h / l) * ((d_1 * (m_m / d)) ** 2.0d0))))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.sqrt((d / h));
double t_1 = Math.sqrt((d / l));
double tmp;
if (M_m <= 1.2e-66) {
tmp = t_0 * t_1;
} else {
tmp = t_0 * (t_1 * (-0.125 * ((h / l) * Math.pow((D * (M_m / d)), 2.0))));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.sqrt((d / h)) t_1 = math.sqrt((d / l)) tmp = 0 if M_m <= 1.2e-66: tmp = t_0 * t_1 else: tmp = t_0 * (t_1 * (-0.125 * ((h / l) * math.pow((D * (M_m / d)), 2.0)))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(d / h)) t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (M_m <= 1.2e-66) tmp = Float64(t_0 * t_1); else tmp = Float64(t_0 * Float64(t_1 * Float64(-0.125 * Float64(Float64(h / l) * (Float64(D * Float64(M_m / d)) ^ 2.0))))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = sqrt((d / h));
t_1 = sqrt((d / l));
tmp = 0.0;
if (M_m <= 1.2e-66)
tmp = t_0 * t_1;
else
tmp = t_0 * (t_1 * (-0.125 * ((h / l) * ((D * (M_m / d)) ^ 2.0))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[M$95$m, 1.2e-66], N[(t$95$0 * t$95$1), $MachinePrecision], N[(t$95$0 * N[(t$95$1 * N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;M\_m \leq 1.2 \cdot 10^{-66}:\\
\;\;\;\;t\_0 \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(t\_1 \cdot \left(-0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M\_m}{d}\right)}^{2}\right)\right)\right)\\
\end{array}
\end{array}
if M < 1.20000000000000013e-66Initial program 65.5%
Simplified65.0%
frac-2neg65.0%
sqrt-div41.2%
Applied egg-rr41.2%
Taylor expanded in d around inf 44.3%
if 1.20000000000000013e-66 < M Initial program 61.7%
Simplified61.7%
Taylor expanded in M around inf 31.2%
associate-*r*31.3%
times-frac31.5%
*-commutative31.5%
associate-/l*31.6%
unpow231.6%
unpow231.6%
unpow231.6%
times-frac38.9%
swap-sqr43.2%
unpow243.2%
associate-*r/43.2%
*-commutative43.2%
associate-/l*41.8%
Simplified41.8%
Final simplification43.6%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (pow (* l h) -0.5)))
(if (<= d -1.25e-113)
(* d (- t_0))
(if (<= d -1.9e-219)
(* d (log (exp t_0)))
(if (<= d -4e-310)
(* d (sqrt (log1p (expm1 (* l h)))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = pow((l * h), -0.5);
double tmp;
if (d <= -1.25e-113) {
tmp = d * -t_0;
} else if (d <= -1.9e-219) {
tmp = d * log(exp(t_0));
} else if (d <= -4e-310) {
tmp = d * sqrt(log1p(expm1((l * h))));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.pow((l * h), -0.5);
double tmp;
if (d <= -1.25e-113) {
tmp = d * -t_0;
} else if (d <= -1.9e-219) {
tmp = d * Math.log(Math.exp(t_0));
} else if (d <= -4e-310) {
tmp = d * Math.sqrt(Math.log1p(Math.expm1((l * h))));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.pow((l * h), -0.5) tmp = 0 if d <= -1.25e-113: tmp = d * -t_0 elif d <= -1.9e-219: tmp = d * math.log(math.exp(t_0)) elif d <= -4e-310: tmp = d * math.sqrt(math.log1p(math.expm1((l * h)))) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(l * h) ^ -0.5 tmp = 0.0 if (d <= -1.25e-113) tmp = Float64(d * Float64(-t_0)); elseif (d <= -1.9e-219) tmp = Float64(d * log(exp(t_0))); elseif (d <= -4e-310) tmp = Float64(d * sqrt(log1p(expm1(Float64(l * h))))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[d, -1.25e-113], N[(d * (-t$95$0)), $MachinePrecision], If[LessEqual[d, -1.9e-219], N[(d * N[Log[N[Exp[t$95$0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(d * N[Sqrt[N[Log[1 + N[(Exp[N[(l * h), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;d \leq -1.25 \cdot 10^{-113}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\
\mathbf{elif}\;d \leq -1.9 \cdot 10^{-219}:\\
\;\;\;\;d \cdot \log \left(e^{t\_0}\right)\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\mathsf{log1p}\left(\mathsf{expm1}\left(\ell \cdot h\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.2499999999999999e-113Initial program 73.8%
Simplified74.8%
Taylor expanded in d around inf 4.6%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt57.5%
neg-mul-157.5%
Simplified57.5%
if -1.2499999999999999e-113 < d < -1.90000000000000012e-219Initial program 51.8%
Simplified51.8%
Taylor expanded in d around inf 11.5%
add-log-exp36.0%
inv-pow36.0%
sqrt-pow136.0%
metadata-eval36.0%
Applied egg-rr36.0%
if -1.90000000000000012e-219 < d < -3.999999999999988e-310Initial program 26.7%
Simplified26.7%
Taylor expanded in d around inf 7.3%
add-exp-log7.3%
log-rec7.3%
Applied egg-rr7.3%
add-sqr-sqrt0.8%
sqrt-unprod7.6%
sqr-neg7.6%
sqrt-unprod6.8%
add-sqr-sqrt7.7%
log1p-expm1-u43.8%
add-exp-log43.8%
*-commutative43.8%
Applied egg-rr43.8%
if -3.999999999999988e-310 < d Initial program 65.8%
Simplified65.1%
Taylor expanded in d around inf 40.6%
associate-/r*40.5%
sqrt-div48.3%
Applied egg-rr48.3%
Final simplification50.1%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= d -2.7e-111)
(* d (- (pow (* l h) -0.5)))
(if (<= d -3.6e-221)
(* d (sqrt (log1p (expm1 (/ 1.0 (* l h))))))
(if (<= d -4e-310)
(* d (sqrt (log1p (expm1 (* l h)))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -2.7e-111) {
tmp = d * -pow((l * h), -0.5);
} else if (d <= -3.6e-221) {
tmp = d * sqrt(log1p(expm1((1.0 / (l * h)))));
} else if (d <= -4e-310) {
tmp = d * sqrt(log1p(expm1((l * h))));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -2.7e-111) {
tmp = d * -Math.pow((l * h), -0.5);
} else if (d <= -3.6e-221) {
tmp = d * Math.sqrt(Math.log1p(Math.expm1((1.0 / (l * h)))));
} else if (d <= -4e-310) {
tmp = d * Math.sqrt(Math.log1p(Math.expm1((l * h))));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if d <= -2.7e-111: tmp = d * -math.pow((l * h), -0.5) elif d <= -3.6e-221: tmp = d * math.sqrt(math.log1p(math.expm1((1.0 / (l * h))))) elif d <= -4e-310: tmp = d * math.sqrt(math.log1p(math.expm1((l * h)))) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (d <= -2.7e-111) tmp = Float64(d * Float64(-(Float64(l * h) ^ -0.5))); elseif (d <= -3.6e-221) tmp = Float64(d * sqrt(log1p(expm1(Float64(1.0 / Float64(l * h)))))); elseif (d <= -4e-310) tmp = Float64(d * sqrt(log1p(expm1(Float64(l * h))))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -2.7e-111], N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -3.6e-221], N[(d * N[Sqrt[N[Log[1 + N[(Exp[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(d * N[Sqrt[N[Log[1 + N[(Exp[N[(l * h), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.7 \cdot 10^{-111}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{elif}\;d \leq -3.6 \cdot 10^{-221}:\\
\;\;\;\;d \cdot \sqrt{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{\ell \cdot h}\right)\right)}\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\mathsf{log1p}\left(\mathsf{expm1}\left(\ell \cdot h\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -2.69999999999999989e-111Initial program 73.8%
Simplified74.8%
Taylor expanded in d around inf 4.6%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt57.5%
neg-mul-157.5%
Simplified57.5%
if -2.69999999999999989e-111 < d < -3.60000000000000011e-221Initial program 51.8%
Simplified51.8%
Taylor expanded in d around inf 11.5%
log1p-expm1-u36.3%
Applied egg-rr36.3%
if -3.60000000000000011e-221 < d < -3.999999999999988e-310Initial program 26.7%
Simplified26.7%
Taylor expanded in d around inf 7.3%
add-exp-log7.3%
log-rec7.3%
Applied egg-rr7.3%
add-sqr-sqrt0.8%
sqrt-unprod7.6%
sqr-neg7.6%
sqrt-unprod6.8%
add-sqr-sqrt7.7%
log1p-expm1-u43.8%
add-exp-log43.8%
*-commutative43.8%
Applied egg-rr43.8%
if -3.999999999999988e-310 < d Initial program 65.8%
Simplified65.1%
Taylor expanded in d around inf 40.6%
associate-/r*40.5%
sqrt-div48.3%
Applied egg-rr48.3%
Final simplification50.1%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= d -3e-56)
(* d (- (pow (* l h) -0.5)))
(if (<= d -4e-310)
(* d (sqrt (log1p (expm1 (* l h)))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -3e-56) {
tmp = d * -pow((l * h), -0.5);
} else if (d <= -4e-310) {
tmp = d * sqrt(log1p(expm1((l * h))));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -3e-56) {
tmp = d * -Math.pow((l * h), -0.5);
} else if (d <= -4e-310) {
tmp = d * Math.sqrt(Math.log1p(Math.expm1((l * h))));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if d <= -3e-56: tmp = d * -math.pow((l * h), -0.5) elif d <= -4e-310: tmp = d * math.sqrt(math.log1p(math.expm1((l * h)))) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (d <= -3e-56) tmp = Float64(d * Float64(-(Float64(l * h) ^ -0.5))); elseif (d <= -4e-310) tmp = Float64(d * sqrt(log1p(expm1(Float64(l * h))))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -3e-56], N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -4e-310], N[(d * N[Sqrt[N[Log[1 + N[(Exp[N[(l * h), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -3 \cdot 10^{-56}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\mathsf{log1p}\left(\mathsf{expm1}\left(\ell \cdot h\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -2.99999999999999989e-56Initial program 73.0%
Simplified74.1%
Taylor expanded in d around inf 4.7%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt60.7%
neg-mul-160.7%
Simplified60.7%
if -2.99999999999999989e-56 < d < -3.999999999999988e-310Initial program 48.1%
Simplified48.1%
Taylor expanded in d around inf 8.4%
add-exp-log8.4%
log-rec8.4%
Applied egg-rr8.4%
add-sqr-sqrt4.8%
sqrt-unprod10.1%
sqr-neg10.1%
sqrt-unprod5.3%
add-sqr-sqrt6.2%
log1p-expm1-u30.0%
add-exp-log30.0%
*-commutative30.0%
Applied egg-rr30.0%
if -3.999999999999988e-310 < d Initial program 65.8%
Simplified65.1%
Taylor expanded in d around inf 40.6%
associate-/r*40.5%
sqrt-div48.3%
Applied egg-rr48.3%
Final simplification48.5%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= d -7.6e-174)
(* d (- (pow (* l h) -0.5)))
(if (<= d -4e-310)
(* d (pow (pow (* l h) 2.0) -0.25))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -7.6e-174) {
tmp = d * -pow((l * h), -0.5);
} else if (d <= -4e-310) {
tmp = d * pow(pow((l * h), 2.0), -0.25);
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
real(8) :: tmp
if (d <= (-7.6d-174)) then
tmp = d * -((l * h) ** (-0.5d0))
else if (d <= (-4d-310)) then
tmp = d * (((l * h) ** 2.0d0) ** (-0.25d0))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -7.6e-174) {
tmp = d * -Math.pow((l * h), -0.5);
} else if (d <= -4e-310) {
tmp = d * Math.pow(Math.pow((l * h), 2.0), -0.25);
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if d <= -7.6e-174: tmp = d * -math.pow((l * h), -0.5) elif d <= -4e-310: tmp = d * math.pow(math.pow((l * h), 2.0), -0.25) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (d <= -7.6e-174) tmp = Float64(d * Float64(-(Float64(l * h) ^ -0.5))); elseif (d <= -4e-310) tmp = Float64(d * ((Float64(l * h) ^ 2.0) ^ -0.25)); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (d <= -7.6e-174)
tmp = d * -((l * h) ^ -0.5);
elseif (d <= -4e-310)
tmp = d * (((l * h) ^ 2.0) ^ -0.25);
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -7.6e-174], N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -4e-310], N[(d * N[Power[N[Power[N[(l * h), $MachinePrecision], 2.0], $MachinePrecision], -0.25], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -7.6 \cdot 10^{-174}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;d \cdot {\left({\left(\ell \cdot h\right)}^{2}\right)}^{-0.25}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -7.60000000000000042e-174Initial program 69.8%
Simplified70.6%
Taylor expanded in d around inf 4.5%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt53.9%
neg-mul-153.9%
Simplified53.9%
if -7.60000000000000042e-174 < d < -3.999999999999988e-310Initial program 43.1%
Simplified43.1%
Taylor expanded in d around inf 11.4%
add-exp-log11.4%
log-rec11.4%
Applied egg-rr11.4%
exp-neg11.4%
add-exp-log11.4%
inv-pow11.4%
metadata-eval11.4%
pow-prod-up11.4%
sqrt-unprod11.4%
add-sqr-sqrt11.4%
sqr-pow11.4%
pow-prod-down29.3%
pow229.3%
*-commutative29.3%
metadata-eval29.3%
Applied egg-rr29.3%
if -3.999999999999988e-310 < d Initial program 65.8%
Simplified65.1%
Taylor expanded in d around inf 40.6%
associate-/r*40.5%
sqrt-div48.3%
Applied egg-rr48.3%
Final simplification48.1%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (if (<= d 1e-176) (* (- d) (sqrt (/ (/ 1.0 h) l))) (* d (* (pow l -0.5) (pow h -0.5)))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= 1e-176) {
tmp = -d * sqrt(((1.0 / h) / l));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
real(8) :: tmp
if (d <= 1d-176) then
tmp = -d * sqrt(((1.0d0 / h) / l))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= 1e-176) {
tmp = -d * Math.sqrt(((1.0 / h) / l));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if d <= 1e-176: tmp = -d * math.sqrt(((1.0 / h) / l)) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (d <= 1e-176) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (d <= 1e-176)
tmp = -d * sqrt(((1.0 / h) / l));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, 1e-176], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 10^{-176}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < 1e-176Initial program 58.8%
Simplified58.8%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt38.5%
neg-mul-138.5%
Simplified38.5%
if 1e-176 < d Initial program 74.5%
Simplified74.5%
Taylor expanded in d around inf 49.6%
*-un-lft-identity49.6%
inv-pow49.6%
sqrt-pow149.7%
metadata-eval49.7%
Applied egg-rr49.7%
*-lft-identity49.7%
Simplified49.7%
*-commutative49.7%
unpow-prod-down59.7%
Applied egg-rr59.7%
Final simplification46.1%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (if (<= d 8.5e-176) (* (- d) (sqrt (/ (/ 1.0 h) l))) (* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= 8.5e-176) {
tmp = -d * sqrt(((1.0 / h) / l));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
real(8) :: tmp
if (d <= 8.5d-176) then
tmp = -d * sqrt(((1.0d0 / h) / l))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= 8.5e-176) {
tmp = -d * Math.sqrt(((1.0 / h) / l));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if d <= 8.5e-176: tmp = -d * math.sqrt(((1.0 / h) / l)) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (d <= 8.5e-176) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (d <= 8.5e-176)
tmp = -d * sqrt(((1.0 / h) / l));
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, 8.5e-176], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 8.5 \cdot 10^{-176}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < 8.5e-176Initial program 58.8%
Simplified58.8%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt38.5%
neg-mul-138.5%
Simplified38.5%
if 8.5e-176 < d Initial program 74.5%
Simplified74.5%
Taylor expanded in d around inf 49.6%
associate-/r*49.5%
sqrt-div59.8%
Applied egg-rr59.8%
Final simplification46.2%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (if (<= d 9e-177) (* (- d) (sqrt (/ (/ 1.0 h) l))) (* d (pow (* l h) -0.5))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= 9e-177) {
tmp = -d * sqrt(((1.0 / h) / l));
} else {
tmp = d * pow((l * h), -0.5);
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
real(8) :: tmp
if (d <= 9d-177) then
tmp = -d * sqrt(((1.0d0 / h) / l))
else
tmp = d * ((l * h) ** (-0.5d0))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= 9e-177) {
tmp = -d * Math.sqrt(((1.0 / h) / l));
} else {
tmp = d * Math.pow((l * h), -0.5);
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if d <= 9e-177: tmp = -d * math.sqrt(((1.0 / h) / l)) else: tmp = d * math.pow((l * h), -0.5) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (d <= 9e-177) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); else tmp = Float64(d * (Float64(l * h) ^ -0.5)); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (d <= 9e-177)
tmp = -d * sqrt(((1.0 / h) / l));
else
tmp = d * ((l * h) ^ -0.5);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, 9e-177], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 9 \cdot 10^{-177}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\end{array}
\end{array}
if d < 9.0000000000000007e-177Initial program 58.8%
Simplified58.8%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt38.5%
neg-mul-138.5%
Simplified38.5%
if 9.0000000000000007e-177 < d Initial program 74.5%
Simplified74.5%
Taylor expanded in d around inf 49.6%
*-un-lft-identity49.6%
inv-pow49.6%
sqrt-pow149.7%
metadata-eval49.7%
Applied egg-rr49.7%
*-lft-identity49.7%
Simplified49.7%
Final simplification42.5%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (let* ((t_0 (pow (* l h) -0.5))) (if (<= l 1.4e-224) (* d (- t_0)) (* d t_0))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = pow((l * h), -0.5);
double tmp;
if (l <= 1.4e-224) {
tmp = d * -t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
real(8) :: t_0
real(8) :: tmp
t_0 = (l * h) ** (-0.5d0)
if (l <= 1.4d-224) then
tmp = d * -t_0
else
tmp = d * t_0
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.pow((l * h), -0.5);
double tmp;
if (l <= 1.4e-224) {
tmp = d * -t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.pow((l * h), -0.5) tmp = 0 if l <= 1.4e-224: tmp = d * -t_0 else: tmp = d * t_0 return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(l * h) ^ -0.5 tmp = 0.0 if (l <= 1.4e-224) tmp = Float64(d * Float64(-t_0)); else tmp = Float64(d * t_0); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = (l * h) ^ -0.5;
tmp = 0.0;
if (l <= 1.4e-224)
tmp = d * -t_0;
else
tmp = d * t_0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[l, 1.4e-224], N[(d * (-t$95$0)), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq 1.4 \cdot 10^{-224}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
\end{array}
if l < 1.3999999999999999e-224Initial program 64.0%
Simplified64.7%
Taylor expanded in d around inf 7.6%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt40.8%
neg-mul-140.8%
Simplified40.8%
if 1.3999999999999999e-224 < l Initial program 65.1%
Simplified64.1%
Taylor expanded in d around inf 44.2%
*-un-lft-identity44.2%
inv-pow44.2%
sqrt-pow144.2%
metadata-eval44.2%
Applied egg-rr44.2%
*-lft-identity44.2%
Simplified44.2%
Final simplification42.2%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (* d (pow (* l h) -0.5)))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
return d * pow((l * h), -0.5);
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
code = d * ((l * h) ** (-0.5d0))
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
return d * Math.pow((l * h), -0.5);
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): return d * math.pow((l * h), -0.5)
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) return Float64(d * (Float64(l * h) ^ -0.5)) end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp = code(d, h, l, M_m, D)
tmp = d * ((l * h) ^ -0.5);
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
d \cdot {\left(\ell \cdot h\right)}^{-0.5}
\end{array}
Initial program 64.5%
Simplified64.5%
Taylor expanded in d around inf 22.4%
*-un-lft-identity22.4%
inv-pow22.4%
sqrt-pow122.4%
metadata-eval22.4%
Applied egg-rr22.4%
*-lft-identity22.4%
Simplified22.4%
Final simplification22.4%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (* d (sqrt (* l h))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
return d * sqrt((l * h));
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
code = d * sqrt((l * h))
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
return d * Math.sqrt((l * h));
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): return d * math.sqrt((l * h))
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) return Float64(d * sqrt(Float64(l * h))) end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp = code(d, h, l, M_m, D)
tmp = d * sqrt((l * h));
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := N[(d * N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
d \cdot \sqrt{\ell \cdot h}
\end{array}
Initial program 64.5%
Simplified64.5%
Taylor expanded in d around inf 22.4%
*-un-lft-identity22.4%
inv-pow22.4%
sqrt-pow122.4%
metadata-eval22.4%
Applied egg-rr22.4%
*-lft-identity22.4%
Simplified22.4%
add-sqr-sqrt22.3%
sqrt-unprod22.4%
pow-prod-up22.4%
metadata-eval22.4%
inv-pow22.4%
add-exp-log21.6%
exp-neg21.6%
add-sqr-sqrt12.2%
sqrt-unprod15.3%
sqr-neg15.3%
sqrt-unprod2.9%
add-sqr-sqrt4.1%
add-exp-log4.1%
*-un-lft-identity4.1%
sqrt-prod4.1%
metadata-eval4.1%
*-commutative4.1%
Applied egg-rr4.1%
*-lft-identity4.1%
Simplified4.1%
Final simplification4.1%
herbie shell --seed 2024086
(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)))))