
(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 21 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 (+ 1.0 (/ (* (pow (/ D (* d (/ 2.0 M_m))) 2.0) (* h -0.5)) l)))
(t_1 (/ (sqrt d) (sqrt h)))
(t_2 (sqrt (/ d l))))
(if (<= l -5e-310)
(* t_2 (* (/ (sqrt (- d)) (sqrt (- h))) t_0))
(if (<= l 7.8e+138)
(* t_2 (* t_0 t_1))
(*
(/ 1.0 (/ (sqrt l) (sqrt d)))
(*
t_1
(+ 1.0 (* (/ h l) (* -0.5 (pow (* D (/ (/ M_m 2.0) d)) 2.0))))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = 1.0 + ((pow((D / (d * (2.0 / M_m))), 2.0) * (h * -0.5)) / l);
double t_1 = sqrt(d) / sqrt(h);
double t_2 = sqrt((d / l));
double tmp;
if (l <= -5e-310) {
tmp = t_2 * ((sqrt(-d) / sqrt(-h)) * t_0);
} else if (l <= 7.8e+138) {
tmp = t_2 * (t_0 * t_1);
} else {
tmp = (1.0 / (sqrt(l) / sqrt(d))) * (t_1 * (1.0 + ((h / l) * (-0.5 * pow((D * ((M_m / 2.0) / d)), 2.0)))));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = 1.0d0 + ((((d_1 / (d * (2.0d0 / m_m))) ** 2.0d0) * (h * (-0.5d0))) / l)
t_1 = sqrt(d) / sqrt(h)
t_2 = sqrt((d / l))
if (l <= (-5d-310)) then
tmp = t_2 * ((sqrt(-d) / sqrt(-h)) * t_0)
else if (l <= 7.8d+138) then
tmp = t_2 * (t_0 * t_1)
else
tmp = (1.0d0 / (sqrt(l) / sqrt(d))) * (t_1 * (1.0d0 + ((h / l) * ((-0.5d0) * ((d_1 * ((m_m / 2.0d0) / d)) ** 2.0d0)))))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = 1.0 + ((Math.pow((D / (d * (2.0 / M_m))), 2.0) * (h * -0.5)) / l);
double t_1 = Math.sqrt(d) / Math.sqrt(h);
double t_2 = Math.sqrt((d / l));
double tmp;
if (l <= -5e-310) {
tmp = t_2 * ((Math.sqrt(-d) / Math.sqrt(-h)) * t_0);
} else if (l <= 7.8e+138) {
tmp = t_2 * (t_0 * t_1);
} else {
tmp = (1.0 / (Math.sqrt(l) / Math.sqrt(d))) * (t_1 * (1.0 + ((h / l) * (-0.5 * Math.pow((D * ((M_m / 2.0) / d)), 2.0)))));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = 1.0 + ((math.pow((D / (d * (2.0 / M_m))), 2.0) * (h * -0.5)) / l) t_1 = math.sqrt(d) / math.sqrt(h) t_2 = math.sqrt((d / l)) tmp = 0 if l <= -5e-310: tmp = t_2 * ((math.sqrt(-d) / math.sqrt(-h)) * t_0) elif l <= 7.8e+138: tmp = t_2 * (t_0 * t_1) else: tmp = (1.0 / (math.sqrt(l) / math.sqrt(d))) * (t_1 * (1.0 + ((h / l) * (-0.5 * math.pow((D * ((M_m / 2.0) / d)), 2.0))))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(1.0 + Float64(Float64((Float64(D / Float64(d * Float64(2.0 / M_m))) ^ 2.0) * Float64(h * -0.5)) / l)) t_1 = Float64(sqrt(d) / sqrt(h)) t_2 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -5e-310) tmp = Float64(t_2 * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0)); elseif (l <= 7.8e+138) tmp = Float64(t_2 * Float64(t_0 * t_1)); else tmp = Float64(Float64(1.0 / Float64(sqrt(l) / sqrt(d))) * Float64(t_1 * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D * Float64(Float64(M_m / 2.0) / d)) ^ 2.0)))))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = 1.0 + ((((D / (d * (2.0 / M_m))) ^ 2.0) * (h * -0.5)) / l);
t_1 = sqrt(d) / sqrt(h);
t_2 = sqrt((d / l));
tmp = 0.0;
if (l <= -5e-310)
tmp = t_2 * ((sqrt(-d) / sqrt(-h)) * t_0);
elseif (l <= 7.8e+138)
tmp = t_2 * (t_0 * t_1);
else
tmp = (1.0 / (sqrt(l) / sqrt(d))) * (t_1 * (1.0 + ((h / l) * (-0.5 * ((D * ((M_m / 2.0) / d)) ^ 2.0)))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(1.0 + N[(N[(N[Power[N[(D / N[(d * N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * -0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -5e-310], N[(t$95$2 * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.8e+138], N[(t$95$2 * N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] / N[Sqrt[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := 1 + \frac{{\left(\frac{D}{d \cdot \frac{2}{M\_m}}\right)}^{2} \cdot \left(h \cdot -0.5\right)}{\ell}\\
t_1 := \frac{\sqrt{d}}{\sqrt{h}}\\
t_2 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t\_2 \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_0\right)\\
\mathbf{elif}\;\ell \leq 7.8 \cdot 10^{+138}:\\
\;\;\;\;t\_2 \cdot \left(t\_0 \cdot t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{\ell}}{\sqrt{d}}} \cdot \left(t\_1 \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2}\right)\right)\right)\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 70.1%
Simplified70.8%
*-commutative70.8%
*-commutative70.8%
associate-*l/70.1%
associate-*r/70.8%
associate-*r*70.8%
associate-*r/70.8%
associate-*r/73.3%
*-commutative73.3%
clear-num73.3%
frac-times73.3%
*-commutative73.3%
*-un-lft-identity73.3%
*-commutative73.3%
Applied egg-rr73.3%
frac-2neg73.3%
sqrt-div82.6%
Applied egg-rr82.6%
if -4.999999999999985e-310 < l < 7.7999999999999996e138Initial program 66.9%
Simplified66.9%
*-commutative66.9%
*-commutative66.9%
associate-*l/66.9%
associate-*r/65.8%
associate-*r*65.8%
associate-*r/65.8%
associate-*r/72.9%
*-commutative72.9%
clear-num72.9%
frac-times74.1%
*-commutative74.1%
*-un-lft-identity74.1%
*-commutative74.1%
Applied egg-rr74.1%
sqrt-div89.3%
div-inv89.3%
Applied egg-rr89.3%
associate-*r/89.3%
*-rgt-identity89.3%
Simplified89.3%
if 7.7999999999999996e138 < l Initial program 59.4%
Simplified61.7%
sqrt-div70.8%
clear-num70.7%
Applied egg-rr70.7%
sqrt-div66.8%
div-inv66.7%
Applied egg-rr77.9%
associate-*r/66.8%
*-rgt-identity66.8%
Simplified77.9%
Final simplification84.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
(*
(* (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))))))
(t_1 (sqrt (/ d l)))
(t_2 (sqrt (/ d h)))
(t_3 (sqrt (* l h)))
(t_4 (fabs (/ d t_3))))
(if (<= t_0 -5e-239)
(*
(- 1.0 (* 0.5 (/ (* h (pow (/ D (* d (/ 2.0 M_m))) 2.0)) l)))
(* t_1 t_2))
(if (<= t_0 0.0)
t_4
(if (<= t_0 1e+250)
(*
t_1
(* (+ 1.0 (* -0.125 (* (/ h l) (pow (* D (/ M_m d)) 2.0)))) t_2))
(if (<= t_0 INFINITY)
t_4
(*
d
(/
(fma h (* (/ -0.5 l) (pow (* M_m (/ D (* d 2.0))) 2.0)) 1.0)
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((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((D * M_m) / (d * 2.0)), 2.0))));
double t_1 = sqrt((d / l));
double t_2 = sqrt((d / h));
double t_3 = sqrt((l * h));
double t_4 = fabs((d / t_3));
double tmp;
if (t_0 <= -5e-239) {
tmp = (1.0 - (0.5 * ((h * pow((D / (d * (2.0 / M_m))), 2.0)) / l))) * (t_1 * t_2);
} else if (t_0 <= 0.0) {
tmp = t_4;
} else if (t_0 <= 1e+250) {
tmp = t_1 * ((1.0 + (-0.125 * ((h / l) * pow((D * (M_m / d)), 2.0)))) * t_2);
} else if (t_0 <= ((double) INFINITY)) {
tmp = t_4;
} else {
tmp = d * (fma(h, ((-0.5 / l) * pow((M_m * (D / (d * 2.0))), 2.0)), 1.0) / 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(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))))) t_1 = sqrt(Float64(d / l)) t_2 = sqrt(Float64(d / h)) t_3 = sqrt(Float64(l * h)) t_4 = abs(Float64(d / t_3)) tmp = 0.0 if (t_0 <= -5e-239) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(D / Float64(d * Float64(2.0 / M_m))) ^ 2.0)) / l))) * Float64(t_1 * t_2)); elseif (t_0 <= 0.0) tmp = t_4; elseif (t_0 <= 1e+250) tmp = Float64(t_1 * Float64(Float64(1.0 + Float64(-0.125 * Float64(Float64(h / l) * (Float64(D * Float64(M_m / d)) ^ 2.0)))) * t_2)); elseif (t_0 <= Inf) tmp = t_4; else tmp = Float64(d * Float64(fma(h, Float64(Float64(-0.5 / l) * (Float64(M_m * Float64(D / Float64(d * 2.0))) ^ 2.0)), 1.0) / t_3)); 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[(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]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Abs[N[(d / t$95$3), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -5e-239], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(D / N[(d * N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], t$95$4, If[LessEqual[t$95$0, 1e+250], N[(t$95$1 * N[(N[(1.0 + N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], t$95$4, N[(d * N[(N[(h * N[(N[(-0.5 / l), $MachinePrecision] * N[Power[N[(M$95$m * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $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({\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)\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \sqrt{\frac{d}{h}}\\
t_3 := \sqrt{\ell \cdot h}\\
t_4 := \left|\frac{d}{t\_3}\right|\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-239}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{d \cdot \frac{2}{M\_m}}\right)}^{2}}{\ell}\right) \cdot \left(t\_1 \cdot t\_2\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_0 \leq 10^{+250}:\\
\;\;\;\;t\_1 \cdot \left(\left(1 + -0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M\_m}{d}\right)}^{2}\right)\right) \cdot t\_2\right)\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;t\_4\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, \frac{-0.5}{\ell} \cdot {\left(M\_m \cdot \frac{D}{d \cdot 2}\right)}^{2}, 1\right)}{t\_3}\\
\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)))) < -5e-239Initial program 84.1%
Simplified85.3%
*-commutative85.3%
unpow285.3%
associate-*r*88.6%
associate-*r/86.4%
associate-*l/88.6%
*-commutative88.6%
associate-*r/87.4%
associate-*l/89.6%
*-commutative89.6%
associate-*r*86.5%
unpow286.5%
associate-*l/89.8%
clear-num89.8%
un-div-inv89.8%
div-inv89.8%
clear-num89.8%
Applied egg-rr89.8%
if -5e-239 < (*.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)))) < 0.0 or 9.9999999999999992e249 < (*.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)))) < +inf.0Initial program 57.4%
Simplified57.1%
Taylor expanded in M around 0 57.4%
pow157.4%
*-rgt-identity57.4%
sqrt-unprod57.4%
Applied egg-rr57.4%
unpow157.4%
Simplified57.4%
add-sqr-sqrt57.4%
rem-sqrt-square57.4%
frac-times57.4%
sqrt-div63.2%
sqrt-unprod48.1%
add-sqr-sqrt90.2%
Applied egg-rr90.2%
if 0.0 < (*.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)))) < 9.9999999999999992e249Initial program 97.9%
Simplified97.9%
*-commutative97.9%
*-commutative97.9%
associate-*l/97.9%
associate-*r/97.9%
associate-*r*97.9%
associate-*r/97.9%
associate-*r/97.9%
*-commutative97.9%
clear-num97.9%
frac-times97.9%
*-commutative97.9%
*-un-lft-identity97.9%
*-commutative97.9%
Applied egg-rr97.9%
Taylor expanded in D around 0 61.7%
associate-*r*69.6%
times-frac72.3%
associate-/l*70.6%
unpow270.6%
unpow270.6%
unpow270.6%
times-frac85.2%
swap-sqr97.9%
unpow297.9%
*-commutative97.9%
Simplified97.9%
if +inf.0 < (*.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 0.0%
Simplified0.0%
*-commutative0.0%
unpow20.0%
associate-*r*2.4%
associate-*r/2.4%
associate-*l/2.4%
*-commutative2.4%
associate-*r/2.6%
associate-*l/2.6%
*-commutative2.6%
associate-*r*0.0%
unpow20.0%
associate-*l/13.8%
clear-num13.8%
un-div-inv13.8%
div-inv13.8%
clear-num13.8%
Applied egg-rr13.8%
sqrt-div10.9%
div-inv10.9%
Applied egg-rr10.9%
associate-*r/10.9%
*-rgt-identity10.9%
Simplified10.9%
pow110.9%
Applied egg-rr27.8%
unpow127.8%
associate-*l/30.0%
associate-/l*30.0%
Simplified30.0%
Final simplification81.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 (pow (/ D (* d (/ 2.0 M_m))) 2.0)) (t_1 (sqrt (/ d l))))
(if (<= d -4.5e-160)
(* (- 1.0 (* 0.5 (/ (* h t_0) l))) (* t_1 (sqrt (/ d h))))
(if (<= d -7.2e-304)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(* t_1 (* -0.125 (* (/ h l) (pow (* D (/ M_m d)) 2.0)))))
(* t_1 (* (+ 1.0 (/ (* t_0 (* h -0.5)) l)) (/ (sqrt d) (sqrt 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 t_0 = pow((D / (d * (2.0 / M_m))), 2.0);
double t_1 = sqrt((d / l));
double tmp;
if (d <= -4.5e-160) {
tmp = (1.0 - (0.5 * ((h * t_0) / l))) * (t_1 * sqrt((d / h)));
} else if (d <= -7.2e-304) {
tmp = (sqrt(-d) / sqrt(-h)) * (t_1 * (-0.125 * ((h / l) * pow((D * (M_m / d)), 2.0))));
} else {
tmp = t_1 * ((1.0 + ((t_0 * (h * -0.5)) / l)) * (sqrt(d) / sqrt(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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (d_1 / (d * (2.0d0 / m_m))) ** 2.0d0
t_1 = sqrt((d / l))
if (d <= (-4.5d-160)) then
tmp = (1.0d0 - (0.5d0 * ((h * t_0) / l))) * (t_1 * sqrt((d / h)))
else if (d <= (-7.2d-304)) then
tmp = (sqrt(-d) / sqrt(-h)) * (t_1 * ((-0.125d0) * ((h / l) * ((d_1 * (m_m / d)) ** 2.0d0))))
else
tmp = t_1 * ((1.0d0 + ((t_0 * (h * (-0.5d0))) / l)) * (sqrt(d) / sqrt(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 t_0 = Math.pow((D / (d * (2.0 / M_m))), 2.0);
double t_1 = Math.sqrt((d / l));
double tmp;
if (d <= -4.5e-160) {
tmp = (1.0 - (0.5 * ((h * t_0) / l))) * (t_1 * Math.sqrt((d / h)));
} else if (d <= -7.2e-304) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * (t_1 * (-0.125 * ((h / l) * Math.pow((D * (M_m / d)), 2.0))));
} else {
tmp = t_1 * ((1.0 + ((t_0 * (h * -0.5)) / l)) * (Math.sqrt(d) / Math.sqrt(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): t_0 = math.pow((D / (d * (2.0 / M_m))), 2.0) t_1 = math.sqrt((d / l)) tmp = 0 if d <= -4.5e-160: tmp = (1.0 - (0.5 * ((h * t_0) / l))) * (t_1 * math.sqrt((d / h))) elif d <= -7.2e-304: tmp = (math.sqrt(-d) / math.sqrt(-h)) * (t_1 * (-0.125 * ((h / l) * math.pow((D * (M_m / d)), 2.0)))) else: tmp = t_1 * ((1.0 + ((t_0 * (h * -0.5)) / l)) * (math.sqrt(d) / math.sqrt(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) t_0 = Float64(D / Float64(d * Float64(2.0 / M_m))) ^ 2.0 t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (d <= -4.5e-160) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * t_0) / l))) * Float64(t_1 * sqrt(Float64(d / h)))); elseif (d <= -7.2e-304) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(t_1 * Float64(-0.125 * Float64(Float64(h / l) * (Float64(D * Float64(M_m / d)) ^ 2.0))))); else tmp = Float64(t_1 * Float64(Float64(1.0 + Float64(Float64(t_0 * Float64(h * -0.5)) / l)) * Float64(sqrt(d) / sqrt(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)
t_0 = (D / (d * (2.0 / M_m))) ^ 2.0;
t_1 = sqrt((d / l));
tmp = 0.0;
if (d <= -4.5e-160)
tmp = (1.0 - (0.5 * ((h * t_0) / l))) * (t_1 * sqrt((d / h)));
elseif (d <= -7.2e-304)
tmp = (sqrt(-d) / sqrt(-h)) * (t_1 * (-0.125 * ((h / l) * ((D * (M_m / d)) ^ 2.0))));
else
tmp = t_1 * ((1.0 + ((t_0 * (h * -0.5)) / l)) * (sqrt(d) / sqrt(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_] := Block[{t$95$0 = N[Power[N[(D / N[(d * N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -4.5e-160], N[(N[(1.0 - N[(0.5 * N[(N[(h * t$95$0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -7.2e-304], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(N[(1.0 + N[(N[(t$95$0 * N[(h * -0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[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}
t_0 := {\left(\frac{D}{d \cdot \frac{2}{M\_m}}\right)}^{2}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -4.5 \cdot 10^{-160}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot t\_0}{\ell}\right) \cdot \left(t\_1 \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{elif}\;d \leq -7.2 \cdot 10^{-304}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(t\_1 \cdot \left(-0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M\_m}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(\left(1 + \frac{t\_0 \cdot \left(h \cdot -0.5\right)}{\ell}\right) \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\end{array}
\end{array}
if d < -4.50000000000000026e-160Initial program 77.4%
Simplified78.3%
*-commutative78.3%
unpow278.3%
associate-*r*81.0%
associate-*r/80.1%
associate-*l/81.0%
*-commutative81.0%
associate-*r/80.2%
associate-*l/81.2%
*-commutative81.2%
associate-*r*78.4%
unpow278.4%
associate-*l/81.5%
clear-num81.5%
un-div-inv81.5%
div-inv81.5%
clear-num81.5%
Applied egg-rr81.5%
if -4.50000000000000026e-160 < d < -7.2000000000000003e-304Initial program 43.3%
Simplified43.2%
Taylor expanded in M around inf 11.5%
associate-*r*15.5%
times-frac15.4%
*-commutative15.4%
associate-/l*15.4%
unpow215.4%
unpow215.4%
unpow215.4%
times-frac24.0%
swap-sqr35.8%
associate-/l*35.9%
associate-*l/35.9%
associate-/l*35.9%
associate-*l/36.0%
associate-/r/35.9%
associate-/r/35.9%
unpow235.9%
associate-/r/36.0%
*-commutative36.0%
Simplified36.0%
frac-2neg43.2%
sqrt-div66.6%
Applied egg-rr59.4%
if -7.2000000000000003e-304 < d Initial program 63.9%
Simplified64.7%
*-commutative64.7%
*-commutative64.7%
associate-*l/63.9%
associate-*r/63.9%
associate-*r*63.9%
associate-*r/63.9%
associate-*r/68.8%
*-commutative68.8%
clear-num68.8%
frac-times69.6%
*-commutative69.6%
*-un-lft-identity69.6%
*-commutative69.6%
Applied egg-rr69.6%
sqrt-div81.2%
div-inv81.2%
Applied egg-rr81.2%
associate-*r/81.2%
*-rgt-identity81.2%
Simplified81.2%
Final simplification79.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 (+ 1.0 (/ (* (pow (/ D (* d (/ 2.0 M_m))) 2.0) (* h -0.5)) l)))
(t_1 (sqrt (/ d l))))
(if (<= l -5e-310)
(* t_1 (* (/ (sqrt (- d)) (sqrt (- h))) t_0))
(* t_1 (* t_0 (/ (sqrt d) (sqrt 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 t_0 = 1.0 + ((pow((D / (d * (2.0 / M_m))), 2.0) * (h * -0.5)) / l);
double t_1 = sqrt((d / l));
double tmp;
if (l <= -5e-310) {
tmp = t_1 * ((sqrt(-d) / sqrt(-h)) * t_0);
} else {
tmp = t_1 * (t_0 * (sqrt(d) / sqrt(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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + ((((d_1 / (d * (2.0d0 / m_m))) ** 2.0d0) * (h * (-0.5d0))) / l)
t_1 = sqrt((d / l))
if (l <= (-5d-310)) then
tmp = t_1 * ((sqrt(-d) / sqrt(-h)) * t_0)
else
tmp = t_1 * (t_0 * (sqrt(d) / sqrt(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 t_0 = 1.0 + ((Math.pow((D / (d * (2.0 / M_m))), 2.0) * (h * -0.5)) / l);
double t_1 = Math.sqrt((d / l));
double tmp;
if (l <= -5e-310) {
tmp = t_1 * ((Math.sqrt(-d) / Math.sqrt(-h)) * t_0);
} else {
tmp = t_1 * (t_0 * (Math.sqrt(d) / Math.sqrt(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): t_0 = 1.0 + ((math.pow((D / (d * (2.0 / M_m))), 2.0) * (h * -0.5)) / l) t_1 = math.sqrt((d / l)) tmp = 0 if l <= -5e-310: tmp = t_1 * ((math.sqrt(-d) / math.sqrt(-h)) * t_0) else: tmp = t_1 * (t_0 * (math.sqrt(d) / math.sqrt(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) t_0 = Float64(1.0 + Float64(Float64((Float64(D / Float64(d * Float64(2.0 / M_m))) ^ 2.0) * Float64(h * -0.5)) / l)) t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -5e-310) tmp = Float64(t_1 * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0)); else tmp = Float64(t_1 * Float64(t_0 * Float64(sqrt(d) / sqrt(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)
t_0 = 1.0 + ((((D / (d * (2.0 / M_m))) ^ 2.0) * (h * -0.5)) / l);
t_1 = sqrt((d / l));
tmp = 0.0;
if (l <= -5e-310)
tmp = t_1 * ((sqrt(-d) / sqrt(-h)) * t_0);
else
tmp = t_1 * (t_0 * (sqrt(d) / sqrt(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_] := Block[{t$95$0 = N[(1.0 + N[(N[(N[Power[N[(D / N[(d * N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * -0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -5e-310], N[(t$95$1 * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[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}
t_0 := 1 + \frac{{\left(\frac{D}{d \cdot \frac{2}{M\_m}}\right)}^{2} \cdot \left(h \cdot -0.5\right)}{\ell}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t\_1 \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(t\_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 70.1%
Simplified70.8%
*-commutative70.8%
*-commutative70.8%
associate-*l/70.1%
associate-*r/70.8%
associate-*r*70.8%
associate-*r/70.8%
associate-*r/73.3%
*-commutative73.3%
clear-num73.3%
frac-times73.3%
*-commutative73.3%
*-un-lft-identity73.3%
*-commutative73.3%
Applied egg-rr73.3%
frac-2neg73.3%
sqrt-div82.6%
Applied egg-rr82.6%
if -4.999999999999985e-310 < l Initial program 64.4%
Simplified65.2%
*-commutative65.2%
*-commutative65.2%
associate-*l/64.4%
associate-*r/64.4%
associate-*r*64.4%
associate-*r/64.4%
associate-*r/69.3%
*-commutative69.3%
clear-num69.3%
frac-times70.1%
*-commutative70.1%
*-un-lft-identity70.1%
*-commutative70.1%
Applied egg-rr70.1%
sqrt-div81.9%
div-inv81.9%
Applied egg-rr81.9%
associate-*r/81.9%
*-rgt-identity81.9%
Simplified81.9%
Final simplification82.3%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= l -5e-310)
(*
t_0
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (* -0.125 (* (/ h l) (pow (* D (/ M_m d)) 2.0))))))
(*
t_0
(*
(+ 1.0 (/ (* (pow (/ D (* d (/ 2.0 M_m))) 2.0) (* h -0.5)) l))
(/ (sqrt d) (sqrt 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 t_0 = sqrt((d / l));
double tmp;
if (l <= -5e-310) {
tmp = t_0 * ((sqrt(-d) / sqrt(-h)) * (1.0 + (-0.125 * ((h / l) * pow((D * (M_m / d)), 2.0)))));
} else {
tmp = t_0 * ((1.0 + ((pow((D / (d * (2.0 / M_m))), 2.0) * (h * -0.5)) / l)) * (sqrt(d) / sqrt(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) :: t_0
real(8) :: tmp
t_0 = sqrt((d / l))
if (l <= (-5d-310)) then
tmp = t_0 * ((sqrt(-d) / sqrt(-h)) * (1.0d0 + ((-0.125d0) * ((h / l) * ((d_1 * (m_m / d)) ** 2.0d0)))))
else
tmp = t_0 * ((1.0d0 + ((((d_1 / (d * (2.0d0 / m_m))) ** 2.0d0) * (h * (-0.5d0))) / l)) * (sqrt(d) / sqrt(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 t_0 = Math.sqrt((d / l));
double tmp;
if (l <= -5e-310) {
tmp = t_0 * ((Math.sqrt(-d) / Math.sqrt(-h)) * (1.0 + (-0.125 * ((h / l) * Math.pow((D * (M_m / d)), 2.0)))));
} else {
tmp = t_0 * ((1.0 + ((Math.pow((D / (d * (2.0 / M_m))), 2.0) * (h * -0.5)) / l)) * (Math.sqrt(d) / Math.sqrt(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): t_0 = math.sqrt((d / l)) tmp = 0 if l <= -5e-310: tmp = t_0 * ((math.sqrt(-d) / math.sqrt(-h)) * (1.0 + (-0.125 * ((h / l) * math.pow((D * (M_m / d)), 2.0))))) else: tmp = t_0 * ((1.0 + ((math.pow((D / (d * (2.0 / M_m))), 2.0) * (h * -0.5)) / l)) * (math.sqrt(d) / math.sqrt(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) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -5e-310) tmp = Float64(t_0 * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(1.0 + Float64(-0.125 * Float64(Float64(h / l) * (Float64(D * Float64(M_m / d)) ^ 2.0)))))); else tmp = Float64(t_0 * Float64(Float64(1.0 + Float64(Float64((Float64(D / Float64(d * Float64(2.0 / M_m))) ^ 2.0) * Float64(h * -0.5)) / l)) * Float64(sqrt(d) / sqrt(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)
t_0 = sqrt((d / l));
tmp = 0.0;
if (l <= -5e-310)
tmp = t_0 * ((sqrt(-d) / sqrt(-h)) * (1.0 + (-0.125 * ((h / l) * ((D * (M_m / d)) ^ 2.0)))));
else
tmp = t_0 * ((1.0 + ((((D / (d * (2.0 / M_m))) ^ 2.0) * (h * -0.5)) / l)) * (sqrt(d) / sqrt(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_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -5e-310], N[(t$95$0 * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[(1.0 + N[(N[(N[Power[N[(D / N[(d * N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * -0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[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}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t\_0 \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(1 + -0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M\_m}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(\left(1 + \frac{{\left(\frac{D}{d \cdot \frac{2}{M\_m}}\right)}^{2} \cdot \left(h \cdot -0.5\right)}{\ell}\right) \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 70.1%
Simplified70.8%
*-commutative70.8%
*-commutative70.8%
associate-*l/70.1%
associate-*r/70.8%
associate-*r*70.8%
associate-*r/70.8%
associate-*r/73.3%
*-commutative73.3%
clear-num73.3%
frac-times73.3%
*-commutative73.3%
*-un-lft-identity73.3%
*-commutative73.3%
Applied egg-rr73.3%
Taylor expanded in D around 0 46.9%
associate-*r*50.6%
times-frac49.7%
associate-/l*45.1%
unpow245.1%
unpow245.1%
unpow245.1%
times-frac58.2%
swap-sqr70.8%
unpow270.8%
*-commutative70.8%
Simplified70.8%
frac-2neg73.3%
sqrt-div82.6%
Applied egg-rr80.2%
if -4.999999999999985e-310 < l Initial program 64.4%
Simplified65.2%
*-commutative65.2%
*-commutative65.2%
associate-*l/64.4%
associate-*r/64.4%
associate-*r*64.4%
associate-*r/64.4%
associate-*r/69.3%
*-commutative69.3%
clear-num69.3%
frac-times70.1%
*-commutative70.1%
*-un-lft-identity70.1%
*-commutative70.1%
Applied egg-rr70.1%
sqrt-div81.9%
div-inv81.9%
Applied egg-rr81.9%
associate-*r/81.9%
*-rgt-identity81.9%
Simplified81.9%
Final simplification81.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 -9.5e-21)
(* (sqrt (/ d l)) (/ (sqrt (- d)) (sqrt (- h))))
(if (<= l 3e-309)
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* (* h -0.5) (/ (pow (* M_m (/ (/ D d) 2.0)) 2.0) l))))
(if (<= l 4.8e+210)
(*
d
(/
(fma h (* (/ -0.5 l) (pow (* M_m (/ D (* d 2.0))) 2.0)) 1.0)
(sqrt (* 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 <= -9.5e-21) {
tmp = sqrt((d / l)) * (sqrt(-d) / sqrt(-h));
} else if (l <= 3e-309) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + ((h * -0.5) * (pow((M_m * ((D / d) / 2.0)), 2.0) / l)));
} else if (l <= 4.8e+210) {
tmp = d * (fma(h, ((-0.5 / l) * pow((M_m * (D / (d * 2.0))), 2.0)), 1.0) / sqrt((l * h)));
} else {
tmp = (d / sqrt(h)) / sqrt(l);
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -9.5e-21) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-h)))); elseif (l <= 3e-309) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(Float64(h * -0.5) * Float64((Float64(M_m * Float64(Float64(D / d) / 2.0)) ^ 2.0) / l)))); elseif (l <= 4.8e+210) tmp = Float64(d * Float64(fma(h, Float64(Float64(-0.5 / l) * (Float64(M_m * Float64(D / Float64(d * 2.0))) ^ 2.0)), 1.0) / sqrt(Float64(l * h)))); else tmp = Float64(Float64(d / sqrt(h)) / sqrt(l)); end return tmp end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -9.5e-21], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3e-309], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * -0.5), $MachinePrecision] * N[(N[Power[N[(M$95$m * N[(N[(D / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.8e+210], N[(d * N[(N[(h * N[(N[(-0.5 / l), $MachinePrecision] * N[Power[N[(M$95$m * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $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 -9.5 \cdot 10^{-21}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{-d}}{\sqrt{-h}}\\
\mathbf{elif}\;\ell \leq 3 \cdot 10^{-309}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + \left(h \cdot -0.5\right) \cdot \frac{{\left(M\_m \cdot \frac{\frac{D}{d}}{2}\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;\ell \leq 4.8 \cdot 10^{+210}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, \frac{-0.5}{\ell} \cdot {\left(M\_m \cdot \frac{D}{d \cdot 2}\right)}^{2}, 1\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -9.4999999999999994e-21Initial program 67.7%
Simplified69.0%
Taylor expanded in M around 0 57.1%
frac-2neg70.5%
sqrt-div80.4%
Applied egg-rr62.9%
if -9.4999999999999994e-21 < l < 3.000000000000001e-309Initial program 73.0%
Simplified73.0%
*-commutative73.0%
unpow273.0%
associate-*r*74.5%
associate-*r/74.6%
associate-*l/74.6%
*-commutative74.6%
associate-*r/74.7%
associate-*l/74.7%
*-commutative74.7%
associate-*r*73.1%
unpow273.1%
associate-*l/76.8%
clear-num76.8%
un-div-inv76.8%
div-inv76.8%
clear-num76.8%
Applied egg-rr76.8%
pow176.8%
sqrt-unprod72.0%
cancel-sign-sub-inv72.0%
metadata-eval72.0%
associate-/l*69.0%
associate-/r*69.0%
Applied egg-rr69.0%
unpow169.0%
associate-*r*69.0%
associate-/r/69.0%
Simplified69.0%
if 3.000000000000001e-309 < l < 4.79999999999999977e210Initial program 67.3%
Simplified66.4%
*-commutative66.4%
unpow266.4%
associate-*r*67.4%
associate-*r/67.4%
associate-*l/67.4%
*-commutative67.4%
associate-*r/68.4%
associate-*l/68.3%
*-commutative68.3%
associate-*r*67.3%
unpow267.3%
associate-*l/73.3%
clear-num73.3%
un-div-inv73.4%
div-inv73.4%
clear-num73.4%
Applied egg-rr73.4%
sqrt-div77.0%
div-inv77.0%
Applied egg-rr77.0%
associate-*r/77.0%
*-rgt-identity77.0%
Simplified77.0%
pow177.0%
Applied egg-rr80.5%
unpow180.5%
associate-*l/81.5%
associate-/l*81.5%
Simplified81.5%
if 4.79999999999999977e210 < l Initial program 53.0%
Simplified56.7%
Taylor expanded in M around 0 45.2%
pow145.2%
*-rgt-identity45.2%
sqrt-unprod37.8%
Applied egg-rr37.8%
unpow137.8%
Simplified37.8%
sqrt-prod45.2%
*-commutative45.2%
sqrt-div56.4%
sqrt-div60.3%
frac-times60.4%
add-sqr-sqrt60.3%
Applied egg-rr60.3%
associate-/l/60.5%
Simplified60.5%
Final simplification71.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.4e-278)
(*
(sqrt (/ d l))
(*
(+ 1.0 (* -0.125 (* (/ h l) (pow (* D (/ M_m d)) 2.0))))
(sqrt (/ d h))))
(if (<= l 1.25e+211)
(*
d
(/
(fma h (* (/ -0.5 l) (pow (* M_m (/ D (* d 2.0))) 2.0)) 1.0)
(sqrt (* 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 <= 2.4e-278) {
tmp = sqrt((d / l)) * ((1.0 + (-0.125 * ((h / l) * pow((D * (M_m / d)), 2.0)))) * sqrt((d / h)));
} else if (l <= 1.25e+211) {
tmp = d * (fma(h, ((-0.5 / l) * pow((M_m * (D / (d * 2.0))), 2.0)), 1.0) / sqrt((l * h)));
} else {
tmp = (d / sqrt(h)) / sqrt(l);
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= 2.4e-278) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(1.0 + Float64(-0.125 * Float64(Float64(h / l) * (Float64(D * Float64(M_m / d)) ^ 2.0)))) * sqrt(Float64(d / h)))); elseif (l <= 1.25e+211) tmp = Float64(d * Float64(fma(h, Float64(Float64(-0.5 / l) * (Float64(M_m * Float64(D / Float64(d * 2.0))) ^ 2.0)), 1.0) / sqrt(Float64(l * h)))); else tmp = Float64(Float64(d / sqrt(h)) / sqrt(l)); end return tmp end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, 2.4e-278], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 + N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.25e+211], N[(d * N[(N[(h * N[(N[(-0.5 / l), $MachinePrecision] * N[Power[N[(M$95$m * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.4 \cdot 10^{-278}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\left(1 + -0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M\_m}{d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{elif}\;\ell \leq 1.25 \cdot 10^{+211}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, \frac{-0.5}{\ell} \cdot {\left(M\_m \cdot \frac{D}{d \cdot 2}\right)}^{2}, 1\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < 2.4e-278Initial program 70.7%
Simplified71.5%
*-commutative71.5%
*-commutative71.5%
associate-*l/70.7%
associate-*r/71.4%
associate-*r*71.4%
associate-*r/71.4%
associate-*r/73.8%
*-commutative73.8%
clear-num73.8%
frac-times73.8%
*-commutative73.8%
*-un-lft-identity73.8%
*-commutative73.8%
Applied egg-rr73.8%
Taylor expanded in D around 0 48.6%
associate-*r*52.1%
times-frac51.2%
associate-/l*46.8%
unpow246.8%
unpow246.8%
unpow246.8%
times-frac59.3%
swap-sqr71.5%
unpow271.5%
*-commutative71.5%
Simplified71.5%
if 2.4e-278 < l < 1.2499999999999999e211Initial program 66.2%
Simplified65.2%
*-commutative65.2%
unpow265.2%
associate-*r*66.3%
associate-*r/66.3%
associate-*l/66.3%
*-commutative66.3%
associate-*r/67.3%
associate-*l/67.3%
*-commutative67.3%
associate-*r*66.2%
unpow266.2%
associate-*l/72.6%
clear-num72.6%
un-div-inv72.6%
div-inv72.6%
clear-num72.6%
Applied egg-rr72.6%
sqrt-div75.6%
div-inv75.6%
Applied egg-rr75.6%
associate-*r/75.6%
*-rgt-identity75.6%
Simplified75.6%
pow175.6%
Applied egg-rr81.2%
unpow181.2%
associate-*l/82.3%
associate-/l*82.3%
Simplified82.3%
if 1.2499999999999999e211 < l Initial program 53.0%
Simplified56.7%
Taylor expanded in M around 0 45.2%
pow145.2%
*-rgt-identity45.2%
sqrt-unprod37.8%
Applied egg-rr37.8%
unpow137.8%
Simplified37.8%
sqrt-prod45.2%
*-commutative45.2%
sqrt-div56.4%
sqrt-div60.3%
frac-times60.4%
add-sqr-sqrt60.3%
Applied egg-rr60.3%
associate-/l/60.5%
Simplified60.5%
Final simplification74.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 3.8e-281)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(+ 1.0 (* -0.5 (* (pow (/ D (* d (/ 2.0 M_m))) 2.0) (/ h l))))))
(if (<= l 2.9e+212)
(*
d
(/
(fma h (* (/ -0.5 l) (pow (* M_m (/ D (* d 2.0))) 2.0)) 1.0)
(sqrt (* 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 <= 3.8e-281) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (-0.5 * (pow((D / (d * (2.0 / M_m))), 2.0) * (h / l)))));
} else if (l <= 2.9e+212) {
tmp = d * (fma(h, ((-0.5 / l) * pow((M_m * (D / (d * 2.0))), 2.0)), 1.0) / sqrt((l * h)));
} else {
tmp = (d / sqrt(h)) / sqrt(l);
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= 3.8e-281) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(-0.5 * Float64((Float64(D / Float64(d * Float64(2.0 / M_m))) ^ 2.0) * Float64(h / l)))))); elseif (l <= 2.9e+212) tmp = Float64(d * Float64(fma(h, Float64(Float64(-0.5 / l) * (Float64(M_m * Float64(D / Float64(d * 2.0))) ^ 2.0)), 1.0) / sqrt(Float64(l * h)))); else tmp = Float64(Float64(d / sqrt(h)) / sqrt(l)); end return tmp end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, 3.8e-281], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[Power[N[(D / N[(d * N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.9e+212], N[(d * N[(N[(h * N[(N[(-0.5 / l), $MachinePrecision] * N[Power[N[(M$95$m * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $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 3.8 \cdot 10^{-281}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left({\left(\frac{D}{d \cdot \frac{2}{M\_m}}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 2.9 \cdot 10^{+212}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, \frac{-0.5}{\ell} \cdot {\left(M\_m \cdot \frac{D}{d \cdot 2}\right)}^{2}, 1\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < 3.79999999999999976e-281Initial program 70.7%
Simplified71.4%
fma-undefine71.4%
Applied egg-rr71.5%
if 3.79999999999999976e-281 < l < 2.8999999999999998e212Initial program 66.2%
Simplified65.2%
*-commutative65.2%
unpow265.2%
associate-*r*66.3%
associate-*r/66.3%
associate-*l/66.3%
*-commutative66.3%
associate-*r/67.3%
associate-*l/67.3%
*-commutative67.3%
associate-*r*66.2%
unpow266.2%
associate-*l/72.6%
clear-num72.6%
un-div-inv72.6%
div-inv72.6%
clear-num72.6%
Applied egg-rr72.6%
sqrt-div75.6%
div-inv75.6%
Applied egg-rr75.6%
associate-*r/75.6%
*-rgt-identity75.6%
Simplified75.6%
pow175.6%
Applied egg-rr81.2%
unpow181.2%
associate-*l/82.3%
associate-/l*82.3%
Simplified82.3%
if 2.8999999999999998e212 < l Initial program 53.0%
Simplified56.7%
Taylor expanded in M around 0 45.2%
pow145.2%
*-rgt-identity45.2%
sqrt-unprod37.8%
Applied egg-rr37.8%
unpow137.8%
Simplified37.8%
sqrt-prod45.2%
*-commutative45.2%
sqrt-div56.4%
sqrt-div60.3%
frac-times60.4%
add-sqr-sqrt60.3%
Applied egg-rr60.3%
associate-/l/60.5%
Simplified60.5%
Final simplification74.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 6e-278)
(*
(sqrt (/ d l))
(*
(+ 1.0 (/ (* (pow (/ D (* d (/ 2.0 M_m))) 2.0) (* h -0.5)) l))
(sqrt (/ d h))))
(if (<= l 8e+209)
(*
d
(/
(fma h (* (/ -0.5 l) (pow (* M_m (/ D (* d 2.0))) 2.0)) 1.0)
(sqrt (* 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 <= 6e-278) {
tmp = sqrt((d / l)) * ((1.0 + ((pow((D / (d * (2.0 / M_m))), 2.0) * (h * -0.5)) / l)) * sqrt((d / h)));
} else if (l <= 8e+209) {
tmp = d * (fma(h, ((-0.5 / l) * pow((M_m * (D / (d * 2.0))), 2.0)), 1.0) / sqrt((l * h)));
} else {
tmp = (d / sqrt(h)) / sqrt(l);
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= 6e-278) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(1.0 + Float64(Float64((Float64(D / Float64(d * Float64(2.0 / M_m))) ^ 2.0) * Float64(h * -0.5)) / l)) * sqrt(Float64(d / h)))); elseif (l <= 8e+209) tmp = Float64(d * Float64(fma(h, Float64(Float64(-0.5 / l) * (Float64(M_m * Float64(D / Float64(d * 2.0))) ^ 2.0)), 1.0) / sqrt(Float64(l * h)))); else tmp = Float64(Float64(d / sqrt(h)) / sqrt(l)); end return tmp end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, 6e-278], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 + N[(N[(N[Power[N[(D / N[(d * N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * -0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8e+209], N[(d * N[(N[(h * N[(N[(-0.5 / l), $MachinePrecision] * N[Power[N[(M$95$m * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $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^{-278}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\left(1 + \frac{{\left(\frac{D}{d \cdot \frac{2}{M\_m}}\right)}^{2} \cdot \left(h \cdot -0.5\right)}{\ell}\right) \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{elif}\;\ell \leq 8 \cdot 10^{+209}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, \frac{-0.5}{\ell} \cdot {\left(M\_m \cdot \frac{D}{d \cdot 2}\right)}^{2}, 1\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < 6e-278Initial program 70.7%
Simplified71.5%
*-commutative71.5%
*-commutative71.5%
associate-*l/70.7%
associate-*r/71.4%
associate-*r*71.4%
associate-*r/71.4%
associate-*r/73.8%
*-commutative73.8%
clear-num73.8%
frac-times73.8%
*-commutative73.8%
*-un-lft-identity73.8%
*-commutative73.8%
Applied egg-rr73.8%
if 6e-278 < l < 8.0000000000000006e209Initial program 66.2%
Simplified65.2%
*-commutative65.2%
unpow265.2%
associate-*r*66.3%
associate-*r/66.3%
associate-*l/66.3%
*-commutative66.3%
associate-*r/67.3%
associate-*l/67.3%
*-commutative67.3%
associate-*r*66.2%
unpow266.2%
associate-*l/72.6%
clear-num72.6%
un-div-inv72.6%
div-inv72.6%
clear-num72.6%
Applied egg-rr72.6%
sqrt-div75.6%
div-inv75.6%
Applied egg-rr75.6%
associate-*r/75.6%
*-rgt-identity75.6%
Simplified75.6%
pow175.6%
Applied egg-rr81.2%
unpow181.2%
associate-*l/82.3%
associate-/l*82.3%
Simplified82.3%
if 8.0000000000000006e209 < l Initial program 53.0%
Simplified56.7%
Taylor expanded in M around 0 45.2%
pow145.2%
*-rgt-identity45.2%
sqrt-unprod37.8%
Applied egg-rr37.8%
unpow137.8%
Simplified37.8%
sqrt-prod45.2%
*-commutative45.2%
sqrt-div56.4%
sqrt-div60.3%
frac-times60.4%
add-sqr-sqrt60.3%
Applied egg-rr60.3%
associate-/l/60.5%
Simplified60.5%
Final simplification75.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 (<= l -1.12e-20)
(* (sqrt (/ d l)) (/ (sqrt (- d)) (sqrt (- h))))
(if (<= l -5e-310)
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* (* h -0.5) (/ (pow (* M_m (/ (/ D d) 2.0)) 2.0) l))))
(if (<= l 2.02e+214)
(*
(/ d (sqrt (* l h)))
(+ 1.0 (* (* h -0.5) (/ (pow (* M_m (/ D (* d 2.0))) 2.0) l))))
(/ (/ 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.12e-20) {
tmp = sqrt((d / l)) * (sqrt(-d) / sqrt(-h));
} else if (l <= -5e-310) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + ((h * -0.5) * (pow((M_m * ((D / d) / 2.0)), 2.0) / l)));
} else if (l <= 2.02e+214) {
tmp = (d / sqrt((l * h))) * (1.0 + ((h * -0.5) * (pow((M_m * (D / (d * 2.0))), 2.0) / l)));
} 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.12d-20)) then
tmp = sqrt((d / l)) * (sqrt(-d) / sqrt(-h))
else if (l <= (-5d-310)) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((h * (-0.5d0)) * (((m_m * ((d_1 / d) / 2.0d0)) ** 2.0d0) / l)))
else if (l <= 2.02d+214) then
tmp = (d / sqrt((l * h))) * (1.0d0 + ((h * (-0.5d0)) * (((m_m * (d_1 / (d * 2.0d0))) ** 2.0d0) / l)))
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.12e-20) {
tmp = Math.sqrt((d / l)) * (Math.sqrt(-d) / Math.sqrt(-h));
} else if (l <= -5e-310) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + ((h * -0.5) * (Math.pow((M_m * ((D / d) / 2.0)), 2.0) / l)));
} else if (l <= 2.02e+214) {
tmp = (d / Math.sqrt((l * h))) * (1.0 + ((h * -0.5) * (Math.pow((M_m * (D / (d * 2.0))), 2.0) / l)));
} 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.12e-20: tmp = math.sqrt((d / l)) * (math.sqrt(-d) / math.sqrt(-h)) elif l <= -5e-310: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + ((h * -0.5) * (math.pow((M_m * ((D / d) / 2.0)), 2.0) / l))) elif l <= 2.02e+214: tmp = (d / math.sqrt((l * h))) * (1.0 + ((h * -0.5) * (math.pow((M_m * (D / (d * 2.0))), 2.0) / l))) 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.12e-20) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-h)))); elseif (l <= -5e-310) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(Float64(h * -0.5) * Float64((Float64(M_m * Float64(Float64(D / d) / 2.0)) ^ 2.0) / l)))); elseif (l <= 2.02e+214) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(1.0 + Float64(Float64(h * -0.5) * Float64((Float64(M_m * Float64(D / Float64(d * 2.0))) ^ 2.0) / l)))); else tmp = 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)
tmp = 0.0;
if (l <= -1.12e-20)
tmp = sqrt((d / l)) * (sqrt(-d) / sqrt(-h));
elseif (l <= -5e-310)
tmp = sqrt(((d / l) * (d / h))) * (1.0 + ((h * -0.5) * (((M_m * ((D / d) / 2.0)) ^ 2.0) / l)));
elseif (l <= 2.02e+214)
tmp = (d / sqrt((l * h))) * (1.0 + ((h * -0.5) * (((M_m * (D / (d * 2.0))) ^ 2.0) / l)));
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.12e-20], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * -0.5), $MachinePrecision] * N[(N[Power[N[(M$95$m * N[(N[(D / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.02e+214], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h * -0.5), $MachinePrecision] * N[(N[Power[N[(M$95$m * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $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.12 \cdot 10^{-20}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{-d}}{\sqrt{-h}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + \left(h \cdot -0.5\right) \cdot \frac{{\left(M\_m \cdot \frac{\frac{D}{d}}{2}\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;\ell \leq 2.02 \cdot 10^{+214}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + \left(h \cdot -0.5\right) \cdot \frac{{\left(M\_m \cdot \frac{D}{d \cdot 2}\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.12000000000000002e-20Initial program 67.7%
Simplified69.0%
Taylor expanded in M around 0 57.1%
frac-2neg70.5%
sqrt-div80.4%
Applied egg-rr62.9%
if -1.12000000000000002e-20 < l < -4.999999999999985e-310Initial program 73.0%
Simplified73.0%
*-commutative73.0%
unpow273.0%
associate-*r*74.5%
associate-*r/74.6%
associate-*l/74.6%
*-commutative74.6%
associate-*r/74.7%
associate-*l/74.7%
*-commutative74.7%
associate-*r*73.1%
unpow273.1%
associate-*l/76.8%
clear-num76.8%
un-div-inv76.8%
div-inv76.8%
clear-num76.8%
Applied egg-rr76.8%
pow176.8%
sqrt-unprod72.0%
cancel-sign-sub-inv72.0%
metadata-eval72.0%
associate-/l*69.0%
associate-/r*69.0%
Applied egg-rr69.0%
unpow169.0%
associate-*r*69.0%
associate-/r/69.0%
Simplified69.0%
if -4.999999999999985e-310 < l < 2.01999999999999999e214Initial program 67.3%
Simplified66.4%
*-commutative66.4%
unpow266.4%
associate-*r*67.4%
associate-*r/67.4%
associate-*l/67.4%
*-commutative67.4%
associate-*r/68.4%
associate-*l/68.3%
*-commutative68.3%
associate-*r*67.3%
unpow267.3%
associate-*l/73.3%
clear-num73.3%
un-div-inv73.4%
div-inv73.4%
clear-num73.4%
Applied egg-rr73.4%
sqrt-div77.0%
div-inv77.0%
Applied egg-rr77.0%
associate-*r/77.0%
*-rgt-identity77.0%
Simplified77.0%
pow177.0%
Applied egg-rr80.5%
unpow180.5%
associate-*r*80.5%
*-commutative80.5%
associate-/r/80.5%
*-commutative80.5%
Simplified80.5%
if 2.01999999999999999e214 < l Initial program 53.0%
Simplified56.7%
Taylor expanded in M around 0 45.2%
pow145.2%
*-rgt-identity45.2%
sqrt-unprod37.8%
Applied egg-rr37.8%
unpow137.8%
Simplified37.8%
sqrt-prod45.2%
*-commutative45.2%
sqrt-div56.4%
sqrt-div60.3%
frac-times60.4%
add-sqr-sqrt60.3%
Applied egg-rr60.3%
associate-/l/60.5%
Simplified60.5%
Final simplification70.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
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* (* h -0.5) (/ (pow (* M_m (/ (/ D d) 2.0)) 2.0) l))))))
(if (<= l -2.3e+144)
t_0
(if (<= l -1.6e-18)
(* (- d) (sqrt (/ 1.0 (* l h))))
(if (<= l -5e-310)
t_0
(if (<= l 1.56e+212)
(*
(/ d (sqrt (* l h)))
(+ 1.0 (* (* h -0.5) (/ (pow (* M_m (/ D (* d 2.0))) 2.0) l))))
(/ (/ 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 = sqrt(((d / l) * (d / h))) * (1.0 + ((h * -0.5) * (pow((M_m * ((D / d) / 2.0)), 2.0) / l)));
double tmp;
if (l <= -2.3e+144) {
tmp = t_0;
} else if (l <= -1.6e-18) {
tmp = -d * sqrt((1.0 / (l * h)));
} else if (l <= -5e-310) {
tmp = t_0;
} else if (l <= 1.56e+212) {
tmp = (d / sqrt((l * h))) * (1.0 + ((h * -0.5) * (pow((M_m * (D / (d * 2.0))), 2.0) / l)));
} 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) :: t_0
real(8) :: tmp
t_0 = sqrt(((d / l) * (d / h))) * (1.0d0 + ((h * (-0.5d0)) * (((m_m * ((d_1 / d) / 2.0d0)) ** 2.0d0) / l)))
if (l <= (-2.3d+144)) then
tmp = t_0
else if (l <= (-1.6d-18)) then
tmp = -d * sqrt((1.0d0 / (l * h)))
else if (l <= (-5d-310)) then
tmp = t_0
else if (l <= 1.56d+212) then
tmp = (d / sqrt((l * h))) * (1.0d0 + ((h * (-0.5d0)) * (((m_m * (d_1 / (d * 2.0d0))) ** 2.0d0) / l)))
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 t_0 = Math.sqrt(((d / l) * (d / h))) * (1.0 + ((h * -0.5) * (Math.pow((M_m * ((D / d) / 2.0)), 2.0) / l)));
double tmp;
if (l <= -2.3e+144) {
tmp = t_0;
} else if (l <= -1.6e-18) {
tmp = -d * Math.sqrt((1.0 / (l * h)));
} else if (l <= -5e-310) {
tmp = t_0;
} else if (l <= 1.56e+212) {
tmp = (d / Math.sqrt((l * h))) * (1.0 + ((h * -0.5) * (Math.pow((M_m * (D / (d * 2.0))), 2.0) / l)));
} 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): t_0 = math.sqrt(((d / l) * (d / h))) * (1.0 + ((h * -0.5) * (math.pow((M_m * ((D / d) / 2.0)), 2.0) / l))) tmp = 0 if l <= -2.3e+144: tmp = t_0 elif l <= -1.6e-18: tmp = -d * math.sqrt((1.0 / (l * h))) elif l <= -5e-310: tmp = t_0 elif l <= 1.56e+212: tmp = (d / math.sqrt((l * h))) * (1.0 + ((h * -0.5) * (math.pow((M_m * (D / (d * 2.0))), 2.0) / l))) 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) t_0 = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(Float64(h * -0.5) * Float64((Float64(M_m * Float64(Float64(D / d) / 2.0)) ^ 2.0) / l)))) tmp = 0.0 if (l <= -2.3e+144) tmp = t_0; elseif (l <= -1.6e-18) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); elseif (l <= -5e-310) tmp = t_0; elseif (l <= 1.56e+212) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(1.0 + Float64(Float64(h * -0.5) * Float64((Float64(M_m * Float64(D / Float64(d * 2.0))) ^ 2.0) / l)))); else tmp = 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 = sqrt(((d / l) * (d / h))) * (1.0 + ((h * -0.5) * (((M_m * ((D / d) / 2.0)) ^ 2.0) / l)));
tmp = 0.0;
if (l <= -2.3e+144)
tmp = t_0;
elseif (l <= -1.6e-18)
tmp = -d * sqrt((1.0 / (l * h)));
elseif (l <= -5e-310)
tmp = t_0;
elseif (l <= 1.56e+212)
tmp = (d / sqrt((l * h))) * (1.0 + ((h * -0.5) * (((M_m * (D / (d * 2.0))) ^ 2.0) / l)));
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_] := Block[{t$95$0 = N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * -0.5), $MachinePrecision] * N[(N[Power[N[(M$95$m * N[(N[(D / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.3e+144], t$95$0, If[LessEqual[l, -1.6e-18], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], t$95$0, If[LessEqual[l, 1.56e+212], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h * -0.5), $MachinePrecision] * N[(N[Power[N[(M$95$m * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $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} \cdot \frac{d}{h}} \cdot \left(1 + \left(h \cdot -0.5\right) \cdot \frac{{\left(M\_m \cdot \frac{\frac{D}{d}}{2}\right)}^{2}}{\ell}\right)\\
\mathbf{if}\;\ell \leq -2.3 \cdot 10^{+144}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -1.6 \cdot 10^{-18}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 1.56 \cdot 10^{+212}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 + \left(h \cdot -0.5\right) \cdot \frac{{\left(M\_m \cdot \frac{D}{d \cdot 2}\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.3000000000000001e144 or -1.6e-18 < l < -4.999999999999985e-310Initial program 71.1%
Simplified71.0%
*-commutative71.0%
unpow271.0%
associate-*r*72.1%
associate-*r/72.2%
associate-*l/72.2%
*-commutative72.2%
associate-*r/72.3%
associate-*l/72.3%
*-commutative72.3%
associate-*r*71.2%
unpow271.2%
associate-*l/74.7%
clear-num74.7%
un-div-inv74.7%
div-inv74.7%
clear-num74.7%
Applied egg-rr74.7%
pow174.7%
sqrt-unprod68.8%
cancel-sign-sub-inv68.8%
metadata-eval68.8%
associate-/l*66.9%
associate-/r*66.8%
Applied egg-rr66.8%
unpow166.8%
associate-*r*66.8%
associate-/r/66.8%
Simplified66.8%
if -2.3000000000000001e144 < l < -1.6e-18Initial program 67.9%
Simplified70.3%
clear-num70.3%
sqrt-div71.0%
metadata-eval71.0%
Applied egg-rr71.0%
Taylor expanded in d around -inf 64.7%
if -4.999999999999985e-310 < l < 1.56000000000000009e212Initial program 67.3%
Simplified66.4%
*-commutative66.4%
unpow266.4%
associate-*r*67.4%
associate-*r/67.4%
associate-*l/67.4%
*-commutative67.4%
associate-*r/68.4%
associate-*l/68.3%
*-commutative68.3%
associate-*r*67.3%
unpow267.3%
associate-*l/73.3%
clear-num73.3%
un-div-inv73.4%
div-inv73.4%
clear-num73.4%
Applied egg-rr73.4%
sqrt-div77.0%
div-inv77.0%
Applied egg-rr77.0%
associate-*r/77.0%
*-rgt-identity77.0%
Simplified77.0%
pow177.0%
Applied egg-rr80.5%
unpow180.5%
associate-*r*80.5%
*-commutative80.5%
associate-/r/80.5%
*-commutative80.5%
Simplified80.5%
if 1.56000000000000009e212 < l Initial program 53.0%
Simplified56.7%
Taylor expanded in M around 0 45.2%
pow145.2%
*-rgt-identity45.2%
sqrt-unprod37.8%
Applied egg-rr37.8%
unpow137.8%
Simplified37.8%
sqrt-prod45.2%
*-commutative45.2%
sqrt-div56.4%
sqrt-div60.3%
frac-times60.4%
add-sqr-sqrt60.3%
Applied egg-rr60.3%
associate-/l/60.5%
Simplified60.5%
Final simplification71.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 (* l h)))))
(if (<= h -1.9e+55)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= h 2.2e-304)
(fabs t_0)
(*
t_0
(+ 1.0 (* (* h -0.5) (/ (pow (* M_m (/ D (* d 2.0))) 2.0) l))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = d / sqrt((l * h));
double tmp;
if (h <= -1.9e+55) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (h <= 2.2e-304) {
tmp = fabs(t_0);
} else {
tmp = t_0 * (1.0 + ((h * -0.5) * (pow((M_m * (D / (d * 2.0))), 2.0) / l)));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = d / sqrt((l * h))
if (h <= (-1.9d+55)) then
tmp = sqrt((d / l)) * sqrt((d / h))
else if (h <= 2.2d-304) then
tmp = abs(t_0)
else
tmp = t_0 * (1.0d0 + ((h * (-0.5d0)) * (((m_m * (d_1 / (d * 2.0d0))) ** 2.0d0) / l)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = d / Math.sqrt((l * h));
double tmp;
if (h <= -1.9e+55) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (h <= 2.2e-304) {
tmp = Math.abs(t_0);
} else {
tmp = t_0 * (1.0 + ((h * -0.5) * (Math.pow((M_m * (D / (d * 2.0))), 2.0) / l)));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = d / math.sqrt((l * h)) tmp = 0 if h <= -1.9e+55: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif h <= 2.2e-304: tmp = math.fabs(t_0) else: tmp = t_0 * (1.0 + ((h * -0.5) * (math.pow((M_m * (D / (d * 2.0))), 2.0) / l))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(d / sqrt(Float64(l * h))) tmp = 0.0 if (h <= -1.9e+55) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (h <= 2.2e-304) tmp = abs(t_0); else tmp = Float64(t_0 * Float64(1.0 + Float64(Float64(h * -0.5) * Float64((Float64(M_m * Float64(D / Float64(d * 2.0))) ^ 2.0) / l)))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = d / sqrt((l * h));
tmp = 0.0;
if (h <= -1.9e+55)
tmp = sqrt((d / l)) * sqrt((d / h));
elseif (h <= 2.2e-304)
tmp = abs(t_0);
else
tmp = t_0 * (1.0 + ((h * -0.5) * (((M_m * (D / (d * 2.0))) ^ 2.0) / l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1.9e+55], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.2e-304], N[Abs[t$95$0], $MachinePrecision], N[(t$95$0 * N[(1.0 + N[(N[(h * -0.5), $MachinePrecision] * N[(N[Power[N[(M$95$m * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / 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 := \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;h \leq -1.9 \cdot 10^{+55}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;h \leq 2.2 \cdot 10^{-304}:\\
\;\;\;\;\left|t\_0\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(1 + \left(h \cdot -0.5\right) \cdot \frac{{\left(M\_m \cdot \frac{D}{d \cdot 2}\right)}^{2}}{\ell}\right)\\
\end{array}
\end{array}
if h < -1.9e55Initial program 60.0%
Simplified59.9%
Taylor expanded in M around 0 45.0%
pow145.0%
*-rgt-identity45.0%
sqrt-unprod38.3%
Applied egg-rr38.3%
unpow138.3%
Simplified38.3%
sqrt-prod45.0%
*-commutative45.0%
Applied egg-rr45.0%
if -1.9e55 < h < 2.2e-304Initial program 74.6%
Simplified75.7%
Taylor expanded in M around 0 45.8%
pow145.8%
*-rgt-identity45.8%
sqrt-unprod38.7%
Applied egg-rr38.7%
unpow138.7%
Simplified38.7%
add-sqr-sqrt38.7%
rem-sqrt-square38.7%
frac-times34.5%
sqrt-div37.5%
sqrt-unprod2.2%
add-sqr-sqrt51.1%
Applied egg-rr51.1%
if 2.2e-304 < h Initial program 64.7%
Simplified64.6%
*-commutative64.6%
unpow264.6%
associate-*r*64.7%
associate-*r/63.9%
associate-*l/64.7%
*-commutative64.7%
associate-*r/64.7%
associate-*l/65.5%
*-commutative65.5%
associate-*r*65.4%
unpow265.4%
associate-*l/70.5%
clear-num70.5%
un-div-inv70.5%
div-inv70.4%
clear-num70.4%
Applied egg-rr70.4%
sqrt-div75.8%
div-inv75.7%
Applied egg-rr75.7%
associate-*r/75.8%
*-rgt-identity75.8%
Simplified75.8%
pow175.8%
Applied egg-rr72.2%
unpow172.2%
associate-*r*72.2%
*-commutative72.2%
associate-/r/71.4%
*-commutative71.4%
Simplified71.4%
Final simplification59.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 (<= h -2.02e+149)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= h 6e-309)
(* (- 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 (h <= -2.02e+149) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (h <= 6e-309) {
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 (h <= (-2.02d+149)) then
tmp = sqrt((d / l)) * sqrt((d / h))
else if (h <= 6d-309) 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 (h <= -2.02e+149) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (h <= 6e-309) {
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 h <= -2.02e+149: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif h <= 6e-309: 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 (h <= -2.02e+149) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (h <= 6e-309) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); else tmp = 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)
tmp = 0.0;
if (h <= -2.02e+149)
tmp = sqrt((d / l)) * sqrt((d / h));
elseif (h <= 6e-309)
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[h, -2.02e+149], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 6e-309], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $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 -2.02 \cdot 10^{+149}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;h \leq 6 \cdot 10^{-309}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if h < -2.02e149Initial program 55.4%
Simplified55.2%
Taylor expanded in M around 0 45.0%
pow145.0%
*-rgt-identity45.0%
sqrt-unprod36.5%
Applied egg-rr36.5%
unpow136.5%
Simplified36.5%
sqrt-prod45.0%
*-commutative45.0%
Applied egg-rr45.0%
if -2.02e149 < h < 6.000000000000001e-309Initial program 75.4%
Simplified76.4%
clear-num76.4%
sqrt-div76.7%
metadata-eval76.7%
Applied egg-rr76.7%
Taylor expanded in d around -inf 49.6%
if 6.000000000000001e-309 < h Initial program 64.4%
Simplified64.4%
Taylor expanded in M around 0 38.9%
pow138.9%
*-rgt-identity38.9%
sqrt-unprod29.2%
Applied egg-rr29.2%
unpow129.2%
Simplified29.2%
sqrt-prod38.9%
*-commutative38.9%
sqrt-div43.4%
sqrt-div47.1%
frac-times47.2%
add-sqr-sqrt47.2%
Applied egg-rr47.2%
associate-/l/47.2%
Simplified47.2%
Final simplification47.8%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (if (<= h -1.25e+166) (sqrt (* (/ d l) (/ d h))) (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 (h <= -1.25e+166) {
tmp = sqrt(((d / l) * (d / h)));
} 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 (h <= (-1.25d+166)) then
tmp = sqrt(((d / l) * (d / h)))
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 (h <= -1.25e+166) {
tmp = Math.sqrt(((d / l) * (d / h)));
} 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 h <= -1.25e+166: tmp = math.sqrt(((d / l) * (d / h))) 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 (h <= -1.25e+166) tmp = sqrt(Float64(Float64(d / l) * Float64(d / h))); 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 (h <= -1.25e+166)
tmp = sqrt(((d / l) * (d / h)));
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[h, -1.25e+166], N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $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}\;h \leq -1.25 \cdot 10^{+166}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\end{array}
\end{array}
if h < -1.25e166Initial program 55.7%
Simplified55.5%
Taylor expanded in M around 0 44.6%
pow144.6%
*-rgt-identity44.6%
sqrt-unprod38.5%
Applied egg-rr38.5%
unpow138.5%
Simplified38.5%
if -1.25e166 < h Initial program 69.1%
Simplified69.5%
Taylor expanded in M around 0 41.5%
pow141.5%
*-rgt-identity41.5%
sqrt-unprod32.8%
Applied egg-rr32.8%
unpow132.8%
Simplified32.8%
add-sqr-sqrt32.8%
rem-sqrt-square32.8%
frac-times26.3%
sqrt-div29.6%
sqrt-unprod21.1%
add-sqr-sqrt43.2%
Applied egg-rr43.2%
Final simplification42.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 3.9e-274) (* (- 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 (d <= 3.9e-274) {
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 (d <= 3.9d-274) 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 (d <= 3.9e-274) {
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 d <= 3.9e-274: 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 (d <= 3.9e-274) 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 (d <= 3.9e-274)
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[d, 3.9e-274], 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}\;d \leq 3.9 \cdot 10^{-274}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < 3.89999999999999985e-274Initial program 66.8%
Simplified66.8%
clear-num66.0%
sqrt-div66.2%
metadata-eval66.2%
Applied egg-rr66.2%
Taylor expanded in d around -inf 41.6%
if 3.89999999999999985e-274 < d Initial program 68.0%
Simplified68.8%
Taylor expanded in M around 0 42.5%
pow142.5%
*-rgt-identity42.5%
sqrt-unprod31.9%
Applied egg-rr31.9%
unpow131.9%
Simplified31.9%
sqrt-prod42.5%
*-commutative42.5%
sqrt-div46.6%
sqrt-div50.7%
frac-times50.7%
add-sqr-sqrt50.7%
Applied egg-rr50.7%
Final simplification45.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.42e-276) (* (- 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 (d <= 1.42e-276) {
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 (d <= 1.42d-276) 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 (d <= 1.42e-276) {
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 d <= 1.42e-276: 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 (d <= 1.42e-276) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); else tmp = 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)
tmp = 0.0;
if (d <= 1.42e-276)
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[d, 1.42e-276], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $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.42 \cdot 10^{-276}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < 1.41999999999999993e-276Initial program 66.8%
Simplified66.8%
clear-num66.0%
sqrt-div66.2%
metadata-eval66.2%
Applied egg-rr66.2%
Taylor expanded in d around -inf 41.6%
if 1.41999999999999993e-276 < d Initial program 68.0%
Simplified68.8%
Taylor expanded in M around 0 42.5%
pow142.5%
*-rgt-identity42.5%
sqrt-unprod31.9%
Applied egg-rr31.9%
unpow131.9%
Simplified31.9%
sqrt-prod42.5%
*-commutative42.5%
sqrt-div46.6%
sqrt-div50.7%
frac-times50.7%
add-sqr-sqrt50.7%
Applied egg-rr50.7%
associate-/l/50.8%
Simplified50.8%
Final simplification45.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 6e-296) (* (- d) (sqrt (/ (/ 1.0 h) l))) (* d (pow (* l h) -0.5))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= 6e-296) {
tmp = -d * sqrt(((1.0 / h) / l));
} else {
tmp = d * pow((l * h), -0.5);
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= 6d-296) then
tmp = -d * sqrt(((1.0d0 / h) / l))
else
tmp = d * ((l * h) ** (-0.5d0))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= 6e-296) {
tmp = -d * Math.sqrt(((1.0 / h) / l));
} else {
tmp = d * Math.pow((l * h), -0.5);
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= 6e-296: tmp = -d * math.sqrt(((1.0 / h) / l)) else: tmp = d * math.pow((l * h), -0.5) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= 6e-296) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); else tmp = Float64(d * (Float64(l * h) ^ -0.5)); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= 6e-296)
tmp = -d * sqrt(((1.0 / h) / l));
else
tmp = d * ((l * h) ^ -0.5);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, 6e-296], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 6 \cdot 10^{-296}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\end{array}
\end{array}
if l < 5.9999999999999995e-296Initial program 70.3%
Simplified71.0%
Taylor expanded in M around 0 43.5%
pow143.5%
*-rgt-identity43.5%
sqrt-unprod36.6%
Applied egg-rr36.6%
unpow136.6%
Simplified36.6%
Taylor expanded in d around -inf 43.6%
associate-*r*43.6%
neg-mul-143.6%
associate-/r*43.5%
Simplified43.5%
if 5.9999999999999995e-296 < l Initial program 64.0%
Simplified64.0%
Taylor expanded in M around 0 40.2%
pow140.2%
*-rgt-identity40.2%
sqrt-unprod30.1%
Applied egg-rr30.1%
unpow130.1%
Simplified30.1%
sqrt-prod40.2%
clear-num40.1%
sqrt-div40.8%
metadata-eval40.8%
*-rgt-identity40.8%
associate-*r*40.8%
metadata-eval40.8%
sqrt-div40.1%
clear-num40.2%
sqrt-prod30.1%
frac-times21.9%
sqrt-div25.0%
sqrt-unprod39.2%
add-sqr-sqrt39.3%
Applied egg-rr39.3%
*-rgt-identity39.3%
Simplified39.3%
clear-num39.3%
associate-/r/39.3%
pow1/239.3%
pow-flip39.3%
metadata-eval39.3%
Applied egg-rr39.3%
Final simplification41.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 (<= l 2.2e-292) (* (- d) (sqrt (/ 1.0 (* 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 (l <= 2.2e-292) {
tmp = -d * sqrt((1.0 / (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 (l <= 2.2d-292) then
tmp = -d * sqrt((1.0d0 / (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 (l <= 2.2e-292) {
tmp = -d * Math.sqrt((1.0 / (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 l <= 2.2e-292: tmp = -d * math.sqrt((1.0 / (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 (l <= 2.2e-292) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); else tmp = Float64(d * (Float64(l * h) ^ -0.5)); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= 2.2e-292)
tmp = -d * sqrt((1.0 / (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[l, 2.2e-292], N[((-d) * N[Sqrt[N[(1.0 / 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}\;\ell \leq 2.2 \cdot 10^{-292}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\end{array}
\end{array}
if l < 2.20000000000000011e-292Initial program 70.3%
Simplified71.0%
clear-num70.1%
sqrt-div70.3%
metadata-eval70.3%
Applied egg-rr70.3%
Taylor expanded in d around -inf 43.6%
if 2.20000000000000011e-292 < l Initial program 64.0%
Simplified64.0%
Taylor expanded in M around 0 40.2%
pow140.2%
*-rgt-identity40.2%
sqrt-unprod30.1%
Applied egg-rr30.1%
unpow130.1%
Simplified30.1%
sqrt-prod40.2%
clear-num40.1%
sqrt-div40.8%
metadata-eval40.8%
*-rgt-identity40.8%
associate-*r*40.8%
metadata-eval40.8%
sqrt-div40.1%
clear-num40.2%
sqrt-prod30.1%
frac-times21.9%
sqrt-div25.0%
sqrt-unprod39.2%
add-sqr-sqrt39.3%
Applied egg-rr39.3%
*-rgt-identity39.3%
Simplified39.3%
clear-num39.3%
associate-/r/39.3%
pow1/239.3%
pow-flip39.3%
metadata-eval39.3%
Applied egg-rr39.3%
Final simplification41.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 -2.9e-136) (sqrt (* (/ d l) (/ d 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 (d <= -2.9e-136) {
tmp = sqrt(((d / l) * (d / 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 (d <= (-2.9d-136)) then
tmp = sqrt(((d / l) * (d / 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 (d <= -2.9e-136) {
tmp = Math.sqrt(((d / l) * (d / 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 d <= -2.9e-136: tmp = math.sqrt(((d / l) * (d / 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 (d <= -2.9e-136) tmp = sqrt(Float64(Float64(d / l) * Float64(d / h))); else tmp = Float64(d * (Float64(l * h) ^ -0.5)); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (d <= -2.9e-136)
tmp = sqrt(((d / l) * (d / 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[d, -2.9e-136], N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.9 \cdot 10^{-136}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\end{array}
\end{array}
if d < -2.89999999999999995e-136Initial program 78.5%
Simplified79.5%
Taylor expanded in M around 0 55.0%
pow155.0%
*-rgt-identity55.0%
sqrt-unprod46.4%
Applied egg-rr46.4%
unpow146.4%
Simplified46.4%
if -2.89999999999999995e-136 < d Initial program 60.5%
Simplified60.5%
Taylor expanded in M around 0 33.9%
pow133.9%
*-rgt-identity33.9%
sqrt-unprod25.8%
Applied egg-rr25.8%
unpow125.8%
Simplified25.8%
sqrt-prod33.9%
clear-num33.9%
sqrt-div34.4%
metadata-eval34.4%
*-rgt-identity34.4%
associate-*r*34.4%
metadata-eval34.4%
sqrt-div33.9%
clear-num33.9%
sqrt-prod25.8%
frac-times18.4%
sqrt-div21.1%
sqrt-unprod29.7%
add-sqr-sqrt33.5%
Applied egg-rr33.5%
*-rgt-identity33.5%
Simplified33.5%
clear-num33.5%
associate-/r/33.5%
pow1/233.5%
pow-flip33.5%
metadata-eval33.5%
Applied egg-rr33.5%
Final simplification38.4%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (* d (pow (* l h) -0.5)))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
return d * pow((l * h), -0.5);
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
code = d * ((l * h) ** (-0.5d0))
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
return d * Math.pow((l * h), -0.5);
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): return d * math.pow((l * h), -0.5)
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) return Float64(d * (Float64(l * h) ^ -0.5)) end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp = code(d, h, l, M_m, D)
tmp = d * ((l * h) ^ -0.5);
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
d \cdot {\left(\ell \cdot h\right)}^{-0.5}
\end{array}
Initial program 67.3%
Simplified67.7%
Taylor expanded in M around 0 41.9%
pow141.9%
*-rgt-identity41.9%
sqrt-unprod33.6%
Applied egg-rr33.6%
unpow133.6%
Simplified33.6%
sqrt-prod41.9%
clear-num41.8%
sqrt-div42.3%
metadata-eval42.3%
*-rgt-identity42.3%
associate-*r*42.3%
metadata-eval42.3%
sqrt-div41.8%
clear-num41.9%
sqrt-prod33.6%
frac-times24.0%
sqrt-div27.3%
sqrt-unprod18.4%
add-sqr-sqrt23.6%
Applied egg-rr23.6%
*-rgt-identity23.6%
Simplified23.6%
clear-num23.6%
associate-/r/23.6%
pow1/223.6%
pow-flip23.6%
metadata-eval23.6%
Applied egg-rr23.6%
Final simplification23.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 (/ 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 67.3%
Simplified67.7%
Taylor expanded in M around 0 41.9%
pow141.9%
*-rgt-identity41.9%
sqrt-unprod33.6%
Applied egg-rr33.6%
unpow133.6%
Simplified33.6%
sqrt-prod41.9%
clear-num41.8%
sqrt-div42.3%
metadata-eval42.3%
*-rgt-identity42.3%
associate-*r*42.3%
metadata-eval42.3%
sqrt-div41.8%
clear-num41.9%
sqrt-prod33.6%
frac-times24.0%
sqrt-div27.3%
sqrt-unprod18.4%
add-sqr-sqrt23.6%
Applied egg-rr23.6%
*-rgt-identity23.6%
Simplified23.6%
Final simplification23.6%
herbie shell --seed 2024115
(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)))))