
(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 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= h -1e-310)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(*
(sqrt (/ d l))
(+ 1.0 (* (/ h l) (* (pow (/ D (* d (/ 2.0 M_m))) 2.0) -0.5)))))
(*
(/ (sqrt d) (sqrt h))
(*
(* (sqrt d) (sqrt (/ 1.0 l)))
(+ 1.0 (* (/ h l) (* -0.5 (pow (* (/ M_m 2.0) (/ D d)) 2.0))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (h <= -1e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0 + ((h / l) * (pow((D / (d * (2.0 / M_m))), 2.0) * -0.5))));
} else {
tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) * sqrt((1.0 / l))) * (1.0 + ((h / l) * (-0.5 * pow(((M_m / 2.0) * (D / d)), 2.0)))));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (h <= (-1d-310)) then
tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0d0 + ((h / l) * (((d_1 / (d * (2.0d0 / m_m))) ** 2.0d0) * (-0.5d0)))))
else
tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) * sqrt((1.0d0 / l))) * (1.0d0 + ((h / l) * ((-0.5d0) * (((m_m / 2.0d0) * (d_1 / d)) ** 2.0d0)))))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (h <= -1e-310) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * (Math.sqrt((d / l)) * (1.0 + ((h / l) * (Math.pow((D / (d * (2.0 / M_m))), 2.0) * -0.5))));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * ((Math.sqrt(d) * Math.sqrt((1.0 / l))) * (1.0 + ((h / l) * (-0.5 * Math.pow(((M_m / 2.0) * (D / d)), 2.0)))));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if h <= -1e-310: tmp = (math.sqrt(-d) / math.sqrt(-h)) * (math.sqrt((d / l)) * (1.0 + ((h / l) * (math.pow((D / (d * (2.0 / M_m))), 2.0) * -0.5)))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * ((math.sqrt(d) * math.sqrt((1.0 / l))) * (1.0 + ((h / l) * (-0.5 * math.pow(((M_m / 2.0) * (D / d)), 2.0))))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (h <= -1e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D / Float64(d * Float64(2.0 / M_m))) ^ 2.0) * -0.5))))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(Float64(sqrt(d) * sqrt(Float64(1.0 / l))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0)))))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (h <= -1e-310)
tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0 + ((h / l) * (((D / (d * (2.0 / M_m))) ^ 2.0) * -0.5))));
else
tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) * sqrt((1.0 / l))) * (1.0 + ((h / l) * (-0.5 * (((M_m / 2.0) * (D / d)) ^ 2.0)))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[h, -1e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D / N[(d * N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] * N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{D}{d \cdot \frac{2}{M\_m}}\right)}^{2} \cdot -0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\left(\sqrt{d} \cdot \sqrt{\frac{1}{\ell}}\right) \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\\
\end{array}
\end{array}
if h < -9.999999999999969e-311Initial program 71.2%
Simplified71.1%
clear-num71.1%
frac-times70.3%
*-un-lft-identity70.3%
*-commutative70.3%
Applied egg-rr70.3%
frac-2neg70.3%
sqrt-div82.0%
Applied egg-rr82.0%
if -9.999999999999969e-311 < h Initial program 64.6%
Simplified64.7%
pow1/264.7%
div-inv64.6%
unpow-prod-down72.0%
pow1/272.0%
Applied egg-rr72.0%
unpow1/272.0%
Simplified72.0%
sqrt-div79.2%
Applied egg-rr79.2%
Final simplification80.5%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= h -1e-310)
(*
(sqrt (/ d h))
(*
(+ 1.0 (* (/ h l) (* (pow (/ D (* d (/ 2.0 M_m))) 2.0) -0.5)))
(/ (sqrt (- d)) (sqrt (- l)))))
(*
(fma (/ h l) (* -0.5 (pow (* D (/ M_m (* d 2.0))) 2.0)) 1.0)
(/ d (* (sqrt h) (sqrt l))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (h <= -1e-310) {
tmp = sqrt((d / h)) * ((1.0 + ((h / l) * (pow((D / (d * (2.0 / M_m))), 2.0) * -0.5))) * (sqrt(-d) / sqrt(-l)));
} else {
tmp = fma((h / l), (-0.5 * pow((D * (M_m / (d * 2.0))), 2.0)), 1.0) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (h <= -1e-310) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D / Float64(d * Float64(2.0 / M_m))) ^ 2.0) * -0.5))) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))))); else tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(D * Float64(M_m / Float64(d * 2.0))) ^ 2.0)), 1.0) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[h, -1e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D / N[(d * N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{D}{d \cdot \frac{2}{M\_m}}\right)}^{2} \cdot -0.5\right)\right) \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(D \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -9.999999999999969e-311Initial program 71.2%
Simplified71.1%
clear-num71.1%
frac-times70.3%
*-un-lft-identity70.3%
*-commutative70.3%
Applied egg-rr70.3%
frac-2neg70.3%
sqrt-div72.7%
Applied egg-rr72.7%
if -9.999999999999969e-311 < h Initial program 64.6%
Simplified64.7%
Applied egg-rr77.1%
unpow177.1%
*-commutative77.1%
+-commutative77.1%
*-commutative77.1%
associate-*r*77.1%
fma-define77.1%
*-commutative77.1%
/-rgt-identity77.1%
associate-/l*77.1%
metadata-eval77.1%
times-frac77.1%
associate-*r/77.1%
*-commutative77.1%
Simplified77.1%
Final simplification75.1%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l -2e-310)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(*
(sqrt (/ d l))
(+ 1.0 (* (/ h l) (* -0.5 (pow (* (/ M_m 2.0) (/ D d)) 2.0))))))
(*
(fma (/ h l) (* -0.5 (pow (* D (/ M_m (* d 2.0))) 2.0)) 1.0)
(/ d (* (sqrt h) (sqrt l))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -2e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * pow(((M_m / 2.0) * (D / d)), 2.0)))));
} else {
tmp = fma((h / l), (-0.5 * pow((D * (M_m / (d * 2.0))), 2.0)), 1.0) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -2e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0)))))); else tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(D * Float64(M_m / Float64(d * 2.0))) ^ 2.0)), 1.0) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -2e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(D \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.999999999999994e-310Initial program 71.2%
Simplified71.1%
frac-2neg70.3%
sqrt-div82.0%
Applied egg-rr83.1%
if -1.999999999999994e-310 < l Initial program 64.6%
Simplified64.7%
Applied egg-rr77.1%
unpow177.1%
*-commutative77.1%
+-commutative77.1%
*-commutative77.1%
associate-*r*77.1%
fma-define77.1%
*-commutative77.1%
/-rgt-identity77.1%
associate-/l*77.1%
metadata-eval77.1%
times-frac77.1%
associate-*r/77.1%
*-commutative77.1%
Simplified77.1%
Final simplification79.8%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= h -1e-310)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(*
(sqrt (/ d l))
(+ 1.0 (* (/ h l) (* (pow (/ D (* d (/ 2.0 M_m))) 2.0) -0.5)))))
(*
(fma (/ h l) (* -0.5 (pow (* D (/ M_m (* d 2.0))) 2.0)) 1.0)
(/ d (* (sqrt h) (sqrt l))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (h <= -1e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0 + ((h / l) * (pow((D / (d * (2.0 / M_m))), 2.0) * -0.5))));
} else {
tmp = fma((h / l), (-0.5 * pow((D * (M_m / (d * 2.0))), 2.0)), 1.0) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (h <= -1e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D / Float64(d * Float64(2.0 / M_m))) ^ 2.0) * -0.5))))); else tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(D * Float64(M_m / Float64(d * 2.0))) ^ 2.0)), 1.0) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[h, -1e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D / N[(d * N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{D}{d \cdot \frac{2}{M\_m}}\right)}^{2} \cdot -0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(D \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -9.999999999999969e-311Initial program 71.2%
Simplified71.1%
clear-num71.1%
frac-times70.3%
*-un-lft-identity70.3%
*-commutative70.3%
Applied egg-rr70.3%
frac-2neg70.3%
sqrt-div82.0%
Applied egg-rr82.0%
if -9.999999999999969e-311 < h Initial program 64.6%
Simplified64.7%
Applied egg-rr77.1%
unpow177.1%
*-commutative77.1%
+-commutative77.1%
*-commutative77.1%
associate-*r*77.1%
fma-define77.1%
*-commutative77.1%
/-rgt-identity77.1%
associate-/l*77.1%
metadata-eval77.1%
times-frac77.1%
associate-*r/77.1%
*-commutative77.1%
Simplified77.1%
Final simplification79.4%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= h -1e-310)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (* 0.5 (pow (* (* (/ D d) (* M_m 0.5)) (sqrt (/ h l))) 2.0))))
(*
(fma (/ h l) (* -0.5 (pow (* D (/ M_m (* d 2.0))) 2.0)) 1.0)
(/ d (* (sqrt h) (sqrt l))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (h <= -1e-310) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * pow((((D / d) * (M_m * 0.5)) * sqrt((h / l))), 2.0)));
} else {
tmp = fma((h / l), (-0.5 * pow((D * (M_m / (d * 2.0))), 2.0)), 1.0) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (h <= -1e-310) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(0.5 * (Float64(Float64(Float64(D / d) * Float64(M_m * 0.5)) * sqrt(Float64(h / l))) ^ 2.0)))); else tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(D * Float64(M_m / Float64(d * 2.0))) ^ 2.0)), 1.0) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[h, -1e-310], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(D \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -9.999999999999969e-311Initial program 71.2%
Simplified71.1%
add-sqr-sqrt71.1%
pow271.1%
sqrt-prod71.1%
sqrt-pow173.5%
metadata-eval73.5%
pow173.5%
div-inv73.5%
metadata-eval73.5%
Applied egg-rr73.5%
if -9.999999999999969e-311 < h Initial program 64.6%
Simplified64.7%
Applied egg-rr77.1%
unpow177.1%
*-commutative77.1%
+-commutative77.1%
*-commutative77.1%
associate-*r*77.1%
fma-define77.1%
*-commutative77.1%
/-rgt-identity77.1%
associate-/l*77.1%
metadata-eval77.1%
times-frac77.1%
associate-*r/77.1%
*-commutative77.1%
Simplified77.1%
Final simplification75.4%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= h -1e-310)
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* D M_m) (* d 2.0)) 2.0)))))
(*
(fma (/ h l) (* -0.5 (pow (* D (/ M_m (* d 2.0))) 2.0)) 1.0)
(/ d (* (sqrt h) (sqrt l))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (h <= -1e-310) {
tmp = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((D * M_m) / (d * 2.0)), 2.0))));
} else {
tmp = fma((h / l), (-0.5 * pow((D * (M_m / (d * 2.0))), 2.0)), 1.0) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (h <= -1e-310) tmp = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(D * M_m) / Float64(d * 2.0)) ^ 2.0))))); else tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(D * Float64(M_m / Float64(d * 2.0))) ^ 2.0)), 1.0) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[h, -1e-310], N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(D * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{D \cdot M\_m}{d \cdot 2}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(D \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -9.999999999999969e-311Initial program 71.2%
if -9.999999999999969e-311 < h Initial program 64.6%
Simplified64.7%
Applied egg-rr77.1%
unpow177.1%
*-commutative77.1%
+-commutative77.1%
*-commutative77.1%
associate-*r*77.1%
fma-define77.1%
*-commutative77.1%
/-rgt-identity77.1%
associate-/l*77.1%
metadata-eval77.1%
times-frac77.1%
associate-*r/77.1%
*-commutative77.1%
Simplified77.1%
Final simplification74.4%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l -4.3e+191)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= l -1.9e-17)
(* d (- (sqrt (/ 1.0 (* h l)))))
(if (<= l 5.5e-303)
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (/ (* -0.5 (pow (* (/ D d) (* M_m 0.5)) 2.0)) (/ l h))))
(if (<= l 5.2e+147)
(*
(fma (pow (* D (/ M_m (* d 2.0))) 2.0) (/ (* h -0.5) l) 1.0)
(/ d (sqrt (* h l))))
(/ d (* (sqrt h) (sqrt l))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -4.3e+191) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (l <= -1.9e-17) {
tmp = d * -sqrt((1.0 / (h * l)));
} else if (l <= 5.5e-303) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + ((-0.5 * pow(((D / d) * (M_m * 0.5)), 2.0)) / (l / h)));
} else if (l <= 5.2e+147) {
tmp = fma(pow((D * (M_m / (d * 2.0))), 2.0), ((h * -0.5) / l), 1.0) * (d / sqrt((h * l)));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -4.3e+191) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (l <= -1.9e-17) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l))))); elseif (l <= 5.5e-303) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(Float64(-0.5 * (Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0)) / Float64(l / h)))); elseif (l <= 5.2e+147) tmp = Float64(fma((Float64(D * Float64(M_m / Float64(d * 2.0))) ^ 2.0), Float64(Float64(h * -0.5) / l), 1.0) * Float64(d / sqrt(Float64(h * l)))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -4.3e+191], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1.9e-17], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 5.5e-303], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(-0.5 * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.2e+147], N[(N[(N[Power[N[(D * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h * -0.5), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[Sqrt[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, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.3 \cdot 10^{+191}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;\ell \leq -1.9 \cdot 10^{-17}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{elif}\;\ell \leq 5.5 \cdot 10^{-303}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + \frac{-0.5 \cdot {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}}{\frac{\ell}{h}}\right)\\
\mathbf{elif}\;\ell \leq 5.2 \cdot 10^{+147}:\\
\;\;\;\;\mathsf{fma}\left({\left(D \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}, \frac{h \cdot -0.5}{\ell}, 1\right) \cdot \frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.2999999999999998e191Initial program 69.7%
Simplified69.7%
pow1/269.7%
div-inv69.7%
unpow-prod-down0.0%
pow1/20.0%
Applied egg-rr0.0%
unpow1/20.0%
Simplified0.0%
Taylor expanded in h around 0 62.8%
if -4.2999999999999998e191 < l < -1.9000000000000001e-17Initial program 61.5%
Simplified64.1%
add-sqr-sqrt64.1%
pow264.1%
sqrt-prod64.0%
sqrt-pow166.8%
metadata-eval66.8%
pow166.8%
div-inv66.8%
metadata-eval66.8%
Applied egg-rr66.8%
clear-num66.8%
sqrt-div66.9%
metadata-eval66.9%
Applied egg-rr66.9%
Taylor expanded in d around -inf 54.4%
mul-1-neg54.4%
Simplified54.4%
if -1.9000000000000001e-17 < l < 5.50000000000000018e-303Initial program 78.6%
Simplified76.9%
associate-*r/80.3%
div-inv80.3%
metadata-eval80.3%
Applied egg-rr80.3%
sqrt-div3.4%
Applied egg-rr3.4%
pow13.4%
sqrt-div80.3%
pow1/280.3%
pow1/280.3%
pow-prod-down75.5%
cancel-sign-sub-inv75.5%
metadata-eval75.5%
associate-/l*72.1%
*-commutative72.1%
Applied egg-rr72.1%
unpow172.1%
rem-log-exp70.6%
rem-log-exp72.1%
associate-/r/75.5%
associate-*l/75.5%
associate-*r/72.1%
*-commutative72.1%
unpow1/272.1%
*-commutative72.1%
Simplified72.1%
if 5.50000000000000018e-303 < l < 5.1999999999999997e147Initial program 71.7%
Simplified71.7%
Applied egg-rr82.5%
unpow182.5%
*-commutative82.5%
+-commutative82.5%
*-commutative82.5%
associate-*r*82.5%
fma-define82.5%
*-commutative82.5%
/-rgt-identity82.5%
associate-/l*82.5%
metadata-eval82.5%
times-frac82.4%
associate-*r/83.5%
*-commutative83.5%
Simplified83.5%
associate-*r/84.7%
associate-*r/83.6%
*-commutative83.6%
sqrt-unprod77.2%
Applied egg-rr77.2%
associate-*r/76.0%
rem-exp-log73.6%
fma-define73.6%
*-commutative73.6%
associate-*l*73.6%
fma-define73.6%
*-commutative73.6%
associate-*l/74.7%
*-commutative74.7%
*-commutative74.7%
associate-*r/74.7%
rem-exp-log77.2%
*-commutative77.2%
Simplified77.2%
if 5.1999999999999997e147 < l Initial program 49.3%
Simplified49.3%
Applied egg-rr65.7%
unpow165.7%
*-commutative65.7%
+-commutative65.7%
*-commutative65.7%
associate-*r*65.7%
fma-define65.7%
*-commutative65.7%
/-rgt-identity65.7%
associate-/l*65.7%
metadata-eval65.7%
times-frac65.6%
associate-*r/63.5%
*-commutative63.5%
Simplified63.5%
Taylor expanded in h around 0 66.0%
Final simplification69.4%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l -1.95e+191)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= l -2.8e-16)
(* d (- (sqrt (/ 1.0 (* h l)))))
(if (<= l 2.35e-303)
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (/ (* -0.5 (pow (* (/ D d) (* M_m 0.5)) 2.0)) (/ l h))))
(if (<= l 3.9e+117)
(/
(* d (fma (/ h l) (* -0.5 (pow (/ (* D M_m) (* d 2.0)) 2.0)) 1.0))
(sqrt (* h l)))
(* d (/ (pow l -0.5) (sqrt h))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -1.95e+191) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (l <= -2.8e-16) {
tmp = d * -sqrt((1.0 / (h * l)));
} else if (l <= 2.35e-303) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + ((-0.5 * pow(((D / d) * (M_m * 0.5)), 2.0)) / (l / h)));
} else if (l <= 3.9e+117) {
tmp = (d * fma((h / l), (-0.5 * pow(((D * M_m) / (d * 2.0)), 2.0)), 1.0)) / sqrt((h * l));
} else {
tmp = d * (pow(l, -0.5) / sqrt(h));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -1.95e+191) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (l <= -2.8e-16) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l))))); elseif (l <= 2.35e-303) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(Float64(-0.5 * (Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0)) / Float64(l / h)))); elseif (l <= 3.9e+117) tmp = Float64(Float64(d * fma(Float64(h / l), Float64(-0.5 * (Float64(Float64(D * M_m) / Float64(d * 2.0)) ^ 2.0)), 1.0)) / sqrt(Float64(h * l))); else tmp = Float64(d * Float64((l ^ -0.5) / sqrt(h))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -1.95e+191], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2.8e-16], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 2.35e-303], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(-0.5 * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.9e+117], N[(N[(d * N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(D * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.95 \cdot 10^{+191}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;\ell \leq -2.8 \cdot 10^{-16}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{elif}\;\ell \leq 2.35 \cdot 10^{-303}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + \frac{-0.5 \cdot {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}}{\frac{\ell}{h}}\right)\\
\mathbf{elif}\;\ell \leq 3.9 \cdot 10^{+117}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(\frac{D \cdot M\_m}{d \cdot 2}\right)}^{2}, 1\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{\ell}^{-0.5}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -1.95e191Initial program 69.7%
Simplified69.7%
pow1/269.7%
div-inv69.7%
unpow-prod-down0.0%
pow1/20.0%
Applied egg-rr0.0%
unpow1/20.0%
Simplified0.0%
Taylor expanded in h around 0 62.8%
if -1.95e191 < l < -2.8000000000000001e-16Initial program 61.5%
Simplified64.1%
add-sqr-sqrt64.1%
pow264.1%
sqrt-prod64.0%
sqrt-pow166.8%
metadata-eval66.8%
pow166.8%
div-inv66.8%
metadata-eval66.8%
Applied egg-rr66.8%
clear-num66.8%
sqrt-div66.9%
metadata-eval66.9%
Applied egg-rr66.9%
Taylor expanded in d around -inf 54.4%
mul-1-neg54.4%
Simplified54.4%
if -2.8000000000000001e-16 < l < 2.3499999999999999e-303Initial program 78.6%
Simplified76.9%
associate-*r/80.3%
div-inv80.3%
metadata-eval80.3%
Applied egg-rr80.3%
sqrt-div3.4%
Applied egg-rr3.4%
pow13.4%
sqrt-div80.3%
pow1/280.3%
pow1/280.3%
pow-prod-down75.5%
cancel-sign-sub-inv75.5%
metadata-eval75.5%
associate-/l*72.1%
*-commutative72.1%
Applied egg-rr72.1%
unpow172.1%
rem-log-exp70.6%
rem-log-exp72.1%
associate-/r/75.5%
associate-*l/75.5%
associate-*r/72.1%
*-commutative72.1%
unpow1/272.1%
*-commutative72.1%
Simplified72.1%
if 2.3499999999999999e-303 < l < 3.8999999999999999e117Initial program 74.3%
Simplified73.2%
Applied egg-rr83.5%
unpow183.5%
*-commutative83.5%
+-commutative83.5%
*-commutative83.5%
associate-*r*83.5%
fma-define83.5%
*-commutative83.5%
/-rgt-identity83.5%
associate-/l*83.5%
metadata-eval83.5%
times-frac84.6%
associate-*r/84.6%
*-commutative84.6%
Simplified84.6%
associate-*r/85.9%
associate-*r/85.9%
*-commutative85.9%
sqrt-unprod81.4%
Applied egg-rr81.4%
if 3.8999999999999999e117 < l Initial program 47.7%
Simplified49.6%
Taylor expanded in d around inf 47.8%
*-commutative47.8%
associate-/r*49.0%
Simplified49.0%
*-un-lft-identity49.0%
sqrt-div62.3%
pow1/262.3%
inv-pow62.3%
pow-pow62.3%
metadata-eval62.3%
Applied egg-rr62.3%
*-lft-identity62.3%
Simplified62.3%
Final simplification69.8%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= d -1.1e+260)
(* d (- (sqrt (/ 1.0 (* h l)))))
(if (<= d -9.6e-288)
(*
(fma (/ h l) (* -0.5 (pow (* M_m (/ (* D 0.5) d)) 2.0)) 1.0)
(sqrt (* (/ d l) (/ d h))))
(*
(/ d (* (sqrt h) (sqrt l)))
(+ 1.0 (* (/ h l) (* -0.5 (pow (/ (* D M_m) (* d 2.0)) 2.0))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -1.1e+260) {
tmp = d * -sqrt((1.0 / (h * l)));
} else if (d <= -9.6e-288) {
tmp = fma((h / l), (-0.5 * pow((M_m * ((D * 0.5) / d)), 2.0)), 1.0) * sqrt(((d / l) * (d / h)));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + ((h / l) * (-0.5 * pow(((D * M_m) / (d * 2.0)), 2.0))));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (d <= -1.1e+260) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l))))); elseif (d <= -9.6e-288) tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(M_m * Float64(Float64(D * 0.5) / d)) ^ 2.0)), 1.0) * sqrt(Float64(Float64(d / l) * Float64(d / h)))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(D * M_m) / Float64(d * 2.0)) ^ 2.0))))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -1.1e+260], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -9.6e-288], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(M$95$m * N[(N[(D * 0.5), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(D * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.1 \cdot 10^{+260}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{elif}\;d \leq -9.6 \cdot 10^{-288}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(M\_m \cdot \frac{D \cdot 0.5}{d}\right)}^{2}, 1\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{D \cdot M\_m}{d \cdot 2}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if d < -1.10000000000000006e260Initial program 60.5%
Simplified59.7%
add-sqr-sqrt59.7%
pow259.7%
sqrt-prod59.6%
sqrt-pow159.6%
metadata-eval59.6%
pow159.6%
div-inv59.6%
metadata-eval59.6%
Applied egg-rr59.6%
clear-num59.8%
sqrt-div59.7%
metadata-eval59.7%
Applied egg-rr59.7%
Taylor expanded in d around -inf 83.4%
mul-1-neg83.4%
Simplified83.4%
if -1.10000000000000006e260 < d < -9.5999999999999994e-288Initial program 74.5%
Simplified74.5%
add-sqr-sqrt74.5%
pow274.5%
sqrt-prod74.5%
sqrt-pow177.3%
metadata-eval77.3%
pow177.3%
div-inv77.3%
metadata-eval77.3%
Applied egg-rr77.3%
pow177.3%
Applied egg-rr66.2%
unpow166.2%
*-commutative66.2%
+-commutative66.2%
*-commutative66.2%
associate-*r*66.2%
fma-undefine66.2%
*-commutative66.2%
associate-*r/66.2%
Simplified66.2%
if -9.5999999999999994e-288 < d Initial program 63.3%
Simplified63.3%
Applied egg-rr75.5%
unpow175.5%
*-commutative75.5%
+-commutative75.5%
*-commutative75.5%
associate-*r*75.5%
fma-define75.5%
*-commutative75.5%
/-rgt-identity75.5%
associate-/l*75.5%
metadata-eval75.5%
times-frac75.4%
associate-*r/75.4%
*-commutative75.4%
Simplified75.4%
fma-undefine75.4%
associate-*r/75.4%
*-commutative75.4%
Applied egg-rr75.4%
Final simplification72.1%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (pow (/ (* D M_m) (* d 2.0)) 2.0)))
(if (<= h -1e-310)
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 t_0))))
(* (/ d (* (sqrt h) (sqrt l))) (+ 1.0 (* (/ h l) (* -0.5 t_0)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = pow(((D * M_m) / (d * 2.0)), 2.0);
double tmp;
if (h <= -1e-310) {
tmp = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * t_0)));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + ((h / l) * (-0.5 * t_0)));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = ((d_1 * m_m) / (d * 2.0d0)) ** 2.0d0
if (h <= (-1d-310)) then
tmp = (((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((h / l) * (0.5d0 * t_0)))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + ((h / l) * ((-0.5d0) * t_0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.pow(((D * M_m) / (d * 2.0)), 2.0);
double tmp;
if (h <= -1e-310) {
tmp = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * t_0)));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + ((h / l) * (-0.5 * t_0)));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.pow(((D * M_m) / (d * 2.0)), 2.0) tmp = 0 if h <= -1e-310: tmp = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * t_0))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + ((h / l) * (-0.5 * t_0))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(Float64(D * M_m) / Float64(d * 2.0)) ^ 2.0 tmp = 0.0 if (h <= -1e-310) tmp = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * t_0)))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * t_0)))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = ((D * M_m) / (d * 2.0)) ^ 2.0;
tmp = 0.0;
if (h <= -1e-310)
tmp = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * t_0)));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + ((h / l) * (-0.5 * t_0)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Power[N[(N[(D * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[h, -1e-310], N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{D \cdot M\_m}{d \cdot 2}\right)}^{2}\\
\mathbf{if}\;h \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot t\_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot t\_0\right)\right)\\
\end{array}
\end{array}
if h < -9.999999999999969e-311Initial program 71.2%
if -9.999999999999969e-311 < h Initial program 64.6%
Simplified64.7%
Applied egg-rr77.1%
unpow177.1%
*-commutative77.1%
+-commutative77.1%
*-commutative77.1%
associate-*r*77.1%
fma-define77.1%
*-commutative77.1%
/-rgt-identity77.1%
associate-/l*77.1%
metadata-eval77.1%
times-frac77.1%
associate-*r/77.1%
*-commutative77.1%
Simplified77.1%
fma-undefine77.1%
associate-*r/77.1%
*-commutative77.1%
Applied egg-rr77.1%
Final simplification74.4%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l 2.35e-303)
(*
(*
(sqrt (/ d l))
(+ 1.0 (* (/ h l) (* -0.5 (pow (* (/ M_m 2.0) (/ D d)) 2.0)))))
(sqrt (/ d h)))
(*
(/ d (* (sqrt h) (sqrt l)))
(+ 1.0 (* (/ h l) (* -0.5 (pow (/ (* D M_m) (* d 2.0)) 2.0)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= 2.35e-303) {
tmp = (sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * pow(((M_m / 2.0) * (D / d)), 2.0))))) * sqrt((d / h));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + ((h / l) * (-0.5 * pow(((D * M_m) / (d * 2.0)), 2.0))));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= 2.35d-303) then
tmp = (sqrt((d / l)) * (1.0d0 + ((h / l) * ((-0.5d0) * (((m_m / 2.0d0) * (d_1 / d)) ** 2.0d0))))) * sqrt((d / h))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + ((h / l) * ((-0.5d0) * (((d_1 * m_m) / (d * 2.0d0)) ** 2.0d0))))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= 2.35e-303) {
tmp = (Math.sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * Math.pow(((M_m / 2.0) * (D / d)), 2.0))))) * Math.sqrt((d / h));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + ((h / l) * (-0.5 * Math.pow(((D * M_m) / (d * 2.0)), 2.0))));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= 2.35e-303: tmp = (math.sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * math.pow(((M_m / 2.0) * (D / d)), 2.0))))) * math.sqrt((d / h)) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + ((h / l) * (-0.5 * math.pow(((D * M_m) / (d * 2.0)), 2.0)))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= 2.35e-303) tmp = Float64(Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0))))) * sqrt(Float64(d / h))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(D * M_m) / Float64(d * 2.0)) ^ 2.0))))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= 2.35e-303)
tmp = (sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * (((M_m / 2.0) * (D / d)) ^ 2.0))))) * sqrt((d / h));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + ((h / l) * (-0.5 * (((D * M_m) / (d * 2.0)) ^ 2.0))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, 2.35e-303], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(D * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.35 \cdot 10^{-303}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{D \cdot M\_m}{d \cdot 2}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if l < 2.3499999999999999e-303Initial program 71.7%
Simplified71.6%
if 2.3499999999999999e-303 < l Initial program 64.1%
Simplified64.2%
Applied egg-rr76.8%
unpow176.8%
*-commutative76.8%
+-commutative76.8%
*-commutative76.8%
associate-*r*76.8%
fma-define76.8%
*-commutative76.8%
/-rgt-identity76.8%
associate-/l*76.8%
metadata-eval76.8%
times-frac76.7%
associate-*r/76.8%
*-commutative76.8%
Simplified76.8%
fma-undefine76.8%
associate-*r/76.7%
*-commutative76.7%
Applied egg-rr76.7%
Final simplification74.3%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= h -1e-310)
(*
(*
(sqrt (/ d l))
(+ 1.0 (* (/ h l) (* (pow (/ D (* d (/ 2.0 M_m))) 2.0) -0.5))))
(sqrt (/ d h)))
(*
(/ d (* (sqrt h) (sqrt l)))
(+ 1.0 (* (/ h l) (* -0.5 (pow (/ (* D M_m) (* d 2.0)) 2.0)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (h <= -1e-310) {
tmp = (sqrt((d / l)) * (1.0 + ((h / l) * (pow((D / (d * (2.0 / M_m))), 2.0) * -0.5)))) * sqrt((d / h));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + ((h / l) * (-0.5 * pow(((D * M_m) / (d * 2.0)), 2.0))));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (h <= (-1d-310)) then
tmp = (sqrt((d / l)) * (1.0d0 + ((h / l) * (((d_1 / (d * (2.0d0 / m_m))) ** 2.0d0) * (-0.5d0))))) * sqrt((d / h))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + ((h / l) * ((-0.5d0) * (((d_1 * m_m) / (d * 2.0d0)) ** 2.0d0))))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (h <= -1e-310) {
tmp = (Math.sqrt((d / l)) * (1.0 + ((h / l) * (Math.pow((D / (d * (2.0 / M_m))), 2.0) * -0.5)))) * Math.sqrt((d / h));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + ((h / l) * (-0.5 * Math.pow(((D * M_m) / (d * 2.0)), 2.0))));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if h <= -1e-310: tmp = (math.sqrt((d / l)) * (1.0 + ((h / l) * (math.pow((D / (d * (2.0 / M_m))), 2.0) * -0.5)))) * math.sqrt((d / h)) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + ((h / l) * (-0.5 * math.pow(((D * M_m) / (d * 2.0)), 2.0)))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (h <= -1e-310) tmp = Float64(Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D / Float64(d * Float64(2.0 / M_m))) ^ 2.0) * -0.5)))) * sqrt(Float64(d / h))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(D * M_m) / Float64(d * 2.0)) ^ 2.0))))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (h <= -1e-310)
tmp = (sqrt((d / l)) * (1.0 + ((h / l) * (((D / (d * (2.0 / M_m))) ^ 2.0) * -0.5)))) * sqrt((d / h));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + ((h / l) * (-0.5 * (((D * M_m) / (d * 2.0)) ^ 2.0))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[h, -1e-310], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D / N[(d * N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(D * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{D}{d \cdot \frac{2}{M\_m}}\right)}^{2} \cdot -0.5\right)\right)\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{D \cdot M\_m}{d \cdot 2}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if h < -9.999999999999969e-311Initial program 71.2%
Simplified71.1%
clear-num71.1%
frac-times70.3%
*-un-lft-identity70.3%
*-commutative70.3%
Applied egg-rr70.3%
if -9.999999999999969e-311 < h Initial program 64.6%
Simplified64.7%
Applied egg-rr77.1%
unpow177.1%
*-commutative77.1%
+-commutative77.1%
*-commutative77.1%
associate-*r*77.1%
fma-define77.1%
*-commutative77.1%
/-rgt-identity77.1%
associate-/l*77.1%
metadata-eval77.1%
times-frac77.1%
associate-*r/77.1%
*-commutative77.1%
Simplified77.1%
fma-undefine77.1%
associate-*r/77.1%
*-commutative77.1%
Applied egg-rr77.1%
Final simplification73.9%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= D 2.45e-14)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (/ (* -0.5 (pow (* (/ D d) (* M_m 0.5)) 2.0)) (/ l h))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (D <= 2.45e-14) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + ((-0.5 * pow(((D / d) * (M_m * 0.5)), 2.0)) / (l / h)));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d_1 <= 2.45d-14) then
tmp = sqrt((d / l)) * sqrt((d / h))
else
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + (((-0.5d0) * (((d_1 / d) * (m_m * 0.5d0)) ** 2.0d0)) / (l / h)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (D <= 2.45e-14) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + ((-0.5 * Math.pow(((D / d) * (M_m * 0.5)), 2.0)) / (l / h)));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if D <= 2.45e-14: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) else: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + ((-0.5 * math.pow(((D / d) * (M_m * 0.5)), 2.0)) / (l / h))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (D <= 2.45e-14) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); else tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(Float64(-0.5 * (Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0)) / Float64(l / h)))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (D <= 2.45e-14)
tmp = sqrt((d / l)) * sqrt((d / h));
else
tmp = sqrt(((d / l) * (d / h))) * (1.0 + ((-0.5 * (((D / d) * (M_m * 0.5)) ^ 2.0)) / (l / h)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[D, 2.45e-14], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(-0.5 * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;D \leq 2.45 \cdot 10^{-14}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + \frac{-0.5 \cdot {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}}{\frac{\ell}{h}}\right)\\
\end{array}
\end{array}
if D < 2.44999999999999997e-14Initial program 67.8%
Simplified67.3%
pow1/267.3%
div-inv67.3%
unpow-prod-down41.8%
pow1/241.8%
Applied egg-rr41.8%
unpow1/241.8%
Simplified41.8%
Taylor expanded in h around 0 45.4%
if 2.44999999999999997e-14 < D Initial program 67.3%
Simplified68.5%
associate-*r/67.3%
div-inv67.3%
metadata-eval67.3%
Applied egg-rr67.3%
sqrt-div34.2%
Applied egg-rr30.1%
pow130.1%
sqrt-div67.3%
pow1/267.3%
pow1/267.3%
pow-prod-down62.0%
cancel-sign-sub-inv62.0%
metadata-eval62.0%
associate-/l*63.1%
*-commutative63.1%
Applied egg-rr63.1%
unpow163.1%
rem-log-exp60.6%
rem-log-exp63.1%
associate-/r/64.5%
associate-*l/62.0%
associate-*r/63.2%
*-commutative63.2%
unpow1/263.2%
*-commutative63.2%
Simplified63.1%
Final simplification50.5%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l -7e+198)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= l 1.75e-169)
(* d (- (pow (* h l) -0.5)))
(* d (/ (pow l -0.5) (sqrt h))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -7e+198) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (l <= 1.75e-169) {
tmp = d * -pow((h * l), -0.5);
} else {
tmp = d * (pow(l, -0.5) / sqrt(h));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-7d+198)) then
tmp = sqrt((d / l)) * sqrt((d / h))
else if (l <= 1.75d-169) then
tmp = d * -((h * l) ** (-0.5d0))
else
tmp = d * ((l ** (-0.5d0)) / sqrt(h))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -7e+198) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (l <= 1.75e-169) {
tmp = d * -Math.pow((h * l), -0.5);
} else {
tmp = d * (Math.pow(l, -0.5) / Math.sqrt(h));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -7e+198: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif l <= 1.75e-169: tmp = d * -math.pow((h * l), -0.5) else: tmp = d * (math.pow(l, -0.5) / math.sqrt(h)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -7e+198) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (l <= 1.75e-169) tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5))); else tmp = Float64(d * Float64((l ^ -0.5) / sqrt(h))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= -7e+198)
tmp = sqrt((d / l)) * sqrt((d / h));
elseif (l <= 1.75e-169)
tmp = d * -((h * l) ^ -0.5);
else
tmp = d * ((l ^ -0.5) / sqrt(h));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -7e+198], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.75e-169], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -7 \cdot 10^{+198}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;\ell \leq 1.75 \cdot 10^{-169}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{\ell}^{-0.5}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -7.00000000000000026e198Initial program 72.5%
Simplified72.5%
pow1/272.5%
div-inv72.5%
unpow-prod-down0.0%
pow1/20.0%
Applied egg-rr0.0%
unpow1/20.0%
Simplified0.0%
Taylor expanded in h around 0 65.2%
if -7.00000000000000026e198 < l < 1.7500000000000001e-169Initial program 72.4%
Simplified72.3%
add-sqr-sqrt72.3%
pow272.3%
sqrt-prod72.3%
sqrt-pow174.6%
metadata-eval74.6%
pow174.6%
div-inv74.6%
metadata-eval74.6%
Applied egg-rr74.6%
clear-num74.6%
sqrt-div74.6%
metadata-eval74.6%
Applied egg-rr74.6%
Taylor expanded in d around -inf 46.3%
associate-*r*46.3%
mul-1-neg46.3%
*-commutative46.3%
rem-exp-log44.8%
rec-exp44.8%
unpow1/244.8%
exp-prod45.9%
*-commutative45.9%
distribute-rgt-neg-out45.9%
distribute-lft-neg-in45.9%
metadata-eval45.9%
*-commutative45.9%
exp-to-pow47.5%
*-commutative47.5%
Simplified47.5%
if 1.7500000000000001e-169 < l Initial program 61.2%
Simplified61.3%
Taylor expanded in d around inf 47.7%
*-commutative47.7%
associate-/r*48.2%
Simplified48.2%
*-un-lft-identity48.2%
sqrt-div55.5%
pow1/255.5%
inv-pow55.5%
pow-pow55.6%
metadata-eval55.6%
Applied egg-rr55.6%
*-lft-identity55.6%
Simplified55.6%
Final simplification52.6%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (if (<= l 2.6e-169) (* d (- (pow (* h l) -0.5))) (* d (/ (pow l -0.5) (sqrt h)))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= 2.6e-169) {
tmp = d * -pow((h * l), -0.5);
} else {
tmp = d * (pow(l, -0.5) / sqrt(h));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= 2.6d-169) then
tmp = d * -((h * l) ** (-0.5d0))
else
tmp = d * ((l ** (-0.5d0)) / sqrt(h))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= 2.6e-169) {
tmp = d * -Math.pow((h * l), -0.5);
} else {
tmp = d * (Math.pow(l, -0.5) / Math.sqrt(h));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= 2.6e-169: tmp = d * -math.pow((h * l), -0.5) else: tmp = d * (math.pow(l, -0.5) / math.sqrt(h)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= 2.6e-169) tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5))); else tmp = Float64(d * Float64((l ^ -0.5) / sqrt(h))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= 2.6e-169)
tmp = d * -((h * l) ^ -0.5);
else
tmp = d * ((l ^ -0.5) / sqrt(h));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, 2.6e-169], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.6 \cdot 10^{-169}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{\ell}^{-0.5}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < 2.60000000000000014e-169Initial program 72.4%
Simplified72.3%
add-sqr-sqrt72.3%
pow272.3%
sqrt-prod72.3%
sqrt-pow174.9%
metadata-eval74.9%
pow174.9%
div-inv74.9%
metadata-eval74.9%
Applied egg-rr74.9%
clear-num74.3%
sqrt-div74.3%
metadata-eval74.3%
Applied egg-rr74.3%
Taylor expanded in d around -inf 46.3%
associate-*r*46.3%
mul-1-neg46.3%
*-commutative46.3%
rem-exp-log44.6%
rec-exp44.6%
unpow1/244.6%
exp-prod45.5%
*-commutative45.5%
distribute-rgt-neg-out45.5%
distribute-lft-neg-in45.5%
metadata-eval45.5%
*-commutative45.5%
exp-to-pow47.2%
*-commutative47.2%
Simplified47.2%
if 2.60000000000000014e-169 < l Initial program 61.2%
Simplified61.3%
Taylor expanded in d around inf 47.7%
*-commutative47.7%
associate-/r*48.2%
Simplified48.2%
*-un-lft-identity48.2%
sqrt-div55.5%
pow1/255.5%
inv-pow55.5%
pow-pow55.6%
metadata-eval55.6%
Applied egg-rr55.6%
*-lft-identity55.6%
Simplified55.6%
Final simplification50.8%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (if (<= l 1.8e-169) (* d (- (pow (* h l) -0.5))) (* d (sqrt (/ (/ 1.0 l) h)))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= 1.8e-169) {
tmp = d * -pow((h * l), -0.5);
} else {
tmp = d * sqrt(((1.0 / l) / h));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= 1.8d-169) then
tmp = d * -((h * l) ** (-0.5d0))
else
tmp = d * sqrt(((1.0d0 / l) / h))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= 1.8e-169) {
tmp = d * -Math.pow((h * l), -0.5);
} else {
tmp = d * Math.sqrt(((1.0 / l) / h));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= 1.8e-169: tmp = d * -math.pow((h * l), -0.5) else: tmp = d * math.sqrt(((1.0 / l) / h)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= 1.8e-169) tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= 1.8e-169)
tmp = d * -((h * l) ^ -0.5);
else
tmp = d * sqrt(((1.0 / l) / h));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, 1.8e-169], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.8 \cdot 10^{-169}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\end{array}
\end{array}
if l < 1.80000000000000001e-169Initial program 72.4%
Simplified72.3%
add-sqr-sqrt72.3%
pow272.3%
sqrt-prod72.3%
sqrt-pow174.9%
metadata-eval74.9%
pow174.9%
div-inv74.9%
metadata-eval74.9%
Applied egg-rr74.9%
clear-num74.3%
sqrt-div74.3%
metadata-eval74.3%
Applied egg-rr74.3%
Taylor expanded in d around -inf 46.3%
associate-*r*46.3%
mul-1-neg46.3%
*-commutative46.3%
rem-exp-log44.6%
rec-exp44.6%
unpow1/244.6%
exp-prod45.5%
*-commutative45.5%
distribute-rgt-neg-out45.5%
distribute-lft-neg-in45.5%
metadata-eval45.5%
*-commutative45.5%
exp-to-pow47.2%
*-commutative47.2%
Simplified47.2%
if 1.80000000000000001e-169 < l Initial program 61.2%
Simplified61.3%
Taylor expanded in d around inf 47.7%
*-commutative47.7%
associate-/r*48.2%
Simplified48.2%
Final simplification47.7%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (* d (sqrt (/ (/ 1.0 l) h))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
return d * sqrt(((1.0 / l) / h));
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
code = d * sqrt(((1.0d0 / l) / h))
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
return d * Math.sqrt(((1.0 / l) / h));
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): return d * math.sqrt(((1.0 / l) / h))
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) return Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp = code(d, h, l, M_m, D)
tmp = d * sqrt(((1.0 / l) / h));
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}
\end{array}
Initial program 67.7%
Simplified67.7%
Taylor expanded in d around inf 26.6%
*-commutative26.6%
associate-/r*26.8%
Simplified26.8%
Final simplification26.8%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (* d (pow (* h l) -0.5)))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
return d * pow((h * l), -0.5);
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
code = d * ((h * l) ** (-0.5d0))
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
return d * Math.pow((h * l), -0.5);
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): return d * math.pow((h * l), -0.5)
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) return Float64(d * (Float64(h * l) ^ -0.5)) end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp = code(d, h, l, M_m, D)
tmp = d * ((h * l) ^ -0.5);
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
d \cdot {\left(h \cdot \ell\right)}^{-0.5}
\end{array}
Initial program 67.7%
Simplified67.7%
add-sqr-sqrt67.6%
pow267.6%
sqrt-prod67.6%
sqrt-pow170.4%
metadata-eval70.4%
pow170.4%
div-inv70.4%
metadata-eval70.4%
Applied egg-rr70.4%
Taylor expanded in d around inf 26.6%
unpow-126.6%
sqr-pow26.6%
rem-sqrt-square26.6%
metadata-eval26.6%
sqr-pow26.5%
fabs-sqr26.5%
sqr-pow26.6%
Simplified26.6%
Final simplification26.6%
herbie shell --seed 2024039
(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)))))