
(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 17 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
(if (<= h -4.9e+104)
(*
(sqrt (/ d l))
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M_m 2.0) d)) 2.0) -0.5)))))
(if (<= h 1.38e-151)
(*
(/ (fabs d) (sqrt (* h l)))
(- 1.0 (* 0.5 (pow (* 0.5 (* (/ (* D M_m) d) (sqrt (/ h l)))) 2.0))))
(*
(/ (/ d (sqrt h)) (sqrt l))
(- 1.0 (* 0.5 (* h (* 0.25 (/ (pow (* M_m (/ D d)) 2.0) 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 (h <= -4.9e+104) {
tmp = sqrt((d / l)) * ((sqrt(-d) / sqrt(-h)) * (1.0 + ((h / l) * (pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))));
} else if (h <= 1.38e-151) {
tmp = (fabs(d) / sqrt((h * l))) * (1.0 - (0.5 * pow((0.5 * (((D * M_m) / d) * sqrt((h / l)))), 2.0)));
} else {
tmp = ((d / sqrt(h)) / sqrt(l)) * (1.0 - (0.5 * (h * (0.25 * (pow((M_m * (D / d)), 2.0) / 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 (h <= (-4.9d+104)) then
tmp = sqrt((d / l)) * ((sqrt(-d) / sqrt(-h)) * (1.0d0 + ((h / l) * (((d_1 * ((m_m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))))
else if (h <= 1.38d-151) then
tmp = (abs(d) / sqrt((h * l))) * (1.0d0 - (0.5d0 * ((0.5d0 * (((d_1 * m_m) / d) * sqrt((h / l)))) ** 2.0d0)))
else
tmp = ((d / sqrt(h)) / sqrt(l)) * (1.0d0 - (0.5d0 * (h * (0.25d0 * (((m_m * (d_1 / d)) ** 2.0d0) / 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 (h <= -4.9e+104) {
tmp = Math.sqrt((d / l)) * ((Math.sqrt(-d) / Math.sqrt(-h)) * (1.0 + ((h / l) * (Math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))));
} else if (h <= 1.38e-151) {
tmp = (Math.abs(d) / Math.sqrt((h * l))) * (1.0 - (0.5 * Math.pow((0.5 * (((D * M_m) / d) * Math.sqrt((h / l)))), 2.0)));
} else {
tmp = ((d / Math.sqrt(h)) / Math.sqrt(l)) * (1.0 - (0.5 * (h * (0.25 * (Math.pow((M_m * (D / d)), 2.0) / 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 h <= -4.9e+104: tmp = math.sqrt((d / l)) * ((math.sqrt(-d) / math.sqrt(-h)) * (1.0 + ((h / l) * (math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5)))) elif h <= 1.38e-151: tmp = (math.fabs(d) / math.sqrt((h * l))) * (1.0 - (0.5 * math.pow((0.5 * (((D * M_m) / d) * math.sqrt((h / l)))), 2.0))) else: tmp = ((d / math.sqrt(h)) / math.sqrt(l)) * (1.0 - (0.5 * (h * (0.25 * (math.pow((M_m * (D / d)), 2.0) / 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 (h <= -4.9e+104) tmp = Float64(sqrt(Float64(d / l)) * 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))))); elseif (h <= 1.38e-151) tmp = Float64(Float64(abs(d) / sqrt(Float64(h * l))) * Float64(1.0 - Float64(0.5 * (Float64(0.5 * Float64(Float64(Float64(D * M_m) / d) * sqrt(Float64(h / l)))) ^ 2.0)))); else tmp = Float64(Float64(Float64(d / sqrt(h)) / sqrt(l)) * Float64(1.0 - Float64(0.5 * Float64(h * Float64(0.25 * Float64((Float64(M_m * Float64(D / d)) ^ 2.0) / 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 (h <= -4.9e+104)
tmp = sqrt((d / l)) * ((sqrt(-d) / sqrt(-h)) * (1.0 + ((h / l) * (((D * ((M_m / 2.0) / d)) ^ 2.0) * -0.5))));
elseif (h <= 1.38e-151)
tmp = (abs(d) / sqrt((h * l))) * (1.0 - (0.5 * ((0.5 * (((D * M_m) / d) * sqrt((h / l)))) ^ 2.0)));
else
tmp = ((d / sqrt(h)) / sqrt(l)) * (1.0 - (0.5 * (h * (0.25 * (((M_m * (D / d)) ^ 2.0) / 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[h, -4.9e+104], 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 / 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[h, 1.38e-151], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(0.5 * N[(N[(N[(D * M$95$m), $MachinePrecision] / d), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(0.25 * N[(N[Power[N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $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}
\mathbf{if}\;h \leq -4.9 \cdot 10^{+104}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \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)\\
\mathbf{elif}\;h \leq 1.38 \cdot 10^{-151}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{h \cdot \ell}} \cdot \left(1 - 0.5 \cdot {\left(0.5 \cdot \left(\frac{D \cdot M\_m}{d} \cdot \sqrt{\frac{h}{\ell}}\right)\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}} \cdot \left(1 - 0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{{\left(M\_m \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)\right)\\
\end{array}
\end{array}
if h < -4.89999999999999985e104Initial program 60.7%
Simplified60.7%
frac-2neg60.7%
sqrt-div72.9%
Applied egg-rr72.9%
if -4.89999999999999985e104 < h < 1.38000000000000008e-151Initial program 72.1%
Simplified72.1%
add-sqr-sqrt72.1%
pow272.1%
sqrt-prod72.1%
sqrt-pow177.3%
metadata-eval77.3%
associate-*l/77.3%
div-inv77.3%
metadata-eval77.3%
*-commutative77.3%
pow177.3%
clear-num77.3%
un-div-inv77.3%
Applied egg-rr77.3%
Taylor expanded in M around 0 77.4%
sqrt-unprod64.5%
pow1/264.5%
frac-times55.9%
pow255.9%
Applied egg-rr55.9%
unpow1/255.9%
Simplified55.9%
sqrt-div59.0%
Applied egg-rr59.0%
unpow259.0%
rem-sqrt-square87.5%
Simplified87.5%
if 1.38000000000000008e-151 < h Initial program 71.3%
Simplified70.2%
sqrt-div73.1%
sqrt-div75.8%
frac-times75.8%
add-sqr-sqrt75.9%
Applied egg-rr75.9%
associate-/r*75.9%
Simplified75.9%
Taylor expanded in M around 0 58.6%
associate-*r*58.6%
times-frac54.6%
associate-/l*55.6%
*-commutative55.6%
unpow255.6%
unpow255.6%
times-frac64.9%
unpow264.9%
swap-sqr77.0%
associate-/r/74.9%
associate-/r/75.9%
unpow275.9%
associate-*l*75.9%
*-commutative75.9%
associate-*l/83.6%
associate-/l*83.6%
associate-/l*83.6%
Simplified83.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 (* M_m (/ D d)) 2.0)))
(if (<= h -4.1e+103)
(* (sqrt (/ d h)) (* (sqrt (/ d l)) (fma h (* t_0 (/ -0.125 l)) 1.0)))
(if (<= h 9.5e-152)
(*
(/ (fabs d) (sqrt (* h l)))
(- 1.0 (* 0.5 (pow (* 0.5 (* (/ (* D M_m) d) (sqrt (/ h l)))) 2.0))))
(*
(/ (/ d (sqrt h)) (sqrt l))
(- 1.0 (* 0.5 (* h (* 0.25 (/ t_0 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((M_m * (D / d)), 2.0);
double tmp;
if (h <= -4.1e+103) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * fma(h, (t_0 * (-0.125 / l)), 1.0));
} else if (h <= 9.5e-152) {
tmp = (fabs(d) / sqrt((h * l))) * (1.0 - (0.5 * pow((0.5 * (((D * M_m) / d) * sqrt((h / l)))), 2.0)));
} else {
tmp = ((d / sqrt(h)) / sqrt(l)) * (1.0 - (0.5 * (h * (0.25 * (t_0 / 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(M_m * Float64(D / d)) ^ 2.0 tmp = 0.0 if (h <= -4.1e+103) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * fma(h, Float64(t_0 * Float64(-0.125 / l)), 1.0))); elseif (h <= 9.5e-152) tmp = Float64(Float64(abs(d) / sqrt(Float64(h * l))) * Float64(1.0 - Float64(0.5 * (Float64(0.5 * Float64(Float64(Float64(D * M_m) / d) * sqrt(Float64(h / l)))) ^ 2.0)))); else tmp = Float64(Float64(Float64(d / sqrt(h)) / sqrt(l)) * Float64(1.0 - Float64(0.5 * Float64(h * Float64(0.25 * Float64(t_0 / 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[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[h, -4.1e+103], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(h * N[(t$95$0 * N[(-0.125 / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 9.5e-152], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(0.5 * N[(N[(N[(D * M$95$m), $MachinePrecision] / d), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(0.25 * N[(t$95$0 / l), $MachinePrecision]), $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 := {\left(M\_m \cdot \frac{D}{d}\right)}^{2}\\
\mathbf{if}\;h \leq -4.1 \cdot 10^{+103}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(h, t\_0 \cdot \frac{-0.125}{\ell}, 1\right)\right)\\
\mathbf{elif}\;h \leq 9.5 \cdot 10^{-152}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{h \cdot \ell}} \cdot \left(1 - 0.5 \cdot {\left(0.5 \cdot \left(\frac{D \cdot M\_m}{d} \cdot \sqrt{\frac{h}{\ell}}\right)\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}} \cdot \left(1 - 0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{t\_0}{\ell}\right)\right)\right)\\
\end{array}
\end{array}
if h < -4.1000000000000002e103Initial program 59.5%
Simplified59.6%
Taylor expanded in M around 0 27.5%
associate-*r/27.5%
associate-*r*35.5%
associate-*r*35.5%
associate-*l/39.7%
associate-*r/39.7%
*-commutative39.7%
+-commutative39.7%
fma-undefine39.7%
Simplified64.1%
if -4.1000000000000002e103 < h < 9.49999999999999925e-152Initial program 72.8%
Simplified72.8%
add-sqr-sqrt72.7%
pow272.7%
sqrt-prod72.7%
sqrt-pow178.0%
metadata-eval78.0%
associate-*l/78.0%
div-inv78.0%
metadata-eval78.0%
*-commutative78.0%
pow178.0%
clear-num78.0%
un-div-inv78.0%
Applied egg-rr78.0%
Taylor expanded in M around 0 78.1%
sqrt-unprod65.1%
pow1/265.1%
frac-times56.4%
pow256.4%
Applied egg-rr56.4%
unpow1/256.4%
Simplified56.4%
sqrt-div59.6%
Applied egg-rr59.6%
unpow259.6%
rem-sqrt-square88.3%
Simplified88.3%
if 9.49999999999999925e-152 < h Initial program 71.3%
Simplified70.2%
sqrt-div73.1%
sqrt-div75.8%
frac-times75.8%
add-sqr-sqrt75.9%
Applied egg-rr75.9%
associate-/r*75.9%
Simplified75.9%
Taylor expanded in M around 0 58.6%
associate-*r*58.6%
times-frac54.6%
associate-/l*55.6%
*-commutative55.6%
unpow255.6%
unpow255.6%
times-frac64.9%
unpow264.9%
swap-sqr77.0%
associate-/r/74.9%
associate-/r/75.9%
unpow275.9%
associate-*l*75.9%
*-commutative75.9%
associate-*l/83.6%
associate-/l*83.6%
associate-/l*83.6%
Simplified83.5%
Final simplification81.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
(let* ((t_0 (pow (* M_m (/ D d)) 2.0)))
(if (<= h -1e-309)
(* (sqrt (/ d h)) (* (sqrt (/ d l)) (fma h (* t_0 (/ -0.125 l)) 1.0)))
(*
(/ (/ d (sqrt h)) (sqrt l))
(- 1.0 (* 0.5 (* h (* 0.25 (/ t_0 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((M_m * (D / d)), 2.0);
double tmp;
if (h <= -1e-309) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * fma(h, (t_0 * (-0.125 / l)), 1.0));
} else {
tmp = ((d / sqrt(h)) / sqrt(l)) * (1.0 - (0.5 * (h * (0.25 * (t_0 / 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(M_m * Float64(D / d)) ^ 2.0 tmp = 0.0 if (h <= -1e-309) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * fma(h, Float64(t_0 * Float64(-0.125 / l)), 1.0))); else tmp = Float64(Float64(Float64(d / sqrt(h)) / sqrt(l)) * Float64(1.0 - Float64(0.5 * Float64(h * Float64(0.25 * Float64(t_0 / 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[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[h, -1e-309], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(h * N[(t$95$0 * N[(-0.125 / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(0.25 * N[(t$95$0 / l), $MachinePrecision]), $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 := {\left(M\_m \cdot \frac{D}{d}\right)}^{2}\\
\mathbf{if}\;h \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(h, t\_0 \cdot \frac{-0.125}{\ell}, 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}} \cdot \left(1 - 0.5 \cdot \left(h \cdot \left(0.25 \cdot \frac{t\_0}{\ell}\right)\right)\right)\\
\end{array}
\end{array}
if h < -1.000000000000002e-309Initial program 69.9%
Simplified70.0%
Taylor expanded in M around 0 38.8%
associate-*r/38.8%
associate-*r*41.9%
associate-*r*41.9%
associate-*l/43.6%
associate-*r/43.6%
*-commutative43.6%
+-commutative43.6%
fma-undefine43.6%
Simplified71.7%
if -1.000000000000002e-309 < h Initial program 69.5%
Simplified68.6%
sqrt-div73.7%
sqrt-div76.4%
frac-times76.4%
add-sqr-sqrt76.5%
Applied egg-rr76.5%
associate-/r*75.8%
Simplified75.8%
Taylor expanded in M around 0 59.6%
associate-*r*58.9%
times-frac53.6%
associate-/l*53.6%
*-commutative53.6%
unpow253.6%
unpow253.6%
times-frac65.2%
unpow265.2%
swap-sqr75.8%
associate-/r/74.3%
associate-/r/75.8%
unpow275.8%
associate-*l*75.8%
*-commutative75.8%
associate-*l/81.6%
associate-/l*81.6%
associate-/l*81.6%
Simplified81.6%
Final simplification76.7%
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 (* M_m (/ D d)) 2.0) l)))
(if (<= h -1e-309)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) (+ 1.0 (* h (* t_0 -0.125))))
(* (/ (/ d (sqrt h)) (sqrt l)) (- 1.0 (* 0.5 (* h (* 0.25 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((M_m * (D / d)), 2.0) / l;
double tmp;
if (h <= -1e-309) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 + (h * (t_0 * -0.125)));
} else {
tmp = ((d / sqrt(h)) / sqrt(l)) * (1.0 - (0.5 * (h * (0.25 * 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 = ((m_m * (d_1 / d)) ** 2.0d0) / l
if (h <= (-1d-309)) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 + (h * (t_0 * (-0.125d0))))
else
tmp = ((d / sqrt(h)) / sqrt(l)) * (1.0d0 - (0.5d0 * (h * (0.25d0 * 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((M_m * (D / d)), 2.0) / l;
double tmp;
if (h <= -1e-309) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 + (h * (t_0 * -0.125)));
} else {
tmp = ((d / Math.sqrt(h)) / Math.sqrt(l)) * (1.0 - (0.5 * (h * (0.25 * 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((M_m * (D / d)), 2.0) / l tmp = 0 if h <= -1e-309: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 + (h * (t_0 * -0.125))) else: tmp = ((d / math.sqrt(h)) / math.sqrt(l)) * (1.0 - (0.5 * (h * (0.25 * 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((Float64(M_m * Float64(D / d)) ^ 2.0) / l) tmp = 0.0 if (h <= -1e-309) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 + Float64(h * Float64(t_0 * -0.125)))); else tmp = Float64(Float64(Float64(d / sqrt(h)) / sqrt(l)) * Float64(1.0 - Float64(0.5 * Float64(h * Float64(0.25 * 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 = ((M_m * (D / d)) ^ 2.0) / l;
tmp = 0.0;
if (h <= -1e-309)
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 + (h * (t_0 * -0.125)));
else
tmp = ((d / sqrt(h)) / sqrt(l)) * (1.0 - (0.5 * (h * (0.25 * 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[(N[Power[N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]}, If[LessEqual[h, -1e-309], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(h * N[(t$95$0 * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(0.25 * t$95$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 := \frac{{\left(M\_m \cdot \frac{D}{d}\right)}^{2}}{\ell}\\
\mathbf{if}\;h \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 + h \cdot \left(t\_0 \cdot -0.125\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}} \cdot \left(1 - 0.5 \cdot \left(h \cdot \left(0.25 \cdot t\_0\right)\right)\right)\\
\end{array}
\end{array}
if h < -1.000000000000002e-309Initial program 69.9%
Simplified69.9%
add-sqr-sqrt69.9%
pow269.9%
sqrt-prod69.9%
sqrt-pow171.4%
metadata-eval71.4%
associate-*l/71.4%
div-inv71.4%
metadata-eval71.4%
*-commutative71.4%
pow171.4%
clear-num71.4%
un-div-inv71.4%
Applied egg-rr71.4%
Taylor expanded in M around 0 72.2%
Taylor expanded in h around inf 43.5%
sub-neg43.5%
distribute-lft-in43.5%
rgt-mult-inverse43.6%
distribute-lft-neg-in43.6%
metadata-eval43.6%
associate-/l*42.8%
associate-/r*42.8%
associate-/l*45.8%
unpow245.8%
unpow245.8%
unpow245.8%
times-frac60.2%
swap-sqr70.2%
unpow270.2%
associate-*r/71.7%
*-commutative71.7%
associate-/l*71.7%
Simplified71.7%
if -1.000000000000002e-309 < h Initial program 69.5%
Simplified68.6%
sqrt-div73.7%
sqrt-div76.4%
frac-times76.4%
add-sqr-sqrt76.5%
Applied egg-rr76.5%
associate-/r*75.8%
Simplified75.8%
Taylor expanded in M around 0 59.6%
associate-*r*58.9%
times-frac53.6%
associate-/l*53.6%
*-commutative53.6%
unpow253.6%
unpow253.6%
times-frac65.2%
unpow265.2%
swap-sqr75.8%
associate-/r/74.3%
associate-/r/75.8%
unpow275.8%
associate-*l*75.8%
*-commutative75.8%
associate-*l/81.6%
associate-/l*81.6%
associate-/l*81.6%
Simplified81.6%
Final simplification76.7%
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.15e+171)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(+ 1.0 (* h (* (/ (pow (* M_m (/ D d)) 2.0) l) -0.125))))
(*
(* d (sqrt (/ (/ 1.0 l) h)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D 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 tmp;
if (d <= 1.15e+171) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 + (h * ((pow((M_m * (D / d)), 2.0) / l) * -0.125)));
} else {
tmp = (d * sqrt(((1.0 / l) / h))) * (1.0 - (0.5 * ((h / l) * pow(((M_m / 2.0) * (D / 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) :: tmp
if (d <= 1.15d+171) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 + (h * ((((m_m * (d_1 / d)) ** 2.0d0) / l) * (-0.125d0))))
else
tmp = (d * sqrt(((1.0d0 / l) / h))) * (1.0d0 - (0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_1 / 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 tmp;
if (d <= 1.15e+171) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 + (h * ((Math.pow((M_m * (D / d)), 2.0) / l) * -0.125)));
} else {
tmp = (d * Math.sqrt(((1.0 / l) / h))) * (1.0 - (0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D / 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): tmp = 0 if d <= 1.15e+171: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 + (h * ((math.pow((M_m * (D / d)), 2.0) / l) * -0.125))) else: tmp = (d * math.sqrt(((1.0 / l) / h))) * (1.0 - (0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D / 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) tmp = 0.0 if (d <= 1.15e+171) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 + Float64(h * Float64(Float64((Float64(M_m * Float64(D / d)) ^ 2.0) / l) * -0.125)))); else tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D / 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)
tmp = 0.0;
if (d <= 1.15e+171)
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 + (h * ((((M_m * (D / d)) ^ 2.0) / l) * -0.125)));
else
tmp = (d * sqrt(((1.0 / l) / h))) * (1.0 - (0.5 * ((h / l) * (((M_m / 2.0) * (D / 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_] := If[LessEqual[d, 1.15e+171], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(h * N[(N[(N[Power[N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / 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}
\mathbf{if}\;d \leq 1.15 \cdot 10^{+171}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 + h \cdot \left(\frac{{\left(M\_m \cdot \frac{D}{d}\right)}^{2}}{\ell} \cdot -0.125\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if d < 1.15000000000000009e171Initial program 69.1%
Simplified68.6%
add-sqr-sqrt68.6%
pow268.6%
sqrt-prod68.6%
sqrt-pow173.3%
metadata-eval73.3%
associate-*l/73.3%
div-inv73.3%
metadata-eval73.3%
*-commutative73.3%
pow173.3%
clear-num73.3%
un-div-inv73.3%
Applied egg-rr73.3%
Taylor expanded in M around 0 73.4%
Taylor expanded in h around inf 50.5%
sub-neg50.5%
distribute-lft-in50.5%
rgt-mult-inverse50.6%
distribute-lft-neg-in50.6%
metadata-eval50.6%
associate-/l*48.9%
associate-/r*48.1%
associate-/l*49.8%
unpow249.8%
unpow249.8%
unpow249.8%
times-frac60.3%
swap-sqr70.3%
unpow270.3%
associate-*r/71.6%
*-commutative71.6%
associate-/l*71.2%
Simplified71.2%
if 1.15000000000000009e171 < d Initial program 73.9%
Simplified73.7%
sqrt-div85.3%
sqrt-div93.3%
frac-times93.3%
add-sqr-sqrt93.3%
Applied egg-rr93.3%
associate-/r*90.5%
Simplified90.5%
Taylor expanded in d around 0 84.4%
associate-/r*84.4%
associate-/l/84.4%
associate-/r*84.4%
Simplified84.4%
Final simplification72.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
(if (<= d -4e-116)
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* -0.5 (* (/ h l) (pow (/ (* M_m 0.5) (/ d D)) 2.0)))))
(if (<= d 2.6e-304)
(* -0.125 (/ (* (pow (* D M_m) 2.0) (- (sqrt (/ h (pow l 3.0))))) d))
(*
(* d (sqrt (/ (/ 1.0 l) h)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D 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 tmp;
if (d <= -4e-116) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * pow(((M_m * 0.5) / (d / D)), 2.0))));
} else if (d <= 2.6e-304) {
tmp = -0.125 * ((pow((D * M_m), 2.0) * -sqrt((h / pow(l, 3.0)))) / d);
} else {
tmp = (d * sqrt(((1.0 / l) / h))) * (1.0 - (0.5 * ((h / l) * pow(((M_m / 2.0) * (D / 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) :: tmp
if (d <= (-4d-116)) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * ((h / l) * (((m_m * 0.5d0) / (d / d_1)) ** 2.0d0))))
else if (d <= 2.6d-304) then
tmp = (-0.125d0) * ((((d_1 * m_m) ** 2.0d0) * -sqrt((h / (l ** 3.0d0)))) / d)
else
tmp = (d * sqrt(((1.0d0 / l) / h))) * (1.0d0 - (0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_1 / 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 tmp;
if (d <= -4e-116) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * Math.pow(((M_m * 0.5) / (d / D)), 2.0))));
} else if (d <= 2.6e-304) {
tmp = -0.125 * ((Math.pow((D * M_m), 2.0) * -Math.sqrt((h / Math.pow(l, 3.0)))) / d);
} else {
tmp = (d * Math.sqrt(((1.0 / l) / h))) * (1.0 - (0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D / 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): tmp = 0 if d <= -4e-116: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * math.pow(((M_m * 0.5) / (d / D)), 2.0)))) elif d <= 2.6e-304: tmp = -0.125 * ((math.pow((D * M_m), 2.0) * -math.sqrt((h / math.pow(l, 3.0)))) / d) else: tmp = (d * math.sqrt(((1.0 / l) / h))) * (1.0 - (0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D / 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) tmp = 0.0 if (d <= -4e-116) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m * 0.5) / Float64(d / D)) ^ 2.0))))); elseif (d <= 2.6e-304) tmp = Float64(-0.125 * Float64(Float64((Float64(D * M_m) ^ 2.0) * Float64(-sqrt(Float64(h / (l ^ 3.0))))) / d)); else tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D / 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)
tmp = 0.0;
if (d <= -4e-116)
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * (((M_m * 0.5) / (d / D)) ^ 2.0))));
elseif (d <= 2.6e-304)
tmp = -0.125 * ((((D * M_m) ^ 2.0) * -sqrt((h / (l ^ 3.0)))) / d);
else
tmp = (d * sqrt(((1.0 / l) / h))) * (1.0 - (0.5 * ((h / l) * (((M_m / 2.0) * (D / 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_] := If[LessEqual[d, -4e-116], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m * 0.5), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.6e-304], N[(-0.125 * N[(N[(N[Power[N[(D * M$95$m), $MachinePrecision], 2.0], $MachinePrecision] * (-N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / 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}
\mathbf{if}\;d \leq -4 \cdot 10^{-116}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot 0.5}{\frac{d}{D}}\right)}^{2}\right)\right)\\
\mathbf{elif}\;d \leq 2.6 \cdot 10^{-304}:\\
\;\;\;\;-0.125 \cdot \frac{{\left(D \cdot M\_m\right)}^{2} \cdot \left(-\sqrt{\frac{h}{{\ell}^{3}}}\right)}{d}\\
\mathbf{else}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if d < -4e-116Initial program 78.1%
Simplified78.1%
add-sqr-sqrt78.1%
pow278.1%
sqrt-prod78.1%
sqrt-pow180.4%
metadata-eval80.4%
associate-*l/80.4%
div-inv80.4%
metadata-eval80.4%
*-commutative80.4%
pow180.4%
clear-num80.4%
un-div-inv80.4%
Applied egg-rr80.4%
*-commutative80.4%
sqrt-unprod72.4%
Applied egg-rr72.4%
cancel-sign-sub-inv72.4%
metadata-eval72.4%
*-commutative72.4%
unpow-prod-down70.1%
pow270.1%
add-sqr-sqrt70.1%
associate-*r/70.1%
Applied egg-rr70.1%
if -4e-116 < d < 2.59999999999999997e-304Initial program 53.4%
Simplified53.5%
Taylor expanded in M around inf 25.5%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
associate-*l/0.0%
associate-*r*0.0%
unpow20.0%
rem-square-sqrt40.8%
unpow240.8%
unpow240.8%
swap-sqr49.1%
unpow249.1%
associate-*l*49.1%
mul-1-neg49.1%
Simplified49.1%
if 2.59999999999999997e-304 < d Initial program 70.5%
Simplified69.7%
sqrt-div74.8%
sqrt-div76.8%
frac-times76.8%
add-sqr-sqrt76.9%
Applied egg-rr76.9%
associate-/r*76.2%
Simplified76.2%
Taylor expanded in d around 0 70.1%
associate-/r*70.9%
associate-/l/70.1%
associate-/r*70.9%
Simplified70.9%
Final simplification66.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 -1.6e-165)
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* -0.5 (* (/ h l) (pow (/ (* M_m 0.5) (/ d D)) 2.0)))))
(if (<= d 2.6e-304)
(* d (sqrt (/ (log (exp (/ 1.0 l))) h)))
(*
(* d (sqrt (/ (/ 1.0 l) h)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D 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 tmp;
if (d <= -1.6e-165) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * pow(((M_m * 0.5) / (d / D)), 2.0))));
} else if (d <= 2.6e-304) {
tmp = d * sqrt((log(exp((1.0 / l))) / h));
} else {
tmp = (d * sqrt(((1.0 / l) / h))) * (1.0 - (0.5 * ((h / l) * pow(((M_m / 2.0) * (D / 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) :: tmp
if (d <= (-1.6d-165)) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * ((h / l) * (((m_m * 0.5d0) / (d / d_1)) ** 2.0d0))))
else if (d <= 2.6d-304) then
tmp = d * sqrt((log(exp((1.0d0 / l))) / h))
else
tmp = (d * sqrt(((1.0d0 / l) / h))) * (1.0d0 - (0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_1 / 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 tmp;
if (d <= -1.6e-165) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * Math.pow(((M_m * 0.5) / (d / D)), 2.0))));
} else if (d <= 2.6e-304) {
tmp = d * Math.sqrt((Math.log(Math.exp((1.0 / l))) / h));
} else {
tmp = (d * Math.sqrt(((1.0 / l) / h))) * (1.0 - (0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D / 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): tmp = 0 if d <= -1.6e-165: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * math.pow(((M_m * 0.5) / (d / D)), 2.0)))) elif d <= 2.6e-304: tmp = d * math.sqrt((math.log(math.exp((1.0 / l))) / h)) else: tmp = (d * math.sqrt(((1.0 / l) / h))) * (1.0 - (0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D / 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) tmp = 0.0 if (d <= -1.6e-165) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m * 0.5) / Float64(d / D)) ^ 2.0))))); elseif (d <= 2.6e-304) tmp = Float64(d * sqrt(Float64(log(exp(Float64(1.0 / l))) / h))); else tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D / 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)
tmp = 0.0;
if (d <= -1.6e-165)
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * (((M_m * 0.5) / (d / D)) ^ 2.0))));
elseif (d <= 2.6e-304)
tmp = d * sqrt((log(exp((1.0 / l))) / h));
else
tmp = (d * sqrt(((1.0 / l) / h))) * (1.0 - (0.5 * ((h / l) * (((M_m / 2.0) * (D / 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_] := If[LessEqual[d, -1.6e-165], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m * 0.5), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.6e-304], N[(d * N[Sqrt[N[(N[Log[N[Exp[N[(1.0 / l), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / 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}
\mathbf{if}\;d \leq -1.6 \cdot 10^{-165}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot 0.5}{\frac{d}{D}}\right)}^{2}\right)\right)\\
\mathbf{elif}\;d \leq 2.6 \cdot 10^{-304}:\\
\;\;\;\;d \cdot \sqrt{\frac{\log \left(e^{\frac{1}{\ell}}\right)}{h}}\\
\mathbf{else}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if d < -1.60000000000000006e-165Initial program 78.0%
Simplified78.1%
add-sqr-sqrt78.0%
pow278.0%
sqrt-prod78.0%
sqrt-pow180.1%
metadata-eval80.1%
associate-*l/80.1%
div-inv80.1%
metadata-eval80.1%
*-commutative80.1%
pow180.1%
clear-num80.2%
un-div-inv80.1%
Applied egg-rr80.1%
*-commutative80.1%
sqrt-unprod68.6%
Applied egg-rr68.6%
cancel-sign-sub-inv68.6%
metadata-eval68.6%
*-commutative68.6%
unpow-prod-down66.5%
pow266.5%
add-sqr-sqrt66.5%
associate-*r/66.5%
Applied egg-rr66.5%
if -1.60000000000000006e-165 < d < 2.59999999999999997e-304Initial program 47.1%
Simplified47.1%
Taylor expanded in d around inf 17.5%
*-un-lft-identity17.5%
associate-/r*17.5%
Applied egg-rr17.5%
*-lft-identity17.5%
associate-/l/17.5%
associate-/r*17.5%
Simplified17.5%
add-log-exp43.6%
Applied egg-rr43.6%
if 2.59999999999999997e-304 < d Initial program 70.5%
Simplified69.7%
sqrt-div74.8%
sqrt-div76.8%
frac-times76.8%
add-sqr-sqrt76.9%
Applied egg-rr76.9%
associate-/r*76.2%
Simplified76.2%
Taylor expanded in d around 0 70.1%
associate-/r*70.9%
associate-/l/70.1%
associate-/r*70.9%
Simplified70.9%
Final simplification65.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 -7e-94)
(* (- d) (pow (* h l) -0.5))
(if (<= l -1.05e-235)
(*
(sqrt (* (/ d l) (/ d h)))
(* -0.125 (* (/ h l) (pow (/ (* D M_m) d) 2.0))))
(if (<= l -4e-310)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= l 9e+199)
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D d)) 2.0))))
(/ d (sqrt (* 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 (l <= -7e-94) {
tmp = -d * pow((h * l), -0.5);
} else if (l <= -1.05e-235) {
tmp = sqrt(((d / l) * (d / h))) * (-0.125 * ((h / l) * pow(((D * M_m) / d), 2.0)));
} else if (l <= -4e-310) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (l <= 9e+199) {
tmp = (1.0 - (0.5 * ((h / l) * pow(((M_m / 2.0) * (D / d)), 2.0)))) * (d / sqrt((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 (l <= (-7d-94)) then
tmp = -d * ((h * l) ** (-0.5d0))
else if (l <= (-1.05d-235)) then
tmp = sqrt(((d / l) * (d / h))) * ((-0.125d0) * ((h / l) * (((d_1 * m_m) / d) ** 2.0d0)))
else if (l <= (-4d-310)) then
tmp = sqrt((d / l)) * sqrt((d / h))
else if (l <= 9d+199) then
tmp = (1.0d0 - (0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_1 / d)) ** 2.0d0)))) * (d / sqrt((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 (l <= -7e-94) {
tmp = -d * Math.pow((h * l), -0.5);
} else if (l <= -1.05e-235) {
tmp = Math.sqrt(((d / l) * (d / h))) * (-0.125 * ((h / l) * Math.pow(((D * M_m) / d), 2.0)));
} else if (l <= -4e-310) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (l <= 9e+199) {
tmp = (1.0 - (0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D / d)), 2.0)))) * (d / Math.sqrt((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 l <= -7e-94: tmp = -d * math.pow((h * l), -0.5) elif l <= -1.05e-235: tmp = math.sqrt(((d / l) * (d / h))) * (-0.125 * ((h / l) * math.pow(((D * M_m) / d), 2.0))) elif l <= -4e-310: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif l <= 9e+199: tmp = (1.0 - (0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D / d)), 2.0)))) * (d / math.sqrt((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 (l <= -7e-94) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); elseif (l <= -1.05e-235) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(-0.125 * Float64(Float64(h / l) * (Float64(Float64(D * M_m) / d) ^ 2.0)))); elseif (l <= -4e-310) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (l <= 9e+199) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0)))) * Float64(d / sqrt(Float64(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 (l <= -7e-94)
tmp = -d * ((h * l) ^ -0.5);
elseif (l <= -1.05e-235)
tmp = sqrt(((d / l) * (d / h))) * (-0.125 * ((h / l) * (((D * M_m) / d) ^ 2.0)));
elseif (l <= -4e-310)
tmp = sqrt((d / l)) * sqrt((d / h));
elseif (l <= 9e+199)
tmp = (1.0 - (0.5 * ((h / l) * (((M_m / 2.0) * (D / d)) ^ 2.0)))) * (d / sqrt((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[l, -7e-94], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1.05e-235], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D * M$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -4e-310], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 9e+199], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $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}\;\ell \leq -7 \cdot 10^{-94}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{elif}\;\ell \leq -1.05 \cdot 10^{-235}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(-0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D \cdot M\_m}{d}\right)}^{2}\right)\right)\\
\mathbf{elif}\;\ell \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;\ell \leq 9 \cdot 10^{+199}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -6.99999999999999996e-94Initial program 66.7%
Simplified66.8%
Taylor expanded in d around inf 7.2%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
unpow1/20.0%
associate-/r*0.0%
rem-exp-log0.0%
exp-neg0.0%
exp-prod0.0%
distribute-lft-neg-out0.0%
distribute-rgt-neg-in0.0%
metadata-eval0.0%
exp-to-pow0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt46.3%
mul-1-neg46.3%
Simplified46.3%
if -6.99999999999999996e-94 < l < -1.05e-235Initial program 87.3%
Simplified87.3%
add-sqr-sqrt87.2%
pow287.2%
sqrt-prod87.2%
sqrt-pow187.2%
metadata-eval87.2%
associate-*l/87.2%
div-inv87.2%
metadata-eval87.2%
*-commutative87.2%
pow187.2%
clear-num87.2%
un-div-inv87.2%
Applied egg-rr87.2%
Taylor expanded in M around 0 87.2%
Taylor expanded in D around inf 52.2%
associate-/l*52.2%
times-frac52.2%
associate-*r*52.2%
unpow252.2%
unpow252.2%
unpow252.2%
times-frac69.6%
swap-sqr78.3%
unpow278.3%
associate-*r/78.3%
*-commutative78.3%
associate-/l*78.3%
Simplified78.3%
pow178.3%
sqrt-unprod74.3%
associate-*r*74.3%
associate-*r/74.3%
*-commutative74.3%
associate-/l*74.3%
Applied egg-rr74.3%
unpow174.3%
*-commutative74.3%
associate-*l*74.3%
*-commutative74.3%
associate-*r/74.3%
Simplified74.3%
if -1.05e-235 < l < -3.999999999999988e-310Initial program 62.3%
Simplified62.4%
Taylor expanded in d around inf 57.2%
if -3.999999999999988e-310 < l < 8.9999999999999994e199Initial program 74.9%
Simplified73.9%
sqrt-div77.4%
sqrt-div80.5%
frac-times80.5%
add-sqr-sqrt80.6%
Applied egg-rr80.6%
associate-/r*80.6%
Simplified80.6%
*-un-lft-identity80.6%
associate-/l/80.6%
pow1/280.6%
pow1/280.6%
pow-prod-down77.0%
*-commutative77.0%
pow1/277.0%
Applied egg-rr77.0%
*-lft-identity77.0%
Simplified77.0%
if 8.9999999999999994e199 < l Initial program 44.2%
Simplified44.2%
Taylor expanded in d around inf 40.4%
*-un-lft-identity40.4%
pow1/240.4%
inv-pow40.4%
pow-pow40.4%
metadata-eval40.4%
Applied egg-rr40.4%
*-lft-identity40.4%
Simplified40.4%
*-commutative40.4%
unpow-prod-down56.9%
Applied egg-rr56.9%
Final simplification63.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
(let* ((t_0
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* -0.5 (* (/ h l) (pow (/ (* M_m 0.5) (/ d D)) 2.0)))))))
(if (<= h -1.95e-49)
t_0
(if (<= h -1e-309)
(* (- d) (pow (* h l) -0.5))
(if (<= h 2.75e+137)
(*
(* d (sqrt (/ (/ 1.0 l) h)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D d)) 2.0)))))
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 = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * pow(((M_m * 0.5) / (d / D)), 2.0))));
double tmp;
if (h <= -1.95e-49) {
tmp = t_0;
} else if (h <= -1e-309) {
tmp = -d * pow((h * l), -0.5);
} else if (h <= 2.75e+137) {
tmp = (d * sqrt(((1.0 / l) / h))) * (1.0 - (0.5 * ((h / l) * pow(((M_m / 2.0) * (D / d)), 2.0))));
} else {
tmp = 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 = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * ((h / l) * (((m_m * 0.5d0) / (d / d_1)) ** 2.0d0))))
if (h <= (-1.95d-49)) then
tmp = t_0
else if (h <= (-1d-309)) then
tmp = -d * ((h * l) ** (-0.5d0))
else if (h <= 2.75d+137) then
tmp = (d * sqrt(((1.0d0 / l) / h))) * (1.0d0 - (0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_1 / d)) ** 2.0d0))))
else
tmp = 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.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * Math.pow(((M_m * 0.5) / (d / D)), 2.0))));
double tmp;
if (h <= -1.95e-49) {
tmp = t_0;
} else if (h <= -1e-309) {
tmp = -d * Math.pow((h * l), -0.5);
} else if (h <= 2.75e+137) {
tmp = (d * Math.sqrt(((1.0 / l) / h))) * (1.0 - (0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D / d)), 2.0))));
} else {
tmp = 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.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * math.pow(((M_m * 0.5) / (d / D)), 2.0)))) tmp = 0 if h <= -1.95e-49: tmp = t_0 elif h <= -1e-309: tmp = -d * math.pow((h * l), -0.5) elif h <= 2.75e+137: tmp = (d * math.sqrt(((1.0 / l) / h))) * (1.0 - (0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D / d)), 2.0)))) else: tmp = 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(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m * 0.5) / Float64(d / D)) ^ 2.0))))) tmp = 0.0 if (h <= -1.95e-49) tmp = t_0; elseif (h <= -1e-309) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); elseif (h <= 2.75e+137) tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0))))); else tmp = 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 = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * (((M_m * 0.5) / (d / D)) ^ 2.0))));
tmp = 0.0;
if (h <= -1.95e-49)
tmp = t_0;
elseif (h <= -1e-309)
tmp = -d * ((h * l) ^ -0.5);
elseif (h <= 2.75e+137)
tmp = (d * sqrt(((1.0 / l) / h))) * (1.0 - (0.5 * ((h / l) * (((M_m / 2.0) * (D / d)) ^ 2.0))));
else
tmp = 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[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m * 0.5), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1.95e-49], t$95$0, If[LessEqual[h, -1e-309], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.75e+137], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\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} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot 0.5}{\frac{d}{D}}\right)}^{2}\right)\right)\\
\mathbf{if}\;h \leq -1.95 \cdot 10^{-49}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;h \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{elif}\;h \leq 2.75 \cdot 10^{+137}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if h < -1.95000000000000006e-49 or 2.7500000000000001e137 < h Initial program 69.1%
Simplified68.2%
add-sqr-sqrt68.2%
pow268.2%
sqrt-prod68.1%
sqrt-pow170.8%
metadata-eval70.8%
associate-*l/70.8%
div-inv70.8%
metadata-eval70.8%
*-commutative70.8%
pow170.8%
clear-num70.8%
un-div-inv70.8%
Applied egg-rr70.8%
*-commutative70.8%
sqrt-unprod59.6%
Applied egg-rr59.6%
cancel-sign-sub-inv59.6%
metadata-eval59.6%
*-commutative59.6%
unpow-prod-down57.8%
pow257.8%
add-sqr-sqrt57.8%
associate-*r/57.8%
Applied egg-rr57.8%
if -1.95000000000000006e-49 < h < -1.000000000000002e-309Initial program 71.5%
Simplified71.6%
Taylor expanded in d around inf 16.0%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
unpow1/20.0%
associate-/r*0.0%
rem-exp-log0.0%
exp-neg0.0%
exp-prod0.0%
distribute-lft-neg-out0.0%
distribute-rgt-neg-in0.0%
metadata-eval0.0%
exp-to-pow0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt64.2%
mul-1-neg64.2%
Simplified64.2%
if -1.000000000000002e-309 < h < 2.7500000000000001e137Initial program 69.5%
Simplified69.4%
sqrt-div75.8%
sqrt-div79.1%
frac-times79.2%
add-sqr-sqrt79.3%
Applied egg-rr79.3%
associate-/r*78.4%
Simplified78.4%
Taylor expanded in d around 0 76.6%
associate-/r*77.5%
associate-/l/76.6%
associate-/r*77.5%
Simplified77.5%
Final simplification67.0%
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) (/ d h)))
(+ 1.0 (* -0.5 (* (/ h l) (pow (/ (* M_m 0.5) (/ d D)) 2.0)))))))
(if (<= h -1.75e-50)
t_0
(if (<= h -1e-309)
(* (- d) (pow (* h l) -0.5))
(if (<= h 6.5e+138)
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D d)) 2.0))))
(/ d (sqrt (* h l))))
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 = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * pow(((M_m * 0.5) / (d / D)), 2.0))));
double tmp;
if (h <= -1.75e-50) {
tmp = t_0;
} else if (h <= -1e-309) {
tmp = -d * pow((h * l), -0.5);
} else if (h <= 6.5e+138) {
tmp = (1.0 - (0.5 * ((h / l) * pow(((M_m / 2.0) * (D / d)), 2.0)))) * (d / sqrt((h * l)));
} else {
tmp = 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 = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * ((h / l) * (((m_m * 0.5d0) / (d / d_1)) ** 2.0d0))))
if (h <= (-1.75d-50)) then
tmp = t_0
else if (h <= (-1d-309)) then
tmp = -d * ((h * l) ** (-0.5d0))
else if (h <= 6.5d+138) then
tmp = (1.0d0 - (0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_1 / d)) ** 2.0d0)))) * (d / sqrt((h * l)))
else
tmp = 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.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * Math.pow(((M_m * 0.5) / (d / D)), 2.0))));
double tmp;
if (h <= -1.75e-50) {
tmp = t_0;
} else if (h <= -1e-309) {
tmp = -d * Math.pow((h * l), -0.5);
} else if (h <= 6.5e+138) {
tmp = (1.0 - (0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D / d)), 2.0)))) * (d / Math.sqrt((h * l)));
} else {
tmp = 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.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * math.pow(((M_m * 0.5) / (d / D)), 2.0)))) tmp = 0 if h <= -1.75e-50: tmp = t_0 elif h <= -1e-309: tmp = -d * math.pow((h * l), -0.5) elif h <= 6.5e+138: tmp = (1.0 - (0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D / d)), 2.0)))) * (d / math.sqrt((h * l))) else: tmp = 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(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m * 0.5) / Float64(d / D)) ^ 2.0))))) tmp = 0.0 if (h <= -1.75e-50) tmp = t_0; elseif (h <= -1e-309) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); elseif (h <= 6.5e+138) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0)))) * Float64(d / sqrt(Float64(h * l)))); else tmp = 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 = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * (((M_m * 0.5) / (d / D)) ^ 2.0))));
tmp = 0.0;
if (h <= -1.75e-50)
tmp = t_0;
elseif (h <= -1e-309)
tmp = -d * ((h * l) ^ -0.5);
elseif (h <= 6.5e+138)
tmp = (1.0 - (0.5 * ((h / l) * (((M_m / 2.0) * (D / d)) ^ 2.0)))) * (d / sqrt((h * l)));
else
tmp = 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[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m * 0.5), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1.75e-50], t$95$0, If[LessEqual[h, -1e-309], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 6.5e+138], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\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} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot 0.5}{\frac{d}{D}}\right)}^{2}\right)\right)\\
\mathbf{if}\;h \leq -1.75 \cdot 10^{-50}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;h \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{elif}\;h \leq 6.5 \cdot 10^{+138}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if h < -1.74999999999999998e-50 or 6.50000000000000054e138 < h Initial program 69.1%
Simplified68.2%
add-sqr-sqrt68.2%
pow268.2%
sqrt-prod68.1%
sqrt-pow170.8%
metadata-eval70.8%
associate-*l/70.8%
div-inv70.8%
metadata-eval70.8%
*-commutative70.8%
pow170.8%
clear-num70.8%
un-div-inv70.8%
Applied egg-rr70.8%
*-commutative70.8%
sqrt-unprod59.6%
Applied egg-rr59.6%
cancel-sign-sub-inv59.6%
metadata-eval59.6%
*-commutative59.6%
unpow-prod-down57.8%
pow257.8%
add-sqr-sqrt57.8%
associate-*r/57.8%
Applied egg-rr57.8%
if -1.74999999999999998e-50 < h < -1.000000000000002e-309Initial program 71.5%
Simplified71.6%
Taylor expanded in d around inf 16.0%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
unpow1/20.0%
associate-/r*0.0%
rem-exp-log0.0%
exp-neg0.0%
exp-prod0.0%
distribute-lft-neg-out0.0%
distribute-rgt-neg-in0.0%
metadata-eval0.0%
exp-to-pow0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt64.2%
mul-1-neg64.2%
Simplified64.2%
if -1.000000000000002e-309 < h < 6.50000000000000054e138Initial program 69.5%
Simplified69.4%
sqrt-div75.8%
sqrt-div79.1%
frac-times79.2%
add-sqr-sqrt79.3%
Applied egg-rr79.3%
associate-/r*78.4%
Simplified78.4%
*-un-lft-identity78.4%
associate-/l/79.3%
pow1/279.3%
pow1/279.3%
pow-prod-down76.5%
*-commutative76.5%
pow1/276.5%
Applied egg-rr76.5%
*-lft-identity76.5%
Simplified76.5%
Final simplification66.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 -6.8e+122)
(* (- d) (pow (* h l) -0.5))
(if (<= d -4.6e-154)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= d -1.25e-294)
(* d (pow (+ -1.0 (fma h l 1.0)) -0.5))
(if (<= d 1.35e-77)
(* -0.125 (/ (* (sqrt (/ h (pow l 3.0))) (* (* D M_m) (* D M_m))) d))
(* 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 <= -6.8e+122) {
tmp = -d * pow((h * l), -0.5);
} else if (d <= -4.6e-154) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (d <= -1.25e-294) {
tmp = d * pow((-1.0 + fma(h, l, 1.0)), -0.5);
} else if (d <= 1.35e-77) {
tmp = -0.125 * ((sqrt((h / pow(l, 3.0))) * ((D * M_m) * (D * M_m))) / d);
} else {
tmp = d * (pow(l, -0.5) * 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 <= -6.8e+122) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); elseif (d <= -4.6e-154) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (d <= -1.25e-294) tmp = Float64(d * (Float64(-1.0 + fma(h, l, 1.0)) ^ -0.5)); elseif (d <= 1.35e-77) tmp = Float64(-0.125 * Float64(Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(Float64(D * M_m) * Float64(D * M_m))) / d)); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); 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, -6.8e+122], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4.6e-154], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.25e-294], N[(d * N[Power[N[(-1.0 + N[(h * l + 1.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.35e-77], N[(-0.125 * N[(N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(D * M$95$m), $MachinePrecision] * N[(D * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $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 -6.8 \cdot 10^{+122}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{elif}\;d \leq -4.6 \cdot 10^{-154}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;d \leq -1.25 \cdot 10^{-294}:\\
\;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}^{-0.5}\\
\mathbf{elif}\;d \leq 1.35 \cdot 10^{-77}:\\
\;\;\;\;-0.125 \cdot \frac{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\left(D \cdot M\_m\right) \cdot \left(D \cdot M\_m\right)\right)}{d}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -6.8e122Initial program 72.2%
Simplified72.3%
Taylor expanded in d around inf 4.2%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
unpow1/20.0%
associate-/r*0.0%
rem-exp-log0.0%
exp-neg0.0%
exp-prod0.0%
distribute-lft-neg-out0.0%
distribute-rgt-neg-in0.0%
metadata-eval0.0%
exp-to-pow0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt66.3%
mul-1-neg66.3%
Simplified66.3%
if -6.8e122 < d < -4.5999999999999999e-154Initial program 82.5%
Simplified82.5%
Taylor expanded in d around inf 44.0%
if -4.5999999999999999e-154 < d < -1.2500000000000001e-294Initial program 51.8%
Simplified51.9%
Taylor expanded in d around inf 13.2%
expm1-log1p-u13.2%
expm1-undefine39.1%
Applied egg-rr39.1%
sub-neg39.1%
metadata-eval39.1%
+-commutative39.1%
log1p-undefine39.1%
rem-exp-log39.1%
+-commutative39.1%
fma-define39.1%
Simplified39.1%
pow1/239.1%
inv-pow39.1%
pow-pow39.1%
metadata-eval39.1%
Applied egg-rr39.1%
if -1.2500000000000001e-294 < d < 1.35e-77Initial program 58.5%
Simplified58.5%
Taylor expanded in d around 0 45.7%
associate-*l/47.8%
pow-prod-down54.6%
Applied egg-rr54.6%
unpow254.6%
Applied egg-rr54.6%
if 1.35e-77 < d Initial program 74.4%
Simplified73.2%
Taylor expanded in d around inf 60.4%
*-un-lft-identity60.4%
pow1/260.4%
inv-pow60.4%
pow-pow60.4%
metadata-eval60.4%
Applied egg-rr60.4%
*-lft-identity60.4%
Simplified60.4%
*-commutative60.4%
unpow-prod-down66.5%
Applied egg-rr66.5%
Final simplification56.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
(if (<= D 1.9e+154)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(*
(sqrt (* (/ d l) (/ d h)))
(* -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 tmp;
if (D <= 1.9e+154) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else {
tmp = sqrt(((d / l) * (d / h))) * (-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) :: tmp
if (d_1 <= 1.9d+154) then
tmp = sqrt((d / l)) * sqrt((d / h))
else
tmp = sqrt(((d / l) * (d / h))) * ((-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 tmp;
if (D <= 1.9e+154) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else {
tmp = Math.sqrt(((d / l) * (d / h))) * (-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): tmp = 0 if D <= 1.9e+154: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) else: tmp = math.sqrt(((d / l) * (d / h))) * (-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) tmp = 0.0 if (D <= 1.9e+154) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); else tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(-0.125 * Float64(Float64(h / l) * (Float64(Float64(D * 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)
tmp = 0.0;
if (D <= 1.9e+154)
tmp = sqrt((d / l)) * sqrt((d / h));
else
tmp = sqrt(((d / l) * (d / h))) * (-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_] := If[LessEqual[D, 1.9e+154], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D * M$95$m), $MachinePrecision] / d), $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}\;D \leq 1.9 \cdot 10^{+154}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(-0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D \cdot M\_m}{d}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if D < 1.8999999999999999e154Initial program 70.3%
Simplified69.9%
Taylor expanded in d around inf 45.4%
if 1.8999999999999999e154 < D Initial program 65.4%
Simplified65.4%
add-sqr-sqrt65.4%
pow265.4%
sqrt-prod65.4%
sqrt-pow168.1%
metadata-eval68.1%
associate-*l/68.1%
div-inv68.1%
metadata-eval68.1%
*-commutative68.1%
pow168.1%
clear-num68.1%
un-div-inv68.1%
Applied egg-rr68.1%
Taylor expanded in M around 0 65.4%
Taylor expanded in D around inf 38.6%
associate-/l*38.6%
times-frac35.7%
associate-*r*35.7%
unpow235.7%
unpow235.7%
unpow235.7%
times-frac50.6%
swap-sqr59.4%
unpow259.4%
associate-*r/62.3%
*-commutative62.3%
associate-/l*62.3%
Simplified62.3%
pow162.3%
sqrt-unprod53.4%
associate-*r*53.4%
associate-*r/53.4%
*-commutative53.4%
associate-/l*50.5%
Applied egg-rr50.5%
unpow150.5%
*-commutative50.5%
associate-*l*50.5%
*-commutative50.5%
associate-*r/53.4%
Simplified53.4%
Final simplification46.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 (* (- d) (pow (* h l) -0.5))))
(if (<= l -9.5e-99)
t_0
(if (<= l -1.05e-235)
(* d (pow (+ -1.0 (fma h l 1.0)) -0.5))
(if (<= l 2.8e-238) t_0 (* 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 t_0 = -d * pow((h * l), -0.5);
double tmp;
if (l <= -9.5e-99) {
tmp = t_0;
} else if (l <= -1.05e-235) {
tmp = d * pow((-1.0 + fma(h, l, 1.0)), -0.5);
} else if (l <= 2.8e-238) {
tmp = t_0;
} else {
tmp = d * (pow(l, -0.5) * 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) t_0 = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)) tmp = 0.0 if (l <= -9.5e-99) tmp = t_0; elseif (l <= -1.05e-235) tmp = Float64(d * (Float64(-1.0 + fma(h, l, 1.0)) ^ -0.5)); elseif (l <= 2.8e-238) tmp = t_0; else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); 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[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -9.5e-99], t$95$0, If[LessEqual[l, -1.05e-235], N[(d * N[Power[N[(-1.0 + N[(h * l + 1.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.8e-238], t$95$0, 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}
t_0 := \left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -9.5 \cdot 10^{-99}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -1.05 \cdot 10^{-235}:\\
\;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}^{-0.5}\\
\mathbf{elif}\;\ell \leq 2.8 \cdot 10^{-238}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -9.5000000000000008e-99 or -1.05e-235 < l < 2.80000000000000004e-238Initial program 69.2%
Simplified69.2%
Taylor expanded in d around inf 8.1%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
unpow1/20.0%
associate-/r*0.0%
rem-exp-log0.0%
exp-neg0.0%
exp-prod0.0%
distribute-lft-neg-out0.0%
distribute-rgt-neg-in0.0%
metadata-eval0.0%
exp-to-pow0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt47.2%
mul-1-neg47.2%
Simplified47.2%
if -9.5000000000000008e-99 < l < -1.05e-235Initial program 87.3%
Simplified87.3%
Taylor expanded in d around inf 20.1%
expm1-log1p-u20.1%
expm1-undefine61.9%
Applied egg-rr61.9%
sub-neg61.9%
metadata-eval61.9%
+-commutative61.9%
log1p-undefine61.9%
rem-exp-log61.9%
+-commutative61.9%
fma-define61.9%
Simplified61.9%
pow1/261.9%
inv-pow61.9%
pow-pow61.9%
metadata-eval61.9%
Applied egg-rr61.9%
if 2.80000000000000004e-238 < l Initial program 66.6%
Simplified65.7%
Taylor expanded in d around inf 52.8%
*-un-lft-identity52.8%
pow1/252.8%
inv-pow52.8%
pow-pow52.8%
metadata-eval52.8%
Applied egg-rr52.8%
*-lft-identity52.8%
Simplified52.8%
*-commutative52.8%
unpow-prod-down57.7%
Applied egg-rr57.7%
Final simplification53.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 5e-238) (* (- d) (pow (* h l) -0.5)) (* 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 (l <= 5e-238) {
tmp = -d * pow((h * l), -0.5);
} 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 (l <= 5d-238) then
tmp = -d * ((h * l) ** (-0.5d0))
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 (l <= 5e-238) {
tmp = -d * Math.pow((h * l), -0.5);
} 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 l <= 5e-238: tmp = -d * math.pow((h * l), -0.5) 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 (l <= 5e-238) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); 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 (l <= 5e-238)
tmp = -d * ((h * l) ^ -0.5);
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[l, 5e-238], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $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}\;\ell \leq 5 \cdot 10^{-238}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < 5e-238Initial program 72.1%
Simplified72.1%
Taylor expanded in d around inf 10.0%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
unpow1/20.0%
associate-/r*0.0%
rem-exp-log0.0%
exp-neg0.0%
exp-prod0.0%
distribute-lft-neg-out0.0%
distribute-rgt-neg-in0.0%
metadata-eval0.0%
exp-to-pow0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt42.4%
mul-1-neg42.4%
Simplified42.4%
if 5e-238 < l Initial program 66.6%
Simplified65.7%
Taylor expanded in d around inf 52.8%
*-un-lft-identity52.8%
pow1/252.8%
inv-pow52.8%
pow-pow52.8%
metadata-eval52.8%
Applied egg-rr52.8%
*-lft-identity52.8%
Simplified52.8%
*-commutative52.8%
unpow-prod-down57.7%
Applied egg-rr57.7%
Final simplification49.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 2.6e-238) (* (- d) (pow (* h l) -0.5)) (* d (sqrt (/ 1.0 (* h 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.6e-238) {
tmp = -d * pow((h * l), -0.5);
} else {
tmp = d * sqrt((1.0 / (h * 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 (l <= 2.6d-238) then
tmp = -d * ((h * l) ** (-0.5d0))
else
tmp = d * sqrt((1.0d0 / (h * 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 (l <= 2.6e-238) {
tmp = -d * Math.pow((h * l), -0.5);
} else {
tmp = d * Math.sqrt((1.0 / (h * 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 l <= 2.6e-238: tmp = -d * math.pow((h * l), -0.5) else: tmp = d * math.sqrt((1.0 / (h * 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.6e-238) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); else tmp = Float64(d * sqrt(Float64(1.0 / Float64(h * l)))); end return tmp end
M_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-238)
tmp = -d * ((h * l) ^ -0.5);
else
tmp = d * sqrt((1.0 / (h * 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[l, 2.6e-238], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \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^{-238}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\end{array}
\end{array}
if l < 2.6000000000000001e-238Initial program 72.1%
Simplified72.1%
Taylor expanded in d around inf 10.0%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
unpow1/20.0%
associate-/r*0.0%
rem-exp-log0.0%
exp-neg0.0%
exp-prod0.0%
distribute-lft-neg-out0.0%
distribute-rgt-neg-in0.0%
metadata-eval0.0%
exp-to-pow0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt42.4%
mul-1-neg42.4%
Simplified42.4%
if 2.6000000000000001e-238 < l Initial program 66.6%
Simplified65.7%
Taylor expanded in d around inf 52.8%
Final simplification47.0%
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 (/ 1.0 (* h 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) {
return d * sqrt((1.0 / (h * l)));
}
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((1.0d0 / (h * l)))
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((1.0 / (h * l)));
}
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((1.0 / (h * l)))
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(1.0 / Float64(h * l)))) 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((1.0 / (h * l)));
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[(1.0 / N[(h * 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])\\
\\
d \cdot \sqrt{\frac{1}{h \cdot \ell}}
\end{array}
Initial program 69.7%
Simplified69.3%
Taylor expanded in d around inf 28.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 (* d (pow (* h l) -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((h * l), -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 * ((h * l) ** (-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((h * l), -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((h * l), -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(h * l) ^ -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 * ((h * l) ^ -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[(h * l), $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(h \cdot \ell\right)}^{-0.5}
\end{array}
Initial program 69.7%
Simplified69.3%
Taylor expanded in d around inf 28.9%
*-un-lft-identity28.9%
pow1/228.9%
inv-pow28.9%
pow-pow28.5%
metadata-eval28.5%
Applied egg-rr28.5%
*-lft-identity28.5%
Simplified28.5%
herbie shell --seed 2024146
(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)))))