
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (- d)))
(t_1 (+ 1.0 (* (/ h l) (* -0.5 (pow (* (/ M_m 2.0) (/ D d)) 2.0))))))
(if (<= l -3e+217)
(*
(sqrt (/ d h))
(*
(/ t_0 (sqrt (- l)))
(fma (/ h l) (* -0.5 (pow (/ D (* d (/ 2.0 M_m))) 2.0)) 1.0)))
(if (<= l -1e-310)
(* (/ t_0 (sqrt (- h))) (* (sqrt (/ d l)) t_1))
(* (/ (sqrt d) (sqrt h)) (* t_1 (/ (sqrt d) (sqrt l))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt(-d);
double t_1 = 1.0 + ((h / l) * (-0.5 * pow(((M_m / 2.0) * (D / d)), 2.0)));
double tmp;
if (l <= -3e+217) {
tmp = sqrt((d / h)) * ((t_0 / sqrt(-l)) * fma((h / l), (-0.5 * pow((D / (d * (2.0 / M_m))), 2.0)), 1.0));
} else if (l <= -1e-310) {
tmp = (t_0 / sqrt(-h)) * (sqrt((d / l)) * t_1);
} else {
tmp = (sqrt(d) / sqrt(h)) * (t_1 * (sqrt(d) / sqrt(l)));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(-d)) t_1 = Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0)))) tmp = 0.0 if (l <= -3e+217) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(t_0 / sqrt(Float64(-l))) * fma(Float64(h / l), Float64(-0.5 * (Float64(D / Float64(d * Float64(2.0 / M_m))) ^ 2.0)), 1.0))); elseif (l <= -1e-310) tmp = Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * t_1)); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_1 * Float64(sqrt(d) / sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3e+217], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D / N[(d * N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-310], N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
t_1 := 1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right)\\
\mathbf{if}\;\ell \leq -3 \cdot 10^{+217}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t\_0}{\sqrt{-\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(\frac{D}{d \cdot \frac{2}{M\_m}}\right)}^{2}, 1\right)\right)\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_1 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
\end{array}
\end{array}
if l < -2.99999999999999976e217Initial program 57.7%
Simplified48.1%
frac-2neg48.1%
sqrt-div60.8%
Applied egg-rr60.8%
if -2.99999999999999976e217 < l < -9.999999999999969e-311Initial program 71.7%
Simplified71.7%
frac-2neg71.7%
sqrt-div86.9%
Applied egg-rr86.9%
if -9.999999999999969e-311 < l Initial program 68.9%
Simplified68.2%
sqrt-div78.1%
Applied egg-rr78.1%
sqrt-div83.1%
Applied egg-rr83.1%
Final simplification82.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 (sqrt (- d))))
(if (<= l -1.3e+218)
(*
(sqrt (/ d h))
(*
(/ t_0 (sqrt (- l)))
(fma (/ h l) (* -0.5 (pow (/ D (* d (/ 2.0 M_m))) 2.0)) 1.0)))
(if (<= l -1e-310)
(*
(/ t_0 (sqrt (- h)))
(*
(sqrt (/ d l))
(+ 1.0 (* (/ h l) (* -0.5 (pow (* (/ M_m 2.0) (/ D d)) 2.0))))))
(*
(fma (/ h l) (* -0.5 (pow (/ M_m (/ d (* D 0.5))) 2.0)) 1.0)
(/ (/ d (sqrt l)) (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);
double tmp;
if (l <= -1.3e+218) {
tmp = sqrt((d / h)) * ((t_0 / sqrt(-l)) * fma((h / l), (-0.5 * pow((D / (d * (2.0 / M_m))), 2.0)), 1.0));
} else if (l <= -1e-310) {
tmp = (t_0 / sqrt(-h)) * (sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * pow(((M_m / 2.0) * (D / d)), 2.0)))));
} else {
tmp = fma((h / l), (-0.5 * pow((M_m / (d / (D * 0.5))), 2.0)), 1.0) * ((d / sqrt(l)) / 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)) tmp = 0.0 if (l <= -1.3e+218) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(t_0 / sqrt(Float64(-l))) * fma(Float64(h / l), Float64(-0.5 * (Float64(D / Float64(d * Float64(2.0 / M_m))) ^ 2.0)), 1.0))); elseif (l <= -1e-310) tmp = Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0)))))); else tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(M_m / Float64(d / Float64(D * 0.5))) ^ 2.0)), 1.0) * Float64(Float64(d / sqrt(l)) / sqrt(h))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -1.3e+218], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D / N[(d * N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-310], N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(M$95$m / N[(d / N[(D * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -1.3 \cdot 10^{+218}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t\_0}{\sqrt{-\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(\frac{D}{d \cdot \frac{2}{M\_m}}\right)}^{2}, 1\right)\right)\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(\frac{M\_m}{\frac{d}{D \cdot 0.5}}\right)}^{2}, 1\right) \cdot \frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -1.30000000000000001e218Initial program 57.7%
Simplified48.1%
frac-2neg48.1%
sqrt-div60.8%
Applied egg-rr60.8%
if -1.30000000000000001e218 < l < -9.999999999999969e-311Initial program 71.7%
Simplified71.7%
frac-2neg71.7%
sqrt-div86.9%
Applied egg-rr86.9%
if -9.999999999999969e-311 < l Initial program 68.9%
Applied egg-rr26.4%
expm1-def41.0%
expm1-log1p80.9%
Simplified80.9%
Final simplification81.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 (sqrt (- d))))
(if (<= l -3.3e+216)
(*
(sqrt (/ d h))
(*
(/ t_0 (sqrt (- l)))
(+ 1.0 (* (/ h l) (* -0.5 (pow (/ (/ D (/ 2.0 M_m)) d) 2.0))))))
(if (<= l -1e-310)
(*
(* (/ t_0 (sqrt (- h))) (sqrt (/ d l)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D d)) 2.0)))))
(*
(fma (/ h l) (* -0.5 (pow (/ M_m (/ d (* D 0.5))) 2.0)) 1.0)
(/ (/ d (sqrt l)) (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);
double tmp;
if (l <= -3.3e+216) {
tmp = sqrt((d / h)) * ((t_0 / sqrt(-l)) * (1.0 + ((h / l) * (-0.5 * pow(((D / (2.0 / M_m)) / d), 2.0)))));
} else if (l <= -1e-310) {
tmp = ((t_0 / sqrt(-h)) * sqrt((d / l))) * (1.0 - (0.5 * ((h / l) * pow(((M_m / 2.0) * (D / d)), 2.0))));
} else {
tmp = fma((h / l), (-0.5 * pow((M_m / (d / (D * 0.5))), 2.0)), 1.0) * ((d / sqrt(l)) / 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)) tmp = 0.0 if (l <= -3.3e+216) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(D / Float64(2.0 / M_m)) / d) ^ 2.0)))))); elseif (l <= -1e-310) tmp = Float64(Float64(Float64(t_0 / sqrt(Float64(-h))) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0))))); else tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(M_m / Float64(d / Float64(D * 0.5))) ^ 2.0)), 1.0) * Float64(Float64(d / sqrt(l)) / sqrt(h))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -3.3e+216], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(D / N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-310], N[(N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(M$95$m / N[(d / N[(D * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -3.3 \cdot 10^{+216}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t\_0}{\sqrt{-\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{\frac{D}{\frac{2}{M\_m}}}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{t\_0}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(\frac{M\_m}{\frac{d}{D \cdot 0.5}}\right)}^{2}, 1\right) \cdot \frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -3.3e216Initial program 57.7%
Simplified57.8%
clear-num57.8%
frac-times48.1%
*-un-lft-identity48.1%
associate-/r*57.7%
Applied egg-rr57.7%
frac-2neg48.1%
sqrt-div60.8%
Applied egg-rr71.5%
if -3.3e216 < l < -9.999999999999969e-311Initial program 71.7%
Simplified71.7%
frac-2neg71.7%
sqrt-div86.9%
Applied egg-rr83.9%
if -9.999999999999969e-311 < l Initial program 68.9%
Applied egg-rr26.4%
expm1-def41.0%
expm1-log1p80.9%
Simplified80.9%
Final simplification81.3%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (- d))))
(if (<= l -6.8e+215)
(*
(sqrt (/ d h))
(*
(/ t_0 (sqrt (- l)))
(+ 1.0 (* (/ h l) (* -0.5 (pow (/ (/ D (/ 2.0 M_m)) d) 2.0))))))
(if (<= l -1e-310)
(*
(/ t_0 (sqrt (- h)))
(*
(sqrt (/ d l))
(+ 1.0 (* (/ h l) (* -0.5 (pow (* (/ M_m 2.0) (/ D d)) 2.0))))))
(*
(fma (/ h l) (* -0.5 (pow (/ M_m (/ d (* D 0.5))) 2.0)) 1.0)
(/ (/ d (sqrt l)) (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);
double tmp;
if (l <= -6.8e+215) {
tmp = sqrt((d / h)) * ((t_0 / sqrt(-l)) * (1.0 + ((h / l) * (-0.5 * pow(((D / (2.0 / M_m)) / d), 2.0)))));
} else if (l <= -1e-310) {
tmp = (t_0 / sqrt(-h)) * (sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * pow(((M_m / 2.0) * (D / d)), 2.0)))));
} else {
tmp = fma((h / l), (-0.5 * pow((M_m / (d / (D * 0.5))), 2.0)), 1.0) * ((d / sqrt(l)) / 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)) tmp = 0.0 if (l <= -6.8e+215) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(D / Float64(2.0 / M_m)) / d) ^ 2.0)))))); elseif (l <= -1e-310) tmp = Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0)))))); else tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(M_m / Float64(d / Float64(D * 0.5))) ^ 2.0)), 1.0) * Float64(Float64(d / sqrt(l)) / sqrt(h))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -6.8e+215], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(D / N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-310], N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(M$95$m / N[(d / N[(D * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -6.8 \cdot 10^{+215}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t\_0}{\sqrt{-\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{\frac{D}{\frac{2}{M\_m}}}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(\frac{M\_m}{\frac{d}{D \cdot 0.5}}\right)}^{2}, 1\right) \cdot \frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -6.80000000000000036e215Initial program 57.7%
Simplified57.8%
clear-num57.8%
frac-times48.1%
*-un-lft-identity48.1%
associate-/r*57.7%
Applied egg-rr57.7%
frac-2neg48.1%
sqrt-div60.8%
Applied egg-rr71.5%
if -6.80000000000000036e215 < l < -9.999999999999969e-311Initial program 71.7%
Simplified71.7%
frac-2neg71.7%
sqrt-div86.9%
Applied egg-rr86.9%
if -9.999999999999969e-311 < l Initial program 68.9%
Applied egg-rr26.4%
expm1-def41.0%
expm1-log1p80.9%
Simplified80.9%
Final simplification82.5%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l -1e-310)
(*
(sqrt (/ d h))
(*
(/ (sqrt (- d)) (sqrt (- l)))
(+ 1.0 (* (/ h l) (* -0.5 (pow (/ (/ D (/ 2.0 M_m)) d) 2.0))))))
(*
(fma (/ h l) (* -0.5 (pow (/ M_m (/ d (* D 0.5))) 2.0)) 1.0)
(/ (/ d (sqrt l)) (sqrt h)))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -1e-310) {
tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0 + ((h / l) * (-0.5 * pow(((D / (2.0 / M_m)) / d), 2.0)))));
} else {
tmp = fma((h / l), (-0.5 * pow((M_m / (d / (D * 0.5))), 2.0)), 1.0) * ((d / sqrt(l)) / sqrt(h));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -1e-310) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(D / Float64(2.0 / M_m)) / d) ^ 2.0)))))); else tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(M_m / Float64(d / Float64(D * 0.5))) ^ 2.0)), 1.0) * Float64(Float64(d / sqrt(l)) / sqrt(h))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -1e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(D / N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(M$95$m / N[(d / N[(D * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{\frac{D}{\frac{2}{M\_m}}}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(\frac{M\_m}{\frac{d}{D \cdot 0.5}}\right)}^{2}, 1\right) \cdot \frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -9.999999999999969e-311Initial program 69.3%
Simplified69.2%
clear-num69.2%
frac-times66.8%
*-un-lft-identity66.8%
associate-/r*69.2%
Applied egg-rr69.2%
frac-2neg66.8%
sqrt-div69.8%
Applied egg-rr72.4%
if -9.999999999999969e-311 < l Initial program 68.9%
Applied egg-rr26.4%
expm1-def41.0%
expm1-log1p80.9%
Simplified80.9%
Final simplification76.9%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= l -2.7e+91)
(* (/ (sqrt (- d)) (sqrt (- h))) t_0)
(if (<= l 3e-307)
(*
(sqrt (/ d h))
(* t_0 (+ 1.0 (/ (* h (* -0.5 (pow (/ D (* d (/ 2.0 M_m))) 2.0))) l))))
(*
(fma (/ h l) (* -0.5 (pow (/ M_m (/ d (* D 0.5))) 2.0)) 1.0)
(/ (/ d (sqrt l)) (sqrt h)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (l <= -2.7e+91) {
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
} else if (l <= 3e-307) {
tmp = sqrt((d / h)) * (t_0 * (1.0 + ((h * (-0.5 * pow((D / (d * (2.0 / M_m))), 2.0))) / l)));
} else {
tmp = fma((h / l), (-0.5 * pow((M_m / (d / (D * 0.5))), 2.0)), 1.0) * ((d / sqrt(l)) / sqrt(h));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -2.7e+91) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0); elseif (l <= 3e-307) tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(D / Float64(d * Float64(2.0 / M_m))) ^ 2.0))) / l)))); else tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(M_m / Float64(d / Float64(D * 0.5))) ^ 2.0)), 1.0) * Float64(Float64(d / sqrt(l)) / sqrt(h))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -2.7e+91], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[l, 3e-307], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(D / N[(d * N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(M$95$m / N[(d / N[(D * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -2.7 \cdot 10^{+91}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_0\\
\mathbf{elif}\;\ell \leq 3 \cdot 10^{-307}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t\_0 \cdot \left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(\frac{D}{d \cdot \frac{2}{M\_m}}\right)}^{2}\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(\frac{M\_m}{\frac{d}{D \cdot 0.5}}\right)}^{2}, 1\right) \cdot \frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -2.7e91Initial program 48.0%
Simplified43.0%
Taylor expanded in h around 0 38.8%
frac-2neg47.9%
sqrt-div65.2%
Applied egg-rr58.4%
if -2.7e91 < l < 2.9999999999999999e-307Initial program 79.9%
Simplified79.9%
clear-num79.8%
frac-times78.7%
*-un-lft-identity78.7%
associate-/r*79.8%
Applied egg-rr79.8%
associate-*l/81.1%
associate-/l/80.0%
Applied egg-rr80.0%
if 2.9999999999999999e-307 < l Initial program 68.9%
Applied egg-rr26.4%
expm1-def41.0%
expm1-log1p80.9%
Simplified80.9%
Final simplification77.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 (<= l -4.7e+91)
(* (/ (sqrt (- d)) (sqrt (- h))) t_0)
(if (<= l -1e-310)
(*
(sqrt (/ d h))
(* t_0 (+ 1.0 (* (/ h l) (* -0.5 (pow (* (/ M_m 2.0) (/ D d)) 2.0))))))
(*
(/ (/ d (sqrt l)) (sqrt h))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D d) (* M_m 0.5)) 2.0)))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (l <= -4.7e+91) {
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
} else if (l <= -1e-310) {
tmp = sqrt((d / h)) * (t_0 * (1.0 + ((h / l) * (-0.5 * pow(((M_m / 2.0) * (D / d)), 2.0)))));
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * pow(((D / d) * (M_m * 0.5)), 2.0))));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / l))
if (l <= (-4.7d+91)) then
tmp = (sqrt(-d) / sqrt(-h)) * t_0
else if (l <= (-1d-310)) then
tmp = sqrt((d / h)) * (t_0 * (1.0d0 + ((h / l) * ((-0.5d0) * (((m_m / 2.0d0) * (d_1 / d)) ** 2.0d0)))))
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0d0 - (0.5d0 * ((h / l) * (((d_1 / d) * (m_m * 0.5d0)) ** 2.0d0))))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.sqrt((d / l));
double tmp;
if (l <= -4.7e+91) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * t_0;
} else if (l <= -1e-310) {
tmp = Math.sqrt((d / h)) * (t_0 * (1.0 + ((h / l) * (-0.5 * Math.pow(((M_m / 2.0) * (D / d)), 2.0)))));
} else {
tmp = ((d / Math.sqrt(l)) / Math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * Math.pow(((D / d) * (M_m * 0.5)), 2.0))));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.sqrt((d / l)) tmp = 0 if l <= -4.7e+91: tmp = (math.sqrt(-d) / math.sqrt(-h)) * t_0 elif l <= -1e-310: tmp = math.sqrt((d / h)) * (t_0 * (1.0 + ((h / l) * (-0.5 * math.pow(((M_m / 2.0) * (D / d)), 2.0))))) else: tmp = ((d / math.sqrt(l)) / math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * math.pow(((D / d) * (M_m * 0.5)), 2.0)))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -4.7e+91) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0); elseif (l <= -1e-310) tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0)))))); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0))))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = sqrt((d / l));
tmp = 0.0;
if (l <= -4.7e+91)
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
elseif (l <= -1e-310)
tmp = sqrt((d / h)) * (t_0 * (1.0 + ((h / l) * (-0.5 * (((M_m / 2.0) * (D / d)) ^ 2.0)))));
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * (((D / d) * (M_m * 0.5)) ^ 2.0))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -4.7e+91], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[l, -1e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -4.7 \cdot 10^{+91}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_0\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t\_0 \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if l < -4.6999999999999997e91Initial program 48.0%
Simplified43.0%
Taylor expanded in h around 0 38.8%
frac-2neg47.9%
sqrt-div65.2%
Applied egg-rr58.4%
if -4.6999999999999997e91 < l < -9.999999999999969e-311Initial program 79.9%
Simplified79.9%
if -9.999999999999969e-311 < l Initial program 68.9%
Applied egg-rr26.4%
expm1-def41.0%
expm1-log1p80.9%
associate-*r*80.9%
associate-/r*80.9%
Simplified80.9%
Final simplification77.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 (<= l -5.2e+91)
(* (/ (sqrt (- d)) (sqrt (- h))) t_0)
(if (<= l -1e-310)
(*
(sqrt (/ d h))
(* t_0 (+ 1.0 (* (/ h l) (* -0.5 (pow (/ M_m (/ d (* D 0.5))) 2.0))))))
(*
(/ (/ d (sqrt l)) (sqrt h))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D d) (* M_m 0.5)) 2.0)))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (l <= -5.2e+91) {
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
} else if (l <= -1e-310) {
tmp = sqrt((d / h)) * (t_0 * (1.0 + ((h / l) * (-0.5 * pow((M_m / (d / (D * 0.5))), 2.0)))));
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * pow(((D / d) * (M_m * 0.5)), 2.0))));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / l))
if (l <= (-5.2d+91)) then
tmp = (sqrt(-d) / sqrt(-h)) * t_0
else if (l <= (-1d-310)) then
tmp = sqrt((d / h)) * (t_0 * (1.0d0 + ((h / l) * ((-0.5d0) * ((m_m / (d / (d_1 * 0.5d0))) ** 2.0d0)))))
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0d0 - (0.5d0 * ((h / l) * (((d_1 / d) * (m_m * 0.5d0)) ** 2.0d0))))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.sqrt((d / l));
double tmp;
if (l <= -5.2e+91) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * t_0;
} else if (l <= -1e-310) {
tmp = Math.sqrt((d / h)) * (t_0 * (1.0 + ((h / l) * (-0.5 * Math.pow((M_m / (d / (D * 0.5))), 2.0)))));
} else {
tmp = ((d / Math.sqrt(l)) / Math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * Math.pow(((D / d) * (M_m * 0.5)), 2.0))));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.sqrt((d / l)) tmp = 0 if l <= -5.2e+91: tmp = (math.sqrt(-d) / math.sqrt(-h)) * t_0 elif l <= -1e-310: tmp = math.sqrt((d / h)) * (t_0 * (1.0 + ((h / l) * (-0.5 * math.pow((M_m / (d / (D * 0.5))), 2.0))))) else: tmp = ((d / math.sqrt(l)) / math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * math.pow(((D / d) * (M_m * 0.5)), 2.0)))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -5.2e+91) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0); elseif (l <= -1e-310) tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(M_m / Float64(d / Float64(D * 0.5))) ^ 2.0)))))); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0))))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = sqrt((d / l));
tmp = 0.0;
if (l <= -5.2e+91)
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
elseif (l <= -1e-310)
tmp = sqrt((d / h)) * (t_0 * (1.0 + ((h / l) * (-0.5 * ((M_m / (d / (D * 0.5))) ^ 2.0)))));
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * (((D / d) * (M_m * 0.5)) ^ 2.0))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -5.2e+91], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[l, -1e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(M$95$m / N[(d / N[(D * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -5.2 \cdot 10^{+91}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_0\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t\_0 \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M\_m}{\frac{d}{D \cdot 0.5}}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if l < -5.2000000000000001e91Initial program 48.0%
Simplified43.0%
Taylor expanded in h around 0 38.8%
frac-2neg47.9%
sqrt-div65.2%
Applied egg-rr58.4%
if -5.2000000000000001e91 < l < -9.999999999999969e-311Initial program 79.9%
Simplified79.9%
Taylor expanded in M around 0 79.9%
associate-*r/79.9%
associate-*r*79.9%
*-commutative79.9%
associate-/l*79.9%
*-commutative79.9%
Simplified79.9%
if -9.999999999999969e-311 < l Initial program 68.9%
Applied egg-rr26.4%
expm1-def41.0%
expm1-log1p80.9%
associate-*r*80.9%
associate-/r*80.9%
Simplified80.9%
Final simplification77.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 (<= l -1.92e+84)
(* (/ (sqrt (- d)) (sqrt (- h))) t_0)
(if (<= l -1e-310)
(*
(sqrt (/ d h))
(* t_0 (+ 1.0 (* (/ h l) (* -0.5 (pow (/ (/ D (/ 2.0 M_m)) d) 2.0))))))
(*
(/ (/ d (sqrt l)) (sqrt h))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D d) (* M_m 0.5)) 2.0)))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (l <= -1.92e+84) {
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
} else if (l <= -1e-310) {
tmp = sqrt((d / h)) * (t_0 * (1.0 + ((h / l) * (-0.5 * pow(((D / (2.0 / M_m)) / d), 2.0)))));
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * pow(((D / d) * (M_m * 0.5)), 2.0))));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / l))
if (l <= (-1.92d+84)) then
tmp = (sqrt(-d) / sqrt(-h)) * t_0
else if (l <= (-1d-310)) then
tmp = sqrt((d / h)) * (t_0 * (1.0d0 + ((h / l) * ((-0.5d0) * (((d_1 / (2.0d0 / m_m)) / d) ** 2.0d0)))))
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0d0 - (0.5d0 * ((h / l) * (((d_1 / d) * (m_m * 0.5d0)) ** 2.0d0))))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.sqrt((d / l));
double tmp;
if (l <= -1.92e+84) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * t_0;
} else if (l <= -1e-310) {
tmp = Math.sqrt((d / h)) * (t_0 * (1.0 + ((h / l) * (-0.5 * Math.pow(((D / (2.0 / M_m)) / d), 2.0)))));
} else {
tmp = ((d / Math.sqrt(l)) / Math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * Math.pow(((D / d) * (M_m * 0.5)), 2.0))));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.sqrt((d / l)) tmp = 0 if l <= -1.92e+84: tmp = (math.sqrt(-d) / math.sqrt(-h)) * t_0 elif l <= -1e-310: tmp = math.sqrt((d / h)) * (t_0 * (1.0 + ((h / l) * (-0.5 * math.pow(((D / (2.0 / M_m)) / d), 2.0))))) else: tmp = ((d / math.sqrt(l)) / math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * math.pow(((D / d) * (M_m * 0.5)), 2.0)))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -1.92e+84) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0); elseif (l <= -1e-310) tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(D / Float64(2.0 / M_m)) / d) ^ 2.0)))))); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0))))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = sqrt((d / l));
tmp = 0.0;
if (l <= -1.92e+84)
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
elseif (l <= -1e-310)
tmp = sqrt((d / h)) * (t_0 * (1.0 + ((h / l) * (-0.5 * (((D / (2.0 / M_m)) / d) ^ 2.0)))));
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * (((D / d) * (M_m * 0.5)) ^ 2.0))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.92e+84], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[l, -1e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(D / N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -1.92 \cdot 10^{+84}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_0\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t\_0 \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{\frac{D}{\frac{2}{M\_m}}}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if l < -1.91999999999999993e84Initial program 48.0%
Simplified43.0%
Taylor expanded in h around 0 38.8%
frac-2neg47.9%
sqrt-div65.2%
Applied egg-rr58.4%
if -1.91999999999999993e84 < l < -9.999999999999969e-311Initial program 79.9%
Simplified79.9%
clear-num79.8%
frac-times78.7%
*-un-lft-identity78.7%
associate-/r*79.8%
Applied egg-rr79.8%
if -9.999999999999969e-311 < l Initial program 68.9%
Applied egg-rr26.4%
expm1-def41.0%
expm1-log1p80.9%
associate-*r*80.9%
associate-/r*80.9%
Simplified80.9%
Final simplification77.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 (<= l -5.8e+90)
(* (/ (sqrt (- d)) (sqrt (- h))) t_0)
(if (<= l -1e-310)
(*
(sqrt (/ d h))
(* t_0 (+ 1.0 (* (/ h l) (* -0.5 (pow (/ (/ (* D M_m) 2.0) d) 2.0))))))
(*
(/ (/ d (sqrt l)) (sqrt h))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D d) (* M_m 0.5)) 2.0)))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (l <= -5.8e+90) {
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
} else if (l <= -1e-310) {
tmp = sqrt((d / h)) * (t_0 * (1.0 + ((h / l) * (-0.5 * pow((((D * M_m) / 2.0) / d), 2.0)))));
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * pow(((D / d) * (M_m * 0.5)), 2.0))));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / l))
if (l <= (-5.8d+90)) then
tmp = (sqrt(-d) / sqrt(-h)) * t_0
else if (l <= (-1d-310)) then
tmp = sqrt((d / h)) * (t_0 * (1.0d0 + ((h / l) * ((-0.5d0) * ((((d_1 * m_m) / 2.0d0) / d) ** 2.0d0)))))
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0d0 - (0.5d0 * ((h / l) * (((d_1 / d) * (m_m * 0.5d0)) ** 2.0d0))))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.sqrt((d / l));
double tmp;
if (l <= -5.8e+90) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * t_0;
} else if (l <= -1e-310) {
tmp = Math.sqrt((d / h)) * (t_0 * (1.0 + ((h / l) * (-0.5 * Math.pow((((D * M_m) / 2.0) / d), 2.0)))));
} else {
tmp = ((d / Math.sqrt(l)) / Math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * Math.pow(((D / d) * (M_m * 0.5)), 2.0))));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.sqrt((d / l)) tmp = 0 if l <= -5.8e+90: tmp = (math.sqrt(-d) / math.sqrt(-h)) * t_0 elif l <= -1e-310: tmp = math.sqrt((d / h)) * (t_0 * (1.0 + ((h / l) * (-0.5 * math.pow((((D * M_m) / 2.0) / d), 2.0))))) else: tmp = ((d / math.sqrt(l)) / math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * math.pow(((D / d) * (M_m * 0.5)), 2.0)))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -5.8e+90) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0); elseif (l <= -1e-310) tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(Float64(D * M_m) / 2.0) / d) ^ 2.0)))))); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0))))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = sqrt((d / l));
tmp = 0.0;
if (l <= -5.8e+90)
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
elseif (l <= -1e-310)
tmp = sqrt((d / h)) * (t_0 * (1.0 + ((h / l) * (-0.5 * ((((D * M_m) / 2.0) / d) ^ 2.0)))));
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * (((D / d) * (M_m * 0.5)) ^ 2.0))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -5.8e+90], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[l, -1e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(N[(D * M$95$m), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -5.8 \cdot 10^{+90}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_0\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t\_0 \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{\frac{D \cdot M\_m}{2}}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if l < -5.8000000000000003e90Initial program 48.0%
Simplified43.0%
Taylor expanded in h around 0 38.8%
frac-2neg47.9%
sqrt-div65.2%
Applied egg-rr58.4%
if -5.8000000000000003e90 < l < -9.999999999999969e-311Initial program 79.9%
Simplified79.9%
frac-times79.9%
associate-/r*79.9%
Applied egg-rr79.9%
if -9.999999999999969e-311 < l Initial program 68.9%
Applied egg-rr26.4%
expm1-def41.0%
expm1-log1p80.9%
associate-*r*80.9%
associate-/r*80.9%
Simplified80.9%
Final simplification77.1%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (pow (* (/ D d) (* M_m 0.5)) 2.0)) (t_1 (sqrt (/ d l))))
(if (<= l -6.2e+90)
(* (/ (sqrt (- d)) (sqrt (- h))) t_1)
(if (<= l 5e-308)
(* (sqrt (/ d h)) (* t_1 (+ 1.0 (/ (* h (* -0.5 t_0)) l))))
(* (/ (/ d (sqrt l)) (sqrt h)) (- 1.0 (* 0.5 (* (/ h l) t_0))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = pow(((D / d) * (M_m * 0.5)), 2.0);
double t_1 = sqrt((d / l));
double tmp;
if (l <= -6.2e+90) {
tmp = (sqrt(-d) / sqrt(-h)) * t_1;
} else if (l <= 5e-308) {
tmp = sqrt((d / h)) * (t_1 * (1.0 + ((h * (-0.5 * t_0)) / l)));
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * 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) :: t_1
real(8) :: tmp
t_0 = ((d_1 / d) * (m_m * 0.5d0)) ** 2.0d0
t_1 = sqrt((d / l))
if (l <= (-6.2d+90)) then
tmp = (sqrt(-d) / sqrt(-h)) * t_1
else if (l <= 5d-308) then
tmp = sqrt((d / h)) * (t_1 * (1.0d0 + ((h * ((-0.5d0) * t_0)) / l)))
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0d0 - (0.5d0 * ((h / l) * t_0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.pow(((D / d) * (M_m * 0.5)), 2.0);
double t_1 = Math.sqrt((d / l));
double tmp;
if (l <= -6.2e+90) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * t_1;
} else if (l <= 5e-308) {
tmp = Math.sqrt((d / h)) * (t_1 * (1.0 + ((h * (-0.5 * t_0)) / l)));
} else {
tmp = ((d / Math.sqrt(l)) / Math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * t_0)));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.pow(((D / d) * (M_m * 0.5)), 2.0) t_1 = math.sqrt((d / l)) tmp = 0 if l <= -6.2e+90: tmp = (math.sqrt(-d) / math.sqrt(-h)) * t_1 elif l <= 5e-308: tmp = math.sqrt((d / h)) * (t_1 * (1.0 + ((h * (-0.5 * t_0)) / l))) else: tmp = ((d / math.sqrt(l)) / math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * t_0))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0 t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -6.2e+90) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_1); elseif (l <= 5e-308) tmp = Float64(sqrt(Float64(d / h)) * Float64(t_1 * Float64(1.0 + Float64(Float64(h * Float64(-0.5 * t_0)) / l)))); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * t_0)))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = ((D / d) * (M_m * 0.5)) ^ 2.0;
t_1 = sqrt((d / l));
tmp = 0.0;
if (l <= -6.2e+90)
tmp = (sqrt(-d) / sqrt(-h)) * t_1;
elseif (l <= 5e-308)
tmp = sqrt((d / h)) * (t_1 * (1.0 + ((h * (-0.5 * t_0)) / l)));
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * t_0)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -6.2e+90], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[l, 5e-308], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 * N[(1.0 + N[(N[(h * N[(-0.5 * t$95$0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -6.2 \cdot 10^{+90}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_1\\
\mathbf{elif}\;\ell \leq 5 \cdot 10^{-308}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t\_1 \cdot \left(1 + \frac{h \cdot \left(-0.5 \cdot t\_0\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot t\_0\right)\right)\\
\end{array}
\end{array}
if l < -6.19999999999999977e90Initial program 48.0%
Simplified43.0%
Taylor expanded in h around 0 38.8%
frac-2neg47.9%
sqrt-div65.2%
Applied egg-rr58.4%
if -6.19999999999999977e90 < l < 4.99999999999999955e-308Initial program 79.9%
Simplified79.9%
associate-*l/81.1%
div-inv81.1%
metadata-eval81.1%
Applied egg-rr81.1%
if 4.99999999999999955e-308 < l Initial program 68.9%
Applied egg-rr26.4%
expm1-def41.0%
expm1-log1p80.9%
associate-*r*80.9%
associate-/r*80.9%
Simplified80.9%
Final simplification77.5%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= l -1.85e+89)
(* (/ (sqrt (- d)) (sqrt (- h))) t_0)
(if (<= l 1.9e-308)
(*
(sqrt (/ d h))
(* t_0 (+ 1.0 (/ (* h (* -0.5 (pow (/ D (* d (/ 2.0 M_m))) 2.0))) l))))
(*
(/ (/ d (sqrt l)) (sqrt h))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D d) (* M_m 0.5)) 2.0)))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (l <= -1.85e+89) {
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
} else if (l <= 1.9e-308) {
tmp = sqrt((d / h)) * (t_0 * (1.0 + ((h * (-0.5 * pow((D / (d * (2.0 / M_m))), 2.0))) / l)));
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * pow(((D / d) * (M_m * 0.5)), 2.0))));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / l))
if (l <= (-1.85d+89)) then
tmp = (sqrt(-d) / sqrt(-h)) * t_0
else if (l <= 1.9d-308) then
tmp = sqrt((d / h)) * (t_0 * (1.0d0 + ((h * ((-0.5d0) * ((d_1 / (d * (2.0d0 / m_m))) ** 2.0d0))) / l)))
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0d0 - (0.5d0 * ((h / l) * (((d_1 / d) * (m_m * 0.5d0)) ** 2.0d0))))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.sqrt((d / l));
double tmp;
if (l <= -1.85e+89) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * t_0;
} else if (l <= 1.9e-308) {
tmp = Math.sqrt((d / h)) * (t_0 * (1.0 + ((h * (-0.5 * Math.pow((D / (d * (2.0 / M_m))), 2.0))) / l)));
} else {
tmp = ((d / Math.sqrt(l)) / Math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * Math.pow(((D / d) * (M_m * 0.5)), 2.0))));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.sqrt((d / l)) tmp = 0 if l <= -1.85e+89: tmp = (math.sqrt(-d) / math.sqrt(-h)) * t_0 elif l <= 1.9e-308: tmp = math.sqrt((d / h)) * (t_0 * (1.0 + ((h * (-0.5 * math.pow((D / (d * (2.0 / M_m))), 2.0))) / l))) else: tmp = ((d / math.sqrt(l)) / math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * math.pow(((D / d) * (M_m * 0.5)), 2.0)))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -1.85e+89) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0); elseif (l <= 1.9e-308) tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(D / Float64(d * Float64(2.0 / M_m))) ^ 2.0))) / l)))); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0))))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = sqrt((d / l));
tmp = 0.0;
if (l <= -1.85e+89)
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
elseif (l <= 1.9e-308)
tmp = sqrt((d / h)) * (t_0 * (1.0 + ((h * (-0.5 * ((D / (d * (2.0 / M_m))) ^ 2.0))) / l)));
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * (((D / d) * (M_m * 0.5)) ^ 2.0))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.85e+89], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[l, 1.9e-308], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(D / N[(d * N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -1.85 \cdot 10^{+89}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_0\\
\mathbf{elif}\;\ell \leq 1.9 \cdot 10^{-308}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t\_0 \cdot \left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(\frac{D}{d \cdot \frac{2}{M\_m}}\right)}^{2}\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if l < -1.8499999999999999e89Initial program 48.0%
Simplified43.0%
Taylor expanded in h around 0 38.8%
frac-2neg47.9%
sqrt-div65.2%
Applied egg-rr58.4%
if -1.8499999999999999e89 < l < 1.9000000000000001e-308Initial program 79.9%
Simplified79.9%
clear-num79.8%
frac-times78.7%
*-un-lft-identity78.7%
associate-/r*79.8%
Applied egg-rr79.8%
associate-*l/81.1%
associate-/l/80.0%
Applied egg-rr80.0%
if 1.9000000000000001e-308 < l Initial program 68.9%
Applied egg-rr26.4%
expm1-def41.0%
expm1-log1p80.9%
associate-*r*80.9%
associate-/r*80.9%
Simplified80.9%
Final simplification77.1%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l -1e-310)
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
(*
(/ (/ d (sqrt l)) (sqrt h))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D d) (* M_m 0.5)) 2.0)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -1e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l));
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * pow(((D / d) * (M_m * 0.5)), 2.0))));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-1d-310)) then
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l))
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0d0 - (0.5d0 * ((h / l) * (((d_1 / d) * (m_m * 0.5d0)) ** 2.0d0))))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -1e-310) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * Math.sqrt((d / l));
} else {
tmp = ((d / Math.sqrt(l)) / Math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * Math.pow(((D / d) * (M_m * 0.5)), 2.0))));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -1e-310: tmp = (math.sqrt(-d) / math.sqrt(-h)) * math.sqrt((d / l)) else: tmp = ((d / math.sqrt(l)) / math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * math.pow(((D / d) * (M_m * 0.5)), 2.0)))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -1e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0))))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= -1e-310)
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l));
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * (((D / d) * (M_m * 0.5)) ^ 2.0))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -1e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if l < -9.999999999999969e-311Initial program 69.3%
Simplified66.8%
Taylor expanded in h around 0 34.4%
frac-2neg69.2%
sqrt-div82.6%
Applied egg-rr43.8%
if -9.999999999999969e-311 < l Initial program 68.9%
Applied egg-rr26.4%
expm1-def41.0%
expm1-log1p80.9%
associate-*r*80.9%
associate-/r*80.9%
Simplified80.9%
Final simplification63.5%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (if (<= l -1e-310) (* (sqrt (/ d h)) (/ (sqrt (- d)) (sqrt (- l)))) (/ d (* (sqrt h) (sqrt l)))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -1e-310) {
tmp = sqrt((d / h)) * (sqrt(-d) / sqrt(-l));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-1d-310)) then
tmp = sqrt((d / h)) * (sqrt(-d) / sqrt(-l))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -1e-310) {
tmp = Math.sqrt((d / h)) * (Math.sqrt(-d) / Math.sqrt(-l));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -1e-310: tmp = math.sqrt((d / h)) * (math.sqrt(-d) / math.sqrt(-l)) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -1e-310) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= -1e-310)
tmp = sqrt((d / h)) * (sqrt(-d) / sqrt(-l));
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -1e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -9.999999999999969e-311Initial program 69.3%
Simplified66.8%
Taylor expanded in h around 0 34.4%
frac-2neg66.8%
sqrt-div69.8%
Applied egg-rr37.5%
if -9.999999999999969e-311 < l Initial program 68.9%
Simplified68.9%
Taylor expanded in h around 0 34.2%
*-commutative34.2%
sqrt-div37.6%
sqrt-div42.3%
frac-times42.3%
add-sqr-sqrt42.4%
Applied egg-rr42.4%
Final simplification40.1%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (if (<= l -1e-310) (* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l))) (/ d (* (sqrt h) (sqrt l)))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -1e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-1d-310)) then
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -1e-310) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * Math.sqrt((d / l));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -1e-310: tmp = (math.sqrt(-d) / math.sqrt(-h)) * math.sqrt((d / l)) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -1e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= -1e-310)
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l));
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -1e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -9.999999999999969e-311Initial program 69.3%
Simplified66.8%
Taylor expanded in h around 0 34.4%
frac-2neg69.2%
sqrt-div82.6%
Applied egg-rr43.8%
if -9.999999999999969e-311 < l Initial program 68.9%
Simplified68.9%
Taylor expanded in h around 0 34.2%
*-commutative34.2%
sqrt-div37.6%
sqrt-div42.3%
frac-times42.3%
add-sqr-sqrt42.4%
Applied egg-rr42.4%
Final simplification43.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 -2.3e-175)
(sqrt (/ (pow d 2.0) (* l h)))
(if (<= d -4e-310)
(* d (sqrt (/ 1.0 (* l h))))
(/ d (* (sqrt h) (sqrt l))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -2.3e-175) {
tmp = sqrt((pow(d, 2.0) / (l * h)));
} else if (d <= -4e-310) {
tmp = d * sqrt((1.0 / (l * h)));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= (-2.3d-175)) then
tmp = sqrt(((d ** 2.0d0) / (l * h)))
else if (d <= (-4d-310)) then
tmp = d * sqrt((1.0d0 / (l * h)))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -2.3e-175) {
tmp = Math.sqrt((Math.pow(d, 2.0) / (l * h)));
} else if (d <= -4e-310) {
tmp = d * Math.sqrt((1.0 / (l * h)));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if d <= -2.3e-175: tmp = math.sqrt((math.pow(d, 2.0) / (l * h))) elif d <= -4e-310: tmp = d * math.sqrt((1.0 / (l * h))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (d <= -2.3e-175) tmp = sqrt(Float64((d ^ 2.0) / Float64(l * h))); elseif (d <= -4e-310) tmp = Float64(d * sqrt(Float64(1.0 / Float64(l * h)))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (d <= -2.3e-175)
tmp = sqrt(((d ^ 2.0) / (l * h)));
elseif (d <= -4e-310)
tmp = d * sqrt((1.0 / (l * h)));
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -2.3e-175], N[Sqrt[N[(N[Power[d, 2.0], $MachinePrecision] / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[d, -4e-310], N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.3 \cdot 10^{-175}:\\
\;\;\;\;\sqrt{\frac{{d}^{2}}{\ell \cdot h}}\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -2.3e-175Initial program 77.1%
Simplified75.9%
Taylor expanded in h around 0 41.2%
sqrt-unprod37.1%
pow1/237.1%
frac-times30.5%
pow230.5%
Applied egg-rr30.5%
unpow1/230.5%
Simplified30.5%
if -2.3e-175 < d < -3.999999999999988e-310Initial program 46.8%
Taylor expanded in d around inf 21.9%
if -3.999999999999988e-310 < d Initial program 68.9%
Simplified68.9%
Taylor expanded in h around 0 34.2%
*-commutative34.2%
sqrt-div37.6%
sqrt-div42.3%
frac-times42.3%
add-sqr-sqrt42.4%
Applied egg-rr42.4%
Final simplification35.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 5.1e-212) (* (sqrt (/ d l)) (/ 1.0 (sqrt (/ h d)))) (/ d (* (sqrt h) (sqrt l)))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= 5.1e-212) {
tmp = sqrt((d / l)) * (1.0 / sqrt((h / d)));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= 5.1d-212) then
tmp = sqrt((d / l)) * (1.0d0 / sqrt((h / d)))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= 5.1e-212) {
tmp = Math.sqrt((d / l)) * (1.0 / Math.sqrt((h / d)));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= 5.1e-212: tmp = math.sqrt((d / l)) * (1.0 / math.sqrt((h / d))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= 5.1e-212) tmp = Float64(sqrt(Float64(d / l)) * Float64(1.0 / sqrt(Float64(h / d)))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= 5.1e-212)
tmp = sqrt((d / l)) * (1.0 / sqrt((h / d)));
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, 5.1e-212], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 5.1 \cdot 10^{-212}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \frac{1}{\sqrt{\frac{h}{d}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < 5.0999999999999997e-212Initial program 70.9%
Simplified70.9%
clear-num70.0%
sqrt-div71.7%
metadata-eval71.7%
Applied egg-rr71.7%
Taylor expanded in h around 0 36.0%
if 5.0999999999999997e-212 < l Initial program 66.7%
Simplified66.7%
Taylor expanded in h around 0 34.3%
*-commutative34.3%
sqrt-div38.4%
sqrt-div44.1%
frac-times44.1%
add-sqr-sqrt44.3%
Applied egg-rr44.3%
Final simplification39.6%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (if (<= l 2.25e-212) (* (sqrt (/ d h)) (sqrt (/ d l))) (/ d (* (sqrt h) (sqrt l)))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= 2.25e-212) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= 2.25d-212) then
tmp = sqrt((d / h)) * sqrt((d / l))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= 2.25e-212) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= 2.25e-212: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= 2.25e-212) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= 2.25e-212)
tmp = sqrt((d / h)) * sqrt((d / l));
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, 2.25e-212], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.25 \cdot 10^{-212}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < 2.2499999999999999e-212Initial program 70.9%
Simplified68.8%
Taylor expanded in h around 0 34.3%
if 2.2499999999999999e-212 < l Initial program 66.7%
Simplified66.7%
Taylor expanded in h around 0 34.3%
*-commutative34.3%
sqrt-div38.4%
sqrt-div44.1%
frac-times44.1%
add-sqr-sqrt44.3%
Applied egg-rr44.3%
Final simplification38.7%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (if (<= l -1e-310) (* d (sqrt (/ 1.0 (* l h)))) (/ d (* (sqrt h) (sqrt l)))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -1e-310) {
tmp = d * sqrt((1.0 / (l * h)));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-1d-310)) then
tmp = d * sqrt((1.0d0 / (l * h)))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -1e-310) {
tmp = d * Math.sqrt((1.0 / (l * h)));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -1e-310: tmp = d * math.sqrt((1.0 / (l * h))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -1e-310) tmp = Float64(d * sqrt(Float64(1.0 / Float64(l * h)))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M_m = abs(M);
d, 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 <= -1e-310)
tmp = d * sqrt((1.0 / (l * h)));
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -1e-310], N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -9.999999999999969e-311Initial program 69.3%
Taylor expanded in d around inf 11.2%
if -9.999999999999969e-311 < l Initial program 68.9%
Simplified68.9%
Taylor expanded in h around 0 34.2%
*-commutative34.2%
sqrt-div37.6%
sqrt-div42.3%
frac-times42.3%
add-sqr-sqrt42.4%
Applied egg-rr42.4%
Final simplification27.8%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (* d (sqrt (/ 1.0 (* l h)))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
return d * sqrt((1.0 / (l * h)));
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
code = d * sqrt((1.0d0 / (l * h)))
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
return d * Math.sqrt((1.0 / (l * h)));
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): return d * math.sqrt((1.0 / (l * h)))
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) return Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp = code(d, h, l, M_m, D)
tmp = d * sqrt((1.0 / (l * h)));
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
d \cdot \sqrt{\frac{1}{\ell \cdot h}}
\end{array}
Initial program 69.1%
Taylor expanded in d around inf 25.3%
Final simplification25.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 (* 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) {
return d * sqrt(((1.0 / h) / l));
}
M_m = abs(M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
code = d * sqrt(((1.0d0 / h) / l))
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
return d * Math.sqrt(((1.0 / h) / l));
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): return d * math.sqrt(((1.0 / h) / l))
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) return Float64(d * sqrt(Float64(Float64(1.0 / h) / l))) end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp = code(d, h, l, M_m, D)
tmp = d * sqrt(((1.0 / h) / l));
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := N[(d * N[Sqrt[N[(N[(1.0 / 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])\\
\\
d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}
\end{array}
Initial program 69.1%
Simplified67.9%
Taylor expanded in h around 0 34.3%
Taylor expanded in d around 0 25.3%
associate-/r*26.0%
Simplified26.0%
Final simplification26.0%
herbie shell --seed 2024031
(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)))))