
(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 19 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
(if (<= h -5e-310)
(*
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
(- 1.0 (* 0.5 (* (pow (* (/ M_m 2.0) (/ D_m d)) 2.0) (/ h l)))))
(*
(+ 1.0 (* h (/ (* (pow (* D_m (/ (* 0.5 M_m) 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 (h <= -5e-310) {
tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * (1.0 - (0.5 * (pow(((M_m / 2.0) * (D_m / d)), 2.0) * (h / l))));
} else {
tmp = (1.0 + (h * ((pow((D_m * ((0.5 * M_m) / d)), 2.0) * -0.5) / l))) * (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 (h <= (-5d-310)) then
tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * (1.0d0 - (0.5d0 * ((((m_m / 2.0d0) * (d_m / d)) ** 2.0d0) * (h / l))))
else
tmp = (1.0d0 + (h * ((((d_m * ((0.5d0 * m_m) / d)) ** 2.0d0) * (-0.5d0)) / l))) * (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 (h <= -5e-310) {
tmp = ((Math.sqrt(-d) / Math.sqrt(-h)) * Math.sqrt((d / l))) * (1.0 - (0.5 * (Math.pow(((M_m / 2.0) * (D_m / d)), 2.0) * (h / l))));
} else {
tmp = (1.0 + (h * ((Math.pow((D_m * ((0.5 * M_m) / d)), 2.0) * -0.5) / l))) * (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 h <= -5e-310: tmp = ((math.sqrt(-d) / math.sqrt(-h)) * math.sqrt((d / l))) * (1.0 - (0.5 * (math.pow(((M_m / 2.0) * (D_m / d)), 2.0) * (h / l)))) else: tmp = (1.0 + (h * ((math.pow((D_m * ((0.5 * M_m) / d)), 2.0) * -0.5) / l))) * (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 (h <= -5e-310) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0) * Float64(h / l))))); else tmp = Float64(Float64(1.0 + Float64(h * Float64(Float64((Float64(D_m * Float64(Float64(0.5 * M_m) / d)) ^ 2.0) * -0.5) / l))) * 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 (h <= -5e-310)
tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * (1.0 - (0.5 * ((((M_m / 2.0) * (D_m / d)) ^ 2.0) * (h / l))));
else
tmp = (1.0 + (h * ((((D_m * ((0.5 * M_m) / d)) ^ 2.0) * -0.5) / l))) * (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[h, -5e-310], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(h * N[(N[(N[Power[N[(D$95$m * N[(N[(0.5 * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $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}
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + h \cdot \frac{{\left(D\_m \cdot \frac{0.5 \cdot M\_m}{d}\right)}^{2} \cdot -0.5}{\ell}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 64.1%
Simplified63.3%
frac-2neg63.3%
sqrt-div73.5%
Applied egg-rr73.5%
if -4.999999999999985e-310 < h Initial program 69.1%
Applied egg-rr72.4%
distribute-rgt1-in80.8%
+-commutative80.8%
associate-*l/85.4%
associate-/l*86.1%
associate-*r*86.1%
associate-*r/86.2%
*-commutative86.2%
associate-/l*85.4%
Simplified85.4%
Final simplification79.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
(let* ((t_0 (pow (* D_m (/ (* 0.5 M_m) d)) 2.0)))
(if (<= l -5.8e-292)
(*
(* (sqrt (/ d h)) (/ (sqrt (- d)) (sqrt (- l))))
(- 1.0 (* 0.5 (* h (/ t_0 l)))))
(* (+ 1.0 (* h (/ (* t_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 t_0 = pow((D_m * ((0.5 * M_m) / d)), 2.0);
double tmp;
if (l <= -5.8e-292) {
tmp = (sqrt((d / h)) * (sqrt(-d) / sqrt(-l))) * (1.0 - (0.5 * (h * (t_0 / l))));
} else {
tmp = (1.0 + (h * ((t_0 * -0.5) / l))) * (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) :: t_0
real(8) :: tmp
t_0 = (d_m * ((0.5d0 * m_m) / d)) ** 2.0d0
if (l <= (-5.8d-292)) then
tmp = (sqrt((d / h)) * (sqrt(-d) / sqrt(-l))) * (1.0d0 - (0.5d0 * (h * (t_0 / l))))
else
tmp = (1.0d0 + (h * ((t_0 * (-0.5d0)) / l))) * (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 t_0 = Math.pow((D_m * ((0.5 * M_m) / d)), 2.0);
double tmp;
if (l <= -5.8e-292) {
tmp = (Math.sqrt((d / h)) * (Math.sqrt(-d) / Math.sqrt(-l))) * (1.0 - (0.5 * (h * (t_0 / l))));
} else {
tmp = (1.0 + (h * ((t_0 * -0.5) / l))) * (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): t_0 = math.pow((D_m * ((0.5 * M_m) / d)), 2.0) tmp = 0 if l <= -5.8e-292: tmp = (math.sqrt((d / h)) * (math.sqrt(-d) / math.sqrt(-l))) * (1.0 - (0.5 * (h * (t_0 / l)))) else: tmp = (1.0 + (h * ((t_0 * -0.5) / l))) * (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) t_0 = Float64(D_m * Float64(Float64(0.5 * M_m) / d)) ^ 2.0 tmp = 0.0 if (l <= -5.8e-292) tmp = Float64(Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))) * Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_0 / l))))); else tmp = Float64(Float64(1.0 + Float64(h * Float64(Float64(t_0 * -0.5) / l))) * 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)
t_0 = (D_m * ((0.5 * M_m) / d)) ^ 2.0;
tmp = 0.0;
if (l <= -5.8e-292)
tmp = (sqrt((d / h)) * (sqrt(-d) / sqrt(-l))) * (1.0 - (0.5 * (h * (t_0 / l))));
else
tmp = (1.0 + (h * ((t_0 * -0.5) / l))) * (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_] := Block[{t$95$0 = N[Power[N[(D$95$m * N[(N[(0.5 * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[l, -5.8e-292], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(h * N[(N[(t$95$0 * -0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $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 \frac{0.5 \cdot M\_m}{d}\right)}^{2}\\
\mathbf{if}\;\ell \leq -5.8 \cdot 10^{-292}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{t\_0}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + h \cdot \frac{t\_0 \cdot -0.5}{\ell}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -5.79999999999999985e-292Initial program 64.7%
Simplified63.8%
clear-num63.8%
un-div-inv64.6%
frac-times65.4%
associate-/l*64.6%
*-un-lft-identity64.6%
times-frac64.6%
metadata-eval64.6%
Applied egg-rr64.6%
associate-/r/65.6%
associate-*r*65.6%
associate-*r/66.4%
*-commutative66.4%
associate-/l*66.2%
Simplified66.2%
frac-2neg66.2%
sqrt-div72.1%
Applied egg-rr72.1%
if -5.79999999999999985e-292 < l Initial program 68.6%
Applied egg-rr71.8%
distribute-rgt1-in80.2%
+-commutative80.2%
associate-*l/84.8%
associate-/l*85.4%
associate-*r*85.4%
associate-*r/85.6%
*-commutative85.6%
associate-/l*84.7%
Simplified84.7%
Final simplification78.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
(let* ((t_0 (* (/ D_m d) (* 0.5 M_m))))
(if (<= l 5.6e-112)
(*
(sqrt (/ d l))
(* (sqrt (/ d h)) (+ 1.0 (/ (* h -0.5) (* (/ 1.0 t_0) (/ l t_0))))))
(if (<= l 1.85e+116)
(*
d
(/
(fma (pow (* 0.5 (* D_m (/ M_m d))) 2.0) (* (/ h l) -0.5) 1.0)
(sqrt (* h l))))
(* 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 = (D_m / d) * (0.5 * M_m);
double tmp;
if (l <= 5.6e-112) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * -0.5) / ((1.0 / t_0) * (l / t_0)))));
} else if (l <= 1.85e+116) {
tmp = d * (fma(pow((0.5 * (D_m * (M_m / d))), 2.0), ((h / l) * -0.5), 1.0) / sqrt((h * l)));
} else {
tmp = d * (pow(h, -0.5) * 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(D_m / d) * Float64(0.5 * M_m)) tmp = 0.0 if (l <= 5.6e-112) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h * -0.5) / Float64(Float64(1.0 / t_0) * Float64(l / t_0)))))); elseif (l <= 1.85e+116) tmp = Float64(d * Float64(fma((Float64(0.5 * Float64(D_m * Float64(M_m / d))) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0) / sqrt(Float64(h * l)))); 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[(D$95$m / d), $MachinePrecision] * N[(0.5 * M$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 5.6e-112], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * -0.5), $MachinePrecision] / N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(l / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.85e+116], N[(d * N[(N[(N[Power[N[(0.5 * N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[N[(h * l), $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{D\_m}{d} \cdot \left(0.5 \cdot M\_m\right)\\
\mathbf{if}\;\ell \leq 5.6 \cdot 10^{-112}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot -0.5}{\frac{1}{t\_0} \cdot \frac{\ell}{t\_0}}\right)\right)\\
\mathbf{elif}\;\ell \leq 1.85 \cdot 10^{+116}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left({\left(0.5 \cdot \left(D\_m \cdot \frac{M\_m}{d}\right)\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot \sqrt{\frac{1}{\ell}}\right)\\
\end{array}
\end{array}
if l < 5.60000000000000046e-112Initial program 68.0%
Simplified67.4%
Applied egg-rr67.4%
associate--l+67.4%
associate-*l/69.8%
associate-/l*70.6%
associate-*r*70.6%
associate-*r/71.2%
*-commutative71.2%
associate-/l*71.0%
Simplified71.0%
*-un-lft-identity71.0%
associate-+r-71.0%
add-exp-log37.4%
log1p-undefine37.4%
expm1-undefine37.4%
expm1-log1p-u71.0%
associate-/l*71.0%
associate-*r/71.2%
Applied egg-rr71.2%
*-lft-identity71.2%
associate-*r*69.9%
associate-*r/69.9%
associate-*l/69.9%
associate-*r/71.2%
*-commutative71.2%
associate-*l*71.2%
*-commutative71.2%
associate-/l*70.6%
associate-*r*70.6%
Simplified70.6%
*-commutative70.6%
clear-num70.6%
un-div-inv70.6%
associate-*r*70.6%
Applied egg-rr70.6%
*-un-lft-identity70.6%
unpow270.6%
times-frac72.4%
Applied egg-rr72.4%
if 5.60000000000000046e-112 < l < 1.8500000000000001e116Initial program 69.5%
Applied egg-rr76.3%
distribute-rgt1-in81.8%
+-commutative81.8%
*-commutative81.8%
associate-*l/82.3%
associate-/l*84.0%
Simplified84.0%
associate-*r/82.4%
*-commutative82.4%
associate-*r*84.1%
sqrt-unprod79.1%
*-commutative79.1%
Applied egg-rr79.1%
associate-*r/80.7%
Simplified78.9%
if 1.8500000000000001e116 < l Initial program 57.2%
Taylor expanded in d around inf 53.1%
add-cbrt-cube48.0%
pow1/345.2%
add-sqr-sqrt45.2%
pow145.2%
pow1/245.2%
pow-prod-up45.2%
associate-/r*45.2%
metadata-eval45.2%
Applied egg-rr45.2%
pow-pow53.0%
div-inv53.1%
metadata-eval53.1%
unpow-prod-down71.1%
pow1/271.1%
inv-pow71.1%
sqrt-pow171.2%
metadata-eval71.2%
Applied egg-rr71.2%
unpow1/271.2%
Simplified71.2%
Final simplification73.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
(let* ((t_0 (* (/ D_m d) (* 0.5 M_m))))
(if (<= l 4e-112)
(*
(sqrt (/ d l))
(* (sqrt (/ d h)) (+ 1.0 (/ (* h -0.5) (* (/ 1.0 t_0) (/ l t_0))))))
(if (<= l 1.7e+116)
(/
(* d (fma (/ h l) (* -0.5 (pow (* (* M_m D_m) (/ 0.5 d)) 2.0)) 1.0))
(sqrt (* h l)))
(* 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 = (D_m / d) * (0.5 * M_m);
double tmp;
if (l <= 4e-112) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * -0.5) / ((1.0 / t_0) * (l / t_0)))));
} else if (l <= 1.7e+116) {
tmp = (d * fma((h / l), (-0.5 * pow(((M_m * D_m) * (0.5 / d)), 2.0)), 1.0)) / sqrt((h * l));
} else {
tmp = d * (pow(h, -0.5) * 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(D_m / d) * Float64(0.5 * M_m)) tmp = 0.0 if (l <= 4e-112) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h * -0.5) / Float64(Float64(1.0 / t_0) * Float64(l / t_0)))))); elseif (l <= 1.7e+116) tmp = Float64(Float64(d * fma(Float64(h / l), Float64(-0.5 * (Float64(Float64(M_m * D_m) * Float64(0.5 / d)) ^ 2.0)), 1.0)) / sqrt(Float64(h * l))); 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[(D$95$m / d), $MachinePrecision] * N[(0.5 * M$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 4e-112], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * -0.5), $MachinePrecision] / N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(l / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.7e+116], N[(N[(d * N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] * N[(0.5 / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $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{D\_m}{d} \cdot \left(0.5 \cdot M\_m\right)\\
\mathbf{if}\;\ell \leq 4 \cdot 10^{-112}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot -0.5}{\frac{1}{t\_0} \cdot \frac{\ell}{t\_0}}\right)\right)\\
\mathbf{elif}\;\ell \leq 1.7 \cdot 10^{+116}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(\left(M\_m \cdot D\_m\right) \cdot \frac{0.5}{d}\right)}^{2}, 1\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot \sqrt{\frac{1}{\ell}}\right)\\
\end{array}
\end{array}
if l < 3.9999999999999998e-112Initial program 68.0%
Simplified67.4%
Applied egg-rr67.4%
associate--l+67.4%
associate-*l/69.8%
associate-/l*70.6%
associate-*r*70.6%
associate-*r/71.2%
*-commutative71.2%
associate-/l*71.0%
Simplified71.0%
*-un-lft-identity71.0%
associate-+r-71.0%
add-exp-log37.4%
log1p-undefine37.4%
expm1-undefine37.4%
expm1-log1p-u71.0%
associate-/l*71.0%
associate-*r/71.2%
Applied egg-rr71.2%
*-lft-identity71.2%
associate-*r*69.9%
associate-*r/69.9%
associate-*l/69.9%
associate-*r/71.2%
*-commutative71.2%
associate-*l*71.2%
*-commutative71.2%
associate-/l*70.6%
associate-*r*70.6%
Simplified70.6%
*-commutative70.6%
clear-num70.6%
un-div-inv70.6%
associate-*r*70.6%
Applied egg-rr70.6%
*-un-lft-identity70.6%
unpow270.6%
times-frac72.4%
Applied egg-rr72.4%
if 3.9999999999999998e-112 < l < 1.70000000000000011e116Initial program 69.5%
Applied egg-rr76.3%
distribute-rgt1-in81.8%
+-commutative81.8%
*-commutative81.8%
associate-*l/82.3%
associate-/l*84.0%
Simplified84.0%
associate-*r/82.4%
*-commutative82.4%
associate-*r*84.1%
sqrt-unprod79.1%
*-commutative79.1%
Applied egg-rr79.1%
if 1.70000000000000011e116 < l Initial program 57.2%
Taylor expanded in d around inf 53.1%
add-cbrt-cube48.0%
pow1/345.2%
add-sqr-sqrt45.2%
pow145.2%
pow1/245.2%
pow-prod-up45.2%
associate-/r*45.2%
metadata-eval45.2%
Applied egg-rr45.2%
pow-pow53.0%
div-inv53.1%
metadata-eval53.1%
unpow-prod-down71.1%
pow1/271.1%
inv-pow71.1%
sqrt-pow171.2%
metadata-eval71.2%
Applied egg-rr71.2%
unpow1/271.2%
Simplified71.2%
Final simplification73.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 (* (/ D_m d) (* 0.5 M_m))))
(if (<= l 3.5e-112)
(*
(sqrt (/ d l))
(* (sqrt (/ d h)) (+ 1.0 (/ (* h -0.5) (* (/ 1.0 t_0) (/ l t_0))))))
(*
d
(/
(+ 1.0 (* (/ h l) (* -0.5 (pow (* (* M_m D_m) (/ 0.5 d)) 2.0))))
(* (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 t_0 = (D_m / d) * (0.5 * M_m);
double tmp;
if (l <= 3.5e-112) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * -0.5) / ((1.0 / t_0) * (l / t_0)))));
} else {
tmp = d * ((1.0 + ((h / l) * (-0.5 * pow(((M_m * D_m) * (0.5 / d)), 2.0)))) / (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) :: t_0
real(8) :: tmp
t_0 = (d_m / d) * (0.5d0 * m_m)
if (l <= 3.5d-112) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((h * (-0.5d0)) / ((1.0d0 / t_0) * (l / t_0)))))
else
tmp = d * ((1.0d0 + ((h / l) * ((-0.5d0) * (((m_m * d_m) * (0.5d0 / d)) ** 2.0d0)))) / (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 t_0 = (D_m / d) * (0.5 * M_m);
double tmp;
if (l <= 3.5e-112) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h * -0.5) / ((1.0 / t_0) * (l / t_0)))));
} else {
tmp = d * ((1.0 + ((h / l) * (-0.5 * Math.pow(((M_m * D_m) * (0.5 / d)), 2.0)))) / (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): t_0 = (D_m / d) * (0.5 * M_m) tmp = 0 if l <= 3.5e-112: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((h * -0.5) / ((1.0 / t_0) * (l / t_0))))) else: tmp = d * ((1.0 + ((h / l) * (-0.5 * math.pow(((M_m * D_m) * (0.5 / d)), 2.0)))) / (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) t_0 = Float64(Float64(D_m / d) * Float64(0.5 * M_m)) tmp = 0.0 if (l <= 3.5e-112) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h * -0.5) / Float64(Float64(1.0 / t_0) * Float64(l / t_0)))))); else tmp = Float64(d * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(M_m * D_m) * Float64(0.5 / d)) ^ 2.0)))) / 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)
t_0 = (D_m / d) * (0.5 * M_m);
tmp = 0.0;
if (l <= 3.5e-112)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * -0.5) / ((1.0 / t_0) * (l / t_0)))));
else
tmp = d * ((1.0 + ((h / l) * (-0.5 * (((M_m * D_m) * (0.5 / d)) ^ 2.0)))) / (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_] := Block[{t$95$0 = N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * M$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 3.5e-112], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * -0.5), $MachinePrecision] / N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(l / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] * N[(0.5 / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[h], $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 := \frac{D\_m}{d} \cdot \left(0.5 \cdot M\_m\right)\\
\mathbf{if}\;\ell \leq 3.5 \cdot 10^{-112}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot -0.5}{\frac{1}{t\_0} \cdot \frac{\ell}{t\_0}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\left(M\_m \cdot D\_m\right) \cdot \frac{0.5}{d}\right)}^{2}\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < 3.49999999999999994e-112Initial program 68.0%
Simplified67.4%
Applied egg-rr67.4%
associate--l+67.4%
associate-*l/69.8%
associate-/l*70.6%
associate-*r*70.6%
associate-*r/71.2%
*-commutative71.2%
associate-/l*71.0%
Simplified71.0%
*-un-lft-identity71.0%
associate-+r-71.0%
add-exp-log37.4%
log1p-undefine37.4%
expm1-undefine37.4%
expm1-log1p-u71.0%
associate-/l*71.0%
associate-*r/71.2%
Applied egg-rr71.2%
*-lft-identity71.2%
associate-*r*69.9%
associate-*r/69.9%
associate-*l/69.9%
associate-*r/71.2%
*-commutative71.2%
associate-*l*71.2%
*-commutative71.2%
associate-/l*70.6%
associate-*r*70.6%
Simplified70.6%
*-commutative70.6%
clear-num70.6%
un-div-inv70.6%
associate-*r*70.6%
Applied egg-rr70.6%
*-un-lft-identity70.6%
unpow270.6%
times-frac72.4%
Applied egg-rr72.4%
if 3.49999999999999994e-112 < l Initial program 64.4%
Applied egg-rr75.3%
distribute-rgt1-in79.5%
+-commutative79.5%
*-commutative79.5%
associate-*l/80.0%
associate-/l*81.9%
Simplified80.9%
fma-undefine80.9%
*-commutative80.9%
associate-*r*83.1%
Applied egg-rr83.1%
Final simplification76.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 (* (/ D_m d) (* 0.5 M_m))))
(if (<= l -5.8e-292)
(*
(sqrt (/ d l))
(* (sqrt (/ d h)) (+ 1.0 (/ (* h -0.5) (* (/ 1.0 t_0) (/ l t_0))))))
(*
(+ 1.0 (* h (/ (* (pow (* D_m (/ (* 0.5 M_m) 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 t_0 = (D_m / d) * (0.5 * M_m);
double tmp;
if (l <= -5.8e-292) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * -0.5) / ((1.0 / t_0) * (l / t_0)))));
} else {
tmp = (1.0 + (h * ((pow((D_m * ((0.5 * M_m) / d)), 2.0) * -0.5) / l))) * (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) :: t_0
real(8) :: tmp
t_0 = (d_m / d) * (0.5d0 * m_m)
if (l <= (-5.8d-292)) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((h * (-0.5d0)) / ((1.0d0 / t_0) * (l / t_0)))))
else
tmp = (1.0d0 + (h * ((((d_m * ((0.5d0 * m_m) / d)) ** 2.0d0) * (-0.5d0)) / l))) * (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 t_0 = (D_m / d) * (0.5 * M_m);
double tmp;
if (l <= -5.8e-292) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h * -0.5) / ((1.0 / t_0) * (l / t_0)))));
} else {
tmp = (1.0 + (h * ((Math.pow((D_m * ((0.5 * M_m) / d)), 2.0) * -0.5) / l))) * (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): t_0 = (D_m / d) * (0.5 * M_m) tmp = 0 if l <= -5.8e-292: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((h * -0.5) / ((1.0 / t_0) * (l / t_0))))) else: tmp = (1.0 + (h * ((math.pow((D_m * ((0.5 * M_m) / d)), 2.0) * -0.5) / l))) * (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) t_0 = Float64(Float64(D_m / d) * Float64(0.5 * M_m)) tmp = 0.0 if (l <= -5.8e-292) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h * -0.5) / Float64(Float64(1.0 / t_0) * Float64(l / t_0)))))); else tmp = Float64(Float64(1.0 + Float64(h * Float64(Float64((Float64(D_m * Float64(Float64(0.5 * M_m) / d)) ^ 2.0) * -0.5) / l))) * 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)
t_0 = (D_m / d) * (0.5 * M_m);
tmp = 0.0;
if (l <= -5.8e-292)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * -0.5) / ((1.0 / t_0) * (l / t_0)))));
else
tmp = (1.0 + (h * ((((D_m * ((0.5 * M_m) / d)) ^ 2.0) * -0.5) / l))) * (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_] := Block[{t$95$0 = N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * M$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5.8e-292], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * -0.5), $MachinePrecision] / N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(l / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(h * N[(N[(N[Power[N[(D$95$m * N[(N[(0.5 * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $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 := \frac{D\_m}{d} \cdot \left(0.5 \cdot M\_m\right)\\
\mathbf{if}\;\ell \leq -5.8 \cdot 10^{-292}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot -0.5}{\frac{1}{t\_0} \cdot \frac{\ell}{t\_0}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + h \cdot \frac{{\left(D\_m \cdot \frac{0.5 \cdot M\_m}{d}\right)}^{2} \cdot -0.5}{\ell}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -5.79999999999999985e-292Initial program 64.7%
Simplified63.8%
Applied egg-rr63.8%
associate--l+63.8%
associate-*l/64.6%
associate-/l*65.6%
associate-*r*65.6%
associate-*r/66.5%
*-commutative66.5%
associate-/l*66.2%
Simplified66.2%
*-un-lft-identity66.2%
associate-+r-66.2%
add-exp-log37.6%
log1p-undefine37.6%
expm1-undefine37.6%
expm1-log1p-u66.2%
associate-/l*66.2%
associate-*r/66.4%
Applied egg-rr66.4%
*-lft-identity66.4%
associate-*r*64.8%
associate-*r/64.7%
associate-*l/64.7%
associate-*r/66.5%
*-commutative66.5%
associate-*l*66.5%
*-commutative66.5%
associate-/l*65.6%
associate-*r*65.6%
Simplified65.6%
*-commutative65.6%
clear-num65.6%
un-div-inv65.6%
associate-*r*65.6%
Applied egg-rr65.6%
*-un-lft-identity65.6%
unpow265.6%
times-frac68.0%
Applied egg-rr68.0%
if -5.79999999999999985e-292 < l Initial program 68.6%
Applied egg-rr71.8%
distribute-rgt1-in80.2%
+-commutative80.2%
associate-*l/84.8%
associate-/l*85.4%
associate-*r*85.4%
associate-*r/85.6%
*-commutative85.6%
associate-/l*84.7%
Simplified84.7%
Final simplification76.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
(let* ((t_0 (* (/ D_m d) (* 0.5 M_m))))
(if (<= l 1.02e+236)
(*
(sqrt (/ d l))
(* (sqrt (/ d h)) (+ 1.0 (/ (* h -0.5) (* (/ 1.0 t_0) (/ l 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 = (D_m / d) * (0.5 * M_m);
double tmp;
if (l <= 1.02e+236) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * -0.5) / ((1.0 / t_0) * (l / t_0)))));
} 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) :: t_0
real(8) :: tmp
t_0 = (d_m / d) * (0.5d0 * m_m)
if (l <= 1.02d+236) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((h * (-0.5d0)) / ((1.0d0 / t_0) * (l / t_0)))))
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 t_0 = (D_m / d) * (0.5 * M_m);
double tmp;
if (l <= 1.02e+236) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h * -0.5) / ((1.0 / t_0) * (l / t_0)))));
} 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): t_0 = (D_m / d) * (0.5 * M_m) tmp = 0 if l <= 1.02e+236: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((h * -0.5) / ((1.0 / t_0) * (l / 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(D_m / d) * Float64(0.5 * M_m)) tmp = 0.0 if (l <= 1.02e+236) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h * -0.5) / Float64(Float64(1.0 / t_0) * Float64(l / t_0)))))); 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)
t_0 = (D_m / d) * (0.5 * M_m);
tmp = 0.0;
if (l <= 1.02e+236)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * -0.5) / ((1.0 / t_0) * (l / t_0)))));
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_] := Block[{t$95$0 = N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * M$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 1.02e+236], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * -0.5), $MachinePrecision] / N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(l / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}
t_0 := \frac{D\_m}{d} \cdot \left(0.5 \cdot M\_m\right)\\
\mathbf{if}\;\ell \leq 1.02 \cdot 10^{+236}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot -0.5}{\frac{1}{t\_0} \cdot \frac{\ell}{t\_0}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < 1.01999999999999993e236Initial program 67.5%
Simplified67.4%
Applied egg-rr67.4%
associate--l+67.4%
associate-*l/69.1%
associate-/l*70.0%
associate-*r*70.0%
associate-*r/70.1%
*-commutative70.1%
associate-/l*70.0%
Simplified70.0%
*-un-lft-identity70.0%
associate-+r-70.0%
add-exp-log38.5%
log1p-undefine38.5%
expm1-undefine38.5%
expm1-log1p-u70.0%
associate-/l*70.0%
associate-*r/70.1%
Applied egg-rr70.1%
*-lft-identity70.1%
associate-*r*69.2%
associate-*r/69.2%
associate-*l/69.2%
associate-*r/70.1%
*-commutative70.1%
associate-*l*70.1%
*-commutative70.1%
associate-/l*70.0%
associate-*r*70.0%
Simplified70.0%
*-commutative70.0%
clear-num70.0%
un-div-inv70.0%
associate-*r*70.0%
Applied egg-rr70.0%
*-un-lft-identity70.0%
unpow270.0%
times-frac71.6%
Applied egg-rr71.6%
if 1.01999999999999993e236 < l Initial program 50.1%
Taylor expanded in d around inf 52.6%
add-cbrt-cube36.4%
pow1/334.4%
add-sqr-sqrt34.4%
pow134.4%
pow1/234.4%
pow-prod-up34.4%
associate-/r*34.4%
metadata-eval34.4%
Applied egg-rr34.4%
pow-pow52.6%
metadata-eval52.6%
pow1/252.6%
sqrt-div79.9%
inv-pow79.9%
sqrt-pow179.9%
metadata-eval79.9%
Applied egg-rr79.9%
Final simplification72.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
(if (<= l 1.3e+46)
(*
(sqrt (* (/ d l) (/ d h)))
(- 1.0 (* h (/ (* 0.5 (pow (* M_m (* 0.5 (/ D_m d))) 2.0)) l))))
(* 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 <= 1.3e+46) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 - (h * ((0.5 * pow((M_m * (0.5 * (D_m / d))), 2.0)) / l)));
} 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 (l <= 1.3d+46) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - (h * ((0.5d0 * ((m_m * (0.5d0 * (d_m / d))) ** 2.0d0)) / l)))
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 (l <= 1.3e+46) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - (h * ((0.5 * Math.pow((M_m * (0.5 * (D_m / d))), 2.0)) / l)));
} 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 l <= 1.3e+46: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - (h * ((0.5 * math.pow((M_m * (0.5 * (D_m / d))), 2.0)) / l))) 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 <= 1.3e+46) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(h * Float64(Float64(0.5 * (Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0)) / l)))); 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 (l <= 1.3e+46)
tmp = sqrt(((d / l) * (d / h))) * (1.0 - (h * ((0.5 * ((M_m * (0.5 * (D_m / d))) ^ 2.0)) / l)));
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[l, 1.3e+46], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(h * N[(N[(0.5 * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $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}\;\ell \leq 1.3 \cdot 10^{+46}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - h \cdot \frac{0.5 \cdot {\left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d}\right)\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot \sqrt{\frac{1}{\ell}}\right)\\
\end{array}
\end{array}
if l < 1.30000000000000007e46Initial program 69.7%
Simplified69.1%
clear-num69.1%
un-div-inv69.8%
frac-times70.4%
associate-/l*69.8%
*-un-lft-identity69.8%
times-frac69.8%
metadata-eval69.8%
Applied egg-rr69.8%
associate-/r/71.8%
associate-*r*71.8%
associate-*r/72.3%
*-commutative72.3%
associate-/l*72.2%
Simplified72.2%
pow172.2%
sqrt-unprod57.5%
associate-*r*57.5%
associate-*r/57.7%
Applied egg-rr57.7%
unpow157.7%
*-commutative57.7%
associate-*r/57.7%
*-commutative57.7%
associate-/l*57.6%
associate-*r*57.6%
Simplified57.6%
if 1.30000000000000007e46 < l Initial program 55.9%
Taylor expanded in d around inf 49.8%
add-cbrt-cube44.4%
pow1/341.9%
add-sqr-sqrt41.9%
pow141.9%
pow1/241.9%
pow-prod-up41.9%
associate-/r*41.9%
metadata-eval41.9%
Applied egg-rr41.9%
pow-pow50.8%
div-inv50.9%
metadata-eval50.9%
unpow-prod-down65.8%
pow1/265.8%
inv-pow65.8%
sqrt-pow165.8%
metadata-eval65.8%
Applied egg-rr65.8%
unpow1/265.8%
Simplified65.8%
Final simplification59.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 -1.45e-139)
(sqrt (/ (pow d 2.0) (* h l)))
(if (<= d -2e-310)
(* d (pow (/ 1.0 (pow (* h l) 3.0)) 0.16666666666666666))
(* 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 <= -1.45e-139) {
tmp = sqrt((pow(d, 2.0) / (h * l)));
} else if (d <= -2e-310) {
tmp = d * pow((1.0 / pow((h * l), 3.0)), 0.16666666666666666);
} 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 <= (-1.45d-139)) then
tmp = sqrt(((d ** 2.0d0) / (h * l)))
else if (d <= (-2d-310)) then
tmp = d * ((1.0d0 / ((h * l) ** 3.0d0)) ** 0.16666666666666666d0)
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 <= -1.45e-139) {
tmp = Math.sqrt((Math.pow(d, 2.0) / (h * l)));
} else if (d <= -2e-310) {
tmp = d * Math.pow((1.0 / Math.pow((h * l), 3.0)), 0.16666666666666666);
} 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 <= -1.45e-139: tmp = math.sqrt((math.pow(d, 2.0) / (h * l))) elif d <= -2e-310: tmp = d * math.pow((1.0 / math.pow((h * l), 3.0)), 0.16666666666666666) 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 <= -1.45e-139) tmp = sqrt(Float64((d ^ 2.0) / Float64(h * l))); elseif (d <= -2e-310) tmp = Float64(d * (Float64(1.0 / (Float64(h * l) ^ 3.0)) ^ 0.16666666666666666)); 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 <= -1.45e-139)
tmp = sqrt(((d ^ 2.0) / (h * l)));
elseif (d <= -2e-310)
tmp = d * ((1.0 / ((h * l) ^ 3.0)) ^ 0.16666666666666666);
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, -1.45e-139], N[Sqrt[N[(N[Power[d, 2.0], $MachinePrecision] / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[d, -2e-310], N[(d * N[Power[N[(1.0 / N[Power[N[(h * l), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision], 0.16666666666666666], $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 -1.45 \cdot 10^{-139}:\\
\;\;\;\;\sqrt{\frac{{d}^{2}}{h \cdot \ell}}\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;d \cdot {\left(\frac{1}{{\left(h \cdot \ell\right)}^{3}}\right)}^{0.16666666666666666}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot \sqrt{\frac{1}{\ell}}\right)\\
\end{array}
\end{array}
if d < -1.4499999999999999e-139Initial program 73.5%
Simplified72.4%
clear-num72.4%
un-div-inv73.5%
frac-times74.6%
associate-/l*73.5%
*-un-lft-identity73.5%
times-frac73.5%
metadata-eval73.5%
Applied egg-rr73.5%
associate-/r/74.8%
associate-*r*74.8%
associate-*r/75.9%
*-commutative75.9%
associate-/l*75.5%
Simplified75.5%
Taylor expanded in d around inf 4.0%
associate-/r*4.0%
unpow1/24.0%
associate-/r*4.0%
rem-exp-log4.0%
exp-neg4.0%
exp-prod4.1%
*-commutative4.1%
distribute-rgt-neg-out4.1%
log-pow4.1%
unpow1/24.1%
rec-exp4.1%
rem-exp-log4.1%
associate-/l*4.1%
*-rgt-identity4.1%
Simplified4.1%
add-sqr-sqrt0.8%
sqrt-unprod31.5%
frac-times31.3%
pow231.3%
add-sqr-sqrt31.4%
*-commutative31.4%
Applied egg-rr31.4%
if -1.4499999999999999e-139 < d < -1.999999999999994e-310Initial program 41.9%
Taylor expanded in d around inf 19.3%
add-cbrt-cube43.1%
pow1/343.1%
pow343.1%
associate-/r*43.1%
Applied egg-rr43.1%
sqrt-pow143.1%
associate-/l/43.1%
cube-div43.1%
metadata-eval43.1%
metadata-eval43.1%
Applied egg-rr43.1%
if -1.999999999999994e-310 < d Initial program 69.1%
Taylor expanded in d around inf 40.6%
add-cbrt-cube35.4%
pow1/333.8%
add-sqr-sqrt33.8%
pow133.8%
pow1/233.8%
pow-prod-up33.8%
associate-/r*33.8%
metadata-eval33.8%
Applied egg-rr33.8%
pow-pow41.1%
div-inv41.1%
metadata-eval41.1%
unpow-prod-down51.0%
pow1/251.0%
inv-pow51.0%
sqrt-pow151.1%
metadata-eval51.1%
Applied egg-rr51.1%
unpow1/251.1%
Simplified51.1%
Final simplification43.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 -7.2e-135)
(sqrt (/ (pow d 2.0) (* h l)))
(if (<= d -2e-310)
(* d (pow (pow (* h l) 2.0) -0.25))
(* 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 <= -7.2e-135) {
tmp = sqrt((pow(d, 2.0) / (h * l)));
} else if (d <= -2e-310) {
tmp = d * pow(pow((h * l), 2.0), -0.25);
} 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 <= (-7.2d-135)) then
tmp = sqrt(((d ** 2.0d0) / (h * l)))
else if (d <= (-2d-310)) then
tmp = d * (((h * l) ** 2.0d0) ** (-0.25d0))
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 <= -7.2e-135) {
tmp = Math.sqrt((Math.pow(d, 2.0) / (h * l)));
} else if (d <= -2e-310) {
tmp = d * Math.pow(Math.pow((h * l), 2.0), -0.25);
} 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 <= -7.2e-135: tmp = math.sqrt((math.pow(d, 2.0) / (h * l))) elif d <= -2e-310: tmp = d * math.pow(math.pow((h * l), 2.0), -0.25) 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 <= -7.2e-135) tmp = sqrt(Float64((d ^ 2.0) / Float64(h * l))); elseif (d <= -2e-310) tmp = Float64(d * ((Float64(h * l) ^ 2.0) ^ -0.25)); 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 <= -7.2e-135)
tmp = sqrt(((d ^ 2.0) / (h * l)));
elseif (d <= -2e-310)
tmp = d * (((h * l) ^ 2.0) ^ -0.25);
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, -7.2e-135], N[Sqrt[N[(N[Power[d, 2.0], $MachinePrecision] / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[d, -2e-310], N[(d * N[Power[N[Power[N[(h * l), $MachinePrecision], 2.0], $MachinePrecision], -0.25], $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 -7.2 \cdot 10^{-135}:\\
\;\;\;\;\sqrt{\frac{{d}^{2}}{h \cdot \ell}}\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;d \cdot {\left({\left(h \cdot \ell\right)}^{2}\right)}^{-0.25}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot \sqrt{\frac{1}{\ell}}\right)\\
\end{array}
\end{array}
if d < -7.19999999999999955e-135Initial program 73.5%
Simplified72.4%
clear-num72.4%
un-div-inv73.5%
frac-times74.6%
associate-/l*73.5%
*-un-lft-identity73.5%
times-frac73.5%
metadata-eval73.5%
Applied egg-rr73.5%
associate-/r/74.8%
associate-*r*74.8%
associate-*r/75.9%
*-commutative75.9%
associate-/l*75.5%
Simplified75.5%
Taylor expanded in d around inf 4.0%
associate-/r*4.0%
unpow1/24.0%
associate-/r*4.0%
rem-exp-log4.0%
exp-neg4.0%
exp-prod4.1%
*-commutative4.1%
distribute-rgt-neg-out4.1%
log-pow4.1%
unpow1/24.1%
rec-exp4.1%
rem-exp-log4.1%
associate-/l*4.1%
*-rgt-identity4.1%
Simplified4.1%
add-sqr-sqrt0.8%
sqrt-unprod31.5%
frac-times31.3%
pow231.3%
add-sqr-sqrt31.4%
*-commutative31.4%
Applied egg-rr31.4%
if -7.19999999999999955e-135 < d < -1.999999999999994e-310Initial program 41.9%
Taylor expanded in d around inf 19.3%
add-cbrt-cube43.1%
pow1/343.1%
pow343.1%
associate-/r*43.1%
Applied egg-rr43.1%
unpow1/343.1%
rem-cbrt-cube19.3%
associate-/l/19.3%
sqrt-div14.0%
metadata-eval14.0%
*-commutative14.0%
sqrt-unprod0.0%
sqrt-unprod14.0%
*-commutative14.0%
pow1/214.0%
pow-flip14.0%
metadata-eval14.0%
sqr-pow14.0%
pow-prod-down27.3%
pow227.3%
metadata-eval27.3%
Applied egg-rr27.3%
if -1.999999999999994e-310 < d Initial program 69.1%
Taylor expanded in d around inf 40.6%
add-cbrt-cube35.4%
pow1/333.8%
add-sqr-sqrt33.8%
pow133.8%
pow1/233.8%
pow-prod-up33.8%
associate-/r*33.8%
metadata-eval33.8%
Applied egg-rr33.8%
pow-pow41.1%
div-inv41.1%
metadata-eval41.1%
unpow-prod-down51.0%
pow1/251.0%
inv-pow51.0%
sqrt-pow151.1%
metadata-eval51.1%
Applied egg-rr51.1%
unpow1/251.1%
Simplified51.1%
Final simplification40.9%
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 -1.62e-142)
(sqrt (/ (pow d 2.0) (* h l)))
(if (<= d -2e-310)
(* d (pow (pow (* h l) 2.0) -0.25))
(* 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 (d <= -1.62e-142) {
tmp = sqrt((pow(d, 2.0) / (h * l)));
} else if (d <= -2e-310) {
tmp = d * pow(pow((h * l), 2.0), -0.25);
} 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 (d <= (-1.62d-142)) then
tmp = sqrt(((d ** 2.0d0) / (h * l)))
else if (d <= (-2d-310)) then
tmp = d * (((h * l) ** 2.0d0) ** (-0.25d0))
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 (d <= -1.62e-142) {
tmp = Math.sqrt((Math.pow(d, 2.0) / (h * l)));
} else if (d <= -2e-310) {
tmp = d * Math.pow(Math.pow((h * l), 2.0), -0.25);
} 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 d <= -1.62e-142: tmp = math.sqrt((math.pow(d, 2.0) / (h * l))) elif d <= -2e-310: tmp = d * math.pow(math.pow((h * l), 2.0), -0.25) 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 (d <= -1.62e-142) tmp = sqrt(Float64((d ^ 2.0) / Float64(h * l))); elseif (d <= -2e-310) tmp = Float64(d * ((Float64(h * l) ^ 2.0) ^ -0.25)); 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 (d <= -1.62e-142)
tmp = sqrt(((d ^ 2.0) / (h * l)));
elseif (d <= -2e-310)
tmp = d * (((h * l) ^ 2.0) ^ -0.25);
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[d, -1.62e-142], N[Sqrt[N[(N[Power[d, 2.0], $MachinePrecision] / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[d, -2e-310], N[(d * N[Power[N[Power[N[(h * l), $MachinePrecision], 2.0], $MachinePrecision], -0.25], $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}\;d \leq -1.62 \cdot 10^{-142}:\\
\;\;\;\;\sqrt{\frac{{d}^{2}}{h \cdot \ell}}\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;d \cdot {\left({\left(h \cdot \ell\right)}^{2}\right)}^{-0.25}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.62e-142Initial program 73.5%
Simplified72.4%
clear-num72.4%
un-div-inv73.5%
frac-times74.6%
associate-/l*73.5%
*-un-lft-identity73.5%
times-frac73.5%
metadata-eval73.5%
Applied egg-rr73.5%
associate-/r/74.8%
associate-*r*74.8%
associate-*r/75.9%
*-commutative75.9%
associate-/l*75.5%
Simplified75.5%
Taylor expanded in d around inf 4.0%
associate-/r*4.0%
unpow1/24.0%
associate-/r*4.0%
rem-exp-log4.0%
exp-neg4.0%
exp-prod4.1%
*-commutative4.1%
distribute-rgt-neg-out4.1%
log-pow4.1%
unpow1/24.1%
rec-exp4.1%
rem-exp-log4.1%
associate-/l*4.1%
*-rgt-identity4.1%
Simplified4.1%
add-sqr-sqrt0.8%
sqrt-unprod31.5%
frac-times31.3%
pow231.3%
add-sqr-sqrt31.4%
*-commutative31.4%
Applied egg-rr31.4%
if -1.62e-142 < d < -1.999999999999994e-310Initial program 41.9%
Taylor expanded in d around inf 19.3%
add-cbrt-cube43.1%
pow1/343.1%
pow343.1%
associate-/r*43.1%
Applied egg-rr43.1%
unpow1/343.1%
rem-cbrt-cube19.3%
associate-/l/19.3%
sqrt-div14.0%
metadata-eval14.0%
*-commutative14.0%
sqrt-unprod0.0%
sqrt-unprod14.0%
*-commutative14.0%
pow1/214.0%
pow-flip14.0%
metadata-eval14.0%
sqr-pow14.0%
pow-prod-down27.3%
pow227.3%
metadata-eval27.3%
Applied egg-rr27.3%
if -1.999999999999994e-310 < d Initial program 69.1%
Taylor expanded in d around inf 40.6%
add-cbrt-cube35.4%
pow1/333.8%
add-sqr-sqrt33.8%
pow133.8%
pow1/233.8%
pow-prod-up33.8%
associate-/r*33.8%
metadata-eval33.8%
Applied egg-rr33.8%
pow-pow41.1%
metadata-eval41.1%
pow1/241.1%
sqrt-div51.0%
inv-pow51.0%
sqrt-pow151.0%
metadata-eval51.0%
Applied egg-rr51.0%
Final simplification40.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
(if (<= d -5.6e-139)
(sqrt (/ (pow d 2.0) (* h l)))
(if (<= d -2e-310)
(* d (pow (pow (* h l) 2.0) -0.25))
(* d (* (pow h -0.5) (pow l -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) {
double tmp;
if (d <= -5.6e-139) {
tmp = sqrt((pow(d, 2.0) / (h * l)));
} else if (d <= -2e-310) {
tmp = d * pow(pow((h * l), 2.0), -0.25);
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
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 <= (-5.6d-139)) then
tmp = sqrt(((d ** 2.0d0) / (h * l)))
else if (d <= (-2d-310)) then
tmp = d * (((h * l) ** 2.0d0) ** (-0.25d0))
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-0.5d0)))
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 <= -5.6e-139) {
tmp = Math.sqrt((Math.pow(d, 2.0) / (h * l)));
} else if (d <= -2e-310) {
tmp = d * Math.pow(Math.pow((h * l), 2.0), -0.25);
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
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 <= -5.6e-139: tmp = math.sqrt((math.pow(d, 2.0) / (h * l))) elif d <= -2e-310: tmp = d * math.pow(math.pow((h * l), 2.0), -0.25) else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -0.5)) 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 <= -5.6e-139) tmp = sqrt(Float64((d ^ 2.0) / Float64(h * l))); elseif (d <= -2e-310) tmp = Float64(d * ((Float64(h * l) ^ 2.0) ^ -0.25)); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); 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 <= -5.6e-139)
tmp = sqrt(((d ^ 2.0) / (h * l)));
elseif (d <= -2e-310)
tmp = d * (((h * l) ^ 2.0) ^ -0.25);
else
tmp = d * ((h ^ -0.5) * (l ^ -0.5));
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, -5.6e-139], N[Sqrt[N[(N[Power[d, 2.0], $MachinePrecision] / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[d, -2e-310], N[(d * N[Power[N[Power[N[(h * l), $MachinePrecision], 2.0], $MachinePrecision], -0.25], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $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 -5.6 \cdot 10^{-139}:\\
\;\;\;\;\sqrt{\frac{{d}^{2}}{h \cdot \ell}}\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;d \cdot {\left({\left(h \cdot \ell\right)}^{2}\right)}^{-0.25}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -5.5999999999999997e-139Initial program 73.5%
Simplified72.4%
clear-num72.4%
un-div-inv73.5%
frac-times74.6%
associate-/l*73.5%
*-un-lft-identity73.5%
times-frac73.5%
metadata-eval73.5%
Applied egg-rr73.5%
associate-/r/74.8%
associate-*r*74.8%
associate-*r/75.9%
*-commutative75.9%
associate-/l*75.5%
Simplified75.5%
Taylor expanded in d around inf 4.0%
associate-/r*4.0%
unpow1/24.0%
associate-/r*4.0%
rem-exp-log4.0%
exp-neg4.0%
exp-prod4.1%
*-commutative4.1%
distribute-rgt-neg-out4.1%
log-pow4.1%
unpow1/24.1%
rec-exp4.1%
rem-exp-log4.1%
associate-/l*4.1%
*-rgt-identity4.1%
Simplified4.1%
add-sqr-sqrt0.8%
sqrt-unprod31.5%
frac-times31.3%
pow231.3%
add-sqr-sqrt31.4%
*-commutative31.4%
Applied egg-rr31.4%
if -5.5999999999999997e-139 < d < -1.999999999999994e-310Initial program 41.9%
Taylor expanded in d around inf 19.3%
add-cbrt-cube43.1%
pow1/343.1%
pow343.1%
associate-/r*43.1%
Applied egg-rr43.1%
unpow1/343.1%
rem-cbrt-cube19.3%
associate-/l/19.3%
sqrt-div14.0%
metadata-eval14.0%
*-commutative14.0%
sqrt-unprod0.0%
sqrt-unprod14.0%
*-commutative14.0%
pow1/214.0%
pow-flip14.0%
metadata-eval14.0%
sqr-pow14.0%
pow-prod-down27.3%
pow227.3%
metadata-eval27.3%
Applied egg-rr27.3%
if -1.999999999999994e-310 < d Initial program 69.1%
Simplified69.6%
clear-num69.6%
un-div-inv69.9%
frac-times69.4%
associate-/l*69.9%
*-un-lft-identity69.9%
times-frac69.9%
metadata-eval69.9%
Applied egg-rr69.9%
associate-/r/72.8%
associate-*r*72.8%
associate-*r/72.2%
*-commutative72.2%
associate-/l*71.5%
Simplified71.5%
Taylor expanded in d around inf 40.6%
associate-/r*41.1%
unpow1/241.1%
associate-/r*40.6%
rem-exp-log38.8%
exp-neg38.8%
exp-prod38.8%
*-commutative38.8%
distribute-rgt-neg-out38.8%
log-pow38.8%
unpow1/238.8%
rec-exp38.8%
rem-exp-log40.6%
associate-/l*40.7%
*-rgt-identity40.7%
Simplified40.7%
div-inv40.6%
metadata-eval40.6%
sqrt-div40.6%
*-commutative40.6%
associate-/l/41.1%
pow1/241.1%
metadata-eval41.1%
pow-pow33.8%
*-commutative33.8%
pow-pow41.1%
metadata-eval41.1%
pow1/241.1%
associate-/l/40.6%
*-commutative40.6%
sqrt-div40.6%
metadata-eval40.6%
pow1/240.6%
pow-flip40.7%
*-commutative40.7%
metadata-eval40.7%
Applied egg-rr40.7%
unpow-prod-down51.0%
Applied egg-rr51.0%
Final simplification40.9%
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 -2.95e-145)
(sqrt (/ (pow d 2.0) (* h l)))
(if (<= d 1.05e-213)
(/ d (cbrt (pow (* h l) 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 (d <= -2.95e-145) {
tmp = sqrt((pow(d, 2.0) / (h * l)));
} else if (d <= 1.05e-213) {
tmp = d / cbrt(pow((h * l), 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 (d <= -2.95e-145) {
tmp = Math.sqrt((Math.pow(d, 2.0) / (h * l)));
} else if (d <= 1.05e-213) {
tmp = d / Math.cbrt(Math.pow((h * l), 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 (d <= -2.95e-145) tmp = sqrt(Float64((d ^ 2.0) / Float64(h * l))); elseif (d <= 1.05e-213) tmp = Float64(d / cbrt((Float64(h * l) ^ 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[d, -2.95e-145], N[Sqrt[N[(N[Power[d, 2.0], $MachinePrecision] / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[d, 1.05e-213], N[(d / N[Power[N[Power[N[(h * l), $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}\;d \leq -2.95 \cdot 10^{-145}:\\
\;\;\;\;\sqrt{\frac{{d}^{2}}{h \cdot \ell}}\\
\mathbf{elif}\;d \leq 1.05 \cdot 10^{-213}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -2.9499999999999999e-145Initial program 72.7%
Simplified71.6%
clear-num71.6%
un-div-inv72.7%
frac-times73.8%
associate-/l*72.7%
*-un-lft-identity72.7%
times-frac72.7%
metadata-eval72.7%
Applied egg-rr72.7%
associate-/r/74.0%
associate-*r*74.0%
associate-*r/75.1%
*-commutative75.1%
associate-/l*74.7%
Simplified74.7%
Taylor expanded in d around inf 4.1%
associate-/r*4.0%
unpow1/24.0%
associate-/r*4.1%
rem-exp-log4.1%
exp-neg4.1%
exp-prod4.1%
*-commutative4.1%
distribute-rgt-neg-out4.1%
log-pow4.1%
unpow1/24.1%
rec-exp4.1%
rem-exp-log4.1%
associate-/l*4.1%
*-rgt-identity4.1%
Simplified4.1%
add-sqr-sqrt0.9%
sqrt-unprod31.2%
frac-times31.0%
pow231.0%
add-sqr-sqrt31.1%
*-commutative31.1%
Applied egg-rr31.1%
if -2.9499999999999999e-145 < d < 1.0499999999999999e-213Initial program 40.6%
Simplified40.5%
clear-num40.5%
un-div-inv40.5%
frac-times40.6%
associate-/l*40.5%
*-un-lft-identity40.5%
times-frac40.5%
metadata-eval40.5%
Applied egg-rr40.5%
associate-/r/40.6%
associate-*r*40.6%
associate-*r/40.8%
*-commutative40.8%
associate-/l*39.4%
Simplified39.4%
Taylor expanded in d around inf 17.6%
associate-/r*17.5%
unpow1/217.5%
associate-/r*17.6%
rem-exp-log17.2%
exp-neg17.2%
exp-prod14.0%
*-commutative14.0%
distribute-rgt-neg-out14.0%
log-pow14.0%
unpow1/214.0%
rec-exp14.0%
rem-exp-log14.3%
associate-/l*14.3%
*-rgt-identity14.3%
Simplified14.3%
add-cbrt-cube20.8%
add-sqr-sqrt20.8%
pow120.8%
pow1/220.8%
pow-prod-up20.8%
*-commutative20.8%
metadata-eval20.8%
Applied egg-rr20.8%
if 1.0499999999999999e-213 < d Initial program 76.3%
Taylor expanded in d around inf 46.5%
add-cbrt-cube40.2%
pow1/338.3%
add-sqr-sqrt38.3%
pow138.3%
pow1/238.3%
pow-prod-up38.3%
associate-/r*38.3%
metadata-eval38.3%
Applied egg-rr38.3%
pow-pow47.1%
metadata-eval47.1%
pow1/247.1%
sqrt-div59.2%
inv-pow59.2%
sqrt-pow159.3%
metadata-eval59.3%
Applied egg-rr59.3%
Final simplification40.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 -5e-311) (sqrt (/ (pow d 2.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 <= -5e-311) {
tmp = sqrt((pow(d, 2.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 <= (-5d-311)) then
tmp = sqrt(((d ** 2.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 <= -5e-311) {
tmp = Math.sqrt((Math.pow(d, 2.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 <= -5e-311: tmp = math.sqrt((math.pow(d, 2.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 <= -5e-311) tmp = sqrt(Float64((d ^ 2.0) / Float64(h * 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 <= -5e-311)
tmp = sqrt(((d ^ 2.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, -5e-311], N[Sqrt[N[(N[Power[d, 2.0], $MachinePrecision] / N[(h * l), $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 -5 \cdot 10^{-311}:\\
\;\;\;\;\sqrt{\frac{{d}^{2}}{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -5.00000000000023e-311Initial program 64.1%
Simplified63.3%
clear-num63.3%
un-div-inv64.1%
frac-times64.9%
associate-/l*64.1%
*-un-lft-identity64.1%
times-frac64.1%
metadata-eval64.1%
Applied egg-rr64.1%
associate-/r/65.0%
associate-*r*65.0%
associate-*r/65.9%
*-commutative65.9%
associate-/l*65.6%
Simplified65.6%
Taylor expanded in d around inf 8.6%
associate-/r*8.6%
unpow1/28.6%
associate-/r*8.6%
rem-exp-log8.6%
exp-neg8.6%
exp-prod7.0%
*-commutative7.0%
distribute-rgt-neg-out7.0%
log-pow7.0%
unpow1/27.0%
rec-exp7.0%
rem-exp-log7.0%
associate-/l*7.0%
*-rgt-identity7.0%
Simplified7.0%
add-sqr-sqrt2.4%
sqrt-unprod25.5%
frac-times25.1%
pow225.1%
add-sqr-sqrt25.2%
*-commutative25.2%
Applied egg-rr25.2%
if -5.00000000000023e-311 < l Initial program 69.1%
Taylor expanded in d around inf 40.6%
sqrt-div40.6%
metadata-eval40.6%
sqrt-unprod50.9%
div-inv50.9%
associate-/r*48.9%
Applied egg-rr48.9%
associate-/l/50.9%
Simplified50.9%
Final simplification38.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 -5e-311) (sqrt (/ (pow d 2.0) (* h l))) (* 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-311) {
tmp = sqrt((pow(d, 2.0) / (h * l)));
} 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-311)) then
tmp = sqrt(((d ** 2.0d0) / (h * l)))
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-311) {
tmp = Math.sqrt((Math.pow(d, 2.0) / (h * l)));
} 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-311: tmp = math.sqrt((math.pow(d, 2.0) / (h * l))) 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-311) tmp = sqrt(Float64((d ^ 2.0) / Float64(h * l))); 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-311)
tmp = sqrt(((d ^ 2.0) / (h * l)));
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-311], N[Sqrt[N[(N[Power[d, 2.0], $MachinePrecision] / N[(h * l), $MachinePrecision]), $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^{-311}:\\
\;\;\;\;\sqrt{\frac{{d}^{2}}{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -5.00000000000023e-311Initial program 64.1%
Simplified63.3%
clear-num63.3%
un-div-inv64.1%
frac-times64.9%
associate-/l*64.1%
*-un-lft-identity64.1%
times-frac64.1%
metadata-eval64.1%
Applied egg-rr64.1%
associate-/r/65.0%
associate-*r*65.0%
associate-*r/65.9%
*-commutative65.9%
associate-/l*65.6%
Simplified65.6%
Taylor expanded in d around inf 8.6%
associate-/r*8.6%
unpow1/28.6%
associate-/r*8.6%
rem-exp-log8.6%
exp-neg8.6%
exp-prod7.0%
*-commutative7.0%
distribute-rgt-neg-out7.0%
log-pow7.0%
unpow1/27.0%
rec-exp7.0%
rem-exp-log7.0%
associate-/l*7.0%
*-rgt-identity7.0%
Simplified7.0%
add-sqr-sqrt2.4%
sqrt-unprod25.5%
frac-times25.1%
pow225.1%
add-sqr-sqrt25.2%
*-commutative25.2%
Applied egg-rr25.2%
if -5.00000000000023e-311 < l Initial program 69.1%
Taylor expanded in d around inf 40.6%
add-cbrt-cube35.4%
pow1/333.8%
add-sqr-sqrt33.8%
pow133.8%
pow1/233.8%
pow-prod-up33.8%
associate-/r*33.8%
metadata-eval33.8%
Applied egg-rr33.8%
pow-pow41.1%
metadata-eval41.1%
pow1/241.1%
sqrt-div51.0%
inv-pow51.0%
sqrt-pow151.0%
metadata-eval51.0%
Applied egg-rr51.0%
Final simplification38.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 (<= h 1.35e-282) (* 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 (h <= 1.35e-282) {
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 (h <= 1.35d-282) 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 (h <= 1.35e-282) {
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 h <= 1.35e-282: 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 (h <= 1.35e-282) tmp = Float64(d * sqrt(Float64(1.0 / Float64(h * 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 (h <= 1.35e-282)
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[h, 1.35e-282], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $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}\;h \leq 1.35 \cdot 10^{-282}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < 1.34999999999999991e-282Initial program 64.3%
Taylor expanded in d around inf 12.0%
if 1.34999999999999991e-282 < h Initial program 69.1%
Taylor expanded in d around inf 38.6%
sqrt-div38.6%
metadata-eval38.6%
sqrt-unprod49.4%
div-inv49.4%
associate-/r*47.3%
Applied egg-rr47.3%
associate-/l/49.4%
Simplified49.4%
Final simplification30.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 (* 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(1.0 / Float64(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[(1.0 / N[(h * 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])\\
\\
d \cdot \sqrt{\frac{1}{h \cdot \ell}}
\end{array}
Initial program 66.7%
Taylor expanded in d around inf 25.0%
Final simplification25.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 (* 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 66.7%
Taylor expanded in d around inf 25.0%
associate-/r*25.2%
Simplified25.2%
Final simplification25.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 (/ d (sqrt (* 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((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((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((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((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(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((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[(h * 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])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Initial program 66.7%
Simplified66.5%
clear-num66.5%
un-div-inv67.1%
frac-times67.2%
associate-/l*67.1%
*-un-lft-identity67.1%
times-frac67.1%
metadata-eval67.1%
Applied egg-rr67.1%
associate-/r/69.0%
associate-*r*69.0%
associate-*r/69.1%
*-commutative69.1%
associate-/l*68.7%
Simplified68.7%
Taylor expanded in d around inf 25.0%
associate-/r*25.2%
unpow1/225.2%
associate-/r*25.0%
rem-exp-log24.0%
exp-neg24.0%
exp-prod23.3%
*-commutative23.3%
distribute-rgt-neg-out23.3%
log-pow23.3%
unpow1/223.3%
rec-exp23.3%
rem-exp-log24.2%
associate-/l*24.3%
*-rgt-identity24.3%
Simplified24.3%
Final simplification24.3%
herbie shell --seed 2024044
(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)))))