
(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)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d l))) (t_1 (pow (* D_m (* M_m (/ 0.5 d))) 2.0)))
(if (<= l -2e-310)
(* (/ (sqrt (- d)) (sqrt (- h))) (* t_0 (+ 1.0 (* h (/ t_1 (/ l -0.5))))))
(*
(* t_0 (* (sqrt d) (/ 1.0 (sqrt h))))
(- 1.0 (* 0.5 (* h (/ t_1 l))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((d / l));
double t_1 = pow((D_m * (M_m * (0.5 / d))), 2.0);
double tmp;
if (l <= -2e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * (1.0 + (h * (t_1 / (l / -0.5)))));
} else {
tmp = (t_0 * (sqrt(d) * (1.0 / sqrt(h)))) * (1.0 - (0.5 * (h * (t_1 / l))));
}
return tmp;
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = (d_m * (m_m * (0.5d0 / d))) ** 2.0d0
if (l <= (-2d-310)) then
tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * (1.0d0 + (h * (t_1 / (l / (-0.5d0))))))
else
tmp = (t_0 * (sqrt(d) * (1.0d0 / sqrt(h)))) * (1.0d0 - (0.5d0 * (h * (t_1 / l))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt((d / l));
double t_1 = Math.pow((D_m * (M_m * (0.5 / d))), 2.0);
double tmp;
if (l <= -2e-310) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * (t_0 * (1.0 + (h * (t_1 / (l / -0.5)))));
} else {
tmp = (t_0 * (Math.sqrt(d) * (1.0 / Math.sqrt(h)))) * (1.0 - (0.5 * (h * (t_1 / l))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt((d / l)) t_1 = math.pow((D_m * (M_m * (0.5 / d))), 2.0) tmp = 0 if l <= -2e-310: tmp = (math.sqrt(-d) / math.sqrt(-h)) * (t_0 * (1.0 + (h * (t_1 / (l / -0.5))))) else: tmp = (t_0 * (math.sqrt(d) * (1.0 / math.sqrt(h)))) * (1.0 - (0.5 * (h * (t_1 / l)))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(d / l)) t_1 = Float64(D_m * Float64(M_m * Float64(0.5 / d))) ^ 2.0 tmp = 0.0 if (l <= -2e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(t_0 * Float64(1.0 + Float64(h * Float64(t_1 / Float64(l / -0.5)))))); else tmp = Float64(Float64(t_0 * Float64(sqrt(d) * Float64(1.0 / sqrt(h)))) * Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_1 / l))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt((d / l));
t_1 = (D_m * (M_m * (0.5 / d))) ^ 2.0;
tmp = 0.0;
if (l <= -2e-310)
tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * (1.0 + (h * (t_1 / (l / -0.5)))));
else
tmp = (t_0 * (sqrt(d) * (1.0 / sqrt(h)))) * (1.0 - (0.5 * (h * (t_1 / l))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[l, -2e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 + N[(h * N[(t$95$1 / N[(l / -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] * N[(1.0 / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(t$95$1 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := {\left(D_m \cdot \left(M_m \cdot \frac{0.5}{d}\right)\right)}^{2}\\
\mathbf{if}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(t_0 \cdot \left(1 + h \cdot \frac{t_1}{\frac{\ell}{-0.5}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_0 \cdot \left(\sqrt{d} \cdot \frac{1}{\sqrt{h}}\right)\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{t_1}{\ell}\right)\right)\\
\end{array}
\end{array}
if l < -1.999999999999994e-310Initial program 67.5%
Simplified66.8%
Applied egg-rr38.5%
expm1-def38.5%
expm1-log1p66.8%
*-commutative66.8%
associate-*r/69.9%
associate-*l/70.6%
*-commutative70.6%
associate-/l*70.6%
associate-*r*70.6%
associate-*r/71.3%
associate-*l/71.2%
associate-*r/71.2%
*-commutative71.2%
Simplified71.2%
frac-2neg71.2%
sqrt-div84.4%
Applied egg-rr84.4%
if -1.999999999999994e-310 < l Initial program 63.8%
Simplified63.8%
expm1-log1p-u63.6%
expm1-udef63.6%
*-commutative63.6%
div-inv63.6%
associate-*l*63.6%
metadata-eval63.6%
Applied egg-rr63.6%
expm1-def63.6%
expm1-log1p63.8%
associate-*l/66.8%
*-commutative66.8%
associate-*l/68.1%
*-commutative68.1%
associate-*r*68.1%
associate-*r/68.0%
associate-*l/68.1%
associate-*r/68.1%
*-commutative68.1%
Simplified68.1%
sqrt-div78.0%
div-inv78.0%
Applied egg-rr78.0%
Final simplification81.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (pow (* D_m (* M_m (/ 0.5 d))) 2.0)) (t_1 (sqrt (/ d h))))
(if (<= h -5e-310)
(* (- 1.0 (* 0.5 (* h (/ t_0 l)))) (* t_1 (/ (sqrt (- d)) (sqrt (- l)))))
(* t_1 (* (+ 1.0 (* h (/ t_0 (/ l -0.5)))) (/ (sqrt d) (sqrt l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = pow((D_m * (M_m * (0.5 / d))), 2.0);
double t_1 = sqrt((d / h));
double tmp;
if (h <= -5e-310) {
tmp = (1.0 - (0.5 * (h * (t_0 / l)))) * (t_1 * (sqrt(-d) / sqrt(-l)));
} else {
tmp = t_1 * ((1.0 + (h * (t_0 / (l / -0.5)))) * (sqrt(d) / sqrt(l)));
}
return tmp;
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (d_m * (m_m * (0.5d0 / d))) ** 2.0d0
t_1 = sqrt((d / h))
if (h <= (-5d-310)) then
tmp = (1.0d0 - (0.5d0 * (h * (t_0 / l)))) * (t_1 * (sqrt(-d) / sqrt(-l)))
else
tmp = t_1 * ((1.0d0 + (h * (t_0 / (l / (-0.5d0))))) * (sqrt(d) / sqrt(l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.pow((D_m * (M_m * (0.5 / d))), 2.0);
double t_1 = Math.sqrt((d / h));
double tmp;
if (h <= -5e-310) {
tmp = (1.0 - (0.5 * (h * (t_0 / l)))) * (t_1 * (Math.sqrt(-d) / Math.sqrt(-l)));
} else {
tmp = t_1 * ((1.0 + (h * (t_0 / (l / -0.5)))) * (Math.sqrt(d) / Math.sqrt(l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.pow((D_m * (M_m * (0.5 / d))), 2.0) t_1 = math.sqrt((d / h)) tmp = 0 if h <= -5e-310: tmp = (1.0 - (0.5 * (h * (t_0 / l)))) * (t_1 * (math.sqrt(-d) / math.sqrt(-l))) else: tmp = t_1 * ((1.0 + (h * (t_0 / (l / -0.5)))) * (math.sqrt(d) / math.sqrt(l))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(M_m * Float64(0.5 / d))) ^ 2.0 t_1 = sqrt(Float64(d / h)) tmp = 0.0 if (h <= -5e-310) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_0 / l)))) * Float64(t_1 * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))))); else tmp = Float64(t_1 * Float64(Float64(1.0 + Float64(h * Float64(t_0 / Float64(l / -0.5)))) * Float64(sqrt(d) / sqrt(l)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (D_m * (M_m * (0.5 / d))) ^ 2.0;
t_1 = sqrt((d / h));
tmp = 0.0;
if (h <= -5e-310)
tmp = (1.0 - (0.5 * (h * (t_0 / l)))) * (t_1 * (sqrt(-d) / sqrt(-l)));
else
tmp = t_1 * ((1.0 + (h * (t_0 / (l / -0.5)))) * (sqrt(d) / sqrt(l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Power[N[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -5e-310], N[(N[(1.0 - N[(0.5 * N[(h * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(N[(1.0 + N[(h * N[(t$95$0 / N[(l / -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := {\left(D_m \cdot \left(M_m \cdot \frac{0.5}{d}\right)\right)}^{2}\\
t_1 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(h \cdot \frac{t_0}{\ell}\right)\right) \cdot \left(t_1 \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(\left(1 + h \cdot \frac{t_0}{\frac{\ell}{-0.5}}\right) \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 67.5%
Simplified66.8%
expm1-log1p-u66.4%
expm1-udef66.4%
*-commutative66.4%
div-inv66.4%
associate-*l*66.4%
metadata-eval66.4%
Applied egg-rr66.4%
expm1-def66.4%
expm1-log1p66.8%
associate-*l/69.9%
*-commutative69.9%
associate-*l/70.6%
*-commutative70.6%
associate-*r*70.6%
associate-*r/71.3%
associate-*l/71.2%
associate-*r/71.2%
*-commutative71.2%
Simplified71.2%
frac-2neg71.2%
sqrt-div74.2%
Applied egg-rr74.2%
if -4.999999999999985e-310 < h Initial program 63.8%
Simplified63.8%
Applied egg-rr37.5%
expm1-def37.5%
expm1-log1p63.8%
*-commutative63.8%
associate-*r/66.0%
associate-*l/67.3%
*-commutative67.3%
associate-/l*67.3%
associate-*r*67.3%
associate-*r/67.3%
associate-*l/67.3%
associate-*r/67.3%
*-commutative67.3%
Simplified67.3%
sqrt-div76.8%
div-inv76.8%
Applied egg-rr76.8%
associate-*r/76.8%
*-rgt-identity76.8%
Simplified76.8%
Final simplification75.4%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (- 1.0 (* 0.5 (* h (/ (pow (* D_m (* M_m (/ 0.5 d))) 2.0) l))))))
(if (<= h -5e-310)
(* t_0 (* (sqrt (/ d h)) (/ (sqrt (- d)) (sqrt (- l)))))
(* (* (sqrt (/ d l)) (* (sqrt d) (/ 1.0 (sqrt h)))) t_0))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 1.0 - (0.5 * (h * (pow((D_m * (M_m * (0.5 / d))), 2.0) / l)));
double tmp;
if (h <= -5e-310) {
tmp = t_0 * (sqrt((d / h)) * (sqrt(-d) / sqrt(-l)));
} else {
tmp = (sqrt((d / l)) * (sqrt(d) * (1.0 / sqrt(h)))) * t_0;
}
return tmp;
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (0.5d0 * (h * (((d_m * (m_m * (0.5d0 / d))) ** 2.0d0) / l)))
if (h <= (-5d-310)) then
tmp = t_0 * (sqrt((d / h)) * (sqrt(-d) / sqrt(-l)))
else
tmp = (sqrt((d / l)) * (sqrt(d) * (1.0d0 / sqrt(h)))) * t_0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 1.0 - (0.5 * (h * (Math.pow((D_m * (M_m * (0.5 / d))), 2.0) / l)));
double tmp;
if (h <= -5e-310) {
tmp = t_0 * (Math.sqrt((d / h)) * (Math.sqrt(-d) / Math.sqrt(-l)));
} else {
tmp = (Math.sqrt((d / l)) * (Math.sqrt(d) * (1.0 / Math.sqrt(h)))) * t_0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = 1.0 - (0.5 * (h * (math.pow((D_m * (M_m * (0.5 / d))), 2.0) / l))) tmp = 0 if h <= -5e-310: tmp = t_0 * (math.sqrt((d / h)) * (math.sqrt(-d) / math.sqrt(-l))) else: tmp = (math.sqrt((d / l)) * (math.sqrt(d) * (1.0 / math.sqrt(h)))) * t_0 return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(D_m * Float64(M_m * Float64(0.5 / d))) ^ 2.0) / l)))) tmp = 0.0 if (h <= -5e-310) tmp = Float64(t_0 * Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))))); else tmp = Float64(Float64(sqrt(Float64(d / l)) * Float64(sqrt(d) * Float64(1.0 / sqrt(h)))) * t_0); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = 1.0 - (0.5 * (h * (((D_m * (M_m * (0.5 / d))) ^ 2.0) / l)));
tmp = 0.0;
if (h <= -5e-310)
tmp = t_0 * (sqrt((d / h)) * (sqrt(-d) / sqrt(-l)));
else
tmp = (sqrt((d / l)) * (sqrt(d) * (1.0 / sqrt(h)))) * t_0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -5e-310], N[(t$95$0 * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] * N[(1.0 / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := 1 - 0.5 \cdot \left(h \cdot \frac{{\left(D_m \cdot \left(M_m \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}\right)\\
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t_0 \cdot \left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{d} \cdot \frac{1}{\sqrt{h}}\right)\right) \cdot t_0\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 67.5%
Simplified66.8%
expm1-log1p-u66.4%
expm1-udef66.4%
*-commutative66.4%
div-inv66.4%
associate-*l*66.4%
metadata-eval66.4%
Applied egg-rr66.4%
expm1-def66.4%
expm1-log1p66.8%
associate-*l/69.9%
*-commutative69.9%
associate-*l/70.6%
*-commutative70.6%
associate-*r*70.6%
associate-*r/71.3%
associate-*l/71.2%
associate-*r/71.2%
*-commutative71.2%
Simplified71.2%
frac-2neg71.2%
sqrt-div74.2%
Applied egg-rr74.2%
if -4.999999999999985e-310 < h Initial program 63.8%
Simplified63.8%
expm1-log1p-u63.6%
expm1-udef63.6%
*-commutative63.6%
div-inv63.6%
associate-*l*63.6%
metadata-eval63.6%
Applied egg-rr63.6%
expm1-def63.6%
expm1-log1p63.8%
associate-*l/66.8%
*-commutative66.8%
associate-*l/68.1%
*-commutative68.1%
associate-*r*68.1%
associate-*r/68.0%
associate-*l/68.1%
associate-*r/68.1%
*-commutative68.1%
Simplified68.1%
sqrt-div78.0%
div-inv78.0%
Applied egg-rr78.0%
Final simplification76.0%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (- 1.0 (* 0.5 (* h (/ (pow (* D_m (* M_m (/ 0.5 d))) 2.0) l)))))
(t_1 (sqrt (/ d l))))
(if (<= l -2e-310)
(* t_0 (* (/ (sqrt (- d)) (sqrt (- h))) t_1))
(* (* t_1 (* (sqrt d) (/ 1.0 (sqrt h)))) t_0))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 1.0 - (0.5 * (h * (pow((D_m * (M_m * (0.5 / d))), 2.0) / l)));
double t_1 = sqrt((d / l));
double tmp;
if (l <= -2e-310) {
tmp = t_0 * ((sqrt(-d) / sqrt(-h)) * t_1);
} else {
tmp = (t_1 * (sqrt(d) * (1.0 / sqrt(h)))) * t_0;
}
return tmp;
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - (0.5d0 * (h * (((d_m * (m_m * (0.5d0 / d))) ** 2.0d0) / l)))
t_1 = sqrt((d / l))
if (l <= (-2d-310)) then
tmp = t_0 * ((sqrt(-d) / sqrt(-h)) * t_1)
else
tmp = (t_1 * (sqrt(d) * (1.0d0 / sqrt(h)))) * t_0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 1.0 - (0.5 * (h * (Math.pow((D_m * (M_m * (0.5 / d))), 2.0) / l)));
double t_1 = Math.sqrt((d / l));
double tmp;
if (l <= -2e-310) {
tmp = t_0 * ((Math.sqrt(-d) / Math.sqrt(-h)) * t_1);
} else {
tmp = (t_1 * (Math.sqrt(d) * (1.0 / Math.sqrt(h)))) * t_0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = 1.0 - (0.5 * (h * (math.pow((D_m * (M_m * (0.5 / d))), 2.0) / l))) t_1 = math.sqrt((d / l)) tmp = 0 if l <= -2e-310: tmp = t_0 * ((math.sqrt(-d) / math.sqrt(-h)) * t_1) else: tmp = (t_1 * (math.sqrt(d) * (1.0 / math.sqrt(h)))) * t_0 return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(D_m * Float64(M_m * Float64(0.5 / d))) ^ 2.0) / l)))) t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -2e-310) tmp = Float64(t_0 * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_1)); else tmp = Float64(Float64(t_1 * Float64(sqrt(d) * Float64(1.0 / sqrt(h)))) * t_0); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = 1.0 - (0.5 * (h * (((D_m * (M_m * (0.5 / d))) ^ 2.0) / l)));
t_1 = sqrt((d / l));
tmp = 0.0;
if (l <= -2e-310)
tmp = t_0 * ((sqrt(-d) / sqrt(-h)) * t_1);
else
tmp = (t_1 * (sqrt(d) * (1.0 / sqrt(h)))) * t_0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -2e-310], N[(t$95$0 * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] * N[(1.0 / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := 1 - 0.5 \cdot \left(h \cdot \frac{{\left(D_m \cdot \left(M_m \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}\right)\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_0 \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t_1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_1 \cdot \left(\sqrt{d} \cdot \frac{1}{\sqrt{h}}\right)\right) \cdot t_0\\
\end{array}
\end{array}
if l < -1.999999999999994e-310Initial program 67.5%
Simplified66.8%
expm1-log1p-u66.4%
expm1-udef66.4%
*-commutative66.4%
div-inv66.4%
associate-*l*66.4%
metadata-eval66.4%
Applied egg-rr66.4%
expm1-def66.4%
expm1-log1p66.8%
associate-*l/69.9%
*-commutative69.9%
associate-*l/70.6%
*-commutative70.6%
associate-*r*70.6%
associate-*r/71.3%
associate-*l/71.2%
associate-*r/71.2%
*-commutative71.2%
Simplified71.2%
frac-2neg71.2%
sqrt-div84.4%
Applied egg-rr84.3%
if -1.999999999999994e-310 < l Initial program 63.8%
Simplified63.8%
expm1-log1p-u63.6%
expm1-udef63.6%
*-commutative63.6%
div-inv63.6%
associate-*l*63.6%
metadata-eval63.6%
Applied egg-rr63.6%
expm1-def63.6%
expm1-log1p63.8%
associate-*l/66.8%
*-commutative66.8%
associate-*l/68.1%
*-commutative68.1%
associate-*r*68.1%
associate-*r/68.0%
associate-*l/68.1%
associate-*r/68.1%
*-commutative68.1%
Simplified68.1%
sqrt-div78.0%
div-inv78.0%
Applied egg-rr78.0%
Final simplification81.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (pow (* D_m (* M_m (/ 0.5 d))) 2.0)) (t_1 (sqrt (/ d h))))
(if (<= l 5e-307)
(* (- 1.0 (* 0.5 (* h (/ t_0 l)))) (* (sqrt (/ d l)) t_1))
(* t_1 (* (+ 1.0 (* h (/ t_0 (/ l -0.5)))) (/ (sqrt d) (sqrt l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = pow((D_m * (M_m * (0.5 / d))), 2.0);
double t_1 = sqrt((d / h));
double tmp;
if (l <= 5e-307) {
tmp = (1.0 - (0.5 * (h * (t_0 / l)))) * (sqrt((d / l)) * t_1);
} else {
tmp = t_1 * ((1.0 + (h * (t_0 / (l / -0.5)))) * (sqrt(d) / sqrt(l)));
}
return tmp;
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (d_m * (m_m * (0.5d0 / d))) ** 2.0d0
t_1 = sqrt((d / h))
if (l <= 5d-307) then
tmp = (1.0d0 - (0.5d0 * (h * (t_0 / l)))) * (sqrt((d / l)) * t_1)
else
tmp = t_1 * ((1.0d0 + (h * (t_0 / (l / (-0.5d0))))) * (sqrt(d) / sqrt(l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.pow((D_m * (M_m * (0.5 / d))), 2.0);
double t_1 = Math.sqrt((d / h));
double tmp;
if (l <= 5e-307) {
tmp = (1.0 - (0.5 * (h * (t_0 / l)))) * (Math.sqrt((d / l)) * t_1);
} else {
tmp = t_1 * ((1.0 + (h * (t_0 / (l / -0.5)))) * (Math.sqrt(d) / Math.sqrt(l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.pow((D_m * (M_m * (0.5 / d))), 2.0) t_1 = math.sqrt((d / h)) tmp = 0 if l <= 5e-307: tmp = (1.0 - (0.5 * (h * (t_0 / l)))) * (math.sqrt((d / l)) * t_1) else: tmp = t_1 * ((1.0 + (h * (t_0 / (l / -0.5)))) * (math.sqrt(d) / math.sqrt(l))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(M_m * Float64(0.5 / d))) ^ 2.0 t_1 = sqrt(Float64(d / h)) tmp = 0.0 if (l <= 5e-307) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_0 / l)))) * Float64(sqrt(Float64(d / l)) * t_1)); else tmp = Float64(t_1 * Float64(Float64(1.0 + Float64(h * Float64(t_0 / Float64(l / -0.5)))) * Float64(sqrt(d) / sqrt(l)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (D_m * (M_m * (0.5 / d))) ^ 2.0;
t_1 = sqrt((d / h));
tmp = 0.0;
if (l <= 5e-307)
tmp = (1.0 - (0.5 * (h * (t_0 / l)))) * (sqrt((d / l)) * t_1);
else
tmp = t_1 * ((1.0 + (h * (t_0 / (l / -0.5)))) * (sqrt(d) / sqrt(l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Power[N[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, 5e-307], N[(N[(1.0 - N[(0.5 * N[(h * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(N[(1.0 + N[(h * N[(t$95$0 / N[(l / -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := {\left(D_m \cdot \left(M_m \cdot \frac{0.5}{d}\right)\right)}^{2}\\
t_1 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;\ell \leq 5 \cdot 10^{-307}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(h \cdot \frac{t_0}{\ell}\right)\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot t_1\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(\left(1 + h \cdot \frac{t_0}{\frac{\ell}{-0.5}}\right) \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
\end{array}
\end{array}
if l < 5.00000000000000014e-307Initial program 67.5%
Simplified66.8%
expm1-log1p-u66.4%
expm1-udef66.4%
*-commutative66.4%
div-inv66.4%
associate-*l*66.4%
metadata-eval66.4%
Applied egg-rr66.4%
expm1-def66.4%
expm1-log1p66.8%
associate-*l/69.9%
*-commutative69.9%
associate-*l/70.6%
*-commutative70.6%
associate-*r*70.6%
associate-*r/71.3%
associate-*l/71.2%
associate-*r/71.2%
*-commutative71.2%
Simplified71.2%
if 5.00000000000000014e-307 < l Initial program 63.8%
Simplified63.8%
Applied egg-rr37.5%
expm1-def37.5%
expm1-log1p63.8%
*-commutative63.8%
associate-*r/66.0%
associate-*l/67.3%
*-commutative67.3%
associate-/l*67.3%
associate-*r*67.3%
associate-*r/67.3%
associate-*l/67.3%
associate-*r/67.3%
*-commutative67.3%
Simplified67.3%
sqrt-div76.8%
div-inv76.8%
Applied egg-rr76.8%
associate-*r/76.8%
*-rgt-identity76.8%
Simplified76.8%
Final simplification73.8%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(* -0.125 (/ (pow (* D_m M_m) 2.0) (/ d (sqrt (/ h (pow l 3.0)))))))
(t_1 (/ (/ 1.0 l) h)))
(if (<= d -1.3e+148)
(cbrt (* (pow t_1 1.5) (pow d 3.0)))
(if (<= d -9e-29)
(sqrt (/ (pow d 2.0) (* l h)))
(if (<= d 2e-300)
(* d (sqrt (log (exp t_1))))
(if (<= d 6.2e-147)
t_0
(if (<= d 4.4e-51)
(/ d (* (sqrt h) (sqrt l)))
(if (<= d 190000.0) t_0 (* d (/ (pow h -0.5) (sqrt l)))))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = -0.125 * (pow((D_m * M_m), 2.0) / (d / sqrt((h / pow(l, 3.0)))));
double t_1 = (1.0 / l) / h;
double tmp;
if (d <= -1.3e+148) {
tmp = cbrt((pow(t_1, 1.5) * pow(d, 3.0)));
} else if (d <= -9e-29) {
tmp = sqrt((pow(d, 2.0) / (l * h)));
} else if (d <= 2e-300) {
tmp = d * sqrt(log(exp(t_1)));
} else if (d <= 6.2e-147) {
tmp = t_0;
} else if (d <= 4.4e-51) {
tmp = d / (sqrt(h) * sqrt(l));
} else if (d <= 190000.0) {
tmp = t_0;
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = -0.125 * (Math.pow((D_m * M_m), 2.0) / (d / Math.sqrt((h / Math.pow(l, 3.0)))));
double t_1 = (1.0 / l) / h;
double tmp;
if (d <= -1.3e+148) {
tmp = Math.cbrt((Math.pow(t_1, 1.5) * Math.pow(d, 3.0)));
} else if (d <= -9e-29) {
tmp = Math.sqrt((Math.pow(d, 2.0) / (l * h)));
} else if (d <= 2e-300) {
tmp = d * Math.sqrt(Math.log(Math.exp(t_1)));
} else if (d <= 6.2e-147) {
tmp = t_0;
} else if (d <= 4.4e-51) {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
} else if (d <= 190000.0) {
tmp = t_0;
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(-0.125 * Float64((Float64(D_m * M_m) ^ 2.0) / Float64(d / sqrt(Float64(h / (l ^ 3.0)))))) t_1 = Float64(Float64(1.0 / l) / h) tmp = 0.0 if (d <= -1.3e+148) tmp = cbrt(Float64((t_1 ^ 1.5) * (d ^ 3.0))); elseif (d <= -9e-29) tmp = sqrt(Float64((d ^ 2.0) / Float64(l * h))); elseif (d <= 2e-300) tmp = Float64(d * sqrt(log(exp(t_1)))); elseif (d <= 6.2e-147) tmp = t_0; elseif (d <= 4.4e-51) tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); elseif (d <= 190000.0) tmp = t_0; else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(-0.125 * N[(N[Power[N[(D$95$m * M$95$m), $MachinePrecision], 2.0], $MachinePrecision] / N[(d / N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]}, If[LessEqual[d, -1.3e+148], N[Power[N[(N[Power[t$95$1, 1.5], $MachinePrecision] * N[Power[d, 3.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], If[LessEqual[d, -9e-29], N[Sqrt[N[(N[Power[d, 2.0], $MachinePrecision] / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[d, 2e-300], N[(d * N[Sqrt[N[Log[N[Exp[t$95$1], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6.2e-147], t$95$0, If[LessEqual[d, 4.4e-51], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 190000.0], t$95$0, N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := -0.125 \cdot \frac{{\left(D_m \cdot M_m\right)}^{2}}{\frac{d}{\sqrt{\frac{h}{{\ell}^{3}}}}}\\
t_1 := \frac{\frac{1}{\ell}}{h}\\
\mathbf{if}\;d \leq -1.3 \cdot 10^{+148}:\\
\;\;\;\;\sqrt[3]{{t_1}^{1.5} \cdot {d}^{3}}\\
\mathbf{elif}\;d \leq -9 \cdot 10^{-29}:\\
\;\;\;\;\sqrt{\frac{{d}^{2}}{\ell \cdot h}}\\
\mathbf{elif}\;d \leq 2 \cdot 10^{-300}:\\
\;\;\;\;d \cdot \sqrt{\log \left(e^{t_1}\right)}\\
\mathbf{elif}\;d \leq 6.2 \cdot 10^{-147}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 4.4 \cdot 10^{-51}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\mathbf{elif}\;d \leq 190000:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.3e148Initial program 70.1%
Simplified70.3%
pow1/270.3%
metadata-eval70.3%
div-inv70.3%
unpow-prod-down0.0%
metadata-eval0.0%
pow1/20.0%
metadata-eval0.0%
Applied egg-rr0.0%
unpow1/20.0%
Simplified0.0%
Taylor expanded in d around inf 16.4%
associate-/r*16.4%
Simplified16.4%
add-cbrt-cube31.9%
add-cbrt-cube29.0%
cbrt-unprod29.0%
pow329.0%
add-sqr-sqrt29.0%
pow129.0%
pow1/229.0%
pow-prod-up29.0%
associate-/l/29.0%
associate-/r*29.0%
metadata-eval29.0%
Applied egg-rr29.0%
*-commutative29.0%
Simplified29.0%
if -1.3e148 < d < -8.9999999999999996e-29Initial program 81.7%
Simplified81.6%
pow1/281.6%
metadata-eval81.6%
div-inv81.6%
unpow-prod-down0.0%
metadata-eval0.0%
pow1/20.0%
metadata-eval0.0%
Applied egg-rr0.0%
unpow1/20.0%
Simplified0.0%
Taylor expanded in d around inf 9.9%
associate-/r*9.9%
Simplified9.9%
add-sqr-sqrt0.4%
sqrt-unprod48.7%
*-commutative48.7%
*-commutative48.7%
swap-sqr48.8%
add-sqr-sqrt48.8%
associate-/l/48.9%
associate-/r*48.8%
unpow248.8%
Applied egg-rr48.8%
associate-/r*48.9%
associate-*l/48.9%
*-lft-identity48.9%
Simplified48.9%
if -8.9999999999999996e-29 < d < 2.00000000000000005e-300Initial program 57.1%
Simplified55.6%
pow1/255.6%
metadata-eval55.6%
div-inv55.6%
unpow-prod-down1.6%
metadata-eval1.6%
pow1/21.6%
metadata-eval1.6%
Applied egg-rr1.6%
unpow1/21.6%
Simplified1.6%
Taylor expanded in d around inf 18.3%
associate-/r*18.3%
Simplified18.3%
add-log-exp31.6%
associate-/l/31.6%
associate-/r*31.6%
Applied egg-rr31.6%
if 2.00000000000000005e-300 < d < 6.2000000000000005e-147 or 4.4e-51 < d < 1.9e5Initial program 49.8%
Simplified49.7%
pow1/249.7%
metadata-eval49.7%
div-inv49.7%
unpow-prod-down56.0%
metadata-eval56.0%
pow1/256.0%
metadata-eval56.0%
Applied egg-rr56.0%
unpow1/256.0%
Simplified56.0%
Taylor expanded in d around 0 42.2%
associate-*l/42.3%
unpow242.3%
unpow242.3%
swap-sqr47.0%
unpow247.0%
associate-/l*46.8%
Simplified46.8%
if 6.2000000000000005e-147 < d < 4.4e-51Initial program 78.6%
Simplified78.6%
pow1/278.6%
metadata-eval78.6%
div-inv78.6%
unpow-prod-down85.0%
metadata-eval85.0%
pow1/285.0%
metadata-eval85.0%
Applied egg-rr85.0%
unpow1/285.0%
Simplified85.0%
Taylor expanded in d around inf 57.9%
associate-/r*61.2%
Simplified61.2%
expm1-log1p-u60.6%
expm1-udef20.5%
sqrt-div26.7%
associate-*r/26.7%
add-sqr-sqrt26.7%
sqrt-prod26.7%
unpow226.7%
sqrt-prod26.7%
div-inv26.7%
sqrt-div26.7%
unpow226.7%
sqrt-prod26.7%
add-sqr-sqrt26.7%
Applied egg-rr26.7%
expm1-def70.1%
expm1-log1p71.3%
associate-/l/71.4%
Simplified71.4%
if 1.9e5 < d Initial program 71.8%
Simplified71.8%
pow1/271.8%
metadata-eval71.8%
div-inv71.8%
unpow-prod-down73.4%
metadata-eval73.4%
pow1/273.4%
metadata-eval73.4%
Applied egg-rr73.4%
unpow1/273.4%
Simplified73.4%
Taylor expanded in d around inf 61.6%
associate-/r*61.6%
Simplified61.6%
*-commutative61.6%
sqrt-div72.1%
associate-*l/72.1%
inv-pow72.1%
sqrt-pow172.1%
metadata-eval72.1%
Applied egg-rr72.1%
associate-/l*68.8%
associate-/r/72.1%
Simplified72.1%
Final simplification48.1%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(* (/ (pow (* D_m M_m) 2.0) d) (* (sqrt (/ h (pow l 3.0))) -0.125)))
(t_1 (/ (/ 1.0 l) h)))
(if (<= d -8.8e+147)
(cbrt (* (pow t_1 1.5) (pow d 3.0)))
(if (<= d -4.7e-29)
(sqrt (/ (pow d 2.0) (* l h)))
(if (<= d -5e-310)
(* d (sqrt (log (exp t_1))))
(if (<= d 1.1e-148)
t_0
(if (<= d 2.8e-49)
(/ d (* (sqrt h) (sqrt l)))
(if (<= d 23000.0) t_0 (* d (/ (pow h -0.5) (sqrt l)))))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (pow((D_m * M_m), 2.0) / d) * (sqrt((h / pow(l, 3.0))) * -0.125);
double t_1 = (1.0 / l) / h;
double tmp;
if (d <= -8.8e+147) {
tmp = cbrt((pow(t_1, 1.5) * pow(d, 3.0)));
} else if (d <= -4.7e-29) {
tmp = sqrt((pow(d, 2.0) / (l * h)));
} else if (d <= -5e-310) {
tmp = d * sqrt(log(exp(t_1)));
} else if (d <= 1.1e-148) {
tmp = t_0;
} else if (d <= 2.8e-49) {
tmp = d / (sqrt(h) * sqrt(l));
} else if (d <= 23000.0) {
tmp = t_0;
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (Math.pow((D_m * M_m), 2.0) / d) * (Math.sqrt((h / Math.pow(l, 3.0))) * -0.125);
double t_1 = (1.0 / l) / h;
double tmp;
if (d <= -8.8e+147) {
tmp = Math.cbrt((Math.pow(t_1, 1.5) * Math.pow(d, 3.0)));
} else if (d <= -4.7e-29) {
tmp = Math.sqrt((Math.pow(d, 2.0) / (l * h)));
} else if (d <= -5e-310) {
tmp = d * Math.sqrt(Math.log(Math.exp(t_1)));
} else if (d <= 1.1e-148) {
tmp = t_0;
} else if (d <= 2.8e-49) {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
} else if (d <= 23000.0) {
tmp = t_0;
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64((Float64(D_m * M_m) ^ 2.0) / d) * Float64(sqrt(Float64(h / (l ^ 3.0))) * -0.125)) t_1 = Float64(Float64(1.0 / l) / h) tmp = 0.0 if (d <= -8.8e+147) tmp = cbrt(Float64((t_1 ^ 1.5) * (d ^ 3.0))); elseif (d <= -4.7e-29) tmp = sqrt(Float64((d ^ 2.0) / Float64(l * h))); elseif (d <= -5e-310) tmp = Float64(d * sqrt(log(exp(t_1)))); elseif (d <= 1.1e-148) tmp = t_0; elseif (d <= 2.8e-49) tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); elseif (d <= 23000.0) tmp = t_0; else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[Power[N[(D$95$m * M$95$m), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision] * N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]}, If[LessEqual[d, -8.8e+147], N[Power[N[(N[Power[t$95$1, 1.5], $MachinePrecision] * N[Power[d, 3.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], If[LessEqual[d, -4.7e-29], N[Sqrt[N[(N[Power[d, 2.0], $MachinePrecision] / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Sqrt[N[Log[N[Exp[t$95$1], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.1e-148], t$95$0, If[LessEqual[d, 2.8e-49], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 23000.0], t$95$0, N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{{\left(D_m \cdot M_m\right)}^{2}}{d} \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot -0.125\right)\\
t_1 := \frac{\frac{1}{\ell}}{h}\\
\mathbf{if}\;d \leq -8.8 \cdot 10^{+147}:\\
\;\;\;\;\sqrt[3]{{t_1}^{1.5} \cdot {d}^{3}}\\
\mathbf{elif}\;d \leq -4.7 \cdot 10^{-29}:\\
\;\;\;\;\sqrt{\frac{{d}^{2}}{\ell \cdot h}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\log \left(e^{t_1}\right)}\\
\mathbf{elif}\;d \leq 1.1 \cdot 10^{-148}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 2.8 \cdot 10^{-49}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\mathbf{elif}\;d \leq 23000:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -8.8000000000000007e147Initial program 70.1%
Simplified70.3%
pow1/270.3%
metadata-eval70.3%
div-inv70.3%
unpow-prod-down0.0%
metadata-eval0.0%
pow1/20.0%
metadata-eval0.0%
Applied egg-rr0.0%
unpow1/20.0%
Simplified0.0%
Taylor expanded in d around inf 16.4%
associate-/r*16.4%
Simplified16.4%
add-cbrt-cube31.9%
add-cbrt-cube29.0%
cbrt-unprod29.0%
pow329.0%
add-sqr-sqrt29.0%
pow129.0%
pow1/229.0%
pow-prod-up29.0%
associate-/l/29.0%
associate-/r*29.0%
metadata-eval29.0%
Applied egg-rr29.0%
*-commutative29.0%
Simplified29.0%
if -8.8000000000000007e147 < d < -4.6999999999999998e-29Initial program 81.7%
Simplified81.6%
pow1/281.6%
metadata-eval81.6%
div-inv81.6%
unpow-prod-down0.0%
metadata-eval0.0%
pow1/20.0%
metadata-eval0.0%
Applied egg-rr0.0%
unpow1/20.0%
Simplified0.0%
Taylor expanded in d around inf 9.9%
associate-/r*9.9%
Simplified9.9%
add-sqr-sqrt0.4%
sqrt-unprod48.7%
*-commutative48.7%
*-commutative48.7%
swap-sqr48.8%
add-sqr-sqrt48.8%
associate-/l/48.9%
associate-/r*48.8%
unpow248.8%
Applied egg-rr48.8%
associate-/r*48.9%
associate-*l/48.9%
*-lft-identity48.9%
Simplified48.9%
if -4.6999999999999998e-29 < d < -4.999999999999985e-310Initial program 57.4%
Simplified55.8%
pow1/255.8%
metadata-eval55.8%
div-inv55.8%
unpow-prod-down0.0%
metadata-eval0.0%
pow1/20.0%
metadata-eval0.0%
Applied egg-rr0.0%
unpow1/20.0%
Simplified0.0%
Taylor expanded in d around inf 17.2%
associate-/r*17.2%
Simplified17.2%
add-log-exp31.0%
associate-/l/31.0%
associate-/r*31.0%
Applied egg-rr31.0%
if -4.999999999999985e-310 < d < 1.10000000000000009e-148 or 2.79999999999999997e-49 < d < 23000Initial program 49.8%
Simplified49.7%
pow1/249.7%
metadata-eval49.7%
div-inv49.7%
unpow-prod-down55.8%
metadata-eval55.8%
pow1/255.8%
metadata-eval55.8%
Applied egg-rr55.8%
unpow1/255.8%
Simplified55.8%
Taylor expanded in d around 0 44.6%
*-commutative44.6%
associate-*l*44.6%
unpow244.6%
unpow244.6%
swap-sqr49.1%
unpow249.1%
Simplified49.1%
if 1.10000000000000009e-148 < d < 2.79999999999999997e-49Initial program 78.6%
Simplified78.6%
pow1/278.6%
metadata-eval78.6%
div-inv78.6%
unpow-prod-down85.0%
metadata-eval85.0%
pow1/285.0%
metadata-eval85.0%
Applied egg-rr85.0%
unpow1/285.0%
Simplified85.0%
Taylor expanded in d around inf 57.9%
associate-/r*61.2%
Simplified61.2%
expm1-log1p-u60.6%
expm1-udef20.5%
sqrt-div26.7%
associate-*r/26.7%
add-sqr-sqrt26.7%
sqrt-prod26.7%
unpow226.7%
sqrt-prod26.7%
div-inv26.7%
sqrt-div26.7%
unpow226.7%
sqrt-prod26.7%
add-sqr-sqrt26.7%
Applied egg-rr26.7%
expm1-def70.1%
expm1-log1p71.3%
associate-/l/71.4%
Simplified71.4%
if 23000 < d Initial program 71.8%
Simplified71.8%
pow1/271.8%
metadata-eval71.8%
div-inv71.8%
unpow-prod-down73.4%
metadata-eval73.4%
pow1/273.4%
metadata-eval73.4%
Applied egg-rr73.4%
unpow1/273.4%
Simplified73.4%
Taylor expanded in d around inf 61.6%
associate-/r*61.6%
Simplified61.6%
*-commutative61.6%
sqrt-div72.1%
associate-*l/72.1%
inv-pow72.1%
sqrt-pow172.1%
metadata-eval72.1%
Applied egg-rr72.1%
associate-/l*68.8%
associate-/r/72.1%
Simplified72.1%
Final simplification48.5%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l 8e+206)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(+ 1.0 (* h (* (pow (* D_m (* M_m (/ 0.5 d))) 2.0) (/ -0.5 l))))))
(/ d (* (sqrt h) (sqrt l)))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 8e+206) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (h * (pow((D_m * (M_m * (0.5 / d))), 2.0) * (-0.5 / l)))));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= 8d+206) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 + (h * (((d_m * (m_m * (0.5d0 / d))) ** 2.0d0) * ((-0.5d0) / l)))))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 8e+206) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 + (h * (Math.pow((D_m * (M_m * (0.5 / d))), 2.0) * (-0.5 / l)))));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= 8e+206: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 + (h * (math.pow((D_m * (M_m * (0.5 / d))), 2.0) * (-0.5 / l))))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= 8e+206) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64((Float64(D_m * Float64(M_m * Float64(0.5 / d))) ^ 2.0) * Float64(-0.5 / l)))))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= 8e+206)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (h * (((D_m * (M_m * (0.5 / d))) ^ 2.0) * (-0.5 / l)))));
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, 8e+206], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(N[Power[N[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision]), $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_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 8 \cdot 10^{+206}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left({\left(D_m \cdot \left(M_m \cdot \frac{0.5}{d}\right)\right)}^{2} \cdot \frac{-0.5}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < 8.0000000000000003e206Initial program 68.7%
Simplified68.3%
Applied egg-rr38.9%
expm1-def38.9%
expm1-log1p68.3%
*-commutative68.3%
associate-*r/71.9%
associate-*l/72.3%
*-commutative72.3%
associate-/l*72.3%
associate-*r*72.3%
associate-*r/72.7%
associate-*l/72.7%
associate-*r/72.6%
*-commutative72.6%
Simplified72.6%
expm1-log1p-u59.6%
expm1-udef56.9%
associate-*r*56.9%
div-inv56.9%
metadata-eval56.9%
Applied egg-rr56.9%
expm1-def59.6%
expm1-log1p72.7%
*-rgt-identity72.7%
associate-*r/72.7%
associate-*l*72.6%
*-commutative72.6%
associate-/r*72.6%
metadata-eval72.6%
Simplified72.6%
if 8.0000000000000003e206 < l Initial program 37.3%
Simplified37.4%
pow1/237.4%
metadata-eval37.4%
div-inv37.4%
unpow-prod-down45.0%
metadata-eval45.0%
pow1/245.0%
metadata-eval45.0%
Applied egg-rr45.0%
unpow1/245.0%
Simplified45.0%
Taylor expanded in d around inf 47.2%
associate-/r*47.2%
Simplified47.2%
expm1-log1p-u44.8%
expm1-udef29.2%
sqrt-div33.0%
associate-*r/33.0%
add-sqr-sqrt33.0%
sqrt-prod11.2%
unpow211.2%
sqrt-prod7.6%
div-inv7.6%
sqrt-div11.2%
unpow211.2%
sqrt-prod33.0%
add-sqr-sqrt33.0%
Applied egg-rr33.0%
expm1-def56.3%
expm1-log1p59.0%
associate-/l/59.1%
Simplified59.1%
Final simplification71.4%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l 1.4e+195)
(*
(- 1.0 (* 0.5 (* h (/ (pow (* D_m (* M_m (/ 0.5 d))) 2.0) l))))
(* (sqrt (/ d l)) (sqrt (/ d h))))
(/ d (* (sqrt h) (sqrt l)))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 1.4e+195) {
tmp = (1.0 - (0.5 * (h * (pow((D_m * (M_m * (0.5 / d))), 2.0) / l)))) * (sqrt((d / l)) * sqrt((d / h)));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= 1.4d+195) then
tmp = (1.0d0 - (0.5d0 * (h * (((d_m * (m_m * (0.5d0 / d))) ** 2.0d0) / l)))) * (sqrt((d / l)) * sqrt((d / h)))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 1.4e+195) {
tmp = (1.0 - (0.5 * (h * (Math.pow((D_m * (M_m * (0.5 / d))), 2.0) / l)))) * (Math.sqrt((d / l)) * Math.sqrt((d / h)));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= 1.4e+195: tmp = (1.0 - (0.5 * (h * (math.pow((D_m * (M_m * (0.5 / d))), 2.0) / l)))) * (math.sqrt((d / l)) * math.sqrt((d / h))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= 1.4e+195) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(D_m * Float64(M_m * Float64(0.5 / d))) ^ 2.0) / l)))) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= 1.4e+195)
tmp = (1.0 - (0.5 * (h * (((D_m * (M_m * (0.5 / d))) ^ 2.0) / l)))) * (sqrt((d / l)) * sqrt((d / h)));
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, 1.4e+195], N[(N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / 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_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.4 \cdot 10^{+195}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(D_m \cdot \left(M_m \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}\right)\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < 1.3999999999999999e195Initial program 68.7%
Simplified68.3%
expm1-log1p-u68.0%
expm1-udef68.0%
*-commutative68.0%
div-inv68.0%
associate-*l*68.0%
metadata-eval68.0%
Applied egg-rr68.0%
expm1-def68.0%
expm1-log1p68.3%
associate-*l/72.3%
*-commutative72.3%
associate-*l/72.7%
*-commutative72.7%
associate-*r*72.7%
associate-*r/73.1%
associate-*l/73.1%
associate-*r/73.1%
*-commutative73.1%
Simplified73.1%
if 1.3999999999999999e195 < l Initial program 37.3%
Simplified37.4%
pow1/237.4%
metadata-eval37.4%
div-inv37.4%
unpow-prod-down45.0%
metadata-eval45.0%
pow1/245.0%
metadata-eval45.0%
Applied egg-rr45.0%
unpow1/245.0%
Simplified45.0%
Taylor expanded in d around inf 47.2%
associate-/r*47.2%
Simplified47.2%
expm1-log1p-u44.8%
expm1-udef29.2%
sqrt-div33.0%
associate-*r/33.0%
add-sqr-sqrt33.0%
sqrt-prod11.2%
unpow211.2%
sqrt-prod7.6%
div-inv7.6%
sqrt-div11.2%
unpow211.2%
sqrt-prod33.0%
add-sqr-sqrt33.0%
Applied egg-rr33.0%
expm1-def56.3%
expm1-log1p59.0%
associate-/l/59.1%
Simplified59.1%
Final simplification71.7%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (/ (/ 1.0 l) h)))
(if (<= d -1.3e+148)
(cbrt (* (pow t_0 1.5) (pow d 3.0)))
(if (<= d -8.5e-29)
(sqrt (/ (pow d 2.0) (* l h)))
(if (<= d -5e-310)
(* d (sqrt (log (exp t_0))))
(* d (* (pow h -0.5) (sqrt (/ 1.0 l)))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (1.0 / l) / h;
double tmp;
if (d <= -1.3e+148) {
tmp = cbrt((pow(t_0, 1.5) * pow(d, 3.0)));
} else if (d <= -8.5e-29) {
tmp = sqrt((pow(d, 2.0) / (l * h)));
} else if (d <= -5e-310) {
tmp = d * sqrt(log(exp(t_0)));
} else {
tmp = d * (pow(h, -0.5) * sqrt((1.0 / l)));
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (1.0 / l) / h;
double tmp;
if (d <= -1.3e+148) {
tmp = Math.cbrt((Math.pow(t_0, 1.5) * Math.pow(d, 3.0)));
} else if (d <= -8.5e-29) {
tmp = Math.sqrt((Math.pow(d, 2.0) / (l * h)));
} else if (d <= -5e-310) {
tmp = d * Math.sqrt(Math.log(Math.exp(t_0)));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.sqrt((1.0 / l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(1.0 / l) / h) tmp = 0.0 if (d <= -1.3e+148) tmp = cbrt(Float64((t_0 ^ 1.5) * (d ^ 3.0))); elseif (d <= -8.5e-29) tmp = sqrt(Float64((d ^ 2.0) / Float64(l * h))); elseif (d <= -5e-310) tmp = Float64(d * sqrt(log(exp(t_0)))); else tmp = Float64(d * Float64((h ^ -0.5) * sqrt(Float64(1.0 / l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]}, If[LessEqual[d, -1.3e+148], N[Power[N[(N[Power[t$95$0, 1.5], $MachinePrecision] * N[Power[d, 3.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], If[LessEqual[d, -8.5e-29], N[Sqrt[N[(N[Power[d, 2.0], $MachinePrecision] / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Sqrt[N[Log[N[Exp[t$95$0], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{\frac{1}{\ell}}{h}\\
\mathbf{if}\;d \leq -1.3 \cdot 10^{+148}:\\
\;\;\;\;\sqrt[3]{{t_0}^{1.5} \cdot {d}^{3}}\\
\mathbf{elif}\;d \leq -8.5 \cdot 10^{-29}:\\
\;\;\;\;\sqrt{\frac{{d}^{2}}{\ell \cdot h}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\log \left(e^{t_0}\right)}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot \sqrt{\frac{1}{\ell}}\right)\\
\end{array}
\end{array}
if d < -1.3e148Initial program 70.1%
Simplified70.3%
pow1/270.3%
metadata-eval70.3%
div-inv70.3%
unpow-prod-down0.0%
metadata-eval0.0%
pow1/20.0%
metadata-eval0.0%
Applied egg-rr0.0%
unpow1/20.0%
Simplified0.0%
Taylor expanded in d around inf 16.4%
associate-/r*16.4%
Simplified16.4%
add-cbrt-cube31.9%
add-cbrt-cube29.0%
cbrt-unprod29.0%
pow329.0%
add-sqr-sqrt29.0%
pow129.0%
pow1/229.0%
pow-prod-up29.0%
associate-/l/29.0%
associate-/r*29.0%
metadata-eval29.0%
Applied egg-rr29.0%
*-commutative29.0%
Simplified29.0%
if -1.3e148 < d < -8.5000000000000001e-29Initial program 81.7%
Simplified81.6%
pow1/281.6%
metadata-eval81.6%
div-inv81.6%
unpow-prod-down0.0%
metadata-eval0.0%
pow1/20.0%
metadata-eval0.0%
Applied egg-rr0.0%
unpow1/20.0%
Simplified0.0%
Taylor expanded in d around inf 9.9%
associate-/r*9.9%
Simplified9.9%
add-sqr-sqrt0.4%
sqrt-unprod48.7%
*-commutative48.7%
*-commutative48.7%
swap-sqr48.8%
add-sqr-sqrt48.8%
associate-/l/48.9%
associate-/r*48.8%
unpow248.8%
Applied egg-rr48.8%
associate-/r*48.9%
associate-*l/48.9%
*-lft-identity48.9%
Simplified48.9%
if -8.5000000000000001e-29 < d < -4.999999999999985e-310Initial program 57.4%
Simplified55.8%
pow1/255.8%
metadata-eval55.8%
div-inv55.8%
unpow-prod-down0.0%
metadata-eval0.0%
pow1/20.0%
metadata-eval0.0%
Applied egg-rr0.0%
unpow1/20.0%
Simplified0.0%
Taylor expanded in d around inf 17.2%
associate-/r*17.2%
Simplified17.2%
add-log-exp31.0%
associate-/l/31.0%
associate-/r*31.0%
Applied egg-rr31.0%
if -4.999999999999985e-310 < d Initial program 63.8%
Simplified63.8%
pow1/263.8%
metadata-eval63.8%
div-inv63.8%
unpow-prod-down67.8%
metadata-eval67.8%
pow1/267.8%
metadata-eval67.8%
Applied egg-rr67.8%
unpow1/267.8%
Simplified67.8%
Taylor expanded in d around inf 45.4%
associate-/r*45.8%
Simplified45.8%
pow1/245.8%
div-inv45.8%
unpow-prod-down52.1%
pow1/252.1%
inv-pow52.1%
sqrt-pow152.1%
metadata-eval52.1%
Applied egg-rr52.1%
unpow1/252.1%
Simplified52.1%
Final simplification43.4%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -4.9e-29)
(sqrt (* (/ (/ 1.0 l) h) (pow d 2.0)))
(if (<= d -5e-310)
(* d (log (exp (/ 1.0 (sqrt (* l h))))))
(* d (* (pow h -0.5) (sqrt (/ 1.0 l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -4.9e-29) {
tmp = sqrt((((1.0 / l) / h) * pow(d, 2.0)));
} else if (d <= -5e-310) {
tmp = d * log(exp((1.0 / sqrt((l * h)))));
} else {
tmp = d * (pow(h, -0.5) * sqrt((1.0 / l)));
}
return tmp;
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (d <= (-4.9d-29)) then
tmp = sqrt((((1.0d0 / l) / h) * (d ** 2.0d0)))
else if (d <= (-5d-310)) then
tmp = d * log(exp((1.0d0 / sqrt((l * h)))))
else
tmp = d * ((h ** (-0.5d0)) * sqrt((1.0d0 / l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -4.9e-29) {
tmp = Math.sqrt((((1.0 / l) / h) * Math.pow(d, 2.0)));
} else if (d <= -5e-310) {
tmp = d * Math.log(Math.exp((1.0 / Math.sqrt((l * h)))));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.sqrt((1.0 / l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if d <= -4.9e-29: tmp = math.sqrt((((1.0 / l) / h) * math.pow(d, 2.0))) elif d <= -5e-310: tmp = d * math.log(math.exp((1.0 / math.sqrt((l * h))))) else: tmp = d * (math.pow(h, -0.5) * math.sqrt((1.0 / l))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -4.9e-29) tmp = sqrt(Float64(Float64(Float64(1.0 / l) / h) * (d ^ 2.0))); elseif (d <= -5e-310) tmp = Float64(d * log(exp(Float64(1.0 / sqrt(Float64(l * h)))))); else tmp = Float64(d * Float64((h ^ -0.5) * sqrt(Float64(1.0 / l)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (d <= -4.9e-29)
tmp = sqrt((((1.0 / l) / h) * (d ^ 2.0)));
elseif (d <= -5e-310)
tmp = d * log(exp((1.0 / sqrt((l * h)))));
else
tmp = d * ((h ^ -0.5) * sqrt((1.0 / l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -4.9e-29], N[Sqrt[N[(N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision] * N[Power[d, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Log[N[Exp[N[(1.0 / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -4.9 \cdot 10^{-29}:\\
\;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h} \cdot {d}^{2}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \log \left(e^{\frac{1}{\sqrt{\ell \cdot h}}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot \sqrt{\frac{1}{\ell}}\right)\\
\end{array}
\end{array}
if d < -4.8999999999999998e-29Initial program 76.1%
Simplified76.2%
pow1/276.2%
metadata-eval76.2%
div-inv76.2%
unpow-prod-down0.0%
metadata-eval0.0%
pow1/20.0%
metadata-eval0.0%
Applied egg-rr0.0%
unpow1/20.0%
Simplified0.0%
Taylor expanded in d around inf 13.0%
associate-/r*13.0%
Simplified13.0%
add-sqr-sqrt0.4%
sqrt-unprod39.8%
*-commutative39.8%
*-commutative39.8%
swap-sqr32.1%
add-sqr-sqrt32.1%
associate-/l/32.1%
associate-/r*32.1%
unpow232.1%
Applied egg-rr32.1%
if -4.8999999999999998e-29 < d < -4.999999999999985e-310Initial program 57.4%
Simplified55.8%
pow1/255.8%
metadata-eval55.8%
div-inv55.8%
unpow-prod-down0.0%
metadata-eval0.0%
pow1/20.0%
metadata-eval0.0%
Applied egg-rr0.0%
unpow1/20.0%
Simplified0.0%
Taylor expanded in d around inf 17.2%
associate-/r*17.2%
Simplified17.2%
add-log-exp31.0%
associate-/l/31.0%
sqrt-div31.0%
metadata-eval31.0%
Applied egg-rr31.0%
if -4.999999999999985e-310 < d Initial program 63.8%
Simplified63.8%
pow1/263.8%
metadata-eval63.8%
div-inv63.8%
unpow-prod-down67.8%
metadata-eval67.8%
pow1/267.8%
metadata-eval67.8%
Applied egg-rr67.8%
unpow1/267.8%
Simplified67.8%
Taylor expanded in d around inf 45.4%
associate-/r*45.8%
Simplified45.8%
pow1/245.8%
div-inv45.8%
unpow-prod-down52.1%
pow1/252.1%
inv-pow52.1%
sqrt-pow152.1%
metadata-eval52.1%
Applied egg-rr52.1%
unpow1/252.1%
Simplified52.1%
Final simplification41.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (/ (/ 1.0 l) h)))
(if (<= d -2.25e-26)
(sqrt (* t_0 (pow d 2.0)))
(if (<= d -5e-310)
(* d (sqrt (log (exp t_0))))
(* d (* (pow h -0.5) (sqrt (/ 1.0 l))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (1.0 / l) / h;
double tmp;
if (d <= -2.25e-26) {
tmp = sqrt((t_0 * pow(d, 2.0)));
} else if (d <= -5e-310) {
tmp = d * sqrt(log(exp(t_0)));
} else {
tmp = d * (pow(h, -0.5) * sqrt((1.0 / l)));
}
return tmp;
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = (1.0d0 / l) / h
if (d <= (-2.25d-26)) then
tmp = sqrt((t_0 * (d ** 2.0d0)))
else if (d <= (-5d-310)) then
tmp = d * sqrt(log(exp(t_0)))
else
tmp = d * ((h ** (-0.5d0)) * sqrt((1.0d0 / l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (1.0 / l) / h;
double tmp;
if (d <= -2.25e-26) {
tmp = Math.sqrt((t_0 * Math.pow(d, 2.0)));
} else if (d <= -5e-310) {
tmp = d * Math.sqrt(Math.log(Math.exp(t_0)));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.sqrt((1.0 / l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = (1.0 / l) / h tmp = 0 if d <= -2.25e-26: tmp = math.sqrt((t_0 * math.pow(d, 2.0))) elif d <= -5e-310: tmp = d * math.sqrt(math.log(math.exp(t_0))) else: tmp = d * (math.pow(h, -0.5) * math.sqrt((1.0 / l))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(1.0 / l) / h) tmp = 0.0 if (d <= -2.25e-26) tmp = sqrt(Float64(t_0 * (d ^ 2.0))); elseif (d <= -5e-310) tmp = Float64(d * sqrt(log(exp(t_0)))); else tmp = Float64(d * Float64((h ^ -0.5) * sqrt(Float64(1.0 / l)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (1.0 / l) / h;
tmp = 0.0;
if (d <= -2.25e-26)
tmp = sqrt((t_0 * (d ^ 2.0)));
elseif (d <= -5e-310)
tmp = d * sqrt(log(exp(t_0)));
else
tmp = d * ((h ^ -0.5) * sqrt((1.0 / l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]}, If[LessEqual[d, -2.25e-26], N[Sqrt[N[(t$95$0 * N[Power[d, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Sqrt[N[Log[N[Exp[t$95$0], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{\frac{1}{\ell}}{h}\\
\mathbf{if}\;d \leq -2.25 \cdot 10^{-26}:\\
\;\;\;\;\sqrt{t_0 \cdot {d}^{2}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\log \left(e^{t_0}\right)}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot \sqrt{\frac{1}{\ell}}\right)\\
\end{array}
\end{array}
if d < -2.2499999999999999e-26Initial program 76.1%
Simplified76.2%
pow1/276.2%
metadata-eval76.2%
div-inv76.2%
unpow-prod-down0.0%
metadata-eval0.0%
pow1/20.0%
metadata-eval0.0%
Applied egg-rr0.0%
unpow1/20.0%
Simplified0.0%
Taylor expanded in d around inf 13.0%
associate-/r*13.0%
Simplified13.0%
add-sqr-sqrt0.4%
sqrt-unprod39.8%
*-commutative39.8%
*-commutative39.8%
swap-sqr32.1%
add-sqr-sqrt32.1%
associate-/l/32.1%
associate-/r*32.1%
unpow232.1%
Applied egg-rr32.1%
if -2.2499999999999999e-26 < d < -4.999999999999985e-310Initial program 57.4%
Simplified55.8%
pow1/255.8%
metadata-eval55.8%
div-inv55.8%
unpow-prod-down0.0%
metadata-eval0.0%
pow1/20.0%
metadata-eval0.0%
Applied egg-rr0.0%
unpow1/20.0%
Simplified0.0%
Taylor expanded in d around inf 17.2%
associate-/r*17.2%
Simplified17.2%
add-log-exp31.0%
associate-/l/31.0%
associate-/r*31.0%
Applied egg-rr31.0%
if -4.999999999999985e-310 < d Initial program 63.8%
Simplified63.8%
pow1/263.8%
metadata-eval63.8%
div-inv63.8%
unpow-prod-down67.8%
metadata-eval67.8%
pow1/267.8%
metadata-eval67.8%
Applied egg-rr67.8%
unpow1/267.8%
Simplified67.8%
Taylor expanded in d around inf 45.4%
associate-/r*45.8%
Simplified45.8%
pow1/245.8%
div-inv45.8%
unpow-prod-down52.1%
pow1/252.1%
inv-pow52.1%
sqrt-pow152.1%
metadata-eval52.1%
Applied egg-rr52.1%
unpow1/252.1%
Simplified52.1%
Final simplification41.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -7.8e-184)
(sqrt (/ (pow d 2.0) (* l h)))
(if (<= l -2e-310)
(* d (cbrt (pow (/ 1.0 (* l h)) 1.5)))
(* d (/ (pow h -0.5) (sqrt l))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -7.8e-184) {
tmp = sqrt((pow(d, 2.0) / (l * h)));
} else if (l <= -2e-310) {
tmp = d * cbrt(pow((1.0 / (l * h)), 1.5));
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -7.8e-184) {
tmp = Math.sqrt((Math.pow(d, 2.0) / (l * h)));
} else if (l <= -2e-310) {
tmp = d * Math.cbrt(Math.pow((1.0 / (l * h)), 1.5));
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -7.8e-184) tmp = sqrt(Float64((d ^ 2.0) / Float64(l * h))); elseif (l <= -2e-310) tmp = Float64(d * cbrt((Float64(1.0 / Float64(l * h)) ^ 1.5))); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -7.8e-184], N[Sqrt[N[(N[Power[d, 2.0], $MachinePrecision] / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, -2e-310], N[(d * N[Power[N[Power[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -7.8 \cdot 10^{-184}:\\
\;\;\;\;\sqrt{\frac{{d}^{2}}{\ell \cdot h}}\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt[3]{{\left(\frac{1}{\ell \cdot h}\right)}^{1.5}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -7.79999999999999988e-184Initial program 66.2%
Simplified65.5%
pow1/265.5%
metadata-eval65.5%
div-inv65.4%
unpow-prod-down0.0%
metadata-eval0.0%
pow1/20.0%
metadata-eval0.0%
Applied egg-rr0.0%
unpow1/20.0%
Simplified0.0%
Taylor expanded in d around inf 11.0%
associate-/r*11.0%
Simplified11.0%
add-sqr-sqrt5.4%
sqrt-unprod32.9%
*-commutative32.9%
*-commutative32.9%
swap-sqr25.7%
add-sqr-sqrt25.7%
associate-/l/25.6%
associate-/r*25.7%
unpow225.7%
Applied egg-rr25.7%
associate-/r*25.6%
associate-*l/26.1%
*-lft-identity26.1%
Simplified26.1%
if -7.79999999999999988e-184 < l < -1.999999999999994e-310Initial program 76.4%
Simplified76.4%
pow1/276.4%
metadata-eval76.4%
div-inv76.4%
unpow-prod-down0.0%
metadata-eval0.0%
pow1/20.0%
metadata-eval0.0%
Applied egg-rr0.0%
unpow1/20.0%
Simplified0.0%
Taylor expanded in d around inf 42.5%
associate-/r*42.5%
Simplified42.5%
add-cbrt-cube59.4%
pow1/359.4%
add-sqr-sqrt59.4%
pow159.4%
pow1/259.4%
pow-prod-up59.4%
associate-/l/59.4%
associate-/r*59.4%
metadata-eval59.4%
Applied egg-rr59.4%
unpow1/359.4%
associate-/r*59.4%
Simplified59.4%
if -1.999999999999994e-310 < l Initial program 63.8%
Simplified63.8%
pow1/263.8%
metadata-eval63.8%
div-inv63.8%
unpow-prod-down67.8%
metadata-eval67.8%
pow1/267.8%
metadata-eval67.8%
Applied egg-rr67.8%
unpow1/267.8%
Simplified67.8%
Taylor expanded in d around inf 45.4%
associate-/r*45.8%
Simplified45.8%
*-commutative45.8%
sqrt-div52.1%
associate-*l/52.1%
inv-pow52.1%
sqrt-pow152.1%
metadata-eval52.1%
Applied egg-rr52.1%
associate-/l*49.8%
associate-/r/52.1%
Simplified52.1%
Final simplification40.6%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -5.4e-184)
(sqrt (/ (pow d 2.0) (* l h)))
(if (<= l 5e-309)
(* d (cbrt (pow (/ 1.0 (* l h)) 1.5)))
(* d (* (pow h -0.5) (sqrt (/ 1.0 l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5.4e-184) {
tmp = sqrt((pow(d, 2.0) / (l * h)));
} else if (l <= 5e-309) {
tmp = d * cbrt(pow((1.0 / (l * h)), 1.5));
} else {
tmp = d * (pow(h, -0.5) * sqrt((1.0 / l)));
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5.4e-184) {
tmp = Math.sqrt((Math.pow(d, 2.0) / (l * h)));
} else if (l <= 5e-309) {
tmp = d * Math.cbrt(Math.pow((1.0 / (l * h)), 1.5));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.sqrt((1.0 / l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -5.4e-184) tmp = sqrt(Float64((d ^ 2.0) / Float64(l * h))); elseif (l <= 5e-309) tmp = Float64(d * cbrt((Float64(1.0 / Float64(l * h)) ^ 1.5))); else tmp = Float64(d * Float64((h ^ -0.5) * sqrt(Float64(1.0 / l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -5.4e-184], N[Sqrt[N[(N[Power[d, 2.0], $MachinePrecision] / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 5e-309], N[(d * N[Power[N[Power[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.4 \cdot 10^{-184}:\\
\;\;\;\;\sqrt{\frac{{d}^{2}}{\ell \cdot h}}\\
\mathbf{elif}\;\ell \leq 5 \cdot 10^{-309}:\\
\;\;\;\;d \cdot \sqrt[3]{{\left(\frac{1}{\ell \cdot h}\right)}^{1.5}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot \sqrt{\frac{1}{\ell}}\right)\\
\end{array}
\end{array}
if l < -5.4000000000000002e-184Initial program 66.2%
Simplified65.5%
pow1/265.5%
metadata-eval65.5%
div-inv65.4%
unpow-prod-down0.0%
metadata-eval0.0%
pow1/20.0%
metadata-eval0.0%
Applied egg-rr0.0%
unpow1/20.0%
Simplified0.0%
Taylor expanded in d around inf 11.0%
associate-/r*11.0%
Simplified11.0%
add-sqr-sqrt5.4%
sqrt-unprod32.9%
*-commutative32.9%
*-commutative32.9%
swap-sqr25.7%
add-sqr-sqrt25.7%
associate-/l/25.6%
associate-/r*25.7%
unpow225.7%
Applied egg-rr25.7%
associate-/r*25.6%
associate-*l/26.1%
*-lft-identity26.1%
Simplified26.1%
if -5.4000000000000002e-184 < l < 4.9999999999999995e-309Initial program 76.4%
Simplified76.4%
pow1/276.4%
metadata-eval76.4%
div-inv76.4%
unpow-prod-down0.0%
metadata-eval0.0%
pow1/20.0%
metadata-eval0.0%
Applied egg-rr0.0%
unpow1/20.0%
Simplified0.0%
Taylor expanded in d around inf 42.5%
associate-/r*42.5%
Simplified42.5%
add-cbrt-cube59.4%
pow1/359.4%
add-sqr-sqrt59.4%
pow159.4%
pow1/259.4%
pow-prod-up59.4%
associate-/l/59.4%
associate-/r*59.4%
metadata-eval59.4%
Applied egg-rr59.4%
unpow1/359.4%
associate-/r*59.4%
Simplified59.4%
if 4.9999999999999995e-309 < l Initial program 63.8%
Simplified63.8%
pow1/263.8%
metadata-eval63.8%
div-inv63.8%
unpow-prod-down67.8%
metadata-eval67.8%
pow1/267.8%
metadata-eval67.8%
Applied egg-rr67.8%
unpow1/267.8%
Simplified67.8%
Taylor expanded in d around inf 45.4%
associate-/r*45.8%
Simplified45.8%
pow1/245.8%
div-inv45.8%
unpow-prod-down52.1%
pow1/252.1%
inv-pow52.1%
sqrt-pow152.1%
metadata-eval52.1%
Applied egg-rr52.1%
unpow1/252.1%
Simplified52.1%
Final simplification40.6%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -5e-231)
(sqrt (/ (pow d 2.0) (* l h)))
(if (<= l 1.1e-308)
(* d (pow (* l h) -0.5))
(* d (/ (pow h -0.5) (sqrt l))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5e-231) {
tmp = sqrt((pow(d, 2.0) / (l * h)));
} else if (l <= 1.1e-308) {
tmp = d * pow((l * h), -0.5);
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-5d-231)) then
tmp = sqrt(((d ** 2.0d0) / (l * h)))
else if (l <= 1.1d-308) then
tmp = d * ((l * h) ** (-0.5d0))
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5e-231) {
tmp = Math.sqrt((Math.pow(d, 2.0) / (l * h)));
} else if (l <= 1.1e-308) {
tmp = d * Math.pow((l * h), -0.5);
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -5e-231: tmp = math.sqrt((math.pow(d, 2.0) / (l * h))) elif l <= 1.1e-308: tmp = d * math.pow((l * h), -0.5) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -5e-231) tmp = sqrt(Float64((d ^ 2.0) / Float64(l * h))); elseif (l <= 1.1e-308) tmp = Float64(d * (Float64(l * h) ^ -0.5)); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= -5e-231)
tmp = sqrt(((d ^ 2.0) / (l * h)));
elseif (l <= 1.1e-308)
tmp = d * ((l * h) ^ -0.5);
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -5e-231], N[Sqrt[N[(N[Power[d, 2.0], $MachinePrecision] / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 1.1e-308], N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-231}:\\
\;\;\;\;\sqrt{\frac{{d}^{2}}{\ell \cdot h}}\\
\mathbf{elif}\;\ell \leq 1.1 \cdot 10^{-308}:\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -5.00000000000000023e-231Initial program 67.3%
Simplified66.6%
pow1/266.6%
metadata-eval66.6%
div-inv66.6%
unpow-prod-down0.0%
metadata-eval0.0%
pow1/20.0%
metadata-eval0.0%
Applied egg-rr0.0%
unpow1/20.0%
Simplified0.0%
Taylor expanded in d around inf 10.5%
associate-/r*10.5%
Simplified10.5%
add-sqr-sqrt5.1%
sqrt-unprod32.7%
*-commutative32.7%
*-commutative32.7%
swap-sqr25.8%
add-sqr-sqrt25.9%
associate-/l/25.8%
associate-/r*25.9%
unpow225.9%
Applied egg-rr25.9%
associate-/r*25.8%
associate-*l/26.3%
*-lft-identity26.3%
Simplified26.3%
if -5.00000000000000023e-231 < l < 1.1000000000000001e-308Initial program 70.0%
Simplified70.0%
pow1/270.0%
metadata-eval70.0%
div-inv70.0%
unpow-prod-down0.0%
metadata-eval0.0%
pow1/20.0%
metadata-eval0.0%
Applied egg-rr0.0%
unpow1/20.0%
Simplified0.0%
Taylor expanded in d around inf 70.4%
associate-/r*70.4%
Simplified70.4%
Taylor expanded in d around 0 70.4%
*-commutative70.4%
rem-exp-log70.4%
exp-neg70.4%
unpow1/270.4%
exp-prod70.4%
distribute-lft-neg-out70.4%
distribute-rgt-neg-in70.4%
metadata-eval70.4%
exp-to-pow70.4%
Simplified70.4%
if 1.1000000000000001e-308 < l Initial program 63.8%
Simplified63.8%
pow1/263.8%
metadata-eval63.8%
div-inv63.8%
unpow-prod-down67.8%
metadata-eval67.8%
pow1/267.8%
metadata-eval67.8%
Applied egg-rr67.8%
unpow1/267.8%
Simplified67.8%
Taylor expanded in d around inf 45.4%
associate-/r*45.8%
Simplified45.8%
*-commutative45.8%
sqrt-div52.1%
associate-*l/52.1%
inv-pow52.1%
sqrt-pow152.1%
metadata-eval52.1%
Applied egg-rr52.1%
associate-/l*49.8%
associate-/r/52.1%
Simplified52.1%
Final simplification40.2%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -9.6e-231)
(sqrt (/ (pow d 2.0) (* l h)))
(if (<= l 4.3e-297)
(* d (sqrt (/ (/ 1.0 h) l)))
(/ (/ d (sqrt h)) (sqrt l)))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -9.6e-231) {
tmp = sqrt((pow(d, 2.0) / (l * h)));
} else if (l <= 4.3e-297) {
tmp = d * sqrt(((1.0 / h) / l));
} else {
tmp = (d / sqrt(h)) / sqrt(l);
}
return tmp;
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-9.6d-231)) then
tmp = sqrt(((d ** 2.0d0) / (l * h)))
else if (l <= 4.3d-297) then
tmp = d * sqrt(((1.0d0 / h) / l))
else
tmp = (d / sqrt(h)) / sqrt(l)
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -9.6e-231) {
tmp = Math.sqrt((Math.pow(d, 2.0) / (l * h)));
} else if (l <= 4.3e-297) {
tmp = d * Math.sqrt(((1.0 / h) / l));
} else {
tmp = (d / Math.sqrt(h)) / Math.sqrt(l);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -9.6e-231: tmp = math.sqrt((math.pow(d, 2.0) / (l * h))) elif l <= 4.3e-297: tmp = d * math.sqrt(((1.0 / h) / l)) else: tmp = (d / math.sqrt(h)) / math.sqrt(l) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -9.6e-231) tmp = sqrt(Float64((d ^ 2.0) / Float64(l * h))); elseif (l <= 4.3e-297) tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); else tmp = Float64(Float64(d / sqrt(h)) / sqrt(l)); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= -9.6e-231)
tmp = sqrt(((d ^ 2.0) / (l * h)));
elseif (l <= 4.3e-297)
tmp = d * sqrt(((1.0 / h) / l));
else
tmp = (d / sqrt(h)) / sqrt(l);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -9.6e-231], N[Sqrt[N[(N[Power[d, 2.0], $MachinePrecision] / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 4.3e-297], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $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_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -9.6 \cdot 10^{-231}:\\
\;\;\;\;\sqrt{\frac{{d}^{2}}{\ell \cdot h}}\\
\mathbf{elif}\;\ell \leq 4.3 \cdot 10^{-297}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -9.59999999999999967e-231Initial program 67.3%
Simplified66.6%
pow1/266.6%
metadata-eval66.6%
div-inv66.6%
unpow-prod-down0.0%
metadata-eval0.0%
pow1/20.0%
metadata-eval0.0%
Applied egg-rr0.0%
unpow1/20.0%
Simplified0.0%
Taylor expanded in d around inf 10.5%
associate-/r*10.5%
Simplified10.5%
add-sqr-sqrt5.1%
sqrt-unprod32.7%
*-commutative32.7%
*-commutative32.7%
swap-sqr25.8%
add-sqr-sqrt25.9%
associate-/l/25.8%
associate-/r*25.9%
unpow225.9%
Applied egg-rr25.9%
associate-/r*25.8%
associate-*l/26.3%
*-lft-identity26.3%
Simplified26.3%
if -9.59999999999999967e-231 < l < 4.3000000000000003e-297Initial program 63.6%
Simplified63.6%
pow1/263.6%
metadata-eval63.6%
div-inv63.6%
unpow-prod-down0.0%
metadata-eval0.0%
pow1/20.0%
metadata-eval0.0%
Applied egg-rr0.0%
unpow1/20.0%
Simplified0.0%
Taylor expanded in d around inf 72.9%
associate-/r*73.1%
Simplified73.1%
if 4.3000000000000003e-297 < l Initial program 64.4%
Simplified64.4%
pow1/264.4%
metadata-eval64.4%
div-inv64.4%
unpow-prod-down68.3%
metadata-eval68.3%
pow1/268.3%
metadata-eval68.3%
Applied egg-rr68.3%
unpow1/268.3%
Simplified68.3%
Taylor expanded in d around inf 45.0%
associate-/r*45.4%
Simplified45.4%
sqrt-div51.7%
associate-*r/51.7%
add-sqr-sqrt51.6%
sqrt-prod36.0%
unpow236.0%
sqrt-prod34.5%
div-inv34.5%
sqrt-div36.0%
unpow236.0%
sqrt-prod51.6%
add-sqr-sqrt51.7%
Applied egg-rr51.7%
Final simplification40.2%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= d 8e-245) (* d (sqrt (/ 1.0 (* l h)))) (/ d (* (sqrt h) (sqrt l)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= 8e-245) {
tmp = d * sqrt((1.0 / (l * h)));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (d <= 8d-245) 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);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= 8e-245) {
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_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if d <= 8e-245: tmp = d * math.sqrt((1.0 / (l * h))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= 8e-245) tmp = 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_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (d <= 8e-245)
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] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, 8e-245], 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_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 8 \cdot 10^{-245}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < 7.9999999999999994e-245Initial program 64.4%
Simplified63.8%
pow1/263.8%
metadata-eval63.8%
div-inv63.8%
unpow-prod-down4.7%
metadata-eval4.7%
pow1/24.7%
metadata-eval4.7%
Applied egg-rr4.7%
unpow1/24.7%
Simplified4.7%
Taylor expanded in d around inf 16.2%
*-commutative16.2%
Simplified16.2%
if 7.9999999999999994e-245 < d Initial program 67.7%
Simplified67.7%
pow1/267.7%
metadata-eval67.7%
div-inv67.7%
unpow-prod-down71.4%
metadata-eval71.4%
pow1/271.4%
metadata-eval71.4%
Applied egg-rr71.4%
unpow1/271.4%
Simplified71.4%
Taylor expanded in d around inf 48.3%
associate-/r*48.8%
Simplified48.8%
expm1-log1p-u46.7%
expm1-udef36.1%
sqrt-div40.1%
associate-*r/40.1%
add-sqr-sqrt40.1%
sqrt-prod27.8%
unpow227.8%
sqrt-prod26.2%
div-inv26.2%
sqrt-div27.8%
unpow227.8%
sqrt-prod40.1%
add-sqr-sqrt40.1%
Applied egg-rr40.1%
expm1-def53.5%
expm1-log1p56.0%
associate-/l/56.0%
Simplified56.0%
Final simplification32.5%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= d 5e-176) (* d (sqrt (/ 1.0 (* l h)))) (/ (/ d (sqrt h)) (sqrt l))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= 5e-176) {
tmp = d * sqrt((1.0 / (l * h)));
} else {
tmp = (d / sqrt(h)) / sqrt(l);
}
return tmp;
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (d <= 5d-176) 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);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= 5e-176) {
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_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if d <= 5e-176: tmp = d * math.sqrt((1.0 / (l * h))) else: tmp = (d / math.sqrt(h)) / math.sqrt(l) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= 5e-176) tmp = 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_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (d <= 5e-176)
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] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, 5e-176], 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_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 5 \cdot 10^{-176}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < 5e-176Initial program 62.1%
Simplified61.5%
pow1/261.5%
metadata-eval61.5%
div-inv61.5%
unpow-prod-down6.9%
metadata-eval6.9%
pow1/26.9%
metadata-eval6.9%
Applied egg-rr6.9%
unpow1/26.9%
Simplified6.9%
Taylor expanded in d around inf 16.6%
*-commutative16.6%
Simplified16.6%
if 5e-176 < d Initial program 71.9%
Simplified71.9%
pow1/271.9%
metadata-eval71.9%
div-inv71.9%
unpow-prod-down73.8%
metadata-eval73.8%
pow1/273.8%
metadata-eval73.8%
Applied egg-rr73.8%
unpow1/273.8%
Simplified73.8%
Taylor expanded in d around inf 50.7%
associate-/r*51.2%
Simplified51.2%
sqrt-div59.0%
associate-*r/59.0%
add-sqr-sqrt58.9%
sqrt-prod43.2%
unpow243.2%
sqrt-prod41.3%
div-inv41.3%
sqrt-div43.2%
unpow243.2%
sqrt-prod58.9%
add-sqr-sqrt59.0%
Applied egg-rr59.0%
Final simplification32.5%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (* d (sqrt (/ 1.0 (* l h)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
return d * sqrt((1.0 / (l * h)));
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
code = d * sqrt((1.0d0 / (l * h)))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
return d * Math.sqrt((1.0 / (l * h)));
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): return d * math.sqrt((1.0 / (l * h)))
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) return Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp = code(d, h, l, M_m, D_m)
tmp = d * sqrt((1.0 / (l * h)));
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
d \cdot \sqrt{\frac{1}{\ell \cdot h}}
\end{array}
Initial program 65.8%
Simplified65.4%
pow1/265.4%
metadata-eval65.4%
div-inv65.4%
unpow-prod-down32.0%
metadata-eval32.0%
pow1/232.0%
metadata-eval32.0%
Applied egg-rr32.0%
unpow1/232.0%
Simplified32.0%
Taylor expanded in d around inf 29.4%
*-commutative29.4%
Simplified29.4%
Final simplification29.4%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (* d (sqrt (/ (/ 1.0 h) l))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
return d * sqrt(((1.0 / h) / l));
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
code = d * sqrt(((1.0d0 / h) / l))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
return d * Math.sqrt(((1.0 / h) / l));
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): return d * math.sqrt(((1.0 / h) / l))
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) return Float64(d * sqrt(Float64(Float64(1.0 / h) / l))) end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp = code(d, h, l, M_m, D_m)
tmp = d * sqrt(((1.0 / h) / l));
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}
\end{array}
Initial program 65.8%
Simplified65.4%
pow1/265.4%
metadata-eval65.4%
div-inv65.4%
unpow-prod-down32.0%
metadata-eval32.0%
pow1/232.0%
metadata-eval32.0%
Applied egg-rr32.0%
unpow1/232.0%
Simplified32.0%
Taylor expanded in d around inf 29.4%
associate-/r*29.5%
Simplified29.5%
Final simplification29.5%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (* d (pow (* l h) -0.5)))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
return d * pow((l * h), -0.5);
}
M_m = abs(M)
D_m = abs(D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
code = d * ((l * h) ** (-0.5d0))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
return d * Math.pow((l * h), -0.5);
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): return d * math.pow((l * h), -0.5)
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) return Float64(d * (Float64(l * h) ^ -0.5)) end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp = code(d, h, l, M_m, D_m)
tmp = d * ((l * h) ^ -0.5);
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
d \cdot {\left(\ell \cdot h\right)}^{-0.5}
\end{array}
Initial program 65.8%
Simplified65.4%
pow1/265.4%
metadata-eval65.4%
div-inv65.4%
unpow-prod-down32.0%
metadata-eval32.0%
pow1/232.0%
metadata-eval32.0%
Applied egg-rr32.0%
unpow1/232.0%
Simplified32.0%
Taylor expanded in d around inf 29.4%
associate-/r*29.5%
Simplified29.5%
Taylor expanded in d around 0 29.4%
*-commutative29.4%
rem-exp-log28.2%
exp-neg28.2%
unpow1/228.2%
exp-prod27.9%
distribute-lft-neg-out27.9%
distribute-rgt-neg-in27.9%
metadata-eval27.9%
exp-to-pow29.0%
Simplified29.0%
Final simplification29.0%
herbie shell --seed 2024011
(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)))))