
(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 26 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 (pow (* M_m (/ D d)) 2.0))
(t_1 (sqrt (- d)))
(t_2
(*
(/ t_1 (sqrt (- h)))
(*
(sqrt (* d (/ 1.0 l)))
(+ 1.0 (/ (* (pow (* D (/ M_m d)) 2.0) (* h -0.125)) l)))))
(t_3 (- 1.0 (* h (* 0.125 (/ t_0 l))))))
(if (<= h -2e+143)
t_2
(if (<= h -8.5e-86)
(* (sqrt (/ d h)) (* (/ t_1 (sqrt (- l))) t_3))
(if (<= h -4e-310)
t_2
(if (<= h 6e+125)
(* (/ d (sqrt (* l h))) (+ 1.0 (* (/ h l) (* t_0 -0.125))))
(* (/ (sqrt d) (sqrt h)) (* t_3 (sqrt (/ d 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 t_1 = sqrt(-d);
double t_2 = (t_1 / sqrt(-h)) * (sqrt((d * (1.0 / l))) * (1.0 + ((pow((D * (M_m / d)), 2.0) * (h * -0.125)) / l)));
double t_3 = 1.0 - (h * (0.125 * (t_0 / l)));
double tmp;
if (h <= -2e+143) {
tmp = t_2;
} else if (h <= -8.5e-86) {
tmp = sqrt((d / h)) * ((t_1 / sqrt(-l)) * t_3);
} else if (h <= -4e-310) {
tmp = t_2;
} else if (h <= 6e+125) {
tmp = (d / sqrt((l * h))) * (1.0 + ((h / l) * (t_0 * -0.125)));
} else {
tmp = (sqrt(d) / sqrt(h)) * (t_3 * sqrt((d / 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) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = (m_m * (d_1 / d)) ** 2.0d0
t_1 = sqrt(-d)
t_2 = (t_1 / sqrt(-h)) * (sqrt((d * (1.0d0 / l))) * (1.0d0 + ((((d_1 * (m_m / d)) ** 2.0d0) * (h * (-0.125d0))) / l)))
t_3 = 1.0d0 - (h * (0.125d0 * (t_0 / l)))
if (h <= (-2d+143)) then
tmp = t_2
else if (h <= (-8.5d-86)) then
tmp = sqrt((d / h)) * ((t_1 / sqrt(-l)) * t_3)
else if (h <= (-4d-310)) then
tmp = t_2
else if (h <= 6d+125) then
tmp = (d / sqrt((l * h))) * (1.0d0 + ((h / l) * (t_0 * (-0.125d0))))
else
tmp = (sqrt(d) / sqrt(h)) * (t_3 * sqrt((d / 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 t_0 = Math.pow((M_m * (D / d)), 2.0);
double t_1 = Math.sqrt(-d);
double t_2 = (t_1 / Math.sqrt(-h)) * (Math.sqrt((d * (1.0 / l))) * (1.0 + ((Math.pow((D * (M_m / d)), 2.0) * (h * -0.125)) / l)));
double t_3 = 1.0 - (h * (0.125 * (t_0 / l)));
double tmp;
if (h <= -2e+143) {
tmp = t_2;
} else if (h <= -8.5e-86) {
tmp = Math.sqrt((d / h)) * ((t_1 / Math.sqrt(-l)) * t_3);
} else if (h <= -4e-310) {
tmp = t_2;
} else if (h <= 6e+125) {
tmp = (d / Math.sqrt((l * h))) * (1.0 + ((h / l) * (t_0 * -0.125)));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (t_3 * Math.sqrt((d / 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((M_m * (D / d)), 2.0) t_1 = math.sqrt(-d) t_2 = (t_1 / math.sqrt(-h)) * (math.sqrt((d * (1.0 / l))) * (1.0 + ((math.pow((D * (M_m / d)), 2.0) * (h * -0.125)) / l))) t_3 = 1.0 - (h * (0.125 * (t_0 / l))) tmp = 0 if h <= -2e+143: tmp = t_2 elif h <= -8.5e-86: tmp = math.sqrt((d / h)) * ((t_1 / math.sqrt(-l)) * t_3) elif h <= -4e-310: tmp = t_2 elif h <= 6e+125: tmp = (d / math.sqrt((l * h))) * (1.0 + ((h / l) * (t_0 * -0.125))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * (t_3 * math.sqrt((d / 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 t_1 = sqrt(Float64(-d)) t_2 = Float64(Float64(t_1 / sqrt(Float64(-h))) * Float64(sqrt(Float64(d * Float64(1.0 / l))) * Float64(1.0 + Float64(Float64((Float64(D * Float64(M_m / d)) ^ 2.0) * Float64(h * -0.125)) / l)))) t_3 = Float64(1.0 - Float64(h * Float64(0.125 * Float64(t_0 / l)))) tmp = 0.0 if (h <= -2e+143) tmp = t_2; elseif (h <= -8.5e-86) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(t_1 / sqrt(Float64(-l))) * t_3)); elseif (h <= -4e-310) tmp = t_2; elseif (h <= 6e+125) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(1.0 + Float64(Float64(h / l) * Float64(t_0 * -0.125)))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_3 * sqrt(Float64(d / 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)
t_0 = (M_m * (D / d)) ^ 2.0;
t_1 = sqrt(-d);
t_2 = (t_1 / sqrt(-h)) * (sqrt((d * (1.0 / l))) * (1.0 + ((((D * (M_m / d)) ^ 2.0) * (h * -0.125)) / l)));
t_3 = 1.0 - (h * (0.125 * (t_0 / l)));
tmp = 0.0;
if (h <= -2e+143)
tmp = t_2;
elseif (h <= -8.5e-86)
tmp = sqrt((d / h)) * ((t_1 / sqrt(-l)) * t_3);
elseif (h <= -4e-310)
tmp = t_2;
elseif (h <= 6e+125)
tmp = (d / sqrt((l * h))) * (1.0 + ((h / l) * (t_0 * -0.125)));
else
tmp = (sqrt(d) / sqrt(h)) * (t_3 * sqrt((d / 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_] := Block[{t$95$0 = N[Power[N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d * N[(1.0 / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * -0.125), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 - N[(h * N[(0.125 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -2e+143], t$95$2, If[LessEqual[h, -8.5e-86], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -4e-310], t$95$2, If[LessEqual[h, 6e+125], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(t$95$0 * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$3 * N[Sqrt[N[(d / 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 := {\left(M\_m \cdot \frac{D}{d}\right)}^{2}\\
t_1 := \sqrt{-d}\\
t_2 := \frac{t\_1}{\sqrt{-h}} \cdot \left(\sqrt{d \cdot \frac{1}{\ell}} \cdot \left(1 + \frac{{\left(D \cdot \frac{M\_m}{d}\right)}^{2} \cdot \left(h \cdot -0.125\right)}{\ell}\right)\right)\\
t_3 := 1 - h \cdot \left(0.125 \cdot \frac{t\_0}{\ell}\right)\\
\mathbf{if}\;h \leq -2 \cdot 10^{+143}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;h \leq -8.5 \cdot 10^{-86}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t\_1}{\sqrt{-\ell}} \cdot t\_3\right)\\
\mathbf{elif}\;h \leq -4 \cdot 10^{-310}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;h \leq 6 \cdot 10^{+125}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(t\_0 \cdot -0.125\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_3 \cdot \sqrt{\frac{d}{\ell}}\right)\\
\end{array}
\end{array}
if h < -2e143 or -8.499999999999999e-86 < h < -3.999999999999988e-310Initial program 54.6%
Simplified54.6%
Taylor expanded in h around -inf 46.3%
associate-*r*46.3%
neg-mul-146.3%
sub-neg46.3%
distribute-lft-in46.3%
Simplified60.9%
div-inv60.9%
Applied egg-rr60.9%
pow160.9%
associate-*r*60.9%
Applied egg-rr60.9%
unpow160.9%
*-commutative60.9%
unpow260.9%
*-commutative60.9%
*-commutative60.9%
swap-sqr50.3%
times-frac46.4%
unpow246.4%
unpow246.4%
unpow246.4%
associate-*r/43.7%
times-frac46.3%
associate-/r*48.5%
associate-*l/48.5%
Simplified60.9%
frac-2neg54.6%
sqrt-div73.4%
Applied egg-rr79.7%
if -2e143 < h < -8.499999999999999e-86Initial program 63.0%
Simplified66.1%
Taylor expanded in h around -inf 48.6%
associate-*r*48.6%
neg-mul-148.6%
sub-neg48.6%
distribute-lft-in48.6%
Simplified71.5%
frac-2neg65.9%
sqrt-div76.8%
Applied egg-rr88.1%
if -3.999999999999988e-310 < h < 6.0000000000000003e125Initial program 75.6%
Simplified76.6%
pow176.6%
sqrt-unprod67.6%
Applied egg-rr67.6%
unpow167.6%
Simplified67.6%
Taylor expanded in M around 0 40.4%
*-commutative40.4%
associate-*r*41.4%
times-frac43.6%
*-commutative43.6%
associate-/l*43.6%
unpow243.6%
unpow243.6%
unpow243.6%
times-frac49.2%
swap-sqr67.6%
unpow267.6%
associate-*r/66.5%
*-commutative66.5%
associate-/l*67.6%
Simplified67.6%
pow167.6%
*-commutative67.6%
associate-*l*67.6%
frac-times59.1%
sqrt-div64.7%
sqrt-unprod91.3%
add-sqr-sqrt91.6%
Applied egg-rr91.6%
unpow191.6%
*-commutative91.6%
sub-neg91.6%
distribute-rgt-neg-in91.6%
*-commutative91.6%
distribute-lft-neg-in91.6%
metadata-eval91.6%
associate-*r*91.6%
*-commutative91.6%
*-commutative91.6%
associate-*r/90.5%
*-commutative90.5%
associate-/l*91.6%
Simplified91.6%
if 6.0000000000000003e125 < h Initial program 53.2%
Simplified53.2%
Taylor expanded in h around -inf 44.2%
associate-*r*44.2%
neg-mul-144.2%
sub-neg44.2%
distribute-lft-in44.2%
Simplified61.8%
sqrt-div81.8%
Applied egg-rr81.8%
Final simplification86.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 (<=
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* D M_m) (* d 2.0)) 2.0)))))
2e+299)
(*
(sqrt (/ d h))
(* (- 1.0 (* h (* 0.125 (/ (pow (* M_m (/ D d)) 2.0) l)))) (sqrt (/ d l))))
(fabs (/ 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) {
double tmp;
if (((pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((D * M_m) / (d * 2.0)), 2.0))))) <= 2e+299) {
tmp = sqrt((d / h)) * ((1.0 - (h * (0.125 * (pow((M_m * (D / d)), 2.0) / l)))) * sqrt((d / l)));
} else {
tmp = fabs((d / sqrt((l * h))));
}
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 / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((h / l) * (0.5d0 * (((d_1 * m_m) / (d * 2.0d0)) ** 2.0d0))))) <= 2d+299) then
tmp = sqrt((d / h)) * ((1.0d0 - (h * (0.125d0 * (((m_m * (d_1 / d)) ** 2.0d0) / l)))) * sqrt((d / l)))
else
tmp = abs((d / sqrt((l * h))))
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 (((Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((D * M_m) / (d * 2.0)), 2.0))))) <= 2e+299) {
tmp = Math.sqrt((d / h)) * ((1.0 - (h * (0.125 * (Math.pow((M_m * (D / d)), 2.0) / l)))) * Math.sqrt((d / l)));
} else {
tmp = Math.abs((d / Math.sqrt((l * h))));
}
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 ((math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((D * M_m) / (d * 2.0)), 2.0))))) <= 2e+299: tmp = math.sqrt((d / h)) * ((1.0 - (h * (0.125 * (math.pow((M_m * (D / d)), 2.0) / l)))) * math.sqrt((d / l))) else: tmp = math.fabs((d / math.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 (Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(D * M_m) / Float64(d * 2.0)) ^ 2.0))))) <= 2e+299) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(1.0 - Float64(h * Float64(0.125 * Float64((Float64(M_m * Float64(D / d)) ^ 2.0) / l)))) * sqrt(Float64(d / l)))); else tmp = abs(Float64(d / sqrt(Float64(l * h)))); 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 / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((D * M_m) / (d * 2.0)) ^ 2.0))))) <= 2e+299)
tmp = sqrt((d / h)) * ((1.0 - (h * (0.125 * (((M_m * (D / d)) ^ 2.0) / l)))) * sqrt((d / l)));
else
tmp = abs((d / sqrt((l * h))));
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[N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(D * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+299], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 - N[(h * N[(0.125 * N[(N[Power[N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Abs[N[(d / 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}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{D \cdot M\_m}{d \cdot 2}\right)}^{2}\right)\right) \leq 2 \cdot 10^{+299}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\left(1 - h \cdot \left(0.125 \cdot \frac{{\left(M\_m \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.0000000000000001e299Initial program 84.5%
Simplified86.1%
Taylor expanded in h around -inf 60.7%
associate-*r*60.7%
neg-mul-160.7%
sub-neg60.7%
distribute-lft-in60.7%
Simplified87.4%
if 2.0000000000000001e299 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 17.2%
Simplified17.2%
Taylor expanded in d around inf 34.2%
*-un-lft-identity34.2%
inv-pow34.2%
sqrt-pow134.2%
metadata-eval34.2%
Applied egg-rr34.2%
*-lft-identity34.2%
Simplified34.2%
Taylor expanded in d around 0 34.2%
*-commutative34.2%
associate-/r*34.3%
Simplified34.3%
add-sqr-sqrt33.7%
sqrt-unprod34.7%
swap-sqr32.2%
sqr-neg32.2%
add-sqr-sqrt32.2%
associate-/l/32.3%
div-inv32.2%
sqr-neg32.2%
frac-times26.8%
sqrt-prod26.7%
frac-2neg26.7%
sqrt-undiv18.9%
add-sqr-sqrt18.9%
sqrt-prod11.8%
rem-sqrt-square18.9%
Applied egg-rr59.0%
Final simplification78.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 (- 1.0 (* h (* 0.125 (/ (pow (* M_m (/ D d)) 2.0) l)))))
(t_1 (sqrt (- d)))
(t_2 (/ t_1 (sqrt (- l)))))
(if (<= l -8e-79)
(*
t_2
(*
(/ t_1 (sqrt (- h)))
(+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M_m 2.0) d)) 2.0) -0.5)))))
(if (<= l -2e-310)
(* (sqrt (/ d h)) (* t_2 t_0))
(* (/ (sqrt d) (sqrt h)) (* t_0 (sqrt (/ d 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 = 1.0 - (h * (0.125 * (pow((M_m * (D / d)), 2.0) / l)));
double t_1 = sqrt(-d);
double t_2 = t_1 / sqrt(-l);
double tmp;
if (l <= -8e-79) {
tmp = t_2 * ((t_1 / sqrt(-h)) * (1.0 + ((h / l) * (pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))));
} else if (l <= -2e-310) {
tmp = sqrt((d / h)) * (t_2 * t_0);
} else {
tmp = (sqrt(d) / sqrt(h)) * (t_0 * sqrt((d / 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) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = 1.0d0 - (h * (0.125d0 * (((m_m * (d_1 / d)) ** 2.0d0) / l)))
t_1 = sqrt(-d)
t_2 = t_1 / sqrt(-l)
if (l <= (-8d-79)) then
tmp = t_2 * ((t_1 / sqrt(-h)) * (1.0d0 + ((h / l) * (((d_1 * ((m_m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))))
else if (l <= (-2d-310)) then
tmp = sqrt((d / h)) * (t_2 * t_0)
else
tmp = (sqrt(d) / sqrt(h)) * (t_0 * sqrt((d / 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 t_0 = 1.0 - (h * (0.125 * (Math.pow((M_m * (D / d)), 2.0) / l)));
double t_1 = Math.sqrt(-d);
double t_2 = t_1 / Math.sqrt(-l);
double tmp;
if (l <= -8e-79) {
tmp = t_2 * ((t_1 / Math.sqrt(-h)) * (1.0 + ((h / l) * (Math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))));
} else if (l <= -2e-310) {
tmp = Math.sqrt((d / h)) * (t_2 * t_0);
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (t_0 * Math.sqrt((d / 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 = 1.0 - (h * (0.125 * (math.pow((M_m * (D / d)), 2.0) / l))) t_1 = math.sqrt(-d) t_2 = t_1 / math.sqrt(-l) tmp = 0 if l <= -8e-79: tmp = t_2 * ((t_1 / math.sqrt(-h)) * (1.0 + ((h / l) * (math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5)))) elif l <= -2e-310: tmp = math.sqrt((d / h)) * (t_2 * t_0) else: tmp = (math.sqrt(d) / math.sqrt(h)) * (t_0 * math.sqrt((d / 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(1.0 - Float64(h * Float64(0.125 * Float64((Float64(M_m * Float64(D / d)) ^ 2.0) / l)))) t_1 = sqrt(Float64(-d)) t_2 = Float64(t_1 / sqrt(Float64(-l))) tmp = 0.0 if (l <= -8e-79) tmp = Float64(t_2 * Float64(Float64(t_1 / 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 <= -2e-310) tmp = Float64(sqrt(Float64(d / h)) * Float64(t_2 * t_0)); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_0 * sqrt(Float64(d / 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)
t_0 = 1.0 - (h * (0.125 * (((M_m * (D / d)) ^ 2.0) / l)));
t_1 = sqrt(-d);
t_2 = t_1 / sqrt(-l);
tmp = 0.0;
if (l <= -8e-79)
tmp = t_2 * ((t_1 / sqrt(-h)) * (1.0 + ((h / l) * (((D * ((M_m / 2.0) / d)) ^ 2.0) * -0.5))));
elseif (l <= -2e-310)
tmp = sqrt((d / h)) * (t_2 * t_0);
else
tmp = (sqrt(d) / sqrt(h)) * (t_0 * sqrt((d / 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_] := Block[{t$95$0 = N[(1.0 - N[(h * N[(0.125 * N[(N[Power[N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -8e-79], N[(t$95$2 * N[(N[(t$95$1 / 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, -2e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$2 * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[Sqrt[N[(d / 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 := 1 - h \cdot \left(0.125 \cdot \frac{{\left(M\_m \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\\
t_1 := \sqrt{-d}\\
t_2 := \frac{t\_1}{\sqrt{-\ell}}\\
\mathbf{if}\;\ell \leq -8 \cdot 10^{-79}:\\
\;\;\;\;t\_2 \cdot \left(\frac{t\_1}{\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 -2 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t\_2 \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_0 \cdot \sqrt{\frac{d}{\ell}}\right)\\
\end{array}
\end{array}
if l < -8e-79Initial program 51.0%
Simplified52.2%
frac-2neg52.2%
sqrt-div68.9%
Applied egg-rr68.9%
frac-2neg68.9%
sqrt-div77.1%
Applied egg-rr77.1%
if -8e-79 < l < -1.999999999999994e-310Initial program 70.4%
Simplified72.0%
Taylor expanded in h around -inf 67.5%
associate-*r*67.5%
neg-mul-167.5%
sub-neg67.5%
distribute-lft-in67.5%
Simplified85.4%
frac-2neg72.0%
sqrt-div78.5%
Applied egg-rr98.5%
if -1.999999999999994e-310 < l Initial program 69.9%
Simplified70.7%
Taylor expanded in h around -inf 47.5%
associate-*r*47.5%
neg-mul-147.5%
sub-neg47.5%
distribute-lft-in47.5%
Simplified72.9%
sqrt-div85.3%
Applied egg-rr85.3%
Final simplification85.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
(let* ((t_0 (sqrt (/ d l)))
(t_1 (sqrt (- d)))
(t_2
(*
(/ t_1 (sqrt (- h)))
(* t_0 (+ 1.0 (/ (* (pow (* D (/ M_m d)) 2.0) (* h -0.125)) l)))))
(t_3 (pow (* M_m (/ D d)) 2.0))
(t_4 (- 1.0 (* h (* 0.125 (/ t_3 l))))))
(if (<= h -2.2e+143)
t_2
(if (<= h -1.4e-71)
(* (sqrt (/ d h)) (* (/ t_1 (sqrt (- l))) t_4))
(if (<= h -4e-310)
t_2
(if (<= h 4.8e+127)
(* (/ d (sqrt (* l h))) (+ 1.0 (* (/ h l) (* t_3 -0.125))))
(* (/ (sqrt d) (sqrt h)) (* t_4 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));
double t_1 = sqrt(-d);
double t_2 = (t_1 / sqrt(-h)) * (t_0 * (1.0 + ((pow((D * (M_m / d)), 2.0) * (h * -0.125)) / l)));
double t_3 = pow((M_m * (D / d)), 2.0);
double t_4 = 1.0 - (h * (0.125 * (t_3 / l)));
double tmp;
if (h <= -2.2e+143) {
tmp = t_2;
} else if (h <= -1.4e-71) {
tmp = sqrt((d / h)) * ((t_1 / sqrt(-l)) * t_4);
} else if (h <= -4e-310) {
tmp = t_2;
} else if (h <= 4.8e+127) {
tmp = (d / sqrt((l * h))) * (1.0 + ((h / l) * (t_3 * -0.125)));
} else {
tmp = (sqrt(d) / sqrt(h)) * (t_4 * 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) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = sqrt(-d)
t_2 = (t_1 / sqrt(-h)) * (t_0 * (1.0d0 + ((((d_1 * (m_m / d)) ** 2.0d0) * (h * (-0.125d0))) / l)))
t_3 = (m_m * (d_1 / d)) ** 2.0d0
t_4 = 1.0d0 - (h * (0.125d0 * (t_3 / l)))
if (h <= (-2.2d+143)) then
tmp = t_2
else if (h <= (-1.4d-71)) then
tmp = sqrt((d / h)) * ((t_1 / sqrt(-l)) * t_4)
else if (h <= (-4d-310)) then
tmp = t_2
else if (h <= 4.8d+127) then
tmp = (d / sqrt((l * h))) * (1.0d0 + ((h / l) * (t_3 * (-0.125d0))))
else
tmp = (sqrt(d) / sqrt(h)) * (t_4 * 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));
double t_1 = Math.sqrt(-d);
double t_2 = (t_1 / Math.sqrt(-h)) * (t_0 * (1.0 + ((Math.pow((D * (M_m / d)), 2.0) * (h * -0.125)) / l)));
double t_3 = Math.pow((M_m * (D / d)), 2.0);
double t_4 = 1.0 - (h * (0.125 * (t_3 / l)));
double tmp;
if (h <= -2.2e+143) {
tmp = t_2;
} else if (h <= -1.4e-71) {
tmp = Math.sqrt((d / h)) * ((t_1 / Math.sqrt(-l)) * t_4);
} else if (h <= -4e-310) {
tmp = t_2;
} else if (h <= 4.8e+127) {
tmp = (d / Math.sqrt((l * h))) * (1.0 + ((h / l) * (t_3 * -0.125)));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (t_4 * 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)) t_1 = math.sqrt(-d) t_2 = (t_1 / math.sqrt(-h)) * (t_0 * (1.0 + ((math.pow((D * (M_m / d)), 2.0) * (h * -0.125)) / l))) t_3 = math.pow((M_m * (D / d)), 2.0) t_4 = 1.0 - (h * (0.125 * (t_3 / l))) tmp = 0 if h <= -2.2e+143: tmp = t_2 elif h <= -1.4e-71: tmp = math.sqrt((d / h)) * ((t_1 / math.sqrt(-l)) * t_4) elif h <= -4e-310: tmp = t_2 elif h <= 4.8e+127: tmp = (d / math.sqrt((l * h))) * (1.0 + ((h / l) * (t_3 * -0.125))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * (t_4 * 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 = sqrt(Float64(d / l)) t_1 = sqrt(Float64(-d)) t_2 = Float64(Float64(t_1 / sqrt(Float64(-h))) * Float64(t_0 * Float64(1.0 + Float64(Float64((Float64(D * Float64(M_m / d)) ^ 2.0) * Float64(h * -0.125)) / l)))) t_3 = Float64(M_m * Float64(D / d)) ^ 2.0 t_4 = Float64(1.0 - Float64(h * Float64(0.125 * Float64(t_3 / l)))) tmp = 0.0 if (h <= -2.2e+143) tmp = t_2; elseif (h <= -1.4e-71) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(t_1 / sqrt(Float64(-l))) * t_4)); elseif (h <= -4e-310) tmp = t_2; elseif (h <= 4.8e+127) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(1.0 + Float64(Float64(h / l) * Float64(t_3 * -0.125)))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_4 * 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));
t_1 = sqrt(-d);
t_2 = (t_1 / sqrt(-h)) * (t_0 * (1.0 + ((((D * (M_m / d)) ^ 2.0) * (h * -0.125)) / l)));
t_3 = (M_m * (D / d)) ^ 2.0;
t_4 = 1.0 - (h * (0.125 * (t_3 / l)));
tmp = 0.0;
if (h <= -2.2e+143)
tmp = t_2;
elseif (h <= -1.4e-71)
tmp = sqrt((d / h)) * ((t_1 / sqrt(-l)) * t_4);
elseif (h <= -4e-310)
tmp = t_2;
elseif (h <= 4.8e+127)
tmp = (d / sqrt((l * h))) * (1.0 + ((h / l) * (t_3 * -0.125)));
else
tmp = (sqrt(d) / sqrt(h)) * (t_4 * 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[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 + N[(N[(N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * -0.125), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[(1.0 - N[(h * N[(0.125 * N[(t$95$3 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -2.2e+143], t$95$2, If[LessEqual[h, -1.4e-71], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$4), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -4e-310], t$95$2, If[LessEqual[h, 4.8e+127], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(t$95$3 * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$4 * t$95$0), $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 := \sqrt{-d}\\
t_2 := \frac{t\_1}{\sqrt{-h}} \cdot \left(t\_0 \cdot \left(1 + \frac{{\left(D \cdot \frac{M\_m}{d}\right)}^{2} \cdot \left(h \cdot -0.125\right)}{\ell}\right)\right)\\
t_3 := {\left(M\_m \cdot \frac{D}{d}\right)}^{2}\\
t_4 := 1 - h \cdot \left(0.125 \cdot \frac{t\_3}{\ell}\right)\\
\mathbf{if}\;h \leq -2.2 \cdot 10^{+143}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;h \leq -1.4 \cdot 10^{-71}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t\_1}{\sqrt{-\ell}} \cdot t\_4\right)\\
\mathbf{elif}\;h \leq -4 \cdot 10^{-310}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;h \leq 4.8 \cdot 10^{+127}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(t\_3 \cdot -0.125\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_4 \cdot t\_0\right)\\
\end{array}
\end{array}
if h < -2.20000000000000014e143 or -1.4e-71 < h < -3.999999999999988e-310Initial program 56.9%
Simplified56.9%
Taylor expanded in h around -inf 49.0%
associate-*r*49.0%
neg-mul-149.0%
sub-neg49.0%
distribute-lft-in49.0%
Simplified62.9%
pow162.9%
associate-*r*62.9%
Applied egg-rr62.9%
unpow162.9%
*-commutative62.9%
unpow262.9%
*-commutative62.9%
*-commutative62.9%
swap-sqr52.9%
times-frac49.2%
unpow249.2%
unpow249.2%
unpow249.2%
associate-*r/46.5%
times-frac49.0%
associate-/r*51.2%
associate-*l/51.2%
Simplified62.8%
frac-2neg56.9%
sqrt-div74.7%
Applied egg-rr80.7%
if -2.20000000000000014e143 < h < -1.4e-71Initial program 60.4%
Simplified63.7%
Taylor expanded in h around -inf 44.9%
associate-*r*44.9%
neg-mul-144.9%
sub-neg44.9%
distribute-lft-in44.9%
Simplified69.5%
frac-2neg63.5%
sqrt-div75.2%
Applied egg-rr87.4%
if -3.999999999999988e-310 < h < 4.8000000000000004e127Initial program 75.6%
Simplified76.6%
pow176.6%
sqrt-unprod67.6%
Applied egg-rr67.6%
unpow167.6%
Simplified67.6%
Taylor expanded in M around 0 40.4%
*-commutative40.4%
associate-*r*41.4%
times-frac43.6%
*-commutative43.6%
associate-/l*43.6%
unpow243.6%
unpow243.6%
unpow243.6%
times-frac49.2%
swap-sqr67.6%
unpow267.6%
associate-*r/66.5%
*-commutative66.5%
associate-/l*67.6%
Simplified67.6%
pow167.6%
*-commutative67.6%
associate-*l*67.6%
frac-times59.1%
sqrt-div64.7%
sqrt-unprod91.3%
add-sqr-sqrt91.6%
Applied egg-rr91.6%
unpow191.6%
*-commutative91.6%
sub-neg91.6%
distribute-rgt-neg-in91.6%
*-commutative91.6%
distribute-lft-neg-in91.6%
metadata-eval91.6%
associate-*r*91.6%
*-commutative91.6%
*-commutative91.6%
associate-*r/90.5%
*-commutative90.5%
associate-/l*91.6%
Simplified91.6%
if 4.8000000000000004e127 < h Initial program 53.2%
Simplified53.2%
Taylor expanded in h around -inf 44.2%
associate-*r*44.2%
neg-mul-144.2%
sub-neg44.2%
distribute-lft-in44.2%
Simplified61.8%
sqrt-div81.8%
Applied egg-rr81.8%
Final simplification86.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
(let* ((t_0 (pow (* M_m (/ D d)) 2.0))
(t_1 (sqrt (- d)))
(t_2 (pow (* D (/ M_m d)) 2.0))
(t_3 (sqrt (/ d l))))
(if (<= h -7e-76)
(*
(sqrt (/ d h))
(* (/ t_1 (sqrt (- l))) (+ 1.0 (/ (* t_2 (* h -0.125)) l))))
(if (<= h -4.5e-303)
(* (* (/ t_1 (sqrt (- h))) t_3) (- 1.0 (* 0.125 (* (/ h l) t_2))))
(if (<= h 6e+125)
(* (/ d (sqrt (* l h))) (+ 1.0 (* (/ h l) (* t_0 -0.125))))
(*
(/ (sqrt d) (sqrt h))
(* (- 1.0 (* h (* 0.125 (/ t_0 l)))) t_3)))))))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 t_1 = sqrt(-d);
double t_2 = pow((D * (M_m / d)), 2.0);
double t_3 = sqrt((d / l));
double tmp;
if (h <= -7e-76) {
tmp = sqrt((d / h)) * ((t_1 / sqrt(-l)) * (1.0 + ((t_2 * (h * -0.125)) / l)));
} else if (h <= -4.5e-303) {
tmp = ((t_1 / sqrt(-h)) * t_3) * (1.0 - (0.125 * ((h / l) * t_2)));
} else if (h <= 6e+125) {
tmp = (d / sqrt((l * h))) * (1.0 + ((h / l) * (t_0 * -0.125)));
} else {
tmp = (sqrt(d) / sqrt(h)) * ((1.0 - (h * (0.125 * (t_0 / l)))) * t_3);
}
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) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = (m_m * (d_1 / d)) ** 2.0d0
t_1 = sqrt(-d)
t_2 = (d_1 * (m_m / d)) ** 2.0d0
t_3 = sqrt((d / l))
if (h <= (-7d-76)) then
tmp = sqrt((d / h)) * ((t_1 / sqrt(-l)) * (1.0d0 + ((t_2 * (h * (-0.125d0))) / l)))
else if (h <= (-4.5d-303)) then
tmp = ((t_1 / sqrt(-h)) * t_3) * (1.0d0 - (0.125d0 * ((h / l) * t_2)))
else if (h <= 6d+125) then
tmp = (d / sqrt((l * h))) * (1.0d0 + ((h / l) * (t_0 * (-0.125d0))))
else
tmp = (sqrt(d) / sqrt(h)) * ((1.0d0 - (h * (0.125d0 * (t_0 / l)))) * t_3)
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);
double t_1 = Math.sqrt(-d);
double t_2 = Math.pow((D * (M_m / d)), 2.0);
double t_3 = Math.sqrt((d / l));
double tmp;
if (h <= -7e-76) {
tmp = Math.sqrt((d / h)) * ((t_1 / Math.sqrt(-l)) * (1.0 + ((t_2 * (h * -0.125)) / l)));
} else if (h <= -4.5e-303) {
tmp = ((t_1 / Math.sqrt(-h)) * t_3) * (1.0 - (0.125 * ((h / l) * t_2)));
} else if (h <= 6e+125) {
tmp = (d / Math.sqrt((l * h))) * (1.0 + ((h / l) * (t_0 * -0.125)));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * ((1.0 - (h * (0.125 * (t_0 / l)))) * t_3);
}
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) t_1 = math.sqrt(-d) t_2 = math.pow((D * (M_m / d)), 2.0) t_3 = math.sqrt((d / l)) tmp = 0 if h <= -7e-76: tmp = math.sqrt((d / h)) * ((t_1 / math.sqrt(-l)) * (1.0 + ((t_2 * (h * -0.125)) / l))) elif h <= -4.5e-303: tmp = ((t_1 / math.sqrt(-h)) * t_3) * (1.0 - (0.125 * ((h / l) * t_2))) elif h <= 6e+125: tmp = (d / math.sqrt((l * h))) * (1.0 + ((h / l) * (t_0 * -0.125))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * ((1.0 - (h * (0.125 * (t_0 / l)))) * t_3) 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 t_1 = sqrt(Float64(-d)) t_2 = Float64(D * Float64(M_m / d)) ^ 2.0 t_3 = sqrt(Float64(d / l)) tmp = 0.0 if (h <= -7e-76) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(t_1 / sqrt(Float64(-l))) * Float64(1.0 + Float64(Float64(t_2 * Float64(h * -0.125)) / l)))); elseif (h <= -4.5e-303) tmp = Float64(Float64(Float64(t_1 / sqrt(Float64(-h))) * t_3) * Float64(1.0 - Float64(0.125 * Float64(Float64(h / l) * t_2)))); elseif (h <= 6e+125) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(1.0 + Float64(Float64(h / l) * Float64(t_0 * -0.125)))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(Float64(1.0 - Float64(h * Float64(0.125 * Float64(t_0 / l)))) * t_3)); 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;
t_1 = sqrt(-d);
t_2 = (D * (M_m / d)) ^ 2.0;
t_3 = sqrt((d / l));
tmp = 0.0;
if (h <= -7e-76)
tmp = sqrt((d / h)) * ((t_1 / sqrt(-l)) * (1.0 + ((t_2 * (h * -0.125)) / l)));
elseif (h <= -4.5e-303)
tmp = ((t_1 / sqrt(-h)) * t_3) * (1.0 - (0.125 * ((h / l) * t_2)));
elseif (h <= 6e+125)
tmp = (d / sqrt((l * h))) * (1.0 + ((h / l) * (t_0 * -0.125)));
else
tmp = (sqrt(d) / sqrt(h)) * ((1.0 - (h * (0.125 * (t_0 / l)))) * t_3);
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[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -7e-76], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(t$95$2 * N[(h * -0.125), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -4.5e-303], N[(N[(N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision] * N[(1.0 - N[(0.125 * N[(N[(h / l), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 6e+125], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(t$95$0 * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 - N[(h * N[(0.125 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$3), $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}\\
t_1 := \sqrt{-d}\\
t_2 := {\left(D \cdot \frac{M\_m}{d}\right)}^{2}\\
t_3 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;h \leq -7 \cdot 10^{-76}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t\_1}{\sqrt{-\ell}} \cdot \left(1 + \frac{t\_2 \cdot \left(h \cdot -0.125\right)}{\ell}\right)\right)\\
\mathbf{elif}\;h \leq -4.5 \cdot 10^{-303}:\\
\;\;\;\;\left(\frac{t\_1}{\sqrt{-h}} \cdot t\_3\right) \cdot \left(1 - 0.125 \cdot \left(\frac{h}{\ell} \cdot t\_2\right)\right)\\
\mathbf{elif}\;h \leq 6 \cdot 10^{+125}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(t\_0 \cdot -0.125\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\left(1 - h \cdot \left(0.125 \cdot \frac{t\_0}{\ell}\right)\right) \cdot t\_3\right)\\
\end{array}
\end{array}
if h < -6.99999999999999995e-76Initial program 52.2%
Simplified54.1%
Taylor expanded in h around -inf 42.0%
associate-*r*42.0%
neg-mul-142.0%
sub-neg42.0%
distribute-lft-in42.0%
Simplified62.4%
pow162.4%
associate-*r*62.4%
Applied egg-rr62.4%
unpow162.4%
*-commutative62.4%
unpow262.4%
*-commutative62.4%
*-commutative62.4%
swap-sqr54.1%
times-frac45.3%
unpow245.3%
unpow245.3%
unpow245.3%
associate-*r/43.0%
times-frac42.0%
associate-/r*47.0%
associate-*l/47.0%
Simplified62.4%
frac-2neg62.8%
sqrt-div73.6%
Applied egg-rr72.4%
if -6.99999999999999995e-76 < h < -4.5000000000000001e-303Initial program 74.6%
Simplified74.6%
frac-2neg74.6%
sqrt-div89.2%
Applied egg-rr89.2%
Taylor expanded in M around 0 68.1%
*-commutative51.2%
associate-*r*51.2%
times-frac51.5%
*-commutative51.5%
associate-/l*51.5%
unpow251.5%
unpow251.5%
unpow251.5%
times-frac54.6%
swap-sqr62.6%
unpow262.6%
associate-*r/62.6%
*-commutative62.6%
associate-/l*62.6%
Simplified89.2%
if -4.5000000000000001e-303 < h < 6.0000000000000003e125Initial program 74.8%
Simplified75.8%
pow175.8%
sqrt-unprod66.9%
Applied egg-rr66.9%
unpow166.9%
Simplified66.9%
Taylor expanded in M around 0 40.1%
*-commutative40.1%
associate-*r*41.2%
times-frac43.2%
*-commutative43.2%
associate-/l*43.1%
unpow243.1%
unpow243.1%
unpow243.1%
times-frac48.6%
swap-sqr66.9%
unpow266.9%
associate-*r/65.8%
*-commutative65.8%
associate-/l*66.9%
Simplified66.9%
pow166.9%
*-commutative66.9%
associate-*l*66.9%
frac-times58.5%
sqrt-div64.0%
sqrt-unprod90.3%
add-sqr-sqrt90.6%
Applied egg-rr90.6%
unpow190.6%
*-commutative90.6%
sub-neg90.6%
distribute-rgt-neg-in90.6%
*-commutative90.6%
distribute-lft-neg-in90.6%
metadata-eval90.6%
associate-*r*90.6%
*-commutative90.6%
*-commutative90.6%
associate-*r/89.5%
*-commutative89.5%
associate-/l*90.6%
Simplified90.6%
if 6.0000000000000003e125 < h Initial program 53.2%
Simplified53.2%
Taylor expanded in h around -inf 44.2%
associate-*r*44.2%
neg-mul-144.2%
sub-neg44.2%
distribute-lft-in44.2%
Simplified61.8%
sqrt-div81.8%
Applied egg-rr81.8%
Final simplification82.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 (+ 1.0 (/ (* (pow (* D (/ M_m d)) 2.0) (* h -0.125)) l)))
(t_2 (sqrt (- d))))
(if (<= l -1.55e-184)
(* (/ t_2 (sqrt (- h))) (* t_0 t_1))
(if (<= l -2e-310)
(* (sqrt (/ d h)) (* (/ t_2 (sqrt (- l))) t_1))
(*
(/ (sqrt d) (sqrt h))
(* (- 1.0 (* h (* 0.125 (/ (pow (* M_m (/ D d)) 2.0) 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));
double t_1 = 1.0 + ((pow((D * (M_m / d)), 2.0) * (h * -0.125)) / l);
double t_2 = sqrt(-d);
double tmp;
if (l <= -1.55e-184) {
tmp = (t_2 / sqrt(-h)) * (t_0 * t_1);
} else if (l <= -2e-310) {
tmp = sqrt((d / h)) * ((t_2 / sqrt(-l)) * t_1);
} else {
tmp = (sqrt(d) / sqrt(h)) * ((1.0 - (h * (0.125 * (pow((M_m * (D / d)), 2.0) / l)))) * 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = 1.0d0 + ((((d_1 * (m_m / d)) ** 2.0d0) * (h * (-0.125d0))) / l)
t_2 = sqrt(-d)
if (l <= (-1.55d-184)) then
tmp = (t_2 / sqrt(-h)) * (t_0 * t_1)
else if (l <= (-2d-310)) then
tmp = sqrt((d / h)) * ((t_2 / sqrt(-l)) * t_1)
else
tmp = (sqrt(d) / sqrt(h)) * ((1.0d0 - (h * (0.125d0 * (((m_m * (d_1 / d)) ** 2.0d0) / l)))) * 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));
double t_1 = 1.0 + ((Math.pow((D * (M_m / d)), 2.0) * (h * -0.125)) / l);
double t_2 = Math.sqrt(-d);
double tmp;
if (l <= -1.55e-184) {
tmp = (t_2 / Math.sqrt(-h)) * (t_0 * t_1);
} else if (l <= -2e-310) {
tmp = Math.sqrt((d / h)) * ((t_2 / Math.sqrt(-l)) * t_1);
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * ((1.0 - (h * (0.125 * (Math.pow((M_m * (D / d)), 2.0) / l)))) * 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)) t_1 = 1.0 + ((math.pow((D * (M_m / d)), 2.0) * (h * -0.125)) / l) t_2 = math.sqrt(-d) tmp = 0 if l <= -1.55e-184: tmp = (t_2 / math.sqrt(-h)) * (t_0 * t_1) elif l <= -2e-310: tmp = math.sqrt((d / h)) * ((t_2 / math.sqrt(-l)) * t_1) else: tmp = (math.sqrt(d) / math.sqrt(h)) * ((1.0 - (h * (0.125 * (math.pow((M_m * (D / d)), 2.0) / l)))) * 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 = sqrt(Float64(d / l)) t_1 = Float64(1.0 + Float64(Float64((Float64(D * Float64(M_m / d)) ^ 2.0) * Float64(h * -0.125)) / l)) t_2 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -1.55e-184) tmp = Float64(Float64(t_2 / sqrt(Float64(-h))) * Float64(t_0 * t_1)); elseif (l <= -2e-310) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(t_2 / sqrt(Float64(-l))) * t_1)); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(Float64(1.0 - Float64(h * Float64(0.125 * Float64((Float64(M_m * Float64(D / d)) ^ 2.0) / l)))) * 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));
t_1 = 1.0 + ((((D * (M_m / d)) ^ 2.0) * (h * -0.125)) / l);
t_2 = sqrt(-d);
tmp = 0.0;
if (l <= -1.55e-184)
tmp = (t_2 / sqrt(-h)) * (t_0 * t_1);
elseif (l <= -2e-310)
tmp = sqrt((d / h)) * ((t_2 / sqrt(-l)) * t_1);
else
tmp = (sqrt(d) / sqrt(h)) * ((1.0 - (h * (0.125 * (((M_m * (D / d)) ^ 2.0) / l)))) * 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[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(N[(N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * -0.125), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -1.55e-184], N[(N[(t$95$2 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$2 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 - N[(h * N[(0.125 * N[(N[Power[N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $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 := 1 + \frac{{\left(D \cdot \frac{M\_m}{d}\right)}^{2} \cdot \left(h \cdot -0.125\right)}{\ell}\\
t_2 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -1.55 \cdot 10^{-184}:\\
\;\;\;\;\frac{t\_2}{\sqrt{-h}} \cdot \left(t\_0 \cdot t\_1\right)\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t\_2}{\sqrt{-\ell}} \cdot t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\left(1 - h \cdot \left(0.125 \cdot \frac{{\left(M\_m \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right) \cdot t\_0\right)\\
\end{array}
\end{array}
if l < -1.5500000000000001e-184Initial program 55.7%
Simplified57.5%
Taylor expanded in h around -inf 42.1%
associate-*r*42.1%
neg-mul-142.1%
sub-neg42.1%
distribute-lft-in42.1%
Simplified61.2%
pow161.2%
associate-*r*61.2%
Applied egg-rr61.2%
unpow161.2%
*-commutative61.2%
unpow261.2%
*-commutative61.2%
*-commutative61.2%
swap-sqr52.4%
times-frac43.2%
unpow243.2%
unpow243.2%
unpow243.2%
associate-*r/42.2%
times-frac42.1%
associate-/r*44.8%
associate-*l/44.8%
Simplified61.2%
frac-2neg57.5%
sqrt-div71.2%
Applied egg-rr74.9%
if -1.5500000000000001e-184 < l < -1.999999999999994e-310Initial program 66.4%
Simplified66.4%
Taylor expanded in h around -inf 63.1%
associate-*r*63.1%
neg-mul-163.1%
sub-neg63.1%
distribute-lft-in63.1%
Simplified79.3%
pow179.3%
associate-*r*79.3%
Applied egg-rr79.3%
unpow179.3%
*-commutative79.3%
unpow279.3%
*-commutative79.3%
*-commutative79.3%
swap-sqr73.1%
times-frac72.4%
unpow272.4%
unpow272.4%
unpow272.4%
associate-*r/62.7%
times-frac63.1%
associate-/r*72.4%
associate-*l/72.4%
Simplified79.2%
frac-2neg66.4%
sqrt-div76.4%
Applied egg-rr98.0%
if -1.999999999999994e-310 < l Initial program 69.9%
Simplified70.7%
Taylor expanded in h around -inf 47.5%
associate-*r*47.5%
neg-mul-147.5%
sub-neg47.5%
distribute-lft-in47.5%
Simplified72.9%
sqrt-div85.3%
Applied egg-rr85.3%
Final simplification82.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 -4e-310)
(*
(sqrt (/ d h))
(*
(/ (sqrt (- d)) (sqrt (- l)))
(+ 1.0 (/ (* (pow (* D (/ M_m d)) 2.0) (* h -0.125)) l))))
(if (<= h 6.4e+125)
(* (/ d (sqrt (* l h))) (+ 1.0 (* (/ h l) (* t_0 -0.125))))
(*
(/ (sqrt d) (sqrt h))
(* (- 1.0 (* h (* 0.125 (/ t_0 l)))) (sqrt (/ d 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 <= -4e-310) {
tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0 + ((pow((D * (M_m / d)), 2.0) * (h * -0.125)) / l)));
} else if (h <= 6.4e+125) {
tmp = (d / sqrt((l * h))) * (1.0 + ((h / l) * (t_0 * -0.125)));
} else {
tmp = (sqrt(d) / sqrt(h)) * ((1.0 - (h * (0.125 * (t_0 / l)))) * sqrt((d / 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) :: t_0
real(8) :: tmp
t_0 = (m_m * (d_1 / d)) ** 2.0d0
if (h <= (-4d-310)) then
tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0d0 + ((((d_1 * (m_m / d)) ** 2.0d0) * (h * (-0.125d0))) / l)))
else if (h <= 6.4d+125) then
tmp = (d / sqrt((l * h))) * (1.0d0 + ((h / l) * (t_0 * (-0.125d0))))
else
tmp = (sqrt(d) / sqrt(h)) * ((1.0d0 - (h * (0.125d0 * (t_0 / l)))) * sqrt((d / 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 t_0 = Math.pow((M_m * (D / d)), 2.0);
double tmp;
if (h <= -4e-310) {
tmp = Math.sqrt((d / h)) * ((Math.sqrt(-d) / Math.sqrt(-l)) * (1.0 + ((Math.pow((D * (M_m / d)), 2.0) * (h * -0.125)) / l)));
} else if (h <= 6.4e+125) {
tmp = (d / Math.sqrt((l * h))) * (1.0 + ((h / l) * (t_0 * -0.125)));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * ((1.0 - (h * (0.125 * (t_0 / l)))) * Math.sqrt((d / 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((M_m * (D / d)), 2.0) tmp = 0 if h <= -4e-310: tmp = math.sqrt((d / h)) * ((math.sqrt(-d) / math.sqrt(-l)) * (1.0 + ((math.pow((D * (M_m / d)), 2.0) * (h * -0.125)) / l))) elif h <= 6.4e+125: tmp = (d / math.sqrt((l * h))) * (1.0 + ((h / l) * (t_0 * -0.125))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * ((1.0 - (h * (0.125 * (t_0 / l)))) * math.sqrt((d / 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 <= -4e-310) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * Float64(1.0 + Float64(Float64((Float64(D * Float64(M_m / d)) ^ 2.0) * Float64(h * -0.125)) / l)))); elseif (h <= 6.4e+125) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(1.0 + Float64(Float64(h / l) * Float64(t_0 * -0.125)))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(Float64(1.0 - Float64(h * Float64(0.125 * Float64(t_0 / l)))) * sqrt(Float64(d / 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)
t_0 = (M_m * (D / d)) ^ 2.0;
tmp = 0.0;
if (h <= -4e-310)
tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0 + ((((D * (M_m / d)) ^ 2.0) * (h * -0.125)) / l)));
elseif (h <= 6.4e+125)
tmp = (d / sqrt((l * h))) * (1.0 + ((h / l) * (t_0 * -0.125)));
else
tmp = (sqrt(d) / sqrt(h)) * ((1.0 - (h * (0.125 * (t_0 / l)))) * sqrt((d / 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_] := Block[{t$95$0 = N[Power[N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[h, -4e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * -0.125), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 6.4e+125], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(t$95$0 * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 - N[(h * N[(0.125 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / 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 := {\left(M\_m \cdot \frac{D}{d}\right)}^{2}\\
\mathbf{if}\;h \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 + \frac{{\left(D \cdot \frac{M\_m}{d}\right)}^{2} \cdot \left(h \cdot -0.125\right)}{\ell}\right)\right)\\
\mathbf{elif}\;h \leq 6.4 \cdot 10^{+125}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(t\_0 \cdot -0.125\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\left(1 - h \cdot \left(0.125 \cdot \frac{t\_0}{\ell}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\
\end{array}
\end{array}
if h < -3.999999999999988e-310Initial program 58.3%
Simplified59.7%
Taylor expanded in h around -inf 47.3%
associate-*r*47.3%
neg-mul-147.3%
sub-neg47.3%
distribute-lft-in47.3%
Simplified65.6%
pow165.6%
associate-*r*65.6%
Applied egg-rr65.6%
unpow165.6%
*-commutative65.6%
unpow265.6%
*-commutative65.6%
*-commutative65.6%
swap-sqr57.5%
times-frac50.4%
unpow250.4%
unpow250.4%
unpow250.4%
associate-*r/47.3%
times-frac47.3%
associate-/r*51.6%
associate-*l/51.6%
Simplified65.6%
frac-2neg70.1%
sqrt-div77.6%
Applied egg-rr73.4%
if -3.999999999999988e-310 < h < 6.39999999999999967e125Initial program 75.6%
Simplified76.6%
pow176.6%
sqrt-unprod67.6%
Applied egg-rr67.6%
unpow167.6%
Simplified67.6%
Taylor expanded in M around 0 40.4%
*-commutative40.4%
associate-*r*41.4%
times-frac43.6%
*-commutative43.6%
associate-/l*43.6%
unpow243.6%
unpow243.6%
unpow243.6%
times-frac49.2%
swap-sqr67.6%
unpow267.6%
associate-*r/66.5%
*-commutative66.5%
associate-/l*67.6%
Simplified67.6%
pow167.6%
*-commutative67.6%
associate-*l*67.6%
frac-times59.1%
sqrt-div64.7%
sqrt-unprod91.3%
add-sqr-sqrt91.6%
Applied egg-rr91.6%
unpow191.6%
*-commutative91.6%
sub-neg91.6%
distribute-rgt-neg-in91.6%
*-commutative91.6%
distribute-lft-neg-in91.6%
metadata-eval91.6%
associate-*r*91.6%
*-commutative91.6%
*-commutative91.6%
associate-*r/90.5%
*-commutative90.5%
associate-/l*91.6%
Simplified91.6%
if 6.39999999999999967e125 < h Initial program 53.2%
Simplified53.2%
Taylor expanded in h around -inf 44.2%
associate-*r*44.2%
neg-mul-144.2%
sub-neg44.2%
distribute-lft-in44.2%
Simplified61.8%
sqrt-div81.8%
Applied egg-rr81.8%
Final simplification81.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 (* d (sqrt (/ 1.0 (* l h)))))
(t_1 (pow (* D (/ M_m d)) 2.0))
(t_2
(*
(sqrt (/ d h))
(* (sqrt (/ d l)) (+ 1.0 (/ (* t_1 (* h -0.125)) l))))))
(if (<= d -3.6e+159)
(* t_0 (+ -1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D d)) 2.0)))))
(if (<= d -4.4e-106)
t_2
(if (<= d -8.5e-308)
(* t_0 (+ (* 0.125 (* (/ h l) t_1)) -1.0))
(if (<= d 6.6e-155)
(* d (/ (fma (* t_1 0.25) (* (/ h l) -0.5) 1.0) (sqrt (* l h))))
(if (<= d 4.1e+113) t_2 (* 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 = d * sqrt((1.0 / (l * h)));
double t_1 = pow((D * (M_m / d)), 2.0);
double t_2 = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + ((t_1 * (h * -0.125)) / l)));
double tmp;
if (d <= -3.6e+159) {
tmp = t_0 * (-1.0 + (0.5 * ((h / l) * pow(((M_m / 2.0) * (D / d)), 2.0))));
} else if (d <= -4.4e-106) {
tmp = t_2;
} else if (d <= -8.5e-308) {
tmp = t_0 * ((0.125 * ((h / l) * t_1)) + -1.0);
} else if (d <= 6.6e-155) {
tmp = d * (fma((t_1 * 0.25), ((h / l) * -0.5), 1.0) / sqrt((l * h)));
} else if (d <= 4.1e+113) {
tmp = t_2;
} else {
tmp = d * (sqrt((1.0 / 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 * sqrt(Float64(1.0 / Float64(l * h)))) t_1 = Float64(D * Float64(M_m / d)) ^ 2.0 t_2 = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(t_1 * Float64(h * -0.125)) / l)))) tmp = 0.0 if (d <= -3.6e+159) tmp = Float64(t_0 * Float64(-1.0 + Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0))))); elseif (d <= -4.4e-106) tmp = t_2; elseif (d <= -8.5e-308) tmp = Float64(t_0 * Float64(Float64(0.125 * Float64(Float64(h / l) * t_1)) + -1.0)); elseif (d <= 6.6e-155) tmp = Float64(d * Float64(fma(Float64(t_1 * 0.25), Float64(Float64(h / l) * -0.5), 1.0) / sqrt(Float64(l * h)))); elseif (d <= 4.1e+113) tmp = t_2; 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[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(t$95$1 * N[(h * -0.125), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -3.6e+159], N[(t$95$0 * 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], If[LessEqual[d, -4.4e-106], t$95$2, If[LessEqual[d, -8.5e-308], N[(t$95$0 * N[(N[(0.125 * N[(N[(h / l), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6.6e-155], N[(d * N[(N[(N[(t$95$1 * 0.25), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4.1e+113], t$95$2, 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 := d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
t_1 := {\left(D \cdot \frac{M\_m}{d}\right)}^{2}\\
t_2 := \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{t\_1 \cdot \left(h \cdot -0.125\right)}{\ell}\right)\right)\\
\mathbf{if}\;d \leq -3.6 \cdot 10^{+159}:\\
\;\;\;\;t\_0 \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{elif}\;d \leq -4.4 \cdot 10^{-106}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d \leq -8.5 \cdot 10^{-308}:\\
\;\;\;\;t\_0 \cdot \left(0.125 \cdot \left(\frac{h}{\ell} \cdot t\_1\right) + -1\right)\\
\mathbf{elif}\;d \leq 6.6 \cdot 10^{-155}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(t\_1 \cdot 0.25, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{elif}\;d \leq 4.1 \cdot 10^{+113}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -3.60000000000000037e159Initial program 55.0%
Simplified59.4%
pow159.4%
sqrt-unprod51.4%
Applied egg-rr51.4%
unpow151.4%
associate-*l/43.1%
associate-*r/26.4%
unpow226.4%
Simplified26.4%
Taylor expanded in d around -inf 82.5%
if -3.60000000000000037e159 < d < -4.39999999999999989e-106 or 6.59999999999999972e-155 < d < 4.09999999999999993e113Initial program 78.0%
Simplified78.0%
Taylor expanded in h around -inf 60.8%
associate-*r*60.8%
neg-mul-160.8%
sub-neg60.8%
distribute-lft-in60.8%
Simplified86.1%
pow186.1%
associate-*r*86.1%
Applied egg-rr86.1%
unpow186.1%
*-commutative86.1%
unpow286.1%
*-commutative86.1%
*-commutative86.1%
swap-sqr68.5%
times-frac65.2%
unpow265.2%
unpow265.2%
unpow265.2%
associate-*r/62.1%
times-frac60.8%
associate-/r*67.2%
associate-*l/66.5%
Simplified85.3%
if -4.39999999999999989e-106 < d < -8.49999999999999972e-308Initial program 40.1%
Simplified42.1%
pow142.1%
sqrt-unprod32.2%
Applied egg-rr32.2%
unpow132.2%
Simplified32.2%
Taylor expanded in M around 0 22.6%
*-commutative22.6%
associate-*r*22.6%
times-frac22.6%
*-commutative22.6%
associate-/l*22.6%
unpow222.6%
unpow222.6%
unpow222.6%
times-frac29.5%
swap-sqr32.2%
unpow232.2%
associate-*r/32.2%
*-commutative32.2%
associate-/l*32.2%
Simplified32.2%
Taylor expanded in d around -inf 56.9%
if -8.49999999999999972e-308 < d < 6.59999999999999972e-155Initial program 44.3%
Simplified44.3%
pow144.3%
sqrt-unprod32.8%
Applied egg-rr32.8%
unpow132.8%
associate-*l/28.7%
associate-*r/9.5%
unpow29.5%
Simplified9.5%
pow19.5%
associate-/l/9.5%
sqrt-div12.0%
unpow212.0%
sqrt-prod74.7%
add-sqr-sqrt75.0%
cancel-sign-sub-inv75.0%
metadata-eval75.0%
*-commutative75.0%
div-inv75.0%
metadata-eval75.0%
Applied egg-rr75.0%
unpow175.0%
associate-*l/77.5%
associate-/l*77.5%
Simplified77.4%
if 4.09999999999999993e113 < d Initial program 61.4%
Simplified63.9%
Taylor expanded in d around inf 84.9%
associate-/r*85.7%
sqrt-div89.6%
Applied egg-rr89.6%
Final simplification80.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 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D d)) 2.0))))
(t_1 (* d (sqrt (/ 1.0 (* l h)))))
(t_2 (pow (* D (/ M_m d)) 2.0)))
(if (<= d -8.6e+158)
(* t_1 (+ -1.0 t_0))
(if (<= d -8.8e-106)
(* (sqrt (/ d h)) (* (sqrt (/ d l)) (+ 1.0 (/ (* t_2 (* h -0.125)) l))))
(if (<= d -8.5e-308)
(* t_1 (+ (* 0.125 (* (/ h l) t_2)) -1.0))
(* (- 1.0 t_0) (/ (/ d (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 = 0.5 * ((h / l) * pow(((M_m / 2.0) * (D / d)), 2.0));
double t_1 = d * sqrt((1.0 / (l * h)));
double t_2 = pow((D * (M_m / d)), 2.0);
double tmp;
if (d <= -8.6e+158) {
tmp = t_1 * (-1.0 + t_0);
} else if (d <= -8.8e-106) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + ((t_2 * (h * -0.125)) / l)));
} else if (d <= -8.5e-308) {
tmp = t_1 * ((0.125 * ((h / l) * t_2)) + -1.0);
} else {
tmp = (1.0 - t_0) * ((d / sqrt(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) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = 0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_1 / d)) ** 2.0d0))
t_1 = d * sqrt((1.0d0 / (l * h)))
t_2 = (d_1 * (m_m / d)) ** 2.0d0
if (d <= (-8.6d+158)) then
tmp = t_1 * ((-1.0d0) + t_0)
else if (d <= (-8.8d-106)) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 + ((t_2 * (h * (-0.125d0))) / l)))
else if (d <= (-8.5d-308)) then
tmp = t_1 * ((0.125d0 * ((h / l) * t_2)) + (-1.0d0))
else
tmp = (1.0d0 - t_0) * ((d / sqrt(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 t_0 = 0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D / d)), 2.0));
double t_1 = d * Math.sqrt((1.0 / (l * h)));
double t_2 = Math.pow((D * (M_m / d)), 2.0);
double tmp;
if (d <= -8.6e+158) {
tmp = t_1 * (-1.0 + t_0);
} else if (d <= -8.8e-106) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 + ((t_2 * (h * -0.125)) / l)));
} else if (d <= -8.5e-308) {
tmp = t_1 * ((0.125 * ((h / l) * t_2)) + -1.0);
} else {
tmp = (1.0 - t_0) * ((d / Math.sqrt(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 = 0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D / d)), 2.0)) t_1 = d * math.sqrt((1.0 / (l * h))) t_2 = math.pow((D * (M_m / d)), 2.0) tmp = 0 if d <= -8.6e+158: tmp = t_1 * (-1.0 + t_0) elif d <= -8.8e-106: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 + ((t_2 * (h * -0.125)) / l))) elif d <= -8.5e-308: tmp = t_1 * ((0.125 * ((h / l) * t_2)) + -1.0) else: tmp = (1.0 - t_0) * ((d / math.sqrt(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(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0))) t_1 = Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) t_2 = Float64(D * Float64(M_m / d)) ^ 2.0 tmp = 0.0 if (d <= -8.6e+158) tmp = Float64(t_1 * Float64(-1.0 + t_0)); elseif (d <= -8.8e-106) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(t_2 * Float64(h * -0.125)) / l)))); elseif (d <= -8.5e-308) tmp = Float64(t_1 * Float64(Float64(0.125 * Float64(Float64(h / l) * t_2)) + -1.0)); else tmp = Float64(Float64(1.0 - t_0) * Float64(Float64(d / sqrt(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)
t_0 = 0.5 * ((h / l) * (((M_m / 2.0) * (D / d)) ^ 2.0));
t_1 = d * sqrt((1.0 / (l * h)));
t_2 = (D * (M_m / d)) ^ 2.0;
tmp = 0.0;
if (d <= -8.6e+158)
tmp = t_1 * (-1.0 + t_0);
elseif (d <= -8.8e-106)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + ((t_2 * (h * -0.125)) / l)));
elseif (d <= -8.5e-308)
tmp = t_1 * ((0.125 * ((h / l) * t_2)) + -1.0);
else
tmp = (1.0 - t_0) * ((d / sqrt(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_] := Block[{t$95$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]}, Block[{t$95$1 = N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[d, -8.6e+158], N[(t$95$1 * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -8.8e-106], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(t$95$2 * N[(h * -0.125), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -8.5e-308], N[(t$95$1 * N[(N[(0.125 * N[(N[(h / l), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$0), $MachinePrecision] * N[(N[(d / N[Sqrt[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 := 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right)\\
t_1 := d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
t_2 := {\left(D \cdot \frac{M\_m}{d}\right)}^{2}\\
\mathbf{if}\;d \leq -8.6 \cdot 10^{+158}:\\
\;\;\;\;t\_1 \cdot \left(-1 + t\_0\right)\\
\mathbf{elif}\;d \leq -8.8 \cdot 10^{-106}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{t\_2 \cdot \left(h \cdot -0.125\right)}{\ell}\right)\right)\\
\mathbf{elif}\;d \leq -8.5 \cdot 10^{-308}:\\
\;\;\;\;t\_1 \cdot \left(0.125 \cdot \left(\frac{h}{\ell} \cdot t\_2\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\_0\right) \cdot \frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -8.6e158Initial program 55.0%
Simplified59.4%
pow159.4%
sqrt-unprod51.4%
Applied egg-rr51.4%
unpow151.4%
associate-*l/43.1%
associate-*r/26.4%
unpow226.4%
Simplified26.4%
Taylor expanded in d around -inf 82.5%
if -8.6e158 < d < -8.79999999999999977e-106Initial program 71.4%
Simplified71.4%
Taylor expanded in h around -inf 62.2%
associate-*r*62.2%
neg-mul-162.2%
sub-neg62.2%
distribute-lft-in62.2%
Simplified83.0%
pow183.0%
associate-*r*83.0%
Applied egg-rr83.0%
unpow183.0%
*-commutative83.0%
unpow283.0%
*-commutative83.0%
*-commutative83.0%
swap-sqr71.6%
times-frac68.3%
unpow268.3%
unpow268.3%
unpow268.3%
associate-*r/63.8%
times-frac62.2%
associate-/r*70.6%
associate-*l/70.6%
Simplified83.0%
if -8.79999999999999977e-106 < d < -8.49999999999999972e-308Initial program 40.1%
Simplified42.1%
pow142.1%
sqrt-unprod32.2%
Applied egg-rr32.2%
unpow132.2%
Simplified32.2%
Taylor expanded in M around 0 22.6%
*-commutative22.6%
associate-*r*22.6%
times-frac22.6%
*-commutative22.6%
associate-/l*22.6%
unpow222.6%
unpow222.6%
unpow222.6%
times-frac29.5%
swap-sqr32.2%
unpow232.2%
associate-*r/32.2%
*-commutative32.2%
associate-/l*32.2%
Simplified32.2%
Taylor expanded in d around -inf 56.9%
if -8.49999999999999972e-308 < d Initial program 69.3%
Simplified70.1%
pow170.1%
sqrt-unprod59.7%
Applied egg-rr59.7%
unpow159.7%
associate-*l/59.6%
associate-*r/50.3%
unpow250.3%
Simplified50.3%
sqrt-div56.3%
sqrt-div60.5%
unpow260.5%
sqrt-prod83.6%
add-sqr-sqrt83.8%
Applied egg-rr83.8%
associate-/l/86.0%
associate-/r*81.9%
Simplified81.9%
Final simplification78.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 (<= h -9.2e+130)
(*
(sqrt (* (/ d h) (/ d l)))
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D d) (* M_m 0.5)) 2.0)) l))))
(if (<= h -4.5e-303)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ -1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D d)) 2.0)))))
(*
d
(/
(fma (* (pow (* D (/ M_m d)) 2.0) 0.25) (* (/ h l) -0.5) 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 (h <= -9.2e+130) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * ((h * pow(((D / d) * (M_m * 0.5)), 2.0)) / l)));
} else if (h <= -4.5e-303) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h / l) * pow(((M_m / 2.0) * (D / d)), 2.0))));
} else {
tmp = d * (fma((pow((D * (M_m / d)), 2.0) * 0.25), ((h / l) * -0.5), 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 (h <= -9.2e+130) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0)) / l)))); elseif (h <= -4.5e-303) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(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 = Float64(d * Float64(fma(Float64((Float64(D * Float64(M_m / d)) ^ 2.0) * 0.25), Float64(Float64(h / l) * -0.5), 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[h, -9.2e+130], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -4.5e-303], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $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], N[(d * N[(N[(N[(N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * 0.25), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $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}\;h \leq -9.2 \cdot 10^{+130}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;h \leq -4.5 \cdot 10^{-303}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot 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}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left({\left(D \cdot \frac{M\_m}{d}\right)}^{2} \cdot 0.25, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if h < -9.20000000000000085e130Initial program 40.1%
Simplified40.1%
pow140.1%
sqrt-unprod28.6%
Applied egg-rr28.6%
unpow128.6%
Simplified28.6%
associate-*r/43.9%
*-commutative43.9%
div-inv43.9%
metadata-eval43.9%
Applied egg-rr43.9%
if -9.20000000000000085e130 < h < -4.5000000000000001e-303Initial program 67.8%
Simplified69.9%
pow169.9%
sqrt-unprod56.9%
Applied egg-rr56.9%
unpow156.9%
associate-*l/55.8%
associate-*r/44.5%
unpow244.5%
Simplified44.5%
Taylor expanded in d around -inf 75.3%
if -4.5000000000000001e-303 < h Initial program 69.3%
Simplified70.1%
pow170.1%
sqrt-unprod59.7%
Applied egg-rr59.7%
unpow159.7%
associate-*l/59.6%
associate-*r/50.3%
unpow250.3%
Simplified50.3%
pow150.3%
associate-/l/50.3%
sqrt-div54.5%
unpow254.5%
sqrt-prod78.3%
add-sqr-sqrt78.5%
cancel-sign-sub-inv78.5%
metadata-eval78.5%
*-commutative78.5%
div-inv78.5%
metadata-eval78.5%
Applied egg-rr78.5%
unpow178.5%
associate-*l/79.0%
associate-/l*79.0%
Simplified78.9%
Final simplification72.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 (/ d (sqrt (* l h)))))
(if (<= d -7.2e+118)
(fabs t_0)
(if (<= d -1.5e-77)
(/ (sqrt (/ d l)) (sqrt (/ h d)))
(if (<= d -4e-311)
(* d (pow (+ -1.0 (fma h l 1.0)) -0.5))
(* t_0 (+ 1.0 (* (/ h l) (* (pow (* M_m (/ D d)) 2.0) -0.125)))))))))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 / sqrt((l * h));
double tmp;
if (d <= -7.2e+118) {
tmp = fabs(t_0);
} else if (d <= -1.5e-77) {
tmp = sqrt((d / l)) / sqrt((h / d));
} else if (d <= -4e-311) {
tmp = d * pow((-1.0 + fma(h, l, 1.0)), -0.5);
} else {
tmp = t_0 * (1.0 + ((h / l) * (pow((M_m * (D / d)), 2.0) * -0.125)));
}
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 / sqrt(Float64(l * h))) tmp = 0.0 if (d <= -7.2e+118) tmp = abs(t_0); elseif (d <= -1.5e-77) tmp = Float64(sqrt(Float64(d / l)) / sqrt(Float64(h / d))); elseif (d <= -4e-311) tmp = Float64(d * (Float64(-1.0 + fma(h, l, 1.0)) ^ -0.5)); else tmp = Float64(t_0 * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(M_m * Float64(D / d)) ^ 2.0) * -0.125)))); 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[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -7.2e+118], N[Abs[t$95$0], $MachinePrecision], If[LessEqual[d, -1.5e-77], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-311], N[(d * N[Power[N[(-1.0 + N[(h * l + 1.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.125), $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{d}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;d \leq -7.2 \cdot 10^{+118}:\\
\;\;\;\;\left|t\_0\right|\\
\mathbf{elif}\;d \leq -1.5 \cdot 10^{-77}:\\
\;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-311}:\\
\;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(M\_m \cdot \frac{D}{d}\right)}^{2} \cdot -0.125\right)\right)\\
\end{array}
\end{array}
if d < -7.2e118Initial program 54.0%
Simplified57.2%
Taylor expanded in d around inf 1.2%
*-un-lft-identity1.2%
inv-pow1.2%
sqrt-pow11.2%
metadata-eval1.2%
Applied egg-rr1.2%
*-lft-identity1.2%
Simplified1.2%
Taylor expanded in d around 0 1.2%
*-commutative1.2%
associate-/r*1.3%
Simplified1.3%
add-sqr-sqrt0.2%
sqrt-unprod35.3%
swap-sqr22.7%
sqr-neg22.7%
add-sqr-sqrt22.8%
associate-/l/22.8%
div-inv22.8%
sqr-neg22.8%
frac-times41.3%
sqrt-prod47.2%
frac-2neg47.2%
sqrt-undiv64.9%
add-sqr-sqrt64.8%
sqrt-prod41.0%
rem-sqrt-square64.9%
Applied egg-rr72.7%
if -7.2e118 < d < -1.50000000000000008e-77Initial program 72.7%
Simplified72.7%
Taylor expanded in d around inf 6.3%
*-un-lft-identity6.3%
inv-pow6.3%
sqrt-pow16.3%
metadata-eval6.3%
Applied egg-rr6.3%
*-lft-identity6.3%
Simplified6.3%
Taylor expanded in d around 0 6.3%
*-commutative6.3%
associate-/r*6.3%
Simplified6.3%
add-sqr-sqrt0.6%
sqrt-unprod40.8%
swap-sqr40.6%
sqr-neg40.6%
add-sqr-sqrt40.7%
associate-/l/40.7%
div-inv40.7%
sqr-neg40.7%
frac-times40.6%
sqrt-prod56.7%
frac-2neg56.7%
sqrt-undiv56.7%
*-commutative56.7%
clear-num56.6%
un-div-inv56.7%
sqrt-undiv56.8%
frac-2neg56.8%
Applied egg-rr56.8%
if -1.50000000000000008e-77 < d < -3.99999999999979e-311Initial program 45.9%
Simplified47.6%
Taylor expanded in d around inf 14.0%
*-un-lft-identity14.0%
inv-pow14.0%
sqrt-pow114.0%
metadata-eval14.0%
Applied egg-rr14.0%
*-lft-identity14.0%
Simplified14.0%
expm1-log1p-u14.0%
expm1-undefine34.2%
Applied egg-rr34.2%
sub-neg34.2%
metadata-eval34.2%
+-commutative34.2%
log1p-undefine34.2%
rem-exp-log34.2%
+-commutative34.2%
fma-define34.2%
Simplified34.2%
if -3.99999999999979e-311 < d Initial program 69.9%
Simplified70.7%
pow170.7%
sqrt-unprod60.1%
Applied egg-rr60.1%
unpow160.1%
Simplified60.1%
Taylor expanded in M around 0 37.5%
*-commutative37.5%
associate-*r*38.3%
times-frac39.0%
*-commutative39.0%
associate-/l*38.9%
unpow238.9%
unpow238.9%
unpow238.9%
times-frac44.7%
swap-sqr60.1%
unpow260.1%
associate-*r/59.3%
*-commutative59.3%
associate-/l*60.2%
Simplified60.2%
pow160.2%
*-commutative60.2%
associate-*l*60.2%
frac-times50.8%
sqrt-div54.9%
sqrt-unprod78.9%
add-sqr-sqrt79.2%
Applied egg-rr79.2%
unpow179.2%
*-commutative79.2%
sub-neg79.2%
distribute-rgt-neg-in79.2%
*-commutative79.2%
distribute-lft-neg-in79.2%
metadata-eval79.2%
associate-*r*79.1%
*-commutative79.1%
*-commutative79.1%
associate-*r/78.3%
*-commutative78.3%
associate-/l*79.2%
Simplified79.2%
Final simplification65.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 (<= h -1.3e+131)
(*
(sqrt (* (/ d h) (/ d l)))
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D d) (* M_m 0.5)) 2.0)) l))))
(if (<= h -4.5e-303)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ -1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D d)) 2.0)))))
(*
(/ d (sqrt (* l h)))
(+ 1.0 (* (/ h l) (* (pow (* M_m (/ D d)) 2.0) -0.125)))))))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 <= -1.3e+131) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * ((h * pow(((D / d) * (M_m * 0.5)), 2.0)) / l)));
} else if (h <= -4.5e-303) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h / l) * pow(((M_m / 2.0) * (D / d)), 2.0))));
} else {
tmp = (d / sqrt((l * h))) * (1.0 + ((h / l) * (pow((M_m * (D / d)), 2.0) * -0.125)));
}
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 <= (-1.3d+131)) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 - (0.5d0 * ((h * (((d_1 / d) * (m_m * 0.5d0)) ** 2.0d0)) / l)))
else if (h <= (-4.5d-303)) 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 = (d / sqrt((l * h))) * (1.0d0 + ((h / l) * (((m_m * (d_1 / d)) ** 2.0d0) * (-0.125d0))))
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 <= -1.3e+131) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * ((h * Math.pow(((D / d) * (M_m * 0.5)), 2.0)) / l)));
} else if (h <= -4.5e-303) {
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 = (d / Math.sqrt((l * h))) * (1.0 + ((h / l) * (Math.pow((M_m * (D / d)), 2.0) * -0.125)));
}
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 <= -1.3e+131: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * ((h * math.pow(((D / d) * (M_m * 0.5)), 2.0)) / l))) elif h <= -4.5e-303: 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 = (d / math.sqrt((l * h))) * (1.0 + ((h / l) * (math.pow((M_m * (D / d)), 2.0) * -0.125))) 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 <= -1.3e+131) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0)) / l)))); elseif (h <= -4.5e-303) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(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 = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(M_m * Float64(D / d)) ^ 2.0) * -0.125)))); 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 <= -1.3e+131)
tmp = sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * ((h * (((D / d) * (M_m * 0.5)) ^ 2.0)) / l)));
elseif (h <= -4.5e-303)
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h / l) * (((M_m / 2.0) * (D / d)) ^ 2.0))));
else
tmp = (d / sqrt((l * h))) * (1.0 + ((h / l) * (((M_m * (D / d)) ^ 2.0) * -0.125)));
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, -1.3e+131], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -4.5e-303], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $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], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.125), $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 -1.3 \cdot 10^{+131}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;h \leq -4.5 \cdot 10^{-303}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot 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}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(M\_m \cdot \frac{D}{d}\right)}^{2} \cdot -0.125\right)\right)\\
\end{array}
\end{array}
if h < -1.3e131Initial program 40.1%
Simplified40.1%
pow140.1%
sqrt-unprod28.6%
Applied egg-rr28.6%
unpow128.6%
Simplified28.6%
associate-*r/43.9%
*-commutative43.9%
div-inv43.9%
metadata-eval43.9%
Applied egg-rr43.9%
if -1.3e131 < h < -4.5000000000000001e-303Initial program 67.8%
Simplified69.9%
pow169.9%
sqrt-unprod56.9%
Applied egg-rr56.9%
unpow156.9%
associate-*l/55.8%
associate-*r/44.5%
unpow244.5%
Simplified44.5%
Taylor expanded in d around -inf 75.3%
if -4.5000000000000001e-303 < h Initial program 69.3%
Simplified70.1%
pow170.1%
sqrt-unprod59.7%
Applied egg-rr59.7%
unpow159.7%
Simplified59.7%
Taylor expanded in M around 0 37.3%
*-commutative37.3%
associate-*r*38.1%
times-frac38.7%
*-commutative38.7%
associate-/l*38.6%
unpow238.6%
unpow238.6%
unpow238.6%
times-frac44.4%
swap-sqr59.7%
unpow259.7%
associate-*r/58.9%
*-commutative58.9%
associate-/l*59.7%
Simplified59.7%
pow159.7%
*-commutative59.7%
associate-*l*59.7%
frac-times50.4%
sqrt-div54.5%
sqrt-unprod78.3%
add-sqr-sqrt78.6%
Applied egg-rr78.6%
unpow178.6%
*-commutative78.6%
sub-neg78.6%
distribute-rgt-neg-in78.6%
*-commutative78.6%
distribute-lft-neg-in78.6%
metadata-eval78.6%
associate-*r*78.5%
*-commutative78.5%
*-commutative78.5%
associate-*r/77.7%
*-commutative77.7%
associate-/l*78.5%
Simplified78.5%
Final simplification71.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 (/ d (sqrt (* l h)))))
(if (<= d -1.86e+155)
(fabs t_0)
(if (<= d -5.3e-285)
(*
(sqrt (* (/ d h) (/ d l)))
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D d) (* M_m 0.5)) 2.0)) l))))
(* t_0 (+ 1.0 (* (/ h l) (* (pow (* M_m (/ D d)) 2.0) -0.125))))))))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 / sqrt((l * h));
double tmp;
if (d <= -1.86e+155) {
tmp = fabs(t_0);
} else if (d <= -5.3e-285) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * ((h * pow(((D / d) * (M_m * 0.5)), 2.0)) / l)));
} else {
tmp = t_0 * (1.0 + ((h / l) * (pow((M_m * (D / d)), 2.0) * -0.125)));
}
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 = d / sqrt((l * h))
if (d <= (-1.86d+155)) then
tmp = abs(t_0)
else if (d <= (-5.3d-285)) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 - (0.5d0 * ((h * (((d_1 / d) * (m_m * 0.5d0)) ** 2.0d0)) / l)))
else
tmp = t_0 * (1.0d0 + ((h / l) * (((m_m * (d_1 / d)) ** 2.0d0) * (-0.125d0))))
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 = d / Math.sqrt((l * h));
double tmp;
if (d <= -1.86e+155) {
tmp = Math.abs(t_0);
} else if (d <= -5.3e-285) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * ((h * Math.pow(((D / d) * (M_m * 0.5)), 2.0)) / l)));
} else {
tmp = t_0 * (1.0 + ((h / l) * (Math.pow((M_m * (D / d)), 2.0) * -0.125)));
}
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 = d / math.sqrt((l * h)) tmp = 0 if d <= -1.86e+155: tmp = math.fabs(t_0) elif d <= -5.3e-285: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * ((h * math.pow(((D / d) * (M_m * 0.5)), 2.0)) / l))) else: tmp = t_0 * (1.0 + ((h / l) * (math.pow((M_m * (D / d)), 2.0) * -0.125))) 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 / sqrt(Float64(l * h))) tmp = 0.0 if (d <= -1.86e+155) tmp = abs(t_0); elseif (d <= -5.3e-285) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0)) / l)))); else tmp = Float64(t_0 * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(M_m * Float64(D / d)) ^ 2.0) * -0.125)))); 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 = d / sqrt((l * h));
tmp = 0.0;
if (d <= -1.86e+155)
tmp = abs(t_0);
elseif (d <= -5.3e-285)
tmp = sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * ((h * (((D / d) * (M_m * 0.5)) ^ 2.0)) / l)));
else
tmp = t_0 * (1.0 + ((h / l) * (((M_m * (D / d)) ^ 2.0) * -0.125)));
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[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.86e+155], N[Abs[t$95$0], $MachinePrecision], If[LessEqual[d, -5.3e-285], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.125), $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{d}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;d \leq -1.86 \cdot 10^{+155}:\\
\;\;\;\;\left|t\_0\right|\\
\mathbf{elif}\;d \leq -5.3 \cdot 10^{-285}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(M\_m \cdot \frac{D}{d}\right)}^{2} \cdot -0.125\right)\right)\\
\end{array}
\end{array}
if d < -1.86000000000000008e155Initial program 52.7%
Simplified56.8%
Taylor expanded in d around inf 0.9%
*-un-lft-identity0.9%
inv-pow0.9%
sqrt-pow10.9%
metadata-eval0.9%
Applied egg-rr0.9%
*-lft-identity0.9%
Simplified0.9%
Taylor expanded in d around 0 0.9%
*-commutative0.9%
associate-/r*0.9%
Simplified0.9%
add-sqr-sqrt0.3%
sqrt-unprod32.9%
swap-sqr16.6%
sqr-neg16.6%
add-sqr-sqrt16.6%
associate-/l/16.6%
div-inv16.6%
sqr-neg16.6%
frac-times40.6%
sqrt-prod48.2%
frac-2neg48.2%
sqrt-undiv67.2%
add-sqr-sqrt67.2%
sqrt-prod40.3%
rem-sqrt-square67.2%
Applied egg-rr77.1%
if -1.86000000000000008e155 < d < -5.3e-285Initial program 62.5%
Simplified63.3%
pow163.3%
sqrt-unprod49.1%
Applied egg-rr49.1%
unpow149.1%
Simplified49.1%
associate-*r/56.7%
*-commutative56.7%
div-inv56.7%
metadata-eval56.7%
Applied egg-rr56.7%
if -5.3e-285 < d Initial program 67.3%
Simplified68.0%
pow168.0%
sqrt-unprod57.9%
Applied egg-rr57.9%
unpow157.9%
Simplified57.9%
Taylor expanded in M around 0 36.1%
*-commutative36.1%
associate-*r*36.9%
times-frac37.5%
*-commutative37.5%
associate-/l*37.5%
unpow237.5%
unpow237.5%
unpow237.5%
times-frac43.1%
swap-sqr57.9%
unpow257.9%
associate-*r/57.1%
*-commutative57.1%
associate-/l*57.9%
Simplified57.9%
pow157.9%
*-commutative57.9%
associate-*l*57.9%
frac-times48.9%
sqrt-div52.9%
sqrt-unprod75.9%
add-sqr-sqrt76.2%
Applied egg-rr76.2%
unpow176.2%
*-commutative76.2%
sub-neg76.2%
distribute-rgt-neg-in76.2%
*-commutative76.2%
distribute-lft-neg-in76.2%
metadata-eval76.2%
associate-*r*76.2%
*-commutative76.2%
*-commutative76.2%
associate-*r/75.4%
*-commutative75.4%
associate-/l*76.2%
Simplified76.2%
Final simplification68.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
(if (<= h -8.8e+129)
(*
(sqrt (* (/ d h) (/ d l)))
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D d) (* M_m 0.5)) 2.0)) l))))
(if (<= h -4.5e-303)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ (* 0.125 (* (/ h l) (pow (* D (/ M_m d)) 2.0))) -1.0))
(*
(/ d (sqrt (* l h)))
(+ 1.0 (* (/ h l) (* (pow (* M_m (/ D d)) 2.0) -0.125)))))))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 <= -8.8e+129) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * ((h * pow(((D / d) * (M_m * 0.5)), 2.0)) / l)));
} else if (h <= -4.5e-303) {
tmp = (d * sqrt((1.0 / (l * h)))) * ((0.125 * ((h / l) * pow((D * (M_m / d)), 2.0))) + -1.0);
} else {
tmp = (d / sqrt((l * h))) * (1.0 + ((h / l) * (pow((M_m * (D / d)), 2.0) * -0.125)));
}
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 <= (-8.8d+129)) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 - (0.5d0 * ((h * (((d_1 / d) * (m_m * 0.5d0)) ** 2.0d0)) / l)))
else if (h <= (-4.5d-303)) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * ((0.125d0 * ((h / l) * ((d_1 * (m_m / d)) ** 2.0d0))) + (-1.0d0))
else
tmp = (d / sqrt((l * h))) * (1.0d0 + ((h / l) * (((m_m * (d_1 / d)) ** 2.0d0) * (-0.125d0))))
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 <= -8.8e+129) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * ((h * Math.pow(((D / d) * (M_m * 0.5)), 2.0)) / l)));
} else if (h <= -4.5e-303) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * ((0.125 * ((h / l) * Math.pow((D * (M_m / d)), 2.0))) + -1.0);
} else {
tmp = (d / Math.sqrt((l * h))) * (1.0 + ((h / l) * (Math.pow((M_m * (D / d)), 2.0) * -0.125)));
}
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 <= -8.8e+129: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * ((h * math.pow(((D / d) * (M_m * 0.5)), 2.0)) / l))) elif h <= -4.5e-303: tmp = (d * math.sqrt((1.0 / (l * h)))) * ((0.125 * ((h / l) * math.pow((D * (M_m / d)), 2.0))) + -1.0) else: tmp = (d / math.sqrt((l * h))) * (1.0 + ((h / l) * (math.pow((M_m * (D / d)), 2.0) * -0.125))) 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 <= -8.8e+129) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0)) / l)))); elseif (h <= -4.5e-303) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(Float64(0.125 * Float64(Float64(h / l) * (Float64(D * Float64(M_m / d)) ^ 2.0))) + -1.0)); else tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(M_m * Float64(D / d)) ^ 2.0) * -0.125)))); 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 <= -8.8e+129)
tmp = sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * ((h * (((D / d) * (M_m * 0.5)) ^ 2.0)) / l)));
elseif (h <= -4.5e-303)
tmp = (d * sqrt((1.0 / (l * h)))) * ((0.125 * ((h / l) * ((D * (M_m / d)) ^ 2.0))) + -1.0);
else
tmp = (d / sqrt((l * h))) * (1.0 + ((h / l) * (((M_m * (D / d)) ^ 2.0) * -0.125)));
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, -8.8e+129], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -4.5e-303], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.125), $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 -8.8 \cdot 10^{+129}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;h \leq -4.5 \cdot 10^{-303}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M\_m}{d}\right)}^{2}\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(M\_m \cdot \frac{D}{d}\right)}^{2} \cdot -0.125\right)\right)\\
\end{array}
\end{array}
if h < -8.7999999999999997e129Initial program 40.1%
Simplified40.1%
pow140.1%
sqrt-unprod28.6%
Applied egg-rr28.6%
unpow128.6%
Simplified28.6%
associate-*r/43.9%
*-commutative43.9%
div-inv43.9%
metadata-eval43.9%
Applied egg-rr43.9%
if -8.7999999999999997e129 < h < -4.5000000000000001e-303Initial program 67.8%
Simplified69.9%
pow169.9%
sqrt-unprod56.9%
Applied egg-rr56.9%
unpow156.9%
Simplified56.9%
Taylor expanded in M around 0 43.3%
*-commutative43.3%
associate-*r*43.5%
times-frac44.7%
*-commutative44.7%
associate-/l*44.7%
unpow244.7%
unpow244.7%
unpow244.7%
times-frac51.1%
swap-sqr56.9%
unpow256.9%
associate-*r/55.8%
*-commutative55.8%
associate-/l*56.9%
Simplified56.9%
Taylor expanded in d around -inf 74.7%
if -4.5000000000000001e-303 < h Initial program 69.3%
Simplified70.1%
pow170.1%
sqrt-unprod59.7%
Applied egg-rr59.7%
unpow159.7%
Simplified59.7%
Taylor expanded in M around 0 37.3%
*-commutative37.3%
associate-*r*38.1%
times-frac38.7%
*-commutative38.7%
associate-/l*38.6%
unpow238.6%
unpow238.6%
unpow238.6%
times-frac44.4%
swap-sqr59.7%
unpow259.7%
associate-*r/58.9%
*-commutative58.9%
associate-/l*59.7%
Simplified59.7%
pow159.7%
*-commutative59.7%
associate-*l*59.7%
frac-times50.4%
sqrt-div54.5%
sqrt-unprod78.3%
add-sqr-sqrt78.6%
Applied egg-rr78.6%
unpow178.6%
*-commutative78.6%
sub-neg78.6%
distribute-rgt-neg-in78.6%
*-commutative78.6%
distribute-lft-neg-in78.6%
metadata-eval78.6%
associate-*r*78.5%
*-commutative78.5%
*-commutative78.5%
associate-*r/77.7%
*-commutative77.7%
associate-/l*78.5%
Simplified78.5%
Final simplification71.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 (sqrt (* l h)))) (t_1 (pow (* M_m (/ D d)) 2.0)))
(if (<= d -1.72e+155)
(fabs t_0)
(if (<= d -5.3e-285)
(* (sqrt (* (/ d h) (/ d l))) (- 1.0 (* 0.125 (* h (/ t_1 l)))))
(* t_0 (+ 1.0 (* (/ h l) (* t_1 -0.125))))))))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 / sqrt((l * h));
double t_1 = pow((M_m * (D / d)), 2.0);
double tmp;
if (d <= -1.72e+155) {
tmp = fabs(t_0);
} else if (d <= -5.3e-285) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 - (0.125 * (h * (t_1 / l))));
} else {
tmp = t_0 * (1.0 + ((h / l) * (t_1 * -0.125)));
}
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 = d / sqrt((l * h))
t_1 = (m_m * (d_1 / d)) ** 2.0d0
if (d <= (-1.72d+155)) then
tmp = abs(t_0)
else if (d <= (-5.3d-285)) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 - (0.125d0 * (h * (t_1 / l))))
else
tmp = t_0 * (1.0d0 + ((h / l) * (t_1 * (-0.125d0))))
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 = d / Math.sqrt((l * h));
double t_1 = Math.pow((M_m * (D / d)), 2.0);
double tmp;
if (d <= -1.72e+155) {
tmp = Math.abs(t_0);
} else if (d <= -5.3e-285) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 - (0.125 * (h * (t_1 / l))));
} else {
tmp = t_0 * (1.0 + ((h / l) * (t_1 * -0.125)));
}
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 = d / math.sqrt((l * h)) t_1 = math.pow((M_m * (D / d)), 2.0) tmp = 0 if d <= -1.72e+155: tmp = math.fabs(t_0) elif d <= -5.3e-285: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 - (0.125 * (h * (t_1 / l)))) else: tmp = t_0 * (1.0 + ((h / l) * (t_1 * -0.125))) 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 / sqrt(Float64(l * h))) t_1 = Float64(M_m * Float64(D / d)) ^ 2.0 tmp = 0.0 if (d <= -1.72e+155) tmp = abs(t_0); elseif (d <= -5.3e-285) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 - Float64(0.125 * Float64(h * Float64(t_1 / l))))); else tmp = Float64(t_0 * Float64(1.0 + Float64(Float64(h / l) * Float64(t_1 * -0.125)))); 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 = d / sqrt((l * h));
t_1 = (M_m * (D / d)) ^ 2.0;
tmp = 0.0;
if (d <= -1.72e+155)
tmp = abs(t_0);
elseif (d <= -5.3e-285)
tmp = sqrt(((d / h) * (d / l))) * (1.0 - (0.125 * (h * (t_1 / l))));
else
tmp = t_0 * (1.0 + ((h / l) * (t_1 * -0.125)));
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[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[d, -1.72e+155], N[Abs[t$95$0], $MachinePrecision], If[LessEqual[d, -5.3e-285], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.125 * N[(h * N[(t$95$1 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(t$95$1 * -0.125), $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{d}{\sqrt{\ell \cdot h}}\\
t_1 := {\left(M\_m \cdot \frac{D}{d}\right)}^{2}\\
\mathbf{if}\;d \leq -1.72 \cdot 10^{+155}:\\
\;\;\;\;\left|t\_0\right|\\
\mathbf{elif}\;d \leq -5.3 \cdot 10^{-285}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - 0.125 \cdot \left(h \cdot \frac{t\_1}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(1 + \frac{h}{\ell} \cdot \left(t\_1 \cdot -0.125\right)\right)\\
\end{array}
\end{array}
if d < -1.7199999999999999e155Initial program 52.7%
Simplified56.8%
Taylor expanded in d around inf 0.9%
*-un-lft-identity0.9%
inv-pow0.9%
sqrt-pow10.9%
metadata-eval0.9%
Applied egg-rr0.9%
*-lft-identity0.9%
Simplified0.9%
Taylor expanded in d around 0 0.9%
*-commutative0.9%
associate-/r*0.9%
Simplified0.9%
add-sqr-sqrt0.3%
sqrt-unprod32.9%
swap-sqr16.6%
sqr-neg16.6%
add-sqr-sqrt16.6%
associate-/l/16.6%
div-inv16.6%
sqr-neg16.6%
frac-times40.6%
sqrt-prod48.2%
frac-2neg48.2%
sqrt-undiv67.2%
add-sqr-sqrt67.2%
sqrt-prod40.3%
rem-sqrt-square67.2%
Applied egg-rr77.1%
if -1.7199999999999999e155 < d < -5.3e-285Initial program 62.5%
Simplified63.3%
pow163.3%
sqrt-unprod49.1%
Applied egg-rr49.1%
unpow149.1%
Simplified49.1%
Taylor expanded in M around 0 39.3%
*-commutative39.3%
associate-*r*41.3%
times-frac38.4%
*-commutative38.4%
associate-/l*38.3%
unpow238.3%
unpow238.3%
unpow238.3%
times-frac43.0%
swap-sqr49.1%
unpow249.1%
associate-*r/49.1%
*-commutative49.1%
associate-/l*49.1%
Simplified49.1%
Taylor expanded in D around 0 39.3%
associate-*r*41.3%
times-frac38.4%
associate-/l*37.4%
unpow237.4%
unpow237.4%
unpow237.4%
times-frac40.1%
swap-sqr49.1%
unpow249.1%
associate-*r/56.6%
*-commutative56.6%
associate-/l*56.6%
associate-*r/56.6%
*-commutative56.6%
associate-/l*56.6%
Simplified56.6%
if -5.3e-285 < d Initial program 67.3%
Simplified68.0%
pow168.0%
sqrt-unprod57.9%
Applied egg-rr57.9%
unpow157.9%
Simplified57.9%
Taylor expanded in M around 0 36.1%
*-commutative36.1%
associate-*r*36.9%
times-frac37.5%
*-commutative37.5%
associate-/l*37.5%
unpow237.5%
unpow237.5%
unpow237.5%
times-frac43.1%
swap-sqr57.9%
unpow257.9%
associate-*r/57.1%
*-commutative57.1%
associate-/l*57.9%
Simplified57.9%
pow157.9%
*-commutative57.9%
associate-*l*57.9%
frac-times48.9%
sqrt-div52.9%
sqrt-unprod75.9%
add-sqr-sqrt76.2%
Applied egg-rr76.2%
unpow176.2%
*-commutative76.2%
sub-neg76.2%
distribute-rgt-neg-in76.2%
*-commutative76.2%
distribute-lft-neg-in76.2%
metadata-eval76.2%
associate-*r*76.2%
*-commutative76.2%
*-commutative76.2%
associate-*r/75.4%
*-commutative75.4%
associate-/l*76.2%
Simplified76.2%
Final simplification68.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
(if (<= d -1.4e+113)
(fabs (/ d (sqrt (* l h))))
(if (<= d -6.4e-80)
(/ (sqrt (/ d l)) (sqrt (/ h d)))
(if (<= d -3e-233)
(* d (cbrt (pow (/ (/ 1.0 l) h) 1.5)))
(if (<= d 1.75e-153)
(* d (- (pow (* l h) -0.5)))
(/ d (* (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 (d <= -1.4e+113) {
tmp = fabs((d / sqrt((l * h))));
} else if (d <= -6.4e-80) {
tmp = sqrt((d / l)) / sqrt((h / d));
} else if (d <= -3e-233) {
tmp = d * cbrt(pow(((1.0 / l) / h), 1.5));
} else if (d <= 1.75e-153) {
tmp = d * -pow((l * h), -0.5);
} else {
tmp = d / (sqrt(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 <= -1.4e+113) {
tmp = Math.abs((d / Math.sqrt((l * h))));
} else if (d <= -6.4e-80) {
tmp = Math.sqrt((d / l)) / Math.sqrt((h / d));
} else if (d <= -3e-233) {
tmp = d * Math.cbrt(Math.pow(((1.0 / l) / h), 1.5));
} else if (d <= 1.75e-153) {
tmp = d * -Math.pow((l * h), -0.5);
} else {
tmp = d / (Math.sqrt(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 <= -1.4e+113) tmp = abs(Float64(d / sqrt(Float64(l * h)))); elseif (d <= -6.4e-80) tmp = Float64(sqrt(Float64(d / l)) / sqrt(Float64(h / d))); elseif (d <= -3e-233) tmp = Float64(d * cbrt((Float64(Float64(1.0 / l) / h) ^ 1.5))); elseif (d <= 1.75e-153) tmp = Float64(d * Float64(-(Float64(l * h) ^ -0.5))); else tmp = Float64(d / 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[d, -1.4e+113], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[d, -6.4e-80], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -3e-233], N[(d * N[Power[N[Power[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.75e-153], N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d / N[(N[Sqrt[h], $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 -1.4 \cdot 10^{+113}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{elif}\;d \leq -6.4 \cdot 10^{-80}:\\
\;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\
\mathbf{elif}\;d \leq -3 \cdot 10^{-233}:\\
\;\;\;\;d \cdot \sqrt[3]{{\left(\frac{\frac{1}{\ell}}{h}\right)}^{1.5}}\\
\mathbf{elif}\;d \leq 1.75 \cdot 10^{-153}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.39999999999999999e113Initial program 54.0%
Simplified57.2%
Taylor expanded in d around inf 1.2%
*-un-lft-identity1.2%
inv-pow1.2%
sqrt-pow11.2%
metadata-eval1.2%
Applied egg-rr1.2%
*-lft-identity1.2%
Simplified1.2%
Taylor expanded in d around 0 1.2%
*-commutative1.2%
associate-/r*1.3%
Simplified1.3%
add-sqr-sqrt0.2%
sqrt-unprod35.3%
swap-sqr22.7%
sqr-neg22.7%
add-sqr-sqrt22.8%
associate-/l/22.8%
div-inv22.8%
sqr-neg22.8%
frac-times41.3%
sqrt-prod47.2%
frac-2neg47.2%
sqrt-undiv64.9%
add-sqr-sqrt64.8%
sqrt-prod41.0%
rem-sqrt-square64.9%
Applied egg-rr72.7%
if -1.39999999999999999e113 < d < -6.3999999999999998e-80Initial program 72.7%
Simplified72.7%
Taylor expanded in d around inf 6.3%
*-un-lft-identity6.3%
inv-pow6.3%
sqrt-pow16.3%
metadata-eval6.3%
Applied egg-rr6.3%
*-lft-identity6.3%
Simplified6.3%
Taylor expanded in d around 0 6.3%
*-commutative6.3%
associate-/r*6.3%
Simplified6.3%
add-sqr-sqrt0.6%
sqrt-unprod40.8%
swap-sqr40.6%
sqr-neg40.6%
add-sqr-sqrt40.7%
associate-/l/40.7%
div-inv40.7%
sqr-neg40.7%
frac-times40.6%
sqrt-prod56.7%
frac-2neg56.7%
sqrt-undiv56.7%
*-commutative56.7%
clear-num56.6%
un-div-inv56.7%
sqrt-undiv56.8%
frac-2neg56.8%
Applied egg-rr56.8%
if -6.3999999999999998e-80 < d < -2.99999999999999999e-233Initial program 54.5%
Simplified54.5%
Taylor expanded in d around inf 16.7%
*-un-lft-identity16.7%
inv-pow16.7%
sqrt-pow116.7%
metadata-eval16.7%
Applied egg-rr16.7%
*-lft-identity16.7%
Simplified16.7%
Taylor expanded in d around 0 16.7%
*-commutative16.7%
associate-/r*16.7%
Simplified16.7%
add-cbrt-cube29.5%
pow1/329.5%
add-sqr-sqrt29.5%
pow129.5%
pow1/229.5%
pow-prod-up29.5%
div-inv29.5%
frac-times29.5%
metadata-eval29.5%
metadata-eval29.5%
Applied egg-rr29.5%
unpow1/329.5%
associate-/r*29.5%
Simplified29.5%
if -2.99999999999999999e-233 < d < 1.7499999999999999e-153Initial program 40.1%
Simplified42.3%
Taylor expanded in d around inf 18.1%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt29.7%
*-commutative29.7%
associate-*r*29.7%
unpow1/229.7%
rem-exp-log29.3%
exp-neg29.3%
exp-prod29.3%
distribute-lft-neg-out29.3%
distribute-rgt-neg-in29.3%
metadata-eval29.3%
exp-to-pow29.7%
neg-mul-129.7%
Simplified29.7%
if 1.7499999999999999e-153 < d Initial program 75.3%
Simplified76.3%
Taylor expanded in d around inf 64.9%
*-un-lft-identity64.9%
inv-pow64.9%
sqrt-pow164.9%
metadata-eval64.9%
Applied egg-rr64.9%
*-lft-identity64.9%
Simplified64.9%
Taylor expanded in d around 0 64.9%
*-commutative64.9%
associate-/r*65.2%
Simplified65.2%
add-sqr-sqrt65.0%
sqrt-unprod50.2%
swap-sqr43.0%
sqr-neg43.0%
add-sqr-sqrt43.1%
associate-/l/43.1%
div-inv43.1%
sqr-neg43.1%
frac-times47.6%
sqrt-prod54.1%
frac-2neg54.1%
sqrt-undiv0.0%
*-commutative0.0%
sqrt-div0.0%
frac-times0.0%
Applied egg-rr69.6%
Final simplification55.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 (<= l -1.22e+104)
(/ (sqrt (/ d l)) (sqrt (/ h d)))
(if (<= l 2.75e-229)
(* (- d) (sqrt (/ 1.0 (* 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 (l <= -1.22e+104) {
tmp = sqrt((d / l)) / sqrt((h / d));
} else if (l <= 2.75e-229) {
tmp = -d * sqrt((1.0 / (l * h)));
} 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 (l <= (-1.22d+104)) then
tmp = sqrt((d / l)) / sqrt((h / d))
else if (l <= 2.75d-229) then
tmp = -d * sqrt((1.0d0 / (l * h)))
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 (l <= -1.22e+104) {
tmp = Math.sqrt((d / l)) / Math.sqrt((h / d));
} else if (l <= 2.75e-229) {
tmp = -d * Math.sqrt((1.0 / (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 l <= -1.22e+104: tmp = math.sqrt((d / l)) / math.sqrt((h / d)) elif l <= 2.75e-229: tmp = -d * math.sqrt((1.0 / (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 (l <= -1.22e+104) tmp = Float64(sqrt(Float64(d / l)) / sqrt(Float64(h / d))); elseif (l <= 2.75e-229) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); 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 (l <= -1.22e+104)
tmp = sqrt((d / l)) / sqrt((h / d));
elseif (l <= 2.75e-229)
tmp = -d * sqrt((1.0 / (l * h)));
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[l, -1.22e+104], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.75e-229], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $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}\;\ell \leq -1.22 \cdot 10^{+104}:\\
\;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\
\mathbf{elif}\;\ell \leq 2.75 \cdot 10^{-229}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.22e104Initial program 43.9%
Simplified46.2%
Taylor expanded in d around inf 3.6%
*-un-lft-identity3.6%
inv-pow3.6%
sqrt-pow13.6%
metadata-eval3.6%
Applied egg-rr3.6%
*-lft-identity3.6%
Simplified3.6%
Taylor expanded in d around 0 3.6%
*-commutative3.6%
associate-/r*3.7%
Simplified3.7%
add-sqr-sqrt2.6%
sqrt-unprod19.7%
swap-sqr12.8%
sqr-neg12.8%
add-sqr-sqrt12.9%
associate-/l/12.8%
div-inv12.9%
sqr-neg12.9%
frac-times26.2%
sqrt-prod36.7%
frac-2neg36.7%
sqrt-undiv40.9%
*-commutative40.9%
clear-num40.9%
un-div-inv40.9%
sqrt-undiv36.7%
frac-2neg36.7%
Applied egg-rr36.7%
if -1.22e104 < l < 2.7500000000000001e-229Initial program 66.1%
Simplified66.8%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt44.4%
neg-mul-144.4%
Simplified44.4%
if 2.7500000000000001e-229 < l Initial program 70.2%
Simplified71.1%
Taylor expanded in d around inf 62.9%
associate-/r*63.2%
sqrt-div66.5%
Applied egg-rr66.5%
Final simplification52.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.1e+107)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= l 1.42e-229)
(* (- d) (sqrt (/ 1.0 (* 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 (l <= -2.1e+107) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (l <= 1.42e-229) {
tmp = -d * sqrt((1.0 / (l * h)));
} 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 (l <= (-2.1d+107)) then
tmp = sqrt((d / h)) * sqrt((d / l))
else if (l <= 1.42d-229) then
tmp = -d * sqrt((1.0d0 / (l * h)))
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 (l <= -2.1e+107) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (l <= 1.42e-229) {
tmp = -d * Math.sqrt((1.0 / (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 l <= -2.1e+107: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) elif l <= 1.42e-229: tmp = -d * math.sqrt((1.0 / (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 (l <= -2.1e+107) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (l <= 1.42e-229) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); 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 (l <= -2.1e+107)
tmp = sqrt((d / h)) * sqrt((d / l));
elseif (l <= 1.42e-229)
tmp = -d * sqrt((1.0 / (l * h)));
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[l, -2.1e+107], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.42e-229], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $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}\;\ell \leq -2.1 \cdot 10^{+107}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq 1.42 \cdot 10^{-229}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.1e107Initial program 43.9%
Simplified46.2%
Taylor expanded in d around inf 36.7%
if -2.1e107 < l < 1.42000000000000004e-229Initial program 66.1%
Simplified66.8%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt44.4%
neg-mul-144.4%
Simplified44.4%
if 1.42000000000000004e-229 < l Initial program 70.2%
Simplified71.1%
Taylor expanded in d around inf 62.9%
associate-/r*63.2%
sqrt-div66.5%
Applied egg-rr66.5%
Final simplification52.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 (<= M_m 4e-86) (fabs (/ d (sqrt (* l h)))) (* d (pow (+ -1.0 (fma h l 1.0)) -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 (M_m <= 4e-86) {
tmp = fabs((d / sqrt((l * h))));
} else {
tmp = d * pow((-1.0 + fma(h, l, 1.0)), -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 (M_m <= 4e-86) tmp = abs(Float64(d / sqrt(Float64(l * h)))); else tmp = Float64(d * (Float64(-1.0 + fma(h, l, 1.0)) ^ -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[M$95$m, 4e-86], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d * N[Power[N[(-1.0 + N[(h * l + 1.0), $MachinePrecision]), $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}\;M\_m \leq 4 \cdot 10^{-86}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}^{-0.5}\\
\end{array}
\end{array}
if M < 4.00000000000000034e-86Initial program 61.8%
Simplified62.8%
Taylor expanded in d around inf 35.9%
*-un-lft-identity35.9%
inv-pow35.9%
sqrt-pow135.9%
metadata-eval35.9%
Applied egg-rr35.9%
*-lft-identity35.9%
Simplified35.9%
Taylor expanded in d around 0 35.9%
*-commutative35.9%
associate-/r*35.9%
Simplified35.9%
add-sqr-sqrt32.1%
sqrt-unprod37.6%
swap-sqr33.7%
sqr-neg33.7%
add-sqr-sqrt33.8%
associate-/l/33.8%
div-inv33.8%
sqr-neg33.8%
frac-times35.7%
sqrt-prod42.1%
frac-2neg42.1%
sqrt-undiv20.0%
add-sqr-sqrt19.9%
sqrt-prod14.1%
rem-sqrt-square20.0%
Applied egg-rr51.2%
if 4.00000000000000034e-86 < M Initial program 68.7%
Simplified69.9%
Taylor expanded in d around inf 22.5%
*-un-lft-identity22.5%
inv-pow22.5%
sqrt-pow122.5%
metadata-eval22.5%
Applied egg-rr22.5%
*-lft-identity22.5%
Simplified22.5%
expm1-log1p-u22.0%
expm1-undefine23.4%
Applied egg-rr23.4%
sub-neg23.4%
metadata-eval23.4%
+-commutative23.4%
log1p-undefine23.4%
rem-exp-log23.8%
+-commutative23.8%
fma-define23.8%
Simplified23.8%
Final simplification42.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.45e-228) (* (- d) (sqrt (/ 1.0 (* 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 (l <= 2.45e-228) {
tmp = -d * sqrt((1.0 / (l * h)));
} 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 (l <= 2.45d-228) then
tmp = -d * sqrt((1.0d0 / (l * h)))
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 (l <= 2.45e-228) {
tmp = -d * Math.sqrt((1.0 / (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 l <= 2.45e-228: tmp = -d * math.sqrt((1.0 / (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 (l <= 2.45e-228) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); 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 (l <= 2.45e-228)
tmp = -d * sqrt((1.0 / (l * h)));
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[l, 2.45e-228], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $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}\;\ell \leq 2.45 \cdot 10^{-228}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < 2.44999999999999994e-228Initial program 59.8%
Simplified61.0%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt39.2%
neg-mul-139.2%
Simplified39.2%
if 2.44999999999999994e-228 < l Initial program 70.2%
Simplified71.1%
Taylor expanded in d around inf 62.9%
associate-/r*63.2%
sqrt-div66.5%
Applied egg-rr66.5%
Final simplification50.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 1.52e-229) (* (- d) (sqrt (/ 1.0 (* l h)))) (/ d (* (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 <= 1.52e-229) {
tmp = -d * sqrt((1.0 / (l * h)));
} else {
tmp = d / (sqrt(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 (l <= 1.52d-229) then
tmp = -d * sqrt((1.0d0 / (l * h)))
else
tmp = d / (sqrt(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 (l <= 1.52e-229) {
tmp = -d * Math.sqrt((1.0 / (l * h)));
} else {
tmp = d / (Math.sqrt(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 l <= 1.52e-229: tmp = -d * math.sqrt((1.0 / (l * h))) else: tmp = d / (math.sqrt(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 (l <= 1.52e-229) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); else tmp = Float64(d / Float64(sqrt(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 (l <= 1.52e-229)
tmp = -d * sqrt((1.0 / (l * h)));
else
tmp = d / (sqrt(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[l, 1.52e-229], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.52 \cdot 10^{-229}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < 1.5199999999999999e-229Initial program 59.8%
Simplified61.0%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt39.2%
neg-mul-139.2%
Simplified39.2%
if 1.5199999999999999e-229 < l Initial program 70.2%
Simplified71.1%
Taylor expanded in d around inf 62.9%
*-un-lft-identity62.9%
inv-pow62.9%
sqrt-pow162.9%
metadata-eval62.9%
Applied egg-rr62.9%
*-lft-identity62.9%
Simplified62.9%
Taylor expanded in d around 0 62.9%
*-commutative62.9%
associate-/r*63.2%
Simplified63.2%
add-sqr-sqrt63.0%
sqrt-unprod47.2%
swap-sqr40.4%
sqr-neg40.4%
add-sqr-sqrt40.5%
associate-/l/40.4%
div-inv40.5%
sqr-neg40.5%
frac-times45.1%
sqrt-prod51.3%
frac-2neg51.3%
sqrt-undiv0.0%
*-commutative0.0%
sqrt-div0.0%
frac-times0.0%
Applied egg-rr66.5%
Final simplification50.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 (<= M_m 5e-43) (fabs (/ d (sqrt (* l h)))) (* 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 (M_m <= 5e-43) {
tmp = fabs((d / sqrt((l * h))));
} 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 (m_m <= 5d-43) then
tmp = abs((d / sqrt((l * h))))
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 (M_m <= 5e-43) {
tmp = Math.abs((d / Math.sqrt((l * h))));
} 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 M_m <= 5e-43: tmp = math.fabs((d / math.sqrt((l * h)))) 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 (M_m <= 5e-43) tmp = abs(Float64(d / sqrt(Float64(l * h)))); else tmp = Float64(d * Float64(-(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 (M_m <= 5e-43)
tmp = abs((d / sqrt((l * h))));
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[M$95$m, 5e-43], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $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}\;M\_m \leq 5 \cdot 10^{-43}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\
\end{array}
\end{array}
if M < 5.00000000000000019e-43Initial program 61.9%
Simplified62.8%
Taylor expanded in d around inf 34.6%
*-un-lft-identity34.6%
inv-pow34.6%
sqrt-pow134.6%
metadata-eval34.6%
Applied egg-rr34.6%
*-lft-identity34.6%
Simplified34.6%
Taylor expanded in d around 0 34.6%
*-commutative34.6%
associate-/r*34.6%
Simplified34.6%
add-sqr-sqrt30.9%
sqrt-unprod36.7%
swap-sqr33.1%
sqr-neg33.1%
add-sqr-sqrt33.1%
associate-/l/33.1%
div-inv33.2%
sqr-neg33.2%
frac-times35.0%
sqrt-prod41.4%
frac-2neg41.4%
sqrt-undiv20.6%
add-sqr-sqrt20.6%
sqrt-prod14.7%
rem-sqrt-square20.6%
Applied egg-rr50.4%
if 5.00000000000000019e-43 < M Initial program 69.6%
Simplified71.0%
Taylor expanded in d around inf 23.8%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt27.9%
*-commutative27.9%
associate-*r*27.9%
unpow1/227.9%
rem-exp-log26.9%
exp-neg26.9%
exp-prod26.9%
distribute-lft-neg-out26.9%
distribute-rgt-neg-in26.9%
metadata-eval26.9%
exp-to-pow27.9%
neg-mul-127.9%
Simplified27.9%
Final simplification44.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 6e-220) (* (- d) (sqrt (/ 1.0 (* l h)))) (* d (sqrt (/ (/ 1.0 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 (l <= 6e-220) {
tmp = -d * sqrt((1.0 / (l * h)));
} else {
tmp = d * sqrt(((1.0 / l) / h));
}
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 <= 6d-220) then
tmp = -d * sqrt((1.0d0 / (l * h)))
else
tmp = d * sqrt(((1.0d0 / l) / h))
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 <= 6e-220) {
tmp = -d * Math.sqrt((1.0 / (l * h)));
} else {
tmp = d * Math.sqrt(((1.0 / l) / h));
}
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 <= 6e-220: tmp = -d * math.sqrt((1.0 / (l * h))) else: tmp = d * math.sqrt(((1.0 / 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 (l <= 6e-220) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h))); 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 <= 6e-220)
tmp = -d * sqrt((1.0 / (l * h)));
else
tmp = d * sqrt(((1.0 / l) / h));
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, 6e-220], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / 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])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 6 \cdot 10^{-220}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\end{array}
\end{array}
if l < 6.00000000000000035e-220Initial program 59.8%
Simplified61.0%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt39.2%
neg-mul-139.2%
Simplified39.2%
if 6.00000000000000035e-220 < l Initial program 70.2%
Simplified71.1%
Taylor expanded in d around inf 62.9%
*-un-lft-identity62.9%
inv-pow62.9%
sqrt-pow162.9%
metadata-eval62.9%
Applied egg-rr62.9%
*-lft-identity62.9%
Simplified62.9%
Taylor expanded in d around 0 62.9%
*-commutative62.9%
associate-/r*63.2%
Simplified63.2%
Final simplification49.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 (if (<= l 1.95e-229) (* d (- (pow (* l h) -0.5))) (* d (sqrt (/ (/ 1.0 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 (l <= 1.95e-229) {
tmp = d * -pow((l * h), -0.5);
} else {
tmp = d * sqrt(((1.0 / l) / h));
}
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.95d-229) then
tmp = d * -((l * h) ** (-0.5d0))
else
tmp = d * sqrt(((1.0d0 / l) / h))
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.95e-229) {
tmp = d * -Math.pow((l * h), -0.5);
} else {
tmp = d * Math.sqrt(((1.0 / l) / h));
}
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.95e-229: tmp = d * -math.pow((l * h), -0.5) else: tmp = d * math.sqrt(((1.0 / 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 (l <= 1.95e-229) tmp = Float64(d * Float64(-(Float64(l * h) ^ -0.5))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h))); 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.95e-229)
tmp = d * -((l * h) ^ -0.5);
else
tmp = d * sqrt(((1.0 / l) / h));
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.95e-229], N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / 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])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.95 \cdot 10^{-229}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\end{array}
\end{array}
if l < 1.94999999999999992e-229Initial program 59.8%
Simplified61.0%
Taylor expanded in d around inf 10.1%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt39.2%
*-commutative39.2%
associate-*r*39.2%
unpow1/239.2%
rem-exp-log37.3%
exp-neg37.3%
exp-prod37.3%
distribute-lft-neg-out37.3%
distribute-rgt-neg-in37.3%
metadata-eval37.3%
exp-to-pow39.2%
neg-mul-139.2%
Simplified39.2%
if 1.94999999999999992e-229 < l Initial program 70.2%
Simplified71.1%
Taylor expanded in d around inf 62.9%
*-un-lft-identity62.9%
inv-pow62.9%
sqrt-pow162.9%
metadata-eval62.9%
Applied egg-rr62.9%
*-lft-identity62.9%
Simplified62.9%
Taylor expanded in d around 0 62.9%
*-commutative62.9%
associate-/r*63.2%
Simplified63.2%
Final simplification49.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 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(((1.0 / 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(((1.0d0 / 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(((1.0 / 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(((1.0 / 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(Float64(1.0 / 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(((1.0 / 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[(N[(1.0 / l), $MachinePrecision] / 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{\frac{\frac{1}{\ell}}{h}}
\end{array}
Initial program 64.0%
Simplified65.1%
Taylor expanded in d around inf 31.6%
*-un-lft-identity31.6%
inv-pow31.6%
sqrt-pow131.6%
metadata-eval31.6%
Applied egg-rr31.6%
*-lft-identity31.6%
Simplified31.6%
Taylor expanded in d around 0 31.6%
*-commutative31.6%
associate-/r*31.7%
Simplified31.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 (/ 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])\\
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 64.0%
Simplified65.1%
Taylor expanded in d around inf 31.6%
*-un-lft-identity31.6%
inv-pow31.6%
sqrt-pow131.6%
metadata-eval31.6%
Applied egg-rr31.6%
*-lft-identity31.6%
Simplified31.6%
Taylor expanded in d around 0 31.6%
*-commutative31.6%
associate-/r*31.7%
Simplified31.7%
add-sqr-sqrt28.1%
sqrt-unprod34.1%
swap-sqr29.5%
sqr-neg29.5%
add-sqr-sqrt29.5%
associate-/l/29.5%
div-inv29.6%
sqr-neg29.6%
frac-times33.9%
frac-times29.6%
sqrt-div33.4%
sqrt-unprod27.5%
add-sqr-sqrt31.6%
Applied egg-rr31.6%
Final simplification31.6%
herbie shell --seed 2024149
(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)))))