
(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 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M_m 2.0) d)) 2.0) -0.5))))
(t_1 (sqrt (- d))))
(if (<= h -1e-311)
(* (/ t_1 (sqrt (- l))) (* (/ t_1 (sqrt (- h))) t_0))
(if (<= h 6e+50)
(* (/ (sqrt d) (sqrt l)) (* t_0 (sqrt (/ d h))))
(*
(/ (sqrt d) (sqrt h))
(*
(sqrt (/ d l))
(+ 1.0 (* (pow (* (/ D d) (* M_m 0.5)) 2.0) (/ (* h -0.5) l)))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = 1.0 + ((h / l) * (pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5));
double t_1 = sqrt(-d);
double tmp;
if (h <= -1e-311) {
tmp = (t_1 / sqrt(-l)) * ((t_1 / sqrt(-h)) * t_0);
} else if (h <= 6e+50) {
tmp = (sqrt(d) / sqrt(l)) * (t_0 * sqrt((d / h)));
} else {
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0 + (pow(((D / d) * (M_m * 0.5)), 2.0) * ((h * -0.5) / l))));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + ((h / l) * (((d_1 * ((m_m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))
t_1 = sqrt(-d)
if (h <= (-1d-311)) then
tmp = (t_1 / sqrt(-l)) * ((t_1 / sqrt(-h)) * t_0)
else if (h <= 6d+50) then
tmp = (sqrt(d) / sqrt(l)) * (t_0 * sqrt((d / h)))
else
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0d0 + ((((d_1 / d) * (m_m * 0.5d0)) ** 2.0d0) * ((h * (-0.5d0)) / l))))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = 1.0 + ((h / l) * (Math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5));
double t_1 = Math.sqrt(-d);
double tmp;
if (h <= -1e-311) {
tmp = (t_1 / Math.sqrt(-l)) * ((t_1 / Math.sqrt(-h)) * t_0);
} else if (h <= 6e+50) {
tmp = (Math.sqrt(d) / Math.sqrt(l)) * (t_0 * Math.sqrt((d / h)));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (Math.sqrt((d / l)) * (1.0 + (Math.pow(((D / d) * (M_m * 0.5)), 2.0) * ((h * -0.5) / l))));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = 1.0 + ((h / l) * (math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5)) t_1 = math.sqrt(-d) tmp = 0 if h <= -1e-311: tmp = (t_1 / math.sqrt(-l)) * ((t_1 / math.sqrt(-h)) * t_0) elif h <= 6e+50: tmp = (math.sqrt(d) / math.sqrt(l)) * (t_0 * math.sqrt((d / h))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * (math.sqrt((d / l)) * (1.0 + (math.pow(((D / d) * (M_m * 0.5)), 2.0) * ((h * -0.5) / l)))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5))) t_1 = sqrt(Float64(-d)) tmp = 0.0 if (h <= -1e-311) tmp = Float64(Float64(t_1 / sqrt(Float64(-l))) * Float64(Float64(t_1 / sqrt(Float64(-h))) * t_0)); elseif (h <= 6e+50) tmp = Float64(Float64(sqrt(d) / sqrt(l)) * Float64(t_0 * sqrt(Float64(d / h)))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64((Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0) * Float64(Float64(h * -0.5) / l))))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = 1.0 + ((h / l) * (((D * ((M_m / 2.0) / d)) ^ 2.0) * -0.5));
t_1 = sqrt(-d);
tmp = 0.0;
if (h <= -1e-311)
tmp = (t_1 / sqrt(-l)) * ((t_1 / sqrt(-h)) * t_0);
elseif (h <= 6e+50)
tmp = (sqrt(d) / sqrt(l)) * (t_0 * sqrt((d / h)));
else
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0 + ((((D / d) * (M_m * 0.5)) ^ 2.0) * ((h * -0.5) / l))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[h, -1e-311], N[(N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 6e+50], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h * -0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := 1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\\
t_1 := \sqrt{-d}\\
\mathbf{if}\;h \leq -1 \cdot 10^{-311}:\\
\;\;\;\;\frac{t\_1}{\sqrt{-\ell}} \cdot \left(\frac{t\_1}{\sqrt{-h}} \cdot t\_0\right)\\
\mathbf{elif}\;h \leq 6 \cdot 10^{+50}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(t\_0 \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2} \cdot \frac{h \cdot -0.5}{\ell}\right)\right)\\
\end{array}
\end{array}
if h < -9.99999999999948e-312Initial program 64.2%
Simplified62.7%
frac-2neg62.7%
sqrt-div68.6%
Applied egg-rr68.6%
frac-2neg68.6%
sqrt-div82.2%
Applied egg-rr82.2%
if -9.99999999999948e-312 < h < 5.9999999999999996e50Initial program 71.8%
Simplified71.8%
sqrt-div85.0%
Applied egg-rr85.0%
if 5.9999999999999996e50 < h Initial program 59.8%
Simplified59.6%
fma-undefine59.6%
associate-*r*59.6%
associate-*r/59.6%
Applied egg-rr59.6%
sqrt-div76.5%
Applied egg-rr76.5%
Final simplification81.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
(let* ((t_0
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* D M_m) (* d 2.0)) 2.0)))))))
(if (<= t_0 2e+102)
(*
(- 1.0 (* 0.5 (* h (/ (pow (* D (* 0.5 (/ M_m d))) 2.0) l))))
(* (sqrt (/ d h)) (sqrt (/ d l))))
(if (<= t_0 INFINITY)
(+ -1.0 (/ (+ l (* d (sqrt (/ l h)))) l))
(*
-0.125
(* (pow (cbrt (* D M_m)) 6.0) (/ (sqrt (/ h (pow l 3.0))) d)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((D * M_m) / (d * 2.0)), 2.0))));
double tmp;
if (t_0 <= 2e+102) {
tmp = (1.0 - (0.5 * (h * (pow((D * (0.5 * (M_m / d))), 2.0) / l)))) * (sqrt((d / h)) * sqrt((d / l)));
} else if (t_0 <= ((double) INFINITY)) {
tmp = -1.0 + ((l + (d * sqrt((l / h)))) / l);
} else {
tmp = -0.125 * (pow(cbrt((D * M_m)), 6.0) * (sqrt((h / pow(l, 3.0))) / d));
}
return tmp;
}
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((D * M_m) / (d * 2.0)), 2.0))));
double tmp;
if (t_0 <= 2e+102) {
tmp = (1.0 - (0.5 * (h * (Math.pow((D * (0.5 * (M_m / d))), 2.0) / l)))) * (Math.sqrt((d / h)) * Math.sqrt((d / l)));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = -1.0 + ((l + (d * Math.sqrt((l / h)))) / l);
} else {
tmp = -0.125 * (Math.pow(Math.cbrt((D * M_m)), 6.0) * (Math.sqrt((h / Math.pow(l, 3.0))) / d));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(D * M_m) / Float64(d * 2.0)) ^ 2.0))))) tmp = 0.0 if (t_0 <= 2e+102) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(D * Float64(0.5 * Float64(M_m / d))) ^ 2.0) / l)))) * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))); elseif (t_0 <= Inf) tmp = Float64(-1.0 + Float64(Float64(l + Float64(d * sqrt(Float64(l / h)))) / l)); else tmp = Float64(-0.125 * Float64((cbrt(Float64(D * M_m)) ^ 6.0) * Float64(sqrt(Float64(h / (l ^ 3.0))) / d))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(D * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2e+102], N[(N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(D * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(-1.0 + N[(N[(l + N[(d * N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision], N[(-0.125 * N[(N[Power[N[Power[N[(D * M$95$m), $MachinePrecision], 1/3], $MachinePrecision], 6.0], $MachinePrecision] * N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / d), $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({\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{if}\;t\_0 \leq 2 \cdot 10^{+102}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(D \cdot \left(0.5 \cdot \frac{M\_m}{d}\right)\right)}^{2}}{\ell}\right)\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;-1 + \frac{\ell + d \cdot \sqrt{\frac{\ell}{h}}}{\ell}\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left({\left(\sqrt[3]{D \cdot M\_m}\right)}^{6} \cdot \frac{\sqrt{\frac{h}{{\ell}^{3}}}}{d}\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1.99999999999999995e102Initial program 81.9%
Simplified81.2%
associate-*r/81.8%
frac-times82.1%
associate-/l*81.8%
*-commutative81.8%
Applied egg-rr81.8%
*-commutative81.8%
associate-/l*82.4%
associate-*r/82.7%
*-rgt-identity82.7%
times-frac82.7%
metadata-eval82.7%
*-commutative82.7%
associate-/l*81.8%
associate-*l*81.8%
Simplified81.8%
if 1.99999999999999995e102 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 78.4%
Simplified78.3%
Taylor expanded in d around inf 54.9%
expm1-log1p-u52.1%
expm1-undefine52.1%
pow1/252.1%
inv-pow52.1%
pow-pow52.1%
metadata-eval52.1%
Applied egg-rr52.1%
sub-neg52.1%
metadata-eval52.1%
+-commutative52.1%
log1p-undefine52.1%
rem-exp-log55.0%
+-commutative55.0%
fma-define55.0%
Simplified55.0%
Taylor expanded in l around 0 93.0%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Simplified0.1%
Taylor expanded in M around inf 0.2%
associate-*r*0.2%
times-frac0.0%
*-commutative0.0%
associate-/l*0.0%
unpow20.0%
unpow20.0%
unpow20.0%
times-frac0.0%
swap-sqr0.0%
unpow20.0%
associate-*r/0.0%
*-commutative0.0%
associate-/l*0.0%
Simplified0.0%
frac-2neg0.1%
sqrt-div4.1%
Applied egg-rr4.0%
Taylor expanded in d around 0 20.6%
associate-*l/20.6%
associate-/l*20.6%
unpow220.6%
unpow220.6%
swap-sqr23.2%
rem-cube-cbrt23.2%
rem-cube-cbrt23.2%
pow-sqr23.2%
metadata-eval23.2%
Simplified23.2%
Final simplification72.3%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0
(*
(* (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)))))))
(if (<= t_0 2e+102)
(*
(- 1.0 (* 0.5 (* h (/ (pow (* D (* 0.5 (/ M_m d))) 2.0) l))))
(* (sqrt (/ d h)) (sqrt (/ d l))))
(if (<= t_0 INFINITY)
(+ -1.0 (/ (+ l (* d (sqrt (/ l h)))) l))
(* d (pow 0.0 -0.5))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((D * M_m) / (d * 2.0)), 2.0))));
double tmp;
if (t_0 <= 2e+102) {
tmp = (1.0 - (0.5 * (h * (pow((D * (0.5 * (M_m / d))), 2.0) / l)))) * (sqrt((d / h)) * sqrt((d / l)));
} else if (t_0 <= ((double) INFINITY)) {
tmp = -1.0 + ((l + (d * sqrt((l / h)))) / l);
} else {
tmp = d * pow(0.0, -0.5);
}
return tmp;
}
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((D * M_m) / (d * 2.0)), 2.0))));
double tmp;
if (t_0 <= 2e+102) {
tmp = (1.0 - (0.5 * (h * (Math.pow((D * (0.5 * (M_m / d))), 2.0) / l)))) * (Math.sqrt((d / h)) * Math.sqrt((d / l)));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = -1.0 + ((l + (d * Math.sqrt((l / h)))) / l);
} else {
tmp = d * Math.pow(0.0, -0.5);
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((D * M_m) / (d * 2.0)), 2.0)))) tmp = 0 if t_0 <= 2e+102: tmp = (1.0 - (0.5 * (h * (math.pow((D * (0.5 * (M_m / d))), 2.0) / l)))) * (math.sqrt((d / h)) * math.sqrt((d / l))) elif t_0 <= math.inf: tmp = -1.0 + ((l + (d * math.sqrt((l / h)))) / l) else: tmp = d * math.pow(0.0, -0.5) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(D * M_m) / Float64(d * 2.0)) ^ 2.0))))) tmp = 0.0 if (t_0 <= 2e+102) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(D * Float64(0.5 * Float64(M_m / d))) ^ 2.0) / l)))) * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))); elseif (t_0 <= Inf) tmp = Float64(-1.0 + Float64(Float64(l + Float64(d * sqrt(Float64(l / h)))) / l)); else tmp = Float64(d * (0.0 ^ -0.5)); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((D * M_m) / (d * 2.0)) ^ 2.0))));
tmp = 0.0;
if (t_0 <= 2e+102)
tmp = (1.0 - (0.5 * (h * (((D * (0.5 * (M_m / d))) ^ 2.0) / l)))) * (sqrt((d / h)) * sqrt((d / l)));
elseif (t_0 <= Inf)
tmp = -1.0 + ((l + (d * sqrt((l / h)))) / l);
else
tmp = d * (0.0 ^ -0.5);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(D * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2e+102], N[(N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(D * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(-1.0 + N[(N[(l + N[(d * N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision], N[(d * N[Power[0.0, -0.5], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{D \cdot M\_m}{d \cdot 2}\right)}^{2}\right)\right)\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{+102}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(D \cdot \left(0.5 \cdot \frac{M\_m}{d}\right)\right)}^{2}}{\ell}\right)\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;-1 + \frac{\ell + d \cdot \sqrt{\frac{\ell}{h}}}{\ell}\\
\mathbf{else}:\\
\;\;\;\;d \cdot {0}^{-0.5}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1.99999999999999995e102Initial program 81.9%
Simplified81.2%
associate-*r/81.8%
frac-times82.1%
associate-/l*81.8%
*-commutative81.8%
Applied egg-rr81.8%
*-commutative81.8%
associate-/l*82.4%
associate-*r/82.7%
*-rgt-identity82.7%
times-frac82.7%
metadata-eval82.7%
*-commutative82.7%
associate-/l*81.8%
associate-*l*81.8%
Simplified81.8%
if 1.99999999999999995e102 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 78.4%
Simplified78.3%
Taylor expanded in d around inf 54.9%
expm1-log1p-u52.1%
expm1-undefine52.1%
pow1/252.1%
inv-pow52.1%
pow-pow52.1%
metadata-eval52.1%
Applied egg-rr52.1%
sub-neg52.1%
metadata-eval52.1%
+-commutative52.1%
log1p-undefine52.1%
rem-exp-log55.0%
+-commutative55.0%
fma-define55.0%
Simplified55.0%
Taylor expanded in l around 0 93.0%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Simplified0.1%
pow10.1%
associate-*r*0.1%
sqrt-unprod0.1%
associate-*r*0.1%
associate-*r/0.1%
Applied egg-rr0.1%
Simplified0.1%
Taylor expanded in d around inf 11.4%
unpow-111.4%
metadata-eval11.4%
pow-sqr11.4%
rem-sqrt-square11.4%
rem-square-sqrt11.4%
fabs-sqr11.4%
rem-square-sqrt11.4%
Simplified11.4%
expm1-log1p-u11.2%
expm1-undefine12.3%
Applied egg-rr12.3%
sub-neg12.3%
metadata-eval12.3%
+-commutative12.3%
log1p-undefine12.3%
rem-exp-log12.5%
+-commutative12.5%
fma-define12.5%
Simplified12.5%
Taylor expanded in h around 0 23.0%
Final simplification72.2%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))) (t_1 (sqrt (/ d h))) (t_2 (sqrt (- d))))
(if (<= h -1.3e+80)
(*
(/ t_2 (sqrt (- h)))
(* t_0 (+ 1.0 (* h (* (/ -0.125 l) (pow (/ (* D M_m) d) 2.0))))))
(if (<= h -1e-311)
(*
(* (/ t_2 (sqrt (- l))) t_1)
(- 1.0 (* 0.5 (pow (* (* M_m (/ D (* d 2.0))) (sqrt (/ h l))) 2.0))))
(if (<= h 6.2e+51)
(*
(/ (sqrt d) (sqrt l))
(*
(+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M_m 2.0) d)) 2.0) -0.5)))
t_1))
(*
(/ (sqrt d) (sqrt h))
(*
t_0
(+
1.0
(* (pow (* (/ D d) (* M_m 0.5)) 2.0) (/ (* h -0.5) l))))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt((d / l));
double t_1 = sqrt((d / h));
double t_2 = sqrt(-d);
double tmp;
if (h <= -1.3e+80) {
tmp = (t_2 / sqrt(-h)) * (t_0 * (1.0 + (h * ((-0.125 / l) * pow(((D * M_m) / d), 2.0)))));
} else if (h <= -1e-311) {
tmp = ((t_2 / sqrt(-l)) * t_1) * (1.0 - (0.5 * pow(((M_m * (D / (d * 2.0))) * sqrt((h / l))), 2.0)));
} else if (h <= 6.2e+51) {
tmp = (sqrt(d) / sqrt(l)) * ((1.0 + ((h / l) * (pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))) * t_1);
} else {
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 + (pow(((D / d) * (M_m * 0.5)), 2.0) * ((h * -0.5) / l))));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = sqrt((d / h))
t_2 = sqrt(-d)
if (h <= (-1.3d+80)) then
tmp = (t_2 / sqrt(-h)) * (t_0 * (1.0d0 + (h * (((-0.125d0) / l) * (((d_1 * m_m) / d) ** 2.0d0)))))
else if (h <= (-1d-311)) then
tmp = ((t_2 / sqrt(-l)) * t_1) * (1.0d0 - (0.5d0 * (((m_m * (d_1 / (d * 2.0d0))) * sqrt((h / l))) ** 2.0d0)))
else if (h <= 6.2d+51) then
tmp = (sqrt(d) / sqrt(l)) * ((1.0d0 + ((h / l) * (((d_1 * ((m_m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))) * t_1)
else
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0d0 + ((((d_1 / d) * (m_m * 0.5d0)) ** 2.0d0) * ((h * (-0.5d0)) / l))))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.sqrt((d / l));
double t_1 = Math.sqrt((d / h));
double t_2 = Math.sqrt(-d);
double tmp;
if (h <= -1.3e+80) {
tmp = (t_2 / Math.sqrt(-h)) * (t_0 * (1.0 + (h * ((-0.125 / l) * Math.pow(((D * M_m) / d), 2.0)))));
} else if (h <= -1e-311) {
tmp = ((t_2 / Math.sqrt(-l)) * t_1) * (1.0 - (0.5 * Math.pow(((M_m * (D / (d * 2.0))) * Math.sqrt((h / l))), 2.0)));
} else if (h <= 6.2e+51) {
tmp = (Math.sqrt(d) / Math.sqrt(l)) * ((1.0 + ((h / l) * (Math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))) * t_1);
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (t_0 * (1.0 + (Math.pow(((D / d) * (M_m * 0.5)), 2.0) * ((h * -0.5) / l))));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.sqrt((d / l)) t_1 = math.sqrt((d / h)) t_2 = math.sqrt(-d) tmp = 0 if h <= -1.3e+80: tmp = (t_2 / math.sqrt(-h)) * (t_0 * (1.0 + (h * ((-0.125 / l) * math.pow(((D * M_m) / d), 2.0))))) elif h <= -1e-311: tmp = ((t_2 / math.sqrt(-l)) * t_1) * (1.0 - (0.5 * math.pow(((M_m * (D / (d * 2.0))) * math.sqrt((h / l))), 2.0))) elif h <= 6.2e+51: tmp = (math.sqrt(d) / math.sqrt(l)) * ((1.0 + ((h / l) * (math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))) * t_1) else: tmp = (math.sqrt(d) / math.sqrt(h)) * (t_0 * (1.0 + (math.pow(((D / d) * (M_m * 0.5)), 2.0) * ((h * -0.5) / l)))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(d / l)) t_1 = sqrt(Float64(d / h)) t_2 = sqrt(Float64(-d)) tmp = 0.0 if (h <= -1.3e+80) tmp = Float64(Float64(t_2 / sqrt(Float64(-h))) * Float64(t_0 * Float64(1.0 + Float64(h * Float64(Float64(-0.125 / l) * (Float64(Float64(D * M_m) / d) ^ 2.0)))))); elseif (h <= -1e-311) tmp = Float64(Float64(Float64(t_2 / sqrt(Float64(-l))) * t_1) * Float64(1.0 - Float64(0.5 * (Float64(Float64(M_m * Float64(D / Float64(d * 2.0))) * sqrt(Float64(h / l))) ^ 2.0)))); elseif (h <= 6.2e+51) tmp = Float64(Float64(sqrt(d) / sqrt(l)) * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5))) * t_1)); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_0 * Float64(1.0 + Float64((Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0) * Float64(Float64(h * -0.5) / l))))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = sqrt((d / l));
t_1 = sqrt((d / h));
t_2 = sqrt(-d);
tmp = 0.0;
if (h <= -1.3e+80)
tmp = (t_2 / sqrt(-h)) * (t_0 * (1.0 + (h * ((-0.125 / l) * (((D * M_m) / d) ^ 2.0)))));
elseif (h <= -1e-311)
tmp = ((t_2 / sqrt(-l)) * t_1) * (1.0 - (0.5 * (((M_m * (D / (d * 2.0))) * sqrt((h / l))) ^ 2.0)));
elseif (h <= 6.2e+51)
tmp = (sqrt(d) / sqrt(l)) * ((1.0 + ((h / l) * (((D * ((M_m / 2.0) / d)) ^ 2.0) * -0.5))) * t_1);
else
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 + ((((D / d) * (M_m * 0.5)) ^ 2.0) * ((h * -0.5) / l))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[h, -1.3e+80], N[(N[(t$95$2 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 + N[(h * N[(N[(-0.125 / l), $MachinePrecision] * N[Power[N[(N[(D * M$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -1e-311], N[(N[(N[(t$95$2 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(N[(M$95$m * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 6.2e+51], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 + N[(N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h * -0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \sqrt{-d}\\
\mathbf{if}\;h \leq -1.3 \cdot 10^{+80}:\\
\;\;\;\;\frac{t\_2}{\sqrt{-h}} \cdot \left(t\_0 \cdot \left(1 + h \cdot \left(\frac{-0.125}{\ell} \cdot {\left(\frac{D \cdot M\_m}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{elif}\;h \leq -1 \cdot 10^{-311}:\\
\;\;\;\;\left(\frac{t\_2}{\sqrt{-\ell}} \cdot t\_1\right) \cdot \left(1 - 0.5 \cdot {\left(\left(M\_m \cdot \frac{D}{d \cdot 2}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\\
\mathbf{elif}\;h \leq 6.2 \cdot 10^{+51}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\right) \cdot t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_0 \cdot \left(1 + {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2} \cdot \frac{h \cdot -0.5}{\ell}\right)\right)\\
\end{array}
\end{array}
if h < -1.29999999999999991e80Initial program 45.3%
Simplified45.3%
fma-undefine45.3%
associate-*r*45.3%
associate-*r/45.3%
Applied egg-rr45.3%
Taylor expanded in M around 0 34.9%
associate-*r/34.9%
associate-*r*38.3%
associate-*r*38.3%
associate-*l/40.6%
associate-*r/40.6%
*-commutative40.6%
associate-*r/40.6%
*-commutative40.6%
times-frac43.0%
*-commutative43.0%
associate-/l*43.0%
unpow243.0%
unpow243.0%
unpow243.0%
times-frac45.9%
swap-sqr50.7%
unpow250.7%
Simplified50.7%
frac-2neg47.4%
sqrt-div78.6%
Applied egg-rr77.0%
if -1.29999999999999991e80 < h < -9.99999999999948e-312Initial program 73.9%
Simplified74.0%
add-sqr-sqrt74.0%
pow274.0%
sqrt-prod74.0%
sqrt-pow178.1%
frac-times78.0%
metadata-eval78.0%
pow178.0%
associate-/l*78.1%
*-commutative78.1%
Applied egg-rr78.1%
frac-2neg71.6%
sqrt-div79.5%
Applied egg-rr86.5%
if -9.99999999999948e-312 < h < 6.20000000000000022e51Initial program 71.8%
Simplified71.8%
sqrt-div85.0%
Applied egg-rr85.0%
if 6.20000000000000022e51 < h Initial program 59.8%
Simplified59.6%
fma-undefine59.6%
associate-*r*59.6%
associate-*r/59.6%
Applied egg-rr59.6%
sqrt-div76.5%
Applied egg-rr76.5%
Final simplification82.2%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (/ d h))) (t_1 (sqrt (/ d l))) (t_2 (* D (/ M_m d))))
(if (<= d -6.6e+268)
(* d (- (pow (* h l) -0.5)))
(if (<= d -9.2e-70)
(* t_0 (* t_1 (+ 1.0 (* h (pow (* t_2 (sqrt (/ -0.125 l))) 2.0)))))
(if (<= d -1e-309)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(* t_1 (* -0.125 (* (/ h l) (pow t_2 2.0)))))
(if (<= d 3.5e-247)
(*
-0.125
(* (pow (cbrt (* D M_m)) 6.0) (/ (sqrt (/ h (pow l 3.0))) d)))
(*
(/ (sqrt d) (sqrt l))
(*
(+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M_m 2.0) d)) 2.0) -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 = sqrt((d / h));
double t_1 = sqrt((d / l));
double t_2 = D * (M_m / d);
double tmp;
if (d <= -6.6e+268) {
tmp = d * -pow((h * l), -0.5);
} else if (d <= -9.2e-70) {
tmp = t_0 * (t_1 * (1.0 + (h * pow((t_2 * sqrt((-0.125 / l))), 2.0))));
} else if (d <= -1e-309) {
tmp = (sqrt(-d) / sqrt(-h)) * (t_1 * (-0.125 * ((h / l) * pow(t_2, 2.0))));
} else if (d <= 3.5e-247) {
tmp = -0.125 * (pow(cbrt((D * M_m)), 6.0) * (sqrt((h / pow(l, 3.0))) / d));
} else {
tmp = (sqrt(d) / sqrt(l)) * ((1.0 + ((h / l) * (pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))) * t_0);
}
return tmp;
}
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.sqrt((d / h));
double t_1 = Math.sqrt((d / l));
double t_2 = D * (M_m / d);
double tmp;
if (d <= -6.6e+268) {
tmp = d * -Math.pow((h * l), -0.5);
} else if (d <= -9.2e-70) {
tmp = t_0 * (t_1 * (1.0 + (h * Math.pow((t_2 * Math.sqrt((-0.125 / l))), 2.0))));
} else if (d <= -1e-309) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * (t_1 * (-0.125 * ((h / l) * Math.pow(t_2, 2.0))));
} else if (d <= 3.5e-247) {
tmp = -0.125 * (Math.pow(Math.cbrt((D * M_m)), 6.0) * (Math.sqrt((h / Math.pow(l, 3.0))) / d));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(l)) * ((1.0 + ((h / l) * (Math.pow((D * ((M_m / 2.0) / d)), 2.0) * -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 = sqrt(Float64(d / h)) t_1 = sqrt(Float64(d / l)) t_2 = Float64(D * Float64(M_m / d)) tmp = 0.0 if (d <= -6.6e+268) tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5))); elseif (d <= -9.2e-70) tmp = Float64(t_0 * Float64(t_1 * Float64(1.0 + Float64(h * (Float64(t_2 * sqrt(Float64(-0.125 / l))) ^ 2.0))))); elseif (d <= -1e-309) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(t_1 * Float64(-0.125 * Float64(Float64(h / l) * (t_2 ^ 2.0))))); elseif (d <= 3.5e-247) tmp = Float64(-0.125 * Float64((cbrt(Float64(D * M_m)) ^ 6.0) * Float64(sqrt(Float64(h / (l ^ 3.0))) / d))); else tmp = Float64(Float64(sqrt(d) / sqrt(l)) * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5))) * t_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_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -6.6e+268], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -9.2e-70], N[(t$95$0 * N[(t$95$1 * N[(1.0 + N[(h * N[Power[N[(t$95$2 * N[Sqrt[N[(-0.125 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1e-309], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[t$95$2, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.5e-247], N[(-0.125 * N[(N[Power[N[Power[N[(D * M$95$m), $MachinePrecision], 1/3], $MachinePrecision], 6.0], $MachinePrecision] * N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := D \cdot \frac{M\_m}{d}\\
\mathbf{if}\;d \leq -6.6 \cdot 10^{+268}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{elif}\;d \leq -9.2 \cdot 10^{-70}:\\
\;\;\;\;t\_0 \cdot \left(t\_1 \cdot \left(1 + h \cdot {\left(t\_2 \cdot \sqrt{\frac{-0.125}{\ell}}\right)}^{2}\right)\right)\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(t\_1 \cdot \left(-0.125 \cdot \left(\frac{h}{\ell} \cdot {t\_2}^{2}\right)\right)\right)\\
\mathbf{elif}\;d \leq 3.5 \cdot 10^{-247}:\\
\;\;\;\;-0.125 \cdot \left({\left(\sqrt[3]{D \cdot M\_m}\right)}^{6} \cdot \frac{\sqrt{\frac{h}{{\ell}^{3}}}}{d}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\right) \cdot t\_0\right)\\
\end{array}
\end{array}
if d < -6.6000000000000002e268Initial program 40.6%
Simplified41.3%
Taylor expanded in d around inf 10.2%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt89.7%
neg-mul-189.7%
unpow-189.7%
metadata-eval89.7%
pow-sqr89.8%
rem-sqrt-square89.8%
rem-square-sqrt89.1%
fabs-sqr89.1%
rem-square-sqrt89.8%
Simplified89.8%
if -6.6000000000000002e268 < d < -9.20000000000000002e-70Initial program 81.6%
Simplified80.3%
fma-undefine80.3%
associate-*r*80.3%
associate-*r/80.3%
Applied egg-rr80.3%
Taylor expanded in M around 0 64.7%
associate-*r/64.7%
associate-*r*65.3%
associate-*r*65.3%
associate-*l/66.7%
associate-*r/66.7%
*-commutative66.7%
associate-*r/66.7%
*-commutative66.7%
times-frac71.3%
*-commutative71.3%
associate-/l*71.3%
unpow271.3%
unpow271.3%
unpow271.3%
times-frac75.7%
swap-sqr81.9%
unpow281.9%
Simplified81.9%
add-sqr-sqrt81.9%
pow281.9%
*-commutative81.9%
associate-*r/81.9%
sqrt-prod81.9%
sqrt-pow184.7%
metadata-eval84.7%
pow184.7%
Applied egg-rr84.7%
if -9.20000000000000002e-70 < d < -1.000000000000002e-309Initial program 44.5%
Simplified44.4%
Taylor expanded in M around inf 26.9%
associate-*r*29.1%
times-frac27.3%
*-commutative27.3%
associate-/l*25.1%
unpow225.1%
unpow225.1%
unpow225.1%
times-frac31.9%
swap-sqr40.3%
unpow240.3%
associate-*r/40.3%
*-commutative40.3%
associate-/l*38.3%
Simplified38.3%
frac-2neg50.6%
sqrt-div77.0%
Applied egg-rr62.4%
if -1.000000000000002e-309 < d < 3.4999999999999999e-247Initial program 7.2%
Simplified7.2%
Taylor expanded in M around inf 6.7%
associate-*r*6.7%
times-frac6.7%
*-commutative6.7%
associate-/l*6.7%
unpow26.7%
unpow26.7%
unpow26.7%
times-frac7.2%
swap-sqr7.2%
unpow27.2%
associate-*r/7.2%
*-commutative7.2%
associate-/l*7.2%
Simplified7.2%
frac-2neg7.2%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around 0 54.7%
associate-*l/54.7%
associate-/l*54.7%
unpow254.7%
unpow254.7%
swap-sqr61.8%
rem-cube-cbrt61.8%
rem-cube-cbrt61.8%
pow-sqr61.8%
metadata-eval61.8%
Simplified61.8%
if 3.4999999999999999e-247 < d Initial program 73.9%
Simplified73.1%
sqrt-div81.2%
Applied egg-rr81.2%
Final simplification77.9%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M_m 2.0) d)) 2.0) -0.5))))
(t_1 (sqrt (/ d l)))
(t_2 (- 1.0 (* 0.5 (* h (/ (pow (* D (* 0.5 (/ M_m d))) 2.0) l)))))
(t_3 (sqrt (/ d h)))
(t_4 (sqrt (- d))))
(if (<= l -1.5e-201)
(* (* (/ t_4 (sqrt (- h))) t_1) t_2)
(if (<= l -5e-310)
(* (* (/ t_4 (sqrt (- l))) t_3) t_2)
(if (<= l 1.5e+97)
(* t_1 (* t_0 (/ (sqrt d) (sqrt h))))
(* (/ (sqrt d) (sqrt l)) (* t_0 t_3)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = 1.0 + ((h / l) * (pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5));
double t_1 = sqrt((d / l));
double t_2 = 1.0 - (0.5 * (h * (pow((D * (0.5 * (M_m / d))), 2.0) / l)));
double t_3 = sqrt((d / h));
double t_4 = sqrt(-d);
double tmp;
if (l <= -1.5e-201) {
tmp = ((t_4 / sqrt(-h)) * t_1) * t_2;
} else if (l <= -5e-310) {
tmp = ((t_4 / sqrt(-l)) * t_3) * t_2;
} else if (l <= 1.5e+97) {
tmp = t_1 * (t_0 * (sqrt(d) / sqrt(h)));
} else {
tmp = (sqrt(d) / sqrt(l)) * (t_0 * t_3);
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = 1.0d0 + ((h / l) * (((d_1 * ((m_m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))
t_1 = sqrt((d / l))
t_2 = 1.0d0 - (0.5d0 * (h * (((d_1 * (0.5d0 * (m_m / d))) ** 2.0d0) / l)))
t_3 = sqrt((d / h))
t_4 = sqrt(-d)
if (l <= (-1.5d-201)) then
tmp = ((t_4 / sqrt(-h)) * t_1) * t_2
else if (l <= (-5d-310)) then
tmp = ((t_4 / sqrt(-l)) * t_3) * t_2
else if (l <= 1.5d+97) then
tmp = t_1 * (t_0 * (sqrt(d) / sqrt(h)))
else
tmp = (sqrt(d) / sqrt(l)) * (t_0 * t_3)
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = 1.0 + ((h / l) * (Math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5));
double t_1 = Math.sqrt((d / l));
double t_2 = 1.0 - (0.5 * (h * (Math.pow((D * (0.5 * (M_m / d))), 2.0) / l)));
double t_3 = Math.sqrt((d / h));
double t_4 = Math.sqrt(-d);
double tmp;
if (l <= -1.5e-201) {
tmp = ((t_4 / Math.sqrt(-h)) * t_1) * t_2;
} else if (l <= -5e-310) {
tmp = ((t_4 / Math.sqrt(-l)) * t_3) * t_2;
} else if (l <= 1.5e+97) {
tmp = t_1 * (t_0 * (Math.sqrt(d) / Math.sqrt(h)));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(l)) * (t_0 * t_3);
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = 1.0 + ((h / l) * (math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5)) t_1 = math.sqrt((d / l)) t_2 = 1.0 - (0.5 * (h * (math.pow((D * (0.5 * (M_m / d))), 2.0) / l))) t_3 = math.sqrt((d / h)) t_4 = math.sqrt(-d) tmp = 0 if l <= -1.5e-201: tmp = ((t_4 / math.sqrt(-h)) * t_1) * t_2 elif l <= -5e-310: tmp = ((t_4 / math.sqrt(-l)) * t_3) * t_2 elif l <= 1.5e+97: tmp = t_1 * (t_0 * (math.sqrt(d) / math.sqrt(h))) else: tmp = (math.sqrt(d) / math.sqrt(l)) * (t_0 * t_3) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5))) t_1 = sqrt(Float64(d / l)) t_2 = Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(D * Float64(0.5 * Float64(M_m / d))) ^ 2.0) / l)))) t_3 = sqrt(Float64(d / h)) t_4 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -1.5e-201) tmp = Float64(Float64(Float64(t_4 / sqrt(Float64(-h))) * t_1) * t_2); elseif (l <= -5e-310) tmp = Float64(Float64(Float64(t_4 / sqrt(Float64(-l))) * t_3) * t_2); elseif (l <= 1.5e+97) tmp = Float64(t_1 * Float64(t_0 * Float64(sqrt(d) / sqrt(h)))); else tmp = Float64(Float64(sqrt(d) / sqrt(l)) * Float64(t_0 * t_3)); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = 1.0 + ((h / l) * (((D * ((M_m / 2.0) / d)) ^ 2.0) * -0.5));
t_1 = sqrt((d / l));
t_2 = 1.0 - (0.5 * (h * (((D * (0.5 * (M_m / d))) ^ 2.0) / l)));
t_3 = sqrt((d / h));
t_4 = sqrt(-d);
tmp = 0.0;
if (l <= -1.5e-201)
tmp = ((t_4 / sqrt(-h)) * t_1) * t_2;
elseif (l <= -5e-310)
tmp = ((t_4 / sqrt(-l)) * t_3) * t_2;
elseif (l <= 1.5e+97)
tmp = t_1 * (t_0 * (sqrt(d) / sqrt(h)));
else
tmp = (sqrt(d) / sqrt(l)) * (t_0 * t_3);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(D * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -1.5e-201], N[(N[(N[(t$95$4 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[l, -5e-310], N[(N[(N[(t$95$4 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[l, 1.5e+97], N[(t$95$1 * N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * t$95$3), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := 1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := 1 - 0.5 \cdot \left(h \cdot \frac{{\left(D \cdot \left(0.5 \cdot \frac{M\_m}{d}\right)\right)}^{2}}{\ell}\right)\\
t_3 := \sqrt{\frac{d}{h}}\\
t_4 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -1.5 \cdot 10^{-201}:\\
\;\;\;\;\left(\frac{t\_4}{\sqrt{-h}} \cdot t\_1\right) \cdot t\_2\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{t\_4}{\sqrt{-\ell}} \cdot t\_3\right) \cdot t\_2\\
\mathbf{elif}\;\ell \leq 1.5 \cdot 10^{+97}:\\
\;\;\;\;t\_1 \cdot \left(t\_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(t\_0 \cdot t\_3\right)\\
\end{array}
\end{array}
if l < -1.50000000000000001e-201Initial program 62.0%
Simplified62.1%
associate-*r/63.3%
frac-times63.2%
associate-/l*63.3%
*-commutative63.3%
Applied egg-rr63.3%
*-commutative63.3%
associate-/l*63.3%
associate-*r/63.2%
*-rgt-identity63.2%
times-frac63.2%
metadata-eval63.2%
*-commutative63.2%
associate-/l*63.2%
associate-*l*63.2%
Simplified63.2%
frac-2neg66.8%
sqrt-div82.7%
Applied egg-rr77.0%
if -1.50000000000000001e-201 < l < -4.999999999999985e-310Initial program 72.9%
Simplified72.8%
associate-*r/73.8%
frac-times73.8%
associate-/l*73.8%
*-commutative73.8%
Applied egg-rr73.8%
*-commutative73.8%
associate-/l*73.8%
associate-*r/73.8%
*-rgt-identity73.8%
times-frac73.8%
metadata-eval73.8%
*-commutative73.8%
associate-/l*69.8%
associate-*l*69.8%
Simplified69.8%
frac-2neg68.9%
sqrt-div76.0%
Applied egg-rr91.7%
if -4.999999999999985e-310 < l < 1.4999999999999999e97Initial program 75.0%
Simplified72.8%
sqrt-div85.2%
Applied egg-rr85.3%
if 1.4999999999999999e97 < l Initial program 49.1%
Simplified51.1%
sqrt-div72.7%
Applied egg-rr72.7%
Final simplification80.6%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M_m 2.0) d)) 2.0) -0.5))))
(t_1 (sqrt (/ d h)))
(t_2 (sqrt (- d)))
(t_3 (sqrt (/ d l))))
(if (<= l -5e-190)
(* (* (/ t_2 (sqrt (- h))) t_0) t_3)
(if (<= l -5e-310)
(*
(* (/ t_2 (sqrt (- l))) t_1)
(- 1.0 (* 0.5 (* h (/ (pow (* D (* 0.5 (/ M_m d))) 2.0) l)))))
(if (<= l 1.05e+97)
(* t_3 (* t_0 (/ (sqrt d) (sqrt h))))
(* (/ (sqrt d) (sqrt l)) (* t_0 t_1)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = 1.0 + ((h / l) * (pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5));
double t_1 = sqrt((d / h));
double t_2 = sqrt(-d);
double t_3 = sqrt((d / l));
double tmp;
if (l <= -5e-190) {
tmp = ((t_2 / sqrt(-h)) * t_0) * t_3;
} else if (l <= -5e-310) {
tmp = ((t_2 / sqrt(-l)) * t_1) * (1.0 - (0.5 * (h * (pow((D * (0.5 * (M_m / d))), 2.0) / l))));
} else if (l <= 1.05e+97) {
tmp = t_3 * (t_0 * (sqrt(d) / sqrt(h)));
} else {
tmp = (sqrt(d) / sqrt(l)) * (t_0 * t_1);
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = 1.0d0 + ((h / l) * (((d_1 * ((m_m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))
t_1 = sqrt((d / h))
t_2 = sqrt(-d)
t_3 = sqrt((d / l))
if (l <= (-5d-190)) then
tmp = ((t_2 / sqrt(-h)) * t_0) * t_3
else if (l <= (-5d-310)) then
tmp = ((t_2 / sqrt(-l)) * t_1) * (1.0d0 - (0.5d0 * (h * (((d_1 * (0.5d0 * (m_m / d))) ** 2.0d0) / l))))
else if (l <= 1.05d+97) then
tmp = t_3 * (t_0 * (sqrt(d) / sqrt(h)))
else
tmp = (sqrt(d) / sqrt(l)) * (t_0 * t_1)
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = 1.0 + ((h / l) * (Math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5));
double t_1 = Math.sqrt((d / h));
double t_2 = Math.sqrt(-d);
double t_3 = Math.sqrt((d / l));
double tmp;
if (l <= -5e-190) {
tmp = ((t_2 / Math.sqrt(-h)) * t_0) * t_3;
} else if (l <= -5e-310) {
tmp = ((t_2 / Math.sqrt(-l)) * t_1) * (1.0 - (0.5 * (h * (Math.pow((D * (0.5 * (M_m / d))), 2.0) / l))));
} else if (l <= 1.05e+97) {
tmp = t_3 * (t_0 * (Math.sqrt(d) / Math.sqrt(h)));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(l)) * (t_0 * t_1);
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = 1.0 + ((h / l) * (math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5)) t_1 = math.sqrt((d / h)) t_2 = math.sqrt(-d) t_3 = math.sqrt((d / l)) tmp = 0 if l <= -5e-190: tmp = ((t_2 / math.sqrt(-h)) * t_0) * t_3 elif l <= -5e-310: tmp = ((t_2 / math.sqrt(-l)) * t_1) * (1.0 - (0.5 * (h * (math.pow((D * (0.5 * (M_m / d))), 2.0) / l)))) elif l <= 1.05e+97: tmp = t_3 * (t_0 * (math.sqrt(d) / math.sqrt(h))) else: tmp = (math.sqrt(d) / math.sqrt(l)) * (t_0 * t_1) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5))) t_1 = sqrt(Float64(d / h)) t_2 = sqrt(Float64(-d)) t_3 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -5e-190) tmp = Float64(Float64(Float64(t_2 / sqrt(Float64(-h))) * t_0) * t_3); elseif (l <= -5e-310) tmp = Float64(Float64(Float64(t_2 / sqrt(Float64(-l))) * t_1) * Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(D * Float64(0.5 * Float64(M_m / d))) ^ 2.0) / l))))); elseif (l <= 1.05e+97) tmp = Float64(t_3 * Float64(t_0 * Float64(sqrt(d) / sqrt(h)))); else tmp = Float64(Float64(sqrt(d) / sqrt(l)) * Float64(t_0 * t_1)); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = 1.0 + ((h / l) * (((D * ((M_m / 2.0) / d)) ^ 2.0) * -0.5));
t_1 = sqrt((d / h));
t_2 = sqrt(-d);
t_3 = sqrt((d / l));
tmp = 0.0;
if (l <= -5e-190)
tmp = ((t_2 / sqrt(-h)) * t_0) * t_3;
elseif (l <= -5e-310)
tmp = ((t_2 / sqrt(-l)) * t_1) * (1.0 - (0.5 * (h * (((D * (0.5 * (M_m / d))) ^ 2.0) / l))));
elseif (l <= 1.05e+97)
tmp = t_3 * (t_0 * (sqrt(d) / sqrt(h)));
else
tmp = (sqrt(d) / sqrt(l)) * (t_0 * t_1);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -5e-190], N[(N[(N[(t$95$2 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$3), $MachinePrecision], If[LessEqual[l, -5e-310], N[(N[(N[(t$95$2 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(D * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.05e+97], N[(t$95$3 * N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := 1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \sqrt{-d}\\
t_3 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-190}:\\
\;\;\;\;\left(\frac{t\_2}{\sqrt{-h}} \cdot t\_0\right) \cdot t\_3\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{t\_2}{\sqrt{-\ell}} \cdot t\_1\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(D \cdot \left(0.5 \cdot \frac{M\_m}{d}\right)\right)}^{2}}{\ell}\right)\right)\\
\mathbf{elif}\;\ell \leq 1.05 \cdot 10^{+97}:\\
\;\;\;\;t\_3 \cdot \left(t\_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(t\_0 \cdot t\_1\right)\\
\end{array}
\end{array}
if l < -5.00000000000000034e-190Initial program 62.4%
Simplified61.4%
frac-2neg67.5%
sqrt-div83.6%
Applied egg-rr76.3%
if -5.00000000000000034e-190 < l < -4.999999999999985e-310Initial program 69.5%
Simplified69.4%
associate-*r/73.4%
frac-times73.4%
associate-/l*73.4%
*-commutative73.4%
Applied egg-rr73.4%
*-commutative73.4%
associate-/l*73.4%
associate-*r/73.4%
*-rgt-identity73.4%
times-frac73.4%
metadata-eval73.4%
*-commutative73.4%
associate-/l*70.3%
associate-*l*70.3%
Simplified70.3%
frac-2neg66.3%
sqrt-div71.8%
Applied egg-rr87.4%
if -4.999999999999985e-310 < l < 1.05000000000000006e97Initial program 75.0%
Simplified72.8%
sqrt-div85.2%
Applied egg-rr85.3%
if 1.05000000000000006e97 < l Initial program 49.1%
Simplified51.1%
sqrt-div72.7%
Applied egg-rr72.7%
Final simplification80.2%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))) (t_1 (* D (/ M_m d))))
(if (<= d -5.4e+274)
(* d (- (pow (* h l) -0.5)))
(if (<= d -2.3e-69)
(*
(sqrt (/ d h))
(* t_0 (+ 1.0 (* h (pow (* t_1 (sqrt (/ -0.125 l))) 2.0)))))
(if (<= d -1e-309)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(* t_0 (* -0.125 (* (/ h l) (pow t_1 2.0)))))
(*
t_0
(*
(+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M_m 2.0) d)) 2.0) -0.5)))
(/ (sqrt d) (sqrt h)))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt((d / l));
double t_1 = D * (M_m / d);
double tmp;
if (d <= -5.4e+274) {
tmp = d * -pow((h * l), -0.5);
} else if (d <= -2.3e-69) {
tmp = sqrt((d / h)) * (t_0 * (1.0 + (h * pow((t_1 * sqrt((-0.125 / l))), 2.0))));
} else if (d <= -1e-309) {
tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * (-0.125 * ((h / l) * pow(t_1, 2.0))));
} else {
tmp = t_0 * ((1.0 + ((h / l) * (pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))) * (sqrt(d) / sqrt(h)));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = d_1 * (m_m / d)
if (d <= (-5.4d+274)) then
tmp = d * -((h * l) ** (-0.5d0))
else if (d <= (-2.3d-69)) then
tmp = sqrt((d / h)) * (t_0 * (1.0d0 + (h * ((t_1 * sqrt(((-0.125d0) / l))) ** 2.0d0))))
else if (d <= (-1d-309)) then
tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * ((-0.125d0) * ((h / l) * (t_1 ** 2.0d0))))
else
tmp = t_0 * ((1.0d0 + ((h / l) * (((d_1 * ((m_m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))) * (sqrt(d) / sqrt(h)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.sqrt((d / l));
double t_1 = D * (M_m / d);
double tmp;
if (d <= -5.4e+274) {
tmp = d * -Math.pow((h * l), -0.5);
} else if (d <= -2.3e-69) {
tmp = Math.sqrt((d / h)) * (t_0 * (1.0 + (h * Math.pow((t_1 * Math.sqrt((-0.125 / l))), 2.0))));
} else if (d <= -1e-309) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * (t_0 * (-0.125 * ((h / l) * Math.pow(t_1, 2.0))));
} else {
tmp = t_0 * ((1.0 + ((h / l) * (Math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))) * (Math.sqrt(d) / Math.sqrt(h)));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.sqrt((d / l)) t_1 = D * (M_m / d) tmp = 0 if d <= -5.4e+274: tmp = d * -math.pow((h * l), -0.5) elif d <= -2.3e-69: tmp = math.sqrt((d / h)) * (t_0 * (1.0 + (h * math.pow((t_1 * math.sqrt((-0.125 / l))), 2.0)))) elif d <= -1e-309: tmp = (math.sqrt(-d) / math.sqrt(-h)) * (t_0 * (-0.125 * ((h / l) * math.pow(t_1, 2.0)))) else: tmp = t_0 * ((1.0 + ((h / l) * (math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))) * (math.sqrt(d) / math.sqrt(h))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(D * Float64(M_m / d)) tmp = 0.0 if (d <= -5.4e+274) tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5))); elseif (d <= -2.3e-69) tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * Float64(1.0 + Float64(h * (Float64(t_1 * sqrt(Float64(-0.125 / l))) ^ 2.0))))); elseif (d <= -1e-309) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(t_0 * Float64(-0.125 * Float64(Float64(h / l) * (t_1 ^ 2.0))))); else tmp = Float64(t_0 * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5))) * Float64(sqrt(d) / sqrt(h)))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = sqrt((d / l));
t_1 = D * (M_m / d);
tmp = 0.0;
if (d <= -5.4e+274)
tmp = d * -((h * l) ^ -0.5);
elseif (d <= -2.3e-69)
tmp = sqrt((d / h)) * (t_0 * (1.0 + (h * ((t_1 * sqrt((-0.125 / l))) ^ 2.0))));
elseif (d <= -1e-309)
tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * (-0.125 * ((h / l) * (t_1 ^ 2.0))));
else
tmp = t_0 * ((1.0 + ((h / l) * (((D * ((M_m / 2.0) / d)) ^ 2.0) * -0.5))) * (sqrt(d) / sqrt(h)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -5.4e+274], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -2.3e-69], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(1.0 + N[(h * N[Power[N[(t$95$1 * N[Sqrt[N[(-0.125 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1e-309], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := D \cdot \frac{M\_m}{d}\\
\mathbf{if}\;d \leq -5.4 \cdot 10^{+274}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{elif}\;d \leq -2.3 \cdot 10^{-69}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t\_0 \cdot \left(1 + h \cdot {\left(t\_1 \cdot \sqrt{\frac{-0.125}{\ell}}\right)}^{2}\right)\right)\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(t\_0 \cdot \left(-0.125 \cdot \left(\frac{h}{\ell} \cdot {t\_1}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\right) \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\end{array}
\end{array}
if d < -5.4000000000000003e274Initial program 40.6%
Simplified41.3%
Taylor expanded in d around inf 10.2%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt89.7%
neg-mul-189.7%
unpow-189.7%
metadata-eval89.7%
pow-sqr89.8%
rem-sqrt-square89.8%
rem-square-sqrt89.1%
fabs-sqr89.1%
rem-square-sqrt89.8%
Simplified89.8%
if -5.4000000000000003e274 < d < -2.3000000000000001e-69Initial program 81.6%
Simplified80.3%
fma-undefine80.3%
associate-*r*80.3%
associate-*r/80.3%
Applied egg-rr80.3%
Taylor expanded in M around 0 64.7%
associate-*r/64.7%
associate-*r*65.3%
associate-*r*65.3%
associate-*l/66.7%
associate-*r/66.7%
*-commutative66.7%
associate-*r/66.7%
*-commutative66.7%
times-frac71.3%
*-commutative71.3%
associate-/l*71.3%
unpow271.3%
unpow271.3%
unpow271.3%
times-frac75.7%
swap-sqr81.9%
unpow281.9%
Simplified81.9%
add-sqr-sqrt81.9%
pow281.9%
*-commutative81.9%
associate-*r/81.9%
sqrt-prod81.9%
sqrt-pow184.7%
metadata-eval84.7%
pow184.7%
Applied egg-rr84.7%
if -2.3000000000000001e-69 < d < -1.000000000000002e-309Initial program 44.5%
Simplified44.4%
Taylor expanded in M around inf 26.9%
associate-*r*29.1%
times-frac27.3%
*-commutative27.3%
associate-/l*25.1%
unpow225.1%
unpow225.1%
unpow225.1%
times-frac31.9%
swap-sqr40.3%
unpow240.3%
associate-*r/40.3%
*-commutative40.3%
associate-/l*38.3%
Simplified38.3%
frac-2neg50.6%
sqrt-div77.0%
Applied egg-rr62.4%
if -1.000000000000002e-309 < d Initial program 66.4%
Simplified65.6%
sqrt-div75.3%
Applied egg-rr75.3%
Final simplification76.0%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (/ d h))) (t_1 (sqrt (/ d l))) (t_2 (* D (/ M_m d))))
(if (<= d -5.7e+262)
(* d (- (pow (* h l) -0.5)))
(if (<= d -9.2e-70)
(* t_0 (* t_1 (+ 1.0 (* h (pow (* t_2 (sqrt (/ -0.125 l))) 2.0)))))
(if (<= d -1e-309)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(* t_1 (* -0.125 (* (/ h l) (pow t_2 2.0)))))
(if (<= d 2.35e-239)
(*
-0.125
(* (pow (cbrt (* D M_m)) 6.0) (/ (sqrt (/ h (pow l 3.0))) d)))
(*
(- 1.0 (* 0.5 (* h (/ (pow (* D (* 0.5 (/ M_m d))) 2.0) l))))
(* t_0 t_1))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt((d / h));
double t_1 = sqrt((d / l));
double t_2 = D * (M_m / d);
double tmp;
if (d <= -5.7e+262) {
tmp = d * -pow((h * l), -0.5);
} else if (d <= -9.2e-70) {
tmp = t_0 * (t_1 * (1.0 + (h * pow((t_2 * sqrt((-0.125 / l))), 2.0))));
} else if (d <= -1e-309) {
tmp = (sqrt(-d) / sqrt(-h)) * (t_1 * (-0.125 * ((h / l) * pow(t_2, 2.0))));
} else if (d <= 2.35e-239) {
tmp = -0.125 * (pow(cbrt((D * M_m)), 6.0) * (sqrt((h / pow(l, 3.0))) / d));
} else {
tmp = (1.0 - (0.5 * (h * (pow((D * (0.5 * (M_m / d))), 2.0) / l)))) * (t_0 * t_1);
}
return tmp;
}
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.sqrt((d / h));
double t_1 = Math.sqrt((d / l));
double t_2 = D * (M_m / d);
double tmp;
if (d <= -5.7e+262) {
tmp = d * -Math.pow((h * l), -0.5);
} else if (d <= -9.2e-70) {
tmp = t_0 * (t_1 * (1.0 + (h * Math.pow((t_2 * Math.sqrt((-0.125 / l))), 2.0))));
} else if (d <= -1e-309) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * (t_1 * (-0.125 * ((h / l) * Math.pow(t_2, 2.0))));
} else if (d <= 2.35e-239) {
tmp = -0.125 * (Math.pow(Math.cbrt((D * M_m)), 6.0) * (Math.sqrt((h / Math.pow(l, 3.0))) / d));
} else {
tmp = (1.0 - (0.5 * (h * (Math.pow((D * (0.5 * (M_m / d))), 2.0) / l)))) * (t_0 * t_1);
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(d / h)) t_1 = sqrt(Float64(d / l)) t_2 = Float64(D * Float64(M_m / d)) tmp = 0.0 if (d <= -5.7e+262) tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5))); elseif (d <= -9.2e-70) tmp = Float64(t_0 * Float64(t_1 * Float64(1.0 + Float64(h * (Float64(t_2 * sqrt(Float64(-0.125 / l))) ^ 2.0))))); elseif (d <= -1e-309) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(t_1 * Float64(-0.125 * Float64(Float64(h / l) * (t_2 ^ 2.0))))); elseif (d <= 2.35e-239) tmp = Float64(-0.125 * Float64((cbrt(Float64(D * M_m)) ^ 6.0) * Float64(sqrt(Float64(h / (l ^ 3.0))) / d))); else tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(D * Float64(0.5 * Float64(M_m / d))) ^ 2.0) / l)))) * Float64(t_0 * t_1)); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -5.7e+262], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -9.2e-70], N[(t$95$0 * N[(t$95$1 * N[(1.0 + N[(h * N[Power[N[(t$95$2 * N[Sqrt[N[(-0.125 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1e-309], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[t$95$2, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.35e-239], N[(-0.125 * N[(N[Power[N[Power[N[(D * M$95$m), $MachinePrecision], 1/3], $MachinePrecision], 6.0], $MachinePrecision] * N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(D * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := D \cdot \frac{M\_m}{d}\\
\mathbf{if}\;d \leq -5.7 \cdot 10^{+262}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{elif}\;d \leq -9.2 \cdot 10^{-70}:\\
\;\;\;\;t\_0 \cdot \left(t\_1 \cdot \left(1 + h \cdot {\left(t\_2 \cdot \sqrt{\frac{-0.125}{\ell}}\right)}^{2}\right)\right)\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(t\_1 \cdot \left(-0.125 \cdot \left(\frac{h}{\ell} \cdot {t\_2}^{2}\right)\right)\right)\\
\mathbf{elif}\;d \leq 2.35 \cdot 10^{-239}:\\
\;\;\;\;-0.125 \cdot \left({\left(\sqrt[3]{D \cdot M\_m}\right)}^{6} \cdot \frac{\sqrt{\frac{h}{{\ell}^{3}}}}{d}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(D \cdot \left(0.5 \cdot \frac{M\_m}{d}\right)\right)}^{2}}{\ell}\right)\right) \cdot \left(t\_0 \cdot t\_1\right)\\
\end{array}
\end{array}
if d < -5.7000000000000002e262Initial program 40.6%
Simplified41.3%
Taylor expanded in d around inf 10.2%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt89.7%
neg-mul-189.7%
unpow-189.7%
metadata-eval89.7%
pow-sqr89.8%
rem-sqrt-square89.8%
rem-square-sqrt89.1%
fabs-sqr89.1%
rem-square-sqrt89.8%
Simplified89.8%
if -5.7000000000000002e262 < d < -9.20000000000000002e-70Initial program 81.6%
Simplified80.3%
fma-undefine80.3%
associate-*r*80.3%
associate-*r/80.3%
Applied egg-rr80.3%
Taylor expanded in M around 0 64.7%
associate-*r/64.7%
associate-*r*65.3%
associate-*r*65.3%
associate-*l/66.7%
associate-*r/66.7%
*-commutative66.7%
associate-*r/66.7%
*-commutative66.7%
times-frac71.3%
*-commutative71.3%
associate-/l*71.3%
unpow271.3%
unpow271.3%
unpow271.3%
times-frac75.7%
swap-sqr81.9%
unpow281.9%
Simplified81.9%
add-sqr-sqrt81.9%
pow281.9%
*-commutative81.9%
associate-*r/81.9%
sqrt-prod81.9%
sqrt-pow184.7%
metadata-eval84.7%
pow184.7%
Applied egg-rr84.7%
if -9.20000000000000002e-70 < d < -1.000000000000002e-309Initial program 44.5%
Simplified44.4%
Taylor expanded in M around inf 26.9%
associate-*r*29.1%
times-frac27.3%
*-commutative27.3%
associate-/l*25.1%
unpow225.1%
unpow225.1%
unpow225.1%
times-frac31.9%
swap-sqr40.3%
unpow240.3%
associate-*r/40.3%
*-commutative40.3%
associate-/l*38.3%
Simplified38.3%
frac-2neg50.6%
sqrt-div77.0%
Applied egg-rr62.4%
if -1.000000000000002e-309 < d < 2.3500000000000001e-239Initial program 7.0%
Simplified7.0%
Taylor expanded in M around inf 5.9%
associate-*r*5.9%
times-frac6.2%
*-commutative6.2%
associate-/l*6.2%
unpow26.2%
unpow26.2%
unpow26.2%
times-frac7.0%
swap-sqr7.0%
unpow27.0%
associate-*r/7.0%
*-commutative7.0%
associate-/l*7.0%
Simplified7.0%
frac-2neg7.0%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around 0 54.5%
associate-*l/54.4%
associate-/l*54.4%
unpow254.4%
unpow254.4%
swap-sqr60.6%
rem-cube-cbrt60.6%
rem-cube-cbrt60.5%
pow-sqr60.5%
metadata-eval60.5%
Simplified60.5%
if 2.3500000000000001e-239 < d Initial program 75.1%
Simplified74.2%
associate-*r/76.9%
frac-times77.3%
associate-/l*76.9%
*-commutative76.9%
Applied egg-rr76.9%
*-commutative76.9%
associate-/l*77.8%
associate-*r/78.1%
*-rgt-identity78.1%
times-frac78.1%
metadata-eval78.1%
*-commutative78.1%
associate-/l*77.9%
associate-*l*77.9%
Simplified77.9%
Final simplification76.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 (sqrt (/ d l))))
(if (<= h -1e-311)
(*
(* (/ (sqrt (- d)) (sqrt (- h))) t_0)
(- 1.0 (* 0.5 (* h (/ (pow (* (/ M_m 2.0) (/ D d)) 2.0) l)))))
(if (<= h 9.2e+51)
(*
(/ (sqrt d) (sqrt l))
(*
(+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M_m 2.0) d)) 2.0) -0.5)))
(sqrt (/ d h))))
(*
(/ (sqrt d) (sqrt h))
(*
t_0
(+ 1.0 (* (pow (* (/ D d) (* M_m 0.5)) 2.0) (/ (* h -0.5) l)))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (h <= -1e-311) {
tmp = ((sqrt(-d) / sqrt(-h)) * t_0) * (1.0 - (0.5 * (h * (pow(((M_m / 2.0) * (D / d)), 2.0) / l))));
} else if (h <= 9.2e+51) {
tmp = (sqrt(d) / sqrt(l)) * ((1.0 + ((h / l) * (pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))) * sqrt((d / h)));
} else {
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 + (pow(((D / d) * (M_m * 0.5)), 2.0) * ((h * -0.5) / l))));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / l))
if (h <= (-1d-311)) then
tmp = ((sqrt(-d) / sqrt(-h)) * t_0) * (1.0d0 - (0.5d0 * (h * ((((m_m / 2.0d0) * (d_1 / d)) ** 2.0d0) / l))))
else if (h <= 9.2d+51) then
tmp = (sqrt(d) / sqrt(l)) * ((1.0d0 + ((h / l) * (((d_1 * ((m_m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))) * sqrt((d / h)))
else
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0d0 + ((((d_1 / d) * (m_m * 0.5d0)) ** 2.0d0) * ((h * (-0.5d0)) / l))))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.sqrt((d / l));
double tmp;
if (h <= -1e-311) {
tmp = ((Math.sqrt(-d) / Math.sqrt(-h)) * t_0) * (1.0 - (0.5 * (h * (Math.pow(((M_m / 2.0) * (D / d)), 2.0) / l))));
} else if (h <= 9.2e+51) {
tmp = (Math.sqrt(d) / Math.sqrt(l)) * ((1.0 + ((h / l) * (Math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))) * Math.sqrt((d / h)));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (t_0 * (1.0 + (Math.pow(((D / d) * (M_m * 0.5)), 2.0) * ((h * -0.5) / l))));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.sqrt((d / l)) tmp = 0 if h <= -1e-311: tmp = ((math.sqrt(-d) / math.sqrt(-h)) * t_0) * (1.0 - (0.5 * (h * (math.pow(((M_m / 2.0) * (D / d)), 2.0) / l)))) elif h <= 9.2e+51: tmp = (math.sqrt(d) / math.sqrt(l)) * ((1.0 + ((h / l) * (math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))) * math.sqrt((d / h))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * (t_0 * (1.0 + (math.pow(((D / d) * (M_m * 0.5)), 2.0) * ((h * -0.5) / l)))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (h <= -1e-311) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0) * Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0) / l))))); elseif (h <= 9.2e+51) tmp = Float64(Float64(sqrt(d) / sqrt(l)) * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5))) * sqrt(Float64(d / h)))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_0 * Float64(1.0 + Float64((Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0) * Float64(Float64(h * -0.5) / l))))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = sqrt((d / l));
tmp = 0.0;
if (h <= -1e-311)
tmp = ((sqrt(-d) / sqrt(-h)) * t_0) * (1.0 - (0.5 * (h * ((((M_m / 2.0) * (D / d)) ^ 2.0) / l))));
elseif (h <= 9.2e+51)
tmp = (sqrt(d) / sqrt(l)) * ((1.0 + ((h / l) * (((D * ((M_m / 2.0) / d)) ^ 2.0) * -0.5))) * sqrt((d / h)));
else
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 + ((((D / d) * (M_m * 0.5)) ^ 2.0) * ((h * -0.5) / l))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -1e-311], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 9.2e+51], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 + N[(N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h * -0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;h \leq -1 \cdot 10^{-311}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_0\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{elif}\;h \leq 9.2 \cdot 10^{+51}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\right) \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_0 \cdot \left(1 + {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2} \cdot \frac{h \cdot -0.5}{\ell}\right)\right)\\
\end{array}
\end{array}
if h < -9.99999999999948e-312Initial program 64.2%
Simplified64.2%
associate-*r/65.4%
frac-times65.3%
associate-/l*65.4%
*-commutative65.4%
Applied egg-rr65.4%
*-commutative65.4%
associate-/l*65.4%
associate-*r/65.4%
*-rgt-identity65.4%
times-frac65.4%
metadata-eval65.4%
*-commutative65.4%
associate-/l*64.5%
associate-*l*64.5%
Simplified64.5%
*-un-lft-identity64.5%
associate-*l/64.5%
metadata-eval64.5%
div-inv64.5%
associate-/l/64.5%
Applied egg-rr64.5%
*-lft-identity64.5%
associate-*r/65.4%
times-frac65.4%
Simplified65.4%
frac-2neg68.6%
sqrt-div82.2%
Applied egg-rr77.2%
if -9.99999999999948e-312 < h < 9.2000000000000002e51Initial program 71.8%
Simplified71.8%
sqrt-div85.0%
Applied egg-rr85.0%
if 9.2000000000000002e51 < h Initial program 59.8%
Simplified59.6%
fma-undefine59.6%
associate-*r*59.6%
associate-*r/59.6%
Applied egg-rr59.6%
sqrt-div76.5%
Applied egg-rr76.5%
Final simplification79.3%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M_m 2.0) d)) 2.0) -0.5))))
(t_1 (sqrt (/ d l))))
(if (<= h -1e-311)
(* (* (/ (sqrt (- d)) (sqrt (- h))) t_0) t_1)
(if (<= h 5.5e+50)
(* (/ (sqrt d) (sqrt l)) (* t_0 (sqrt (/ d h))))
(*
(/ (sqrt d) (sqrt h))
(*
t_1
(+ 1.0 (* (pow (* (/ D d) (* M_m 0.5)) 2.0) (/ (* h -0.5) l)))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = 1.0 + ((h / l) * (pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5));
double t_1 = sqrt((d / l));
double tmp;
if (h <= -1e-311) {
tmp = ((sqrt(-d) / sqrt(-h)) * t_0) * t_1;
} else if (h <= 5.5e+50) {
tmp = (sqrt(d) / sqrt(l)) * (t_0 * sqrt((d / h)));
} else {
tmp = (sqrt(d) / sqrt(h)) * (t_1 * (1.0 + (pow(((D / d) * (M_m * 0.5)), 2.0) * ((h * -0.5) / l))));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + ((h / l) * (((d_1 * ((m_m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))
t_1 = sqrt((d / l))
if (h <= (-1d-311)) then
tmp = ((sqrt(-d) / sqrt(-h)) * t_0) * t_1
else if (h <= 5.5d+50) then
tmp = (sqrt(d) / sqrt(l)) * (t_0 * sqrt((d / h)))
else
tmp = (sqrt(d) / sqrt(h)) * (t_1 * (1.0d0 + ((((d_1 / d) * (m_m * 0.5d0)) ** 2.0d0) * ((h * (-0.5d0)) / l))))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = 1.0 + ((h / l) * (Math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5));
double t_1 = Math.sqrt((d / l));
double tmp;
if (h <= -1e-311) {
tmp = ((Math.sqrt(-d) / Math.sqrt(-h)) * t_0) * t_1;
} else if (h <= 5.5e+50) {
tmp = (Math.sqrt(d) / Math.sqrt(l)) * (t_0 * Math.sqrt((d / h)));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (t_1 * (1.0 + (Math.pow(((D / d) * (M_m * 0.5)), 2.0) * ((h * -0.5) / l))));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = 1.0 + ((h / l) * (math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5)) t_1 = math.sqrt((d / l)) tmp = 0 if h <= -1e-311: tmp = ((math.sqrt(-d) / math.sqrt(-h)) * t_0) * t_1 elif h <= 5.5e+50: tmp = (math.sqrt(d) / math.sqrt(l)) * (t_0 * math.sqrt((d / h))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * (t_1 * (1.0 + (math.pow(((D / d) * (M_m * 0.5)), 2.0) * ((h * -0.5) / l)))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5))) t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (h <= -1e-311) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0) * t_1); elseif (h <= 5.5e+50) tmp = Float64(Float64(sqrt(d) / sqrt(l)) * Float64(t_0 * sqrt(Float64(d / h)))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_1 * Float64(1.0 + Float64((Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0) * Float64(Float64(h * -0.5) / l))))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = 1.0 + ((h / l) * (((D * ((M_m / 2.0) / d)) ^ 2.0) * -0.5));
t_1 = sqrt((d / l));
tmp = 0.0;
if (h <= -1e-311)
tmp = ((sqrt(-d) / sqrt(-h)) * t_0) * t_1;
elseif (h <= 5.5e+50)
tmp = (sqrt(d) / sqrt(l)) * (t_0 * sqrt((d / h)));
else
tmp = (sqrt(d) / sqrt(h)) * (t_1 * (1.0 + ((((D / d) * (M_m * 0.5)) ^ 2.0) * ((h * -0.5) / l))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -1e-311], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[h, 5.5e+50], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * N[(1.0 + N[(N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h * -0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := 1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;h \leq -1 \cdot 10^{-311}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_0\right) \cdot t\_1\\
\mathbf{elif}\;h \leq 5.5 \cdot 10^{+50}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(t\_0 \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_1 \cdot \left(1 + {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2} \cdot \frac{h \cdot -0.5}{\ell}\right)\right)\\
\end{array}
\end{array}
if h < -9.99999999999948e-312Initial program 64.2%
Simplified62.7%
frac-2neg68.6%
sqrt-div82.2%
Applied egg-rr75.4%
if -9.99999999999948e-312 < h < 5.4999999999999998e50Initial program 71.8%
Simplified71.8%
sqrt-div85.0%
Applied egg-rr85.0%
if 5.4999999999999998e50 < h Initial program 59.8%
Simplified59.6%
fma-undefine59.6%
associate-*r*59.6%
associate-*r/59.6%
Applied egg-rr59.6%
sqrt-div76.5%
Applied egg-rr76.5%
Final simplification78.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
(let* ((t_0 (sqrt (/ d l))))
(if (<= h -1e-311)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(* t_0 (+ 1.0 (* h (* (/ -0.125 l) (pow (/ (* D M_m) d) 2.0))))))
(if (<= h 9e+51)
(*
(/ (sqrt d) (sqrt l))
(*
(+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M_m 2.0) d)) 2.0) -0.5)))
(sqrt (/ d h))))
(*
(/ (sqrt d) (sqrt h))
(*
t_0
(+ 1.0 (* (pow (* (/ D d) (* M_m 0.5)) 2.0) (/ (* h -0.5) l)))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (h <= -1e-311) {
tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * (1.0 + (h * ((-0.125 / l) * pow(((D * M_m) / d), 2.0)))));
} else if (h <= 9e+51) {
tmp = (sqrt(d) / sqrt(l)) * ((1.0 + ((h / l) * (pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))) * sqrt((d / h)));
} else {
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 + (pow(((D / d) * (M_m * 0.5)), 2.0) * ((h * -0.5) / l))));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / l))
if (h <= (-1d-311)) then
tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * (1.0d0 + (h * (((-0.125d0) / l) * (((d_1 * m_m) / d) ** 2.0d0)))))
else if (h <= 9d+51) then
tmp = (sqrt(d) / sqrt(l)) * ((1.0d0 + ((h / l) * (((d_1 * ((m_m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))) * sqrt((d / h)))
else
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0d0 + ((((d_1 / d) * (m_m * 0.5d0)) ** 2.0d0) * ((h * (-0.5d0)) / l))))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.sqrt((d / l));
double tmp;
if (h <= -1e-311) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * (t_0 * (1.0 + (h * ((-0.125 / l) * Math.pow(((D * M_m) / d), 2.0)))));
} else if (h <= 9e+51) {
tmp = (Math.sqrt(d) / Math.sqrt(l)) * ((1.0 + ((h / l) * (Math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))) * Math.sqrt((d / h)));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (t_0 * (1.0 + (Math.pow(((D / d) * (M_m * 0.5)), 2.0) * ((h * -0.5) / l))));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.sqrt((d / l)) tmp = 0 if h <= -1e-311: tmp = (math.sqrt(-d) / math.sqrt(-h)) * (t_0 * (1.0 + (h * ((-0.125 / l) * math.pow(((D * M_m) / d), 2.0))))) elif h <= 9e+51: tmp = (math.sqrt(d) / math.sqrt(l)) * ((1.0 + ((h / l) * (math.pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))) * math.sqrt((d / h))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * (t_0 * (1.0 + (math.pow(((D / d) * (M_m * 0.5)), 2.0) * ((h * -0.5) / l)))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (h <= -1e-311) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(t_0 * Float64(1.0 + Float64(h * Float64(Float64(-0.125 / l) * (Float64(Float64(D * M_m) / d) ^ 2.0)))))); elseif (h <= 9e+51) tmp = Float64(Float64(sqrt(d) / sqrt(l)) * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5))) * sqrt(Float64(d / h)))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_0 * Float64(1.0 + Float64((Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0) * Float64(Float64(h * -0.5) / l))))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = sqrt((d / l));
tmp = 0.0;
if (h <= -1e-311)
tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * (1.0 + (h * ((-0.125 / l) * (((D * M_m) / d) ^ 2.0)))));
elseif (h <= 9e+51)
tmp = (sqrt(d) / sqrt(l)) * ((1.0 + ((h / l) * (((D * ((M_m / 2.0) / d)) ^ 2.0) * -0.5))) * sqrt((d / h)));
else
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 + ((((D / d) * (M_m * 0.5)) ^ 2.0) * ((h * -0.5) / l))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -1e-311], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 + N[(h * N[(N[(-0.125 / l), $MachinePrecision] * N[Power[N[(N[(D * M$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 9e+51], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 + N[(N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h * -0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;h \leq -1 \cdot 10^{-311}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(t\_0 \cdot \left(1 + h \cdot \left(\frac{-0.125}{\ell} \cdot {\left(\frac{D \cdot M\_m}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{elif}\;h \leq 9 \cdot 10^{+51}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\right) \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_0 \cdot \left(1 + {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2} \cdot \frac{h \cdot -0.5}{\ell}\right)\right)\\
\end{array}
\end{array}
if h < -9.99999999999948e-312Initial program 64.2%
Simplified63.6%
fma-undefine63.6%
associate-*r*63.6%
associate-*r/63.6%
Applied egg-rr63.6%
Taylor expanded in M around 0 48.5%
associate-*r/48.5%
associate-*r*50.5%
associate-*r*50.5%
associate-*l/49.8%
associate-*r/49.8%
*-commutative49.8%
associate-*r/49.8%
*-commutative49.8%
times-frac53.0%
*-commutative53.0%
associate-/l*52.2%
unpow252.2%
unpow252.2%
unpow252.2%
times-frac58.8%
swap-sqr64.7%
unpow264.7%
Simplified64.7%
frac-2neg68.6%
sqrt-div82.2%
Applied egg-rr75.8%
if -9.99999999999948e-312 < h < 8.9999999999999999e51Initial program 71.8%
Simplified71.8%
sqrt-div85.0%
Applied egg-rr85.0%
if 8.9999999999999999e51 < h Initial program 59.8%
Simplified59.6%
fma-undefine59.6%
associate-*r*59.6%
associate-*r/59.6%
Applied egg-rr59.6%
sqrt-div76.5%
Applied egg-rr76.5%
Final simplification78.6%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l -1.55e+199)
(* d (- (pow (* h l) -0.5)))
(if (<= l 1.9e+135)
(*
(sqrt (/ d h))
(*
(+ 1.0 (* h (* (/ -0.125 l) (pow (/ (* D M_m) d) 2.0))))
(/ 1.0 (sqrt (/ l d)))))
(* d (* (pow l -0.5) (pow h -0.5))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -1.55e+199) {
tmp = d * -pow((h * l), -0.5);
} else if (l <= 1.9e+135) {
tmp = sqrt((d / h)) * ((1.0 + (h * ((-0.125 / l) * pow(((D * M_m) / d), 2.0)))) * (1.0 / sqrt((l / d))));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-1.55d+199)) then
tmp = d * -((h * l) ** (-0.5d0))
else if (l <= 1.9d+135) then
tmp = sqrt((d / h)) * ((1.0d0 + (h * (((-0.125d0) / l) * (((d_1 * m_m) / d) ** 2.0d0)))) * (1.0d0 / sqrt((l / d))))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -1.55e+199) {
tmp = d * -Math.pow((h * l), -0.5);
} else if (l <= 1.9e+135) {
tmp = Math.sqrt((d / h)) * ((1.0 + (h * ((-0.125 / l) * Math.pow(((D * M_m) / d), 2.0)))) * (1.0 / Math.sqrt((l / d))));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -1.55e+199: tmp = d * -math.pow((h * l), -0.5) elif l <= 1.9e+135: tmp = math.sqrt((d / h)) * ((1.0 + (h * ((-0.125 / l) * math.pow(((D * M_m) / d), 2.0)))) * (1.0 / math.sqrt((l / d)))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -1.55e+199) tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5))); elseif (l <= 1.9e+135) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(1.0 + Float64(h * Float64(Float64(-0.125 / l) * (Float64(Float64(D * M_m) / d) ^ 2.0)))) * Float64(1.0 / sqrt(Float64(l / d))))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= -1.55e+199)
tmp = d * -((h * l) ^ -0.5);
elseif (l <= 1.9e+135)
tmp = sqrt((d / h)) * ((1.0 + (h * ((-0.125 / l) * (((D * M_m) / d) ^ 2.0)))) * (1.0 / sqrt((l / d))));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -1.55e+199], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 1.9e+135], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 + N[(h * N[(N[(-0.125 / l), $MachinePrecision] * N[Power[N[(N[(D * M$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $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.55 \cdot 10^{+199}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{elif}\;\ell \leq 1.9 \cdot 10^{+135}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\left(1 + h \cdot \left(\frac{-0.125}{\ell} \cdot {\left(\frac{D \cdot M\_m}{d}\right)}^{2}\right)\right) \cdot \frac{1}{\sqrt{\frac{\ell}{d}}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -1.54999999999999993e199Initial program 53.3%
Simplified53.7%
Taylor expanded in d around inf 17.8%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt79.3%
neg-mul-179.3%
unpow-179.3%
metadata-eval79.3%
pow-sqr79.4%
rem-sqrt-square79.4%
rem-square-sqrt78.9%
fabs-sqr78.9%
rem-square-sqrt79.4%
Simplified79.4%
if -1.54999999999999993e199 < l < 1.9000000000000001e135Initial program 70.0%
Simplified68.5%
fma-undefine68.5%
associate-*r*68.5%
associate-*r/68.5%
Applied egg-rr68.5%
Taylor expanded in M around 0 51.1%
associate-*r/51.1%
associate-*r*52.9%
associate-*r*52.9%
associate-*l/52.5%
associate-*r/52.5%
*-commutative52.5%
associate-*r/52.5%
*-commutative52.5%
times-frac54.5%
*-commutative54.5%
associate-/l*54.5%
unpow254.5%
unpow254.5%
unpow254.5%
times-frac64.7%
swap-sqr70.8%
unpow270.8%
Simplified71.4%
clear-num71.4%
sqrt-div72.0%
metadata-eval72.0%
Applied egg-rr72.0%
if 1.9000000000000001e135 < l Initial program 47.6%
Simplified49.9%
pow149.9%
associate-*r*49.9%
sqrt-unprod40.7%
associate-*r*40.7%
associate-*r/40.7%
Applied egg-rr40.7%
Simplified35.7%
Taylor expanded in d around inf 45.3%
unpow-145.3%
metadata-eval45.3%
pow-sqr45.3%
rem-sqrt-square45.3%
rem-square-sqrt45.1%
fabs-sqr45.1%
rem-square-sqrt45.3%
Simplified45.3%
*-commutative45.3%
unpow-prod-down67.1%
Applied egg-rr67.1%
Final simplification71.8%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l -1.4e+196)
(* d (- (pow (* h l) -0.5)))
(if (<= l 3.3e+137)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(+ 1.0 (* h (* (/ -0.125 l) (pow (/ (* D M_m) d) 2.0))))))
(* d (* (pow l -0.5) (pow h -0.5))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -1.4e+196) {
tmp = d * -pow((h * l), -0.5);
} else if (l <= 3.3e+137) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (h * ((-0.125 / l) * pow(((D * M_m) / d), 2.0)))));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-1.4d+196)) then
tmp = d * -((h * l) ** (-0.5d0))
else if (l <= 3.3d+137) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 + (h * (((-0.125d0) / l) * (((d_1 * m_m) / d) ** 2.0d0)))))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -1.4e+196) {
tmp = d * -Math.pow((h * l), -0.5);
} else if (l <= 3.3e+137) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 + (h * ((-0.125 / l) * Math.pow(((D * M_m) / d), 2.0)))));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -1.4e+196: tmp = d * -math.pow((h * l), -0.5) elif l <= 3.3e+137: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 + (h * ((-0.125 / l) * math.pow(((D * M_m) / d), 2.0))))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -1.4e+196) tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5))); elseif (l <= 3.3e+137) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64(Float64(-0.125 / l) * (Float64(Float64(D * M_m) / d) ^ 2.0)))))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= -1.4e+196)
tmp = d * -((h * l) ^ -0.5);
elseif (l <= 3.3e+137)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (h * ((-0.125 / l) * (((D * M_m) / d) ^ 2.0)))));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -1.4e+196], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 3.3e+137], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(N[(-0.125 / l), $MachinePrecision] * N[Power[N[(N[(D * M$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $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.4 \cdot 10^{+196}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{elif}\;\ell \leq 3.3 \cdot 10^{+137}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left(\frac{-0.125}{\ell} \cdot {\left(\frac{D \cdot M\_m}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -1.4000000000000001e196Initial program 53.3%
Simplified53.7%
Taylor expanded in d around inf 17.8%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt79.3%
neg-mul-179.3%
unpow-179.3%
metadata-eval79.3%
pow-sqr79.4%
rem-sqrt-square79.4%
rem-square-sqrt78.9%
fabs-sqr78.9%
rem-square-sqrt79.4%
Simplified79.4%
if -1.4000000000000001e196 < l < 3.30000000000000003e137Initial program 70.0%
Simplified68.5%
fma-undefine68.5%
associate-*r*68.5%
associate-*r/68.5%
Applied egg-rr68.5%
Taylor expanded in M around 0 51.1%
associate-*r/51.1%
associate-*r*52.9%
associate-*r*52.9%
associate-*l/52.5%
associate-*r/52.5%
*-commutative52.5%
associate-*r/52.5%
*-commutative52.5%
times-frac54.5%
*-commutative54.5%
associate-/l*54.5%
unpow254.5%
unpow254.5%
unpow254.5%
times-frac64.7%
swap-sqr70.8%
unpow270.8%
Simplified71.4%
if 3.30000000000000003e137 < l Initial program 47.6%
Simplified49.9%
pow149.9%
associate-*r*49.9%
sqrt-unprod40.7%
associate-*r*40.7%
associate-*r/40.7%
Applied egg-rr40.7%
Simplified35.7%
Taylor expanded in d around inf 45.3%
unpow-145.3%
metadata-eval45.3%
pow-sqr45.3%
rem-sqrt-square45.3%
rem-square-sqrt45.1%
fabs-sqr45.1%
rem-square-sqrt45.3%
Simplified45.3%
*-commutative45.3%
unpow-prod-down67.1%
Applied egg-rr67.1%
Final simplification71.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 -5.2e+184)
(* d (- (pow (* h l) -0.5)))
(if (<= l 5.7e+25)
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (/ (* -0.5 (* h (pow (/ (* D (* M_m 0.5)) d) 2.0))) l)))
(* d (* (pow l -0.5) (pow h -0.5))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -5.2e+184) {
tmp = d * -pow((h * l), -0.5);
} else if (l <= 5.7e+25) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + ((-0.5 * (h * pow(((D * (M_m * 0.5)) / d), 2.0))) / l));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-5.2d+184)) then
tmp = d * -((h * l) ** (-0.5d0))
else if (l <= 5.7d+25) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + (((-0.5d0) * (h * (((d_1 * (m_m * 0.5d0)) / d) ** 2.0d0))) / l))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -5.2e+184) {
tmp = d * -Math.pow((h * l), -0.5);
} else if (l <= 5.7e+25) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + ((-0.5 * (h * Math.pow(((D * (M_m * 0.5)) / d), 2.0))) / l));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -5.2e+184: tmp = d * -math.pow((h * l), -0.5) elif l <= 5.7e+25: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + ((-0.5 * (h * math.pow(((D * (M_m * 0.5)) / d), 2.0))) / l)) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -5.2e+184) tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5))); elseif (l <= 5.7e+25) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(Float64(-0.5 * Float64(h * (Float64(Float64(D * Float64(M_m * 0.5)) / d) ^ 2.0))) / l))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= -5.2e+184)
tmp = d * -((h * l) ^ -0.5);
elseif (l <= 5.7e+25)
tmp = sqrt(((d / h) * (d / l))) * (1.0 + ((-0.5 * (h * (((D * (M_m * 0.5)) / d) ^ 2.0))) / l));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -5.2e+184], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 5.7e+25], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(-0.5 * N[(h * N[Power[N[(N[(D * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $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 -5.2 \cdot 10^{+184}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{elif}\;\ell \leq 5.7 \cdot 10^{+25}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \frac{-0.5 \cdot \left(h \cdot {\left(\frac{D \cdot \left(M\_m \cdot 0.5\right)}{d}\right)}^{2}\right)}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -5.19999999999999986e184Initial program 50.9%
Simplified51.3%
Taylor expanded in d around inf 17.1%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt75.4%
neg-mul-175.4%
unpow-175.4%
metadata-eval75.4%
pow-sqr75.5%
rem-sqrt-square75.5%
rem-square-sqrt75.0%
fabs-sqr75.0%
rem-square-sqrt75.5%
Simplified75.5%
if -5.19999999999999986e184 < l < 5.6999999999999996e25Initial program 69.5%
Simplified68.9%
associate-*r/72.0%
frac-times72.2%
associate-/l*72.0%
*-commutative72.0%
Applied egg-rr72.0%
*-commutative72.0%
associate-/l*72.0%
associate-*r/72.2%
*-rgt-identity72.2%
times-frac72.2%
metadata-eval72.2%
*-commutative72.2%
associate-/l*70.9%
associate-*l*70.9%
Simplified70.9%
*-un-lft-identity70.9%
associate-*l/70.9%
metadata-eval70.9%
div-inv70.9%
associate-/l/70.9%
Applied egg-rr70.9%
*-lft-identity70.9%
associate-*r/72.2%
times-frac72.0%
Simplified72.0%
pow172.0%
sqrt-unprod63.5%
cancel-sign-sub-inv63.5%
metadata-eval63.5%
associate-*r/64.0%
div-inv64.0%
metadata-eval64.0%
Applied egg-rr64.0%
unpow164.0%
associate-*r/64.0%
associate-*l/64.1%
Simplified64.1%
if 5.6999999999999996e25 < l Initial program 58.1%
Simplified57.8%
pow157.8%
associate-*r*57.8%
sqrt-unprod42.9%
associate-*r*42.9%
associate-*r/42.9%
Applied egg-rr42.9%
Simplified36.8%
Taylor expanded in d around inf 44.1%
unpow-144.1%
metadata-eval44.1%
pow-sqr44.2%
rem-sqrt-square44.2%
rem-square-sqrt44.0%
fabs-sqr44.0%
rem-square-sqrt44.2%
Simplified44.2%
*-commutative44.2%
unpow-prod-down65.7%
Applied egg-rr65.7%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= d -1.9e+20)
(* d (- (pow (* h l) -0.5)))
(if (<= d -3.5e-301)
(* d (pow 0.0 -0.5))
(if (<= d 0.7)
(*
d
(/ (* -0.125 (* (/ h l) (pow (* D (/ M_m d)) 2.0))) (sqrt (* h l))))
(* d (* (pow l -0.5) (pow h -0.5)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -1.9e+20) {
tmp = d * -pow((h * l), -0.5);
} else if (d <= -3.5e-301) {
tmp = d * pow(0.0, -0.5);
} else if (d <= 0.7) {
tmp = d * ((-0.125 * ((h / l) * pow((D * (M_m / d)), 2.0))) / sqrt((h * l)));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= (-1.9d+20)) then
tmp = d * -((h * l) ** (-0.5d0))
else if (d <= (-3.5d-301)) then
tmp = d * (0.0d0 ** (-0.5d0))
else if (d <= 0.7d0) then
tmp = d * (((-0.125d0) * ((h / l) * ((d_1 * (m_m / d)) ** 2.0d0))) / sqrt((h * l)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -1.9e+20) {
tmp = d * -Math.pow((h * l), -0.5);
} else if (d <= -3.5e-301) {
tmp = d * Math.pow(0.0, -0.5);
} else if (d <= 0.7) {
tmp = d * ((-0.125 * ((h / l) * Math.pow((D * (M_m / d)), 2.0))) / Math.sqrt((h * l)));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if d <= -1.9e+20: tmp = d * -math.pow((h * l), -0.5) elif d <= -3.5e-301: tmp = d * math.pow(0.0, -0.5) elif d <= 0.7: tmp = d * ((-0.125 * ((h / l) * math.pow((D * (M_m / d)), 2.0))) / math.sqrt((h * l))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (d <= -1.9e+20) tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5))); elseif (d <= -3.5e-301) tmp = Float64(d * (0.0 ^ -0.5)); elseif (d <= 0.7) tmp = Float64(d * Float64(Float64(-0.125 * Float64(Float64(h / l) * (Float64(D * Float64(M_m / d)) ^ 2.0))) / sqrt(Float64(h * l)))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (d <= -1.9e+20)
tmp = d * -((h * l) ^ -0.5);
elseif (d <= -3.5e-301)
tmp = d * (0.0 ^ -0.5);
elseif (d <= 0.7)
tmp = d * ((-0.125 * ((h / l) * ((D * (M_m / d)) ^ 2.0))) / sqrt((h * l)));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -1.9e+20], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -3.5e-301], N[(d * N[Power[0.0, -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 0.7], N[(d * N[(N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $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.9 \cdot 10^{+20}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{elif}\;d \leq -3.5 \cdot 10^{-301}:\\
\;\;\;\;d \cdot {0}^{-0.5}\\
\mathbf{elif}\;d \leq 0.7:\\
\;\;\;\;d \cdot \frac{-0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M\_m}{d}\right)}^{2}\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -1.9e20Initial program 74.0%
Simplified72.7%
Taylor expanded in d around inf 8.7%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt63.6%
neg-mul-163.6%
unpow-163.6%
metadata-eval63.6%
pow-sqr63.6%
rem-sqrt-square63.6%
rem-square-sqrt63.2%
fabs-sqr63.2%
rem-square-sqrt63.6%
Simplified63.6%
if -1.9e20 < d < -3.49999999999999992e-301Initial program 55.8%
Simplified55.8%
pow155.8%
associate-*r*55.8%
sqrt-unprod43.9%
associate-*r*43.9%
associate-*r/43.9%
Applied egg-rr43.9%
Simplified32.5%
Taylor expanded in d around inf 10.9%
unpow-110.9%
metadata-eval10.9%
pow-sqr10.9%
rem-sqrt-square10.9%
rem-square-sqrt10.9%
fabs-sqr10.9%
rem-square-sqrt10.9%
Simplified10.9%
expm1-log1p-u10.9%
expm1-undefine30.7%
Applied egg-rr30.7%
sub-neg30.7%
metadata-eval30.7%
+-commutative30.7%
log1p-undefine30.7%
rem-exp-log30.7%
+-commutative30.7%
fma-define30.7%
Simplified30.7%
Taylor expanded in h around 0 45.9%
if -3.49999999999999992e-301 < d < 0.69999999999999996Initial program 55.4%
Simplified52.7%
Taylor expanded in M around inf 30.0%
associate-*r*30.1%
times-frac30.1%
*-commutative30.1%
associate-/l*30.0%
unpow230.0%
unpow230.0%
unpow230.0%
times-frac33.5%
swap-sqr37.6%
unpow237.6%
associate-*r/39.0%
*-commutative39.0%
associate-/l*37.7%
Simplified37.7%
frac-2neg54.1%
sqrt-div0.1%
Applied egg-rr0.1%
sqrt-div0.0%
associate-*l/0.0%
frac-times0.0%
add-sqr-sqrt0.0%
sqrt-unprod0.0%
sqr-neg0.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
add-sqr-sqrt0.0%
sqrt-unprod50.1%
sqr-neg50.1%
sqrt-unprod59.7%
Applied egg-rr51.2%
*-commutative51.2%
*-commutative51.2%
associate-*r*51.2%
rem-square-sqrt51.3%
associate-/l*50.0%
Simplified50.0%
if 0.69999999999999996 < d Initial program 78.6%
Simplified80.1%
pow180.1%
associate-*r*80.1%
sqrt-unprod67.9%
associate-*r*67.9%
associate-*r/67.9%
Applied egg-rr67.9%
Simplified56.8%
Taylor expanded in d around inf 60.7%
unpow-160.7%
metadata-eval60.7%
pow-sqr60.7%
rem-sqrt-square60.7%
rem-square-sqrt60.5%
fabs-sqr60.5%
rem-square-sqrt60.7%
Simplified60.7%
*-commutative60.7%
unpow-prod-down79.5%
Applied egg-rr79.5%
Final simplification59.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 (<= d -6.2e+19)
(* d (- (pow (* h l) -0.5)))
(if (<= d -1e-309)
(* d (pow 0.0 -0.5))
(* d (* (pow l -0.5) (pow h -0.5))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -6.2e+19) {
tmp = d * -pow((h * l), -0.5);
} else if (d <= -1e-309) {
tmp = d * pow(0.0, -0.5);
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= (-6.2d+19)) then
tmp = d * -((h * l) ** (-0.5d0))
else if (d <= (-1d-309)) then
tmp = d * (0.0d0 ** (-0.5d0))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -6.2e+19) {
tmp = d * -Math.pow((h * l), -0.5);
} else if (d <= -1e-309) {
tmp = d * Math.pow(0.0, -0.5);
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if d <= -6.2e+19: tmp = d * -math.pow((h * l), -0.5) elif d <= -1e-309: tmp = d * math.pow(0.0, -0.5) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (d <= -6.2e+19) tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5))); elseif (d <= -1e-309) tmp = Float64(d * (0.0 ^ -0.5)); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (d <= -6.2e+19)
tmp = d * -((h * l) ^ -0.5);
elseif (d <= -1e-309)
tmp = d * (0.0 ^ -0.5);
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -6.2e+19], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -1e-309], N[(d * N[Power[0.0, -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $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 -6.2 \cdot 10^{+19}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-309}:\\
\;\;\;\;d \cdot {0}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -6.2e19Initial program 74.0%
Simplified72.7%
Taylor expanded in d around inf 8.7%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt63.6%
neg-mul-163.6%
unpow-163.6%
metadata-eval63.6%
pow-sqr63.6%
rem-sqrt-square63.6%
rem-square-sqrt63.2%
fabs-sqr63.2%
rem-square-sqrt63.6%
Simplified63.6%
if -6.2e19 < d < -1.000000000000002e-309Initial program 55.1%
Simplified55.0%
pow155.0%
associate-*r*55.0%
sqrt-unprod43.3%
associate-*r*43.3%
associate-*r/43.3%
Applied egg-rr43.3%
Simplified32.1%
Taylor expanded in d around inf 10.9%
unpow-110.9%
metadata-eval10.9%
pow-sqr10.9%
rem-sqrt-square10.9%
rem-square-sqrt10.9%
fabs-sqr10.9%
rem-square-sqrt10.9%
Simplified10.9%
expm1-log1p-u10.9%
expm1-undefine30.3%
Applied egg-rr30.3%
sub-neg30.3%
metadata-eval30.3%
+-commutative30.3%
log1p-undefine30.3%
rem-exp-log30.3%
+-commutative30.3%
fma-define30.3%
Simplified30.3%
Taylor expanded in h around 0 45.2%
if -1.000000000000002e-309 < d Initial program 66.4%
Simplified65.5%
pow165.5%
associate-*r*65.5%
sqrt-unprod55.0%
associate-*r*55.0%
associate-*r/55.0%
Applied egg-rr55.0%
Simplified47.0%
Taylor expanded in d around inf 39.7%
unpow-139.7%
metadata-eval39.7%
pow-sqr39.8%
rem-sqrt-square39.8%
rem-square-sqrt39.6%
fabs-sqr39.6%
rem-square-sqrt39.8%
Simplified39.8%
*-commutative39.8%
unpow-prod-down53.3%
Applied egg-rr53.3%
Final simplification53.7%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (if (<= d -2e+19) (* d (- (pow (* h l) -0.5))) (if (<= d -4.8e-297) (* d (pow 0.0 -0.5)) (* d (sqrt (/ (/ 1.0 h) l))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -2e+19) {
tmp = d * -pow((h * l), -0.5);
} else if (d <= -4.8e-297) {
tmp = d * pow(0.0, -0.5);
} else {
tmp = d * sqrt(((1.0 / h) / l));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= (-2d+19)) then
tmp = d * -((h * l) ** (-0.5d0))
else if (d <= (-4.8d-297)) then
tmp = d * (0.0d0 ** (-0.5d0))
else
tmp = d * sqrt(((1.0d0 / h) / l))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -2e+19) {
tmp = d * -Math.pow((h * l), -0.5);
} else if (d <= -4.8e-297) {
tmp = d * Math.pow(0.0, -0.5);
} else {
tmp = d * Math.sqrt(((1.0 / h) / l));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if d <= -2e+19: tmp = d * -math.pow((h * l), -0.5) elif d <= -4.8e-297: tmp = d * math.pow(0.0, -0.5) else: tmp = d * math.sqrt(((1.0 / h) / l)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (d <= -2e+19) tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5))); elseif (d <= -4.8e-297) tmp = Float64(d * (0.0 ^ -0.5)); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (d <= -2e+19)
tmp = d * -((h * l) ^ -0.5);
elseif (d <= -4.8e-297)
tmp = d * (0.0 ^ -0.5);
else
tmp = d * sqrt(((1.0 / h) / l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -2e+19], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -4.8e-297], N[(d * N[Power[0.0, -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2 \cdot 10^{+19}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{elif}\;d \leq -4.8 \cdot 10^{-297}:\\
\;\;\;\;d \cdot {0}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if d < -2e19Initial program 74.0%
Simplified72.7%
Taylor expanded in d around inf 8.7%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt63.6%
neg-mul-163.6%
unpow-163.6%
metadata-eval63.6%
pow-sqr63.6%
rem-sqrt-square63.6%
rem-square-sqrt63.2%
fabs-sqr63.2%
rem-square-sqrt63.6%
Simplified63.6%
if -2e19 < d < -4.7999999999999999e-297Initial program 54.4%
Simplified54.4%
pow154.4%
associate-*r*54.3%
sqrt-unprod43.7%
associate-*r*43.7%
associate-*r/43.7%
Applied egg-rr43.7%
Simplified31.9%
Taylor expanded in d around inf 9.6%
unpow-19.6%
metadata-eval9.6%
pow-sqr9.6%
rem-sqrt-square9.6%
rem-square-sqrt9.6%
fabs-sqr9.6%
rem-square-sqrt9.6%
Simplified9.6%
expm1-log1p-u9.6%
expm1-undefine28.5%
Applied egg-rr28.5%
sub-neg28.5%
metadata-eval28.5%
+-commutative28.5%
log1p-undefine28.5%
rem-exp-log28.5%
+-commutative28.5%
fma-define28.5%
Simplified28.5%
Taylor expanded in h around 0 45.7%
if -4.7999999999999999e-297 < d Initial program 66.4%
Simplified65.6%
pow165.6%
associate-*r*65.6%
sqrt-unprod54.6%
associate-*r*54.6%
associate-*r/54.6%
Applied egg-rr54.6%
Simplified46.7%
Taylor expanded in d around inf 39.7%
unpow-139.7%
metadata-eval39.7%
pow-sqr39.7%
rem-sqrt-square39.7%
rem-square-sqrt39.6%
fabs-sqr39.6%
rem-square-sqrt39.7%
Simplified39.7%
expm1-log1p-u38.6%
expm1-undefine27.1%
Applied egg-rr27.1%
sub-neg27.1%
metadata-eval27.1%
+-commutative27.1%
log1p-undefine27.1%
rem-exp-log28.2%
+-commutative28.2%
fma-define28.2%
Simplified28.2%
Taylor expanded in d around 0 39.7%
associate-/r*41.8%
Simplified41.8%
Final simplification47.9%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (pow (* h l) -0.5)))
(if (<= d -3.2e+20)
(* d (- t_0))
(if (<= d -4.4e-297) (* d (pow 0.0 -0.5)) (* d 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((h * l), -0.5);
double tmp;
if (d <= -3.2e+20) {
tmp = d * -t_0;
} else if (d <= -4.4e-297) {
tmp = d * pow(0.0, -0.5);
} else {
tmp = d * 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 = (h * l) ** (-0.5d0)
if (d <= (-3.2d+20)) then
tmp = d * -t_0
else if (d <= (-4.4d-297)) then
tmp = d * (0.0d0 ** (-0.5d0))
else
tmp = d * 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((h * l), -0.5);
double tmp;
if (d <= -3.2e+20) {
tmp = d * -t_0;
} else if (d <= -4.4e-297) {
tmp = d * Math.pow(0.0, -0.5);
} else {
tmp = d * 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((h * l), -0.5) tmp = 0 if d <= -3.2e+20: tmp = d * -t_0 elif d <= -4.4e-297: tmp = d * math.pow(0.0, -0.5) else: tmp = d * 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(h * l) ^ -0.5 tmp = 0.0 if (d <= -3.2e+20) tmp = Float64(d * Float64(-t_0)); elseif (d <= -4.4e-297) tmp = Float64(d * (0.0 ^ -0.5)); else tmp = Float64(d * 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 = (h * l) ^ -0.5;
tmp = 0.0;
if (d <= -3.2e+20)
tmp = d * -t_0;
elseif (d <= -4.4e-297)
tmp = d * (0.0 ^ -0.5);
else
tmp = d * 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[(h * l), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[d, -3.2e+20], N[(d * (-t$95$0)), $MachinePrecision], If[LessEqual[d, -4.4e-297], N[(d * N[Power[0.0, -0.5], $MachinePrecision]), $MachinePrecision], N[(d * t$95$0), $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(h \cdot \ell\right)}^{-0.5}\\
\mathbf{if}\;d \leq -3.2 \cdot 10^{+20}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\
\mathbf{elif}\;d \leq -4.4 \cdot 10^{-297}:\\
\;\;\;\;d \cdot {0}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
\end{array}
if d < -3.2e20Initial program 74.0%
Simplified72.7%
Taylor expanded in d around inf 8.7%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt63.6%
neg-mul-163.6%
unpow-163.6%
metadata-eval63.6%
pow-sqr63.6%
rem-sqrt-square63.6%
rem-square-sqrt63.2%
fabs-sqr63.2%
rem-square-sqrt63.6%
Simplified63.6%
if -3.2e20 < d < -4.3999999999999997e-297Initial program 54.4%
Simplified54.4%
pow154.4%
associate-*r*54.3%
sqrt-unprod43.7%
associate-*r*43.7%
associate-*r/43.7%
Applied egg-rr43.7%
Simplified31.9%
Taylor expanded in d around inf 9.6%
unpow-19.6%
metadata-eval9.6%
pow-sqr9.6%
rem-sqrt-square9.6%
rem-square-sqrt9.6%
fabs-sqr9.6%
rem-square-sqrt9.6%
Simplified9.6%
expm1-log1p-u9.6%
expm1-undefine28.5%
Applied egg-rr28.5%
sub-neg28.5%
metadata-eval28.5%
+-commutative28.5%
log1p-undefine28.5%
rem-exp-log28.5%
+-commutative28.5%
fma-define28.5%
Simplified28.5%
Taylor expanded in h around 0 45.7%
if -4.3999999999999997e-297 < d Initial program 66.4%
Simplified65.6%
pow165.6%
associate-*r*65.6%
sqrt-unprod54.6%
associate-*r*54.6%
associate-*r/54.6%
Applied egg-rr54.6%
Simplified46.7%
Taylor expanded in d around inf 39.7%
unpow-139.7%
metadata-eval39.7%
pow-sqr39.7%
rem-sqrt-square39.7%
rem-square-sqrt39.6%
fabs-sqr39.6%
rem-square-sqrt39.7%
Simplified39.7%
Final simplification46.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 -4.4e-297) (* d (pow 0.0 -0.5)) (* 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) {
double tmp;
if (d <= -4.4e-297) {
tmp = d * pow(0.0, -0.5);
} else {
tmp = d * pow((h * l), -0.5);
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= (-4.4d-297)) then
tmp = d * (0.0d0 ** (-0.5d0))
else
tmp = d * ((h * l) ** (-0.5d0))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -4.4e-297) {
tmp = d * Math.pow(0.0, -0.5);
} else {
tmp = d * Math.pow((h * l), -0.5);
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if d <= -4.4e-297: tmp = d * math.pow(0.0, -0.5) else: tmp = d * math.pow((h * l), -0.5) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (d <= -4.4e-297) tmp = Float64(d * (0.0 ^ -0.5)); else tmp = Float64(d * (Float64(h * l) ^ -0.5)); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (d <= -4.4e-297)
tmp = d * (0.0 ^ -0.5);
else
tmp = d * ((h * l) ^ -0.5);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -4.4e-297], N[(d * N[Power[0.0, -0.5], $MachinePrecision]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -4.4 \cdot 10^{-297}:\\
\;\;\;\;d \cdot {0}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\end{array}
\end{array}
if d < -4.3999999999999997e-297Initial program 64.1%
Simplified63.5%
pow163.5%
associate-*r*64.1%
sqrt-unprod56.5%
associate-*r*56.5%
associate-*r/56.5%
Applied egg-rr56.5%
Simplified45.8%
Taylor expanded in d around inf 9.1%
unpow-19.1%
metadata-eval9.1%
pow-sqr9.1%
rem-sqrt-square9.1%
rem-square-sqrt9.1%
fabs-sqr9.1%
rem-square-sqrt9.1%
Simplified9.1%
expm1-log1p-u9.1%
expm1-undefine21.8%
Applied egg-rr21.8%
sub-neg21.8%
metadata-eval21.8%
+-commutative21.8%
log1p-undefine21.8%
rem-exp-log21.8%
+-commutative21.8%
fma-define21.8%
Simplified21.8%
Taylor expanded in h around 0 33.4%
if -4.3999999999999997e-297 < d Initial program 66.4%
Simplified65.6%
pow165.6%
associate-*r*65.6%
sqrt-unprod54.6%
associate-*r*54.6%
associate-*r/54.6%
Applied egg-rr54.6%
Simplified46.7%
Taylor expanded in d around inf 39.7%
unpow-139.7%
metadata-eval39.7%
pow-sqr39.7%
rem-sqrt-square39.7%
rem-square-sqrt39.6%
fabs-sqr39.6%
rem-square-sqrt39.7%
Simplified39.7%
Final simplification36.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 (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 65.3%
Simplified64.6%
pow164.6%
associate-*r*64.9%
sqrt-unprod55.5%
associate-*r*55.5%
associate-*r/55.5%
Applied egg-rr55.5%
Simplified46.3%
Taylor expanded in d around inf 25.2%
unpow-125.2%
metadata-eval25.2%
pow-sqr25.3%
rem-sqrt-square25.3%
rem-square-sqrt25.2%
fabs-sqr25.2%
rem-square-sqrt25.3%
Simplified25.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 0.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) {
return 0.0;
}
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 = 0.0d0
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 0.0;
}
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 0.0
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 0.0 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 = 0.0;
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_] := 0.0
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
0
\end{array}
Initial program 65.3%
Simplified64.6%
Taylor expanded in d around inf 25.2%
expm1-log1p-u21.7%
expm1-undefine16.2%
pow1/216.2%
inv-pow16.2%
pow-pow16.2%
metadata-eval16.2%
Applied egg-rr16.2%
sub-neg16.2%
metadata-eval16.2%
+-commutative16.2%
log1p-undefine16.2%
rem-exp-log19.7%
+-commutative19.7%
fma-define19.7%
Simplified19.7%
Taylor expanded in d around 0 4.5%
metadata-eval4.5%
Applied egg-rr4.5%
herbie shell --seed 2024155
(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)))))