
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* (/ D_m d) (* M 0.5)))
(t_1 (- 1.0 (* 0.5 (/ (* h (pow t_0 2.0)) l))))
(t_2 (sqrt (- d)))
(t_3 (sqrt (/ d h))))
(if (<= l -2.45e-126)
(*
(* (/ t_2 (sqrt (- h))) (sqrt (/ d l)))
(- 1.0 (* 0.5 (pow (* t_0 (sqrt (/ h l))) 2.0))))
(if (<= l -1e-310)
(* t_1 (* (/ t_2 (sqrt (- l))) t_3))
(if (<= l 1.5e-76)
(* (* t_3 (/ (sqrt d) (sqrt l))) t_1)
(*
(/ d (sqrt h))
(/
(fma (pow (* D_m (/ M (* d 2.0))) 2.0) (* (/ h l) -0.5) 1.0)
(sqrt l))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = (D_m / d) * (M * 0.5);
double t_1 = 1.0 - (0.5 * ((h * pow(t_0, 2.0)) / l));
double t_2 = sqrt(-d);
double t_3 = sqrt((d / h));
double tmp;
if (l <= -2.45e-126) {
tmp = ((t_2 / sqrt(-h)) * sqrt((d / l))) * (1.0 - (0.5 * pow((t_0 * sqrt((h / l))), 2.0)));
} else if (l <= -1e-310) {
tmp = t_1 * ((t_2 / sqrt(-l)) * t_3);
} else if (l <= 1.5e-76) {
tmp = (t_3 * (sqrt(d) / sqrt(l))) * t_1;
} else {
tmp = (d / sqrt(h)) * (fma(pow((D_m * (M / (d * 2.0))), 2.0), ((h / l) * -0.5), 1.0) / sqrt(l));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(D_m / d) * Float64(M * 0.5)) t_1 = Float64(1.0 - Float64(0.5 * Float64(Float64(h * (t_0 ^ 2.0)) / l))) t_2 = sqrt(Float64(-d)) t_3 = sqrt(Float64(d / h)) tmp = 0.0 if (l <= -2.45e-126) tmp = Float64(Float64(Float64(t_2 / sqrt(Float64(-h))) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * (Float64(t_0 * sqrt(Float64(h / l))) ^ 2.0)))); elseif (l <= -1e-310) tmp = Float64(t_1 * Float64(Float64(t_2 / sqrt(Float64(-l))) * t_3)); elseif (l <= 1.5e-76) tmp = Float64(Float64(t_3 * Float64(sqrt(d) / sqrt(l))) * t_1); else tmp = Float64(Float64(d / sqrt(h)) * Float64(fma((Float64(D_m * Float64(M / Float64(d * 2.0))) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0) / sqrt(l))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(D$95$m / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(0.5 * N[(N[(h * N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -2.45e-126], N[(N[(N[(t$95$2 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(t$95$0 * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-310], N[(t$95$1 * N[(N[(t$95$2 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.5e-76], N[(N[(t$95$3 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[N[(D$95$m * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{D\_m}{d} \cdot \left(M \cdot 0.5\right)\\
t_1 := 1 - 0.5 \cdot \frac{h \cdot {t\_0}^{2}}{\ell}\\
t_2 := \sqrt{-d}\\
t_3 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;\ell \leq -2.45 \cdot 10^{-126}:\\
\;\;\;\;\left(\frac{t\_2}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(t\_0 \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;t\_1 \cdot \left(\frac{t\_2}{\sqrt{-\ell}} \cdot t\_3\right)\\
\mathbf{elif}\;\ell \leq 1.5 \cdot 10^{-76}:\\
\;\;\;\;\left(t\_3 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h}} \cdot \frac{\mathsf{fma}\left({\left(D\_m \cdot \frac{M}{d \cdot 2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.45000000000000005e-126Initial program 64.5%
Simplified64.5%
add-sqr-sqrt64.5%
pow264.5%
sqrt-prod64.5%
unpow264.5%
sqrt-prod42.0%
add-sqr-sqrt66.5%
div-inv66.5%
metadata-eval66.5%
Applied egg-rr66.5%
frac-2neg66.5%
sqrt-div77.8%
Applied egg-rr77.8%
if -2.45000000000000005e-126 < l < -9.999999999999969e-311Initial program 67.2%
Simplified70.1%
associate-*r/73.4%
add-sqr-sqrt34.5%
add-sqr-sqrt73.4%
div-inv73.4%
metadata-eval73.4%
Applied egg-rr73.4%
frac-2neg73.4%
sqrt-div94.1%
Applied egg-rr94.1%
if -9.999999999999969e-311 < l < 1.50000000000000012e-76Initial program 58.4%
Simplified58.4%
associate-*r/65.3%
add-sqr-sqrt37.2%
add-sqr-sqrt65.3%
div-inv65.3%
metadata-eval65.3%
Applied egg-rr65.3%
sqrt-div81.0%
Applied egg-rr81.0%
if 1.50000000000000012e-76 < l Initial program 68.9%
Simplified70.2%
Applied egg-rr32.1%
Simplified85.2%
Final simplification83.1%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<=
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* M D_m) (* d 2.0)) 2.0)))))
2e+254)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(- 1.0 (* 0.5 (* (/ h l) (pow (/ D_m (* 2.0 (/ d M))) 2.0)))))
(sqrt (pow (* d (pow (* l h) -0.5)) 2.0))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (((pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((M * D_m) / (d * 2.0)), 2.0))))) <= 2e+254) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.5 * ((h / l) * pow((D_m / (2.0 * (d / M))), 2.0))));
} else {
tmp = sqrt(pow((d * pow((l * h), -0.5)), 2.0));
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (((((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((h / l) * (0.5d0 * (((m * d_m) / (d * 2.0d0)) ** 2.0d0))))) <= 2d+254) then
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0d0 - (0.5d0 * ((h / l) * ((d_m / (2.0d0 * (d / m))) ** 2.0d0))))
else
tmp = sqrt(((d * ((l * h) ** (-0.5d0))) ** 2.0d0))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (((Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((M * D_m) / (d * 2.0)), 2.0))))) <= 2e+254) {
tmp = (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - (0.5 * ((h / l) * Math.pow((D_m / (2.0 * (d / M))), 2.0))));
} else {
tmp = Math.sqrt(Math.pow((d * Math.pow((l * h), -0.5)), 2.0));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if ((math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((M * D_m) / (d * 2.0)), 2.0))))) <= 2e+254: tmp = (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - (0.5 * ((h / l) * math.pow((D_m / (2.0 * (d / M))), 2.0)))) else: tmp = math.sqrt(math.pow((d * math.pow((l * h), -0.5)), 2.0)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M * D_m) / Float64(d * 2.0)) ^ 2.0))))) <= 2e+254) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(D_m / Float64(2.0 * Float64(d / M))) ^ 2.0))))); else tmp = sqrt((Float64(d * (Float64(l * h) ^ -0.5)) ^ 2.0)); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (((((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((M * D_m) / (d * 2.0)) ^ 2.0))))) <= 2e+254)
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.5 * ((h / l) * ((D_m / (2.0 * (d / M))) ^ 2.0))));
else
tmp = sqrt(((d * ((l * h) ^ -0.5)) ^ 2.0));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[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[(M * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+254], N[(N[(N[Sqrt[N[(d / 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[(D$95$m / N[(2.0 * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[Power[N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\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{M \cdot D\_m}{d \cdot 2}\right)}^{2}\right)\right) \leq 2 \cdot 10^{+254}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{2 \cdot \frac{d}{M}}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{{\left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)}^{2}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 1.9999999999999999e254Initial program 89.4%
Simplified90.0%
clear-num90.0%
frac-times89.0%
*-un-lft-identity89.0%
associate-*l/89.0%
*-un-lft-identity89.0%
times-frac89.0%
metadata-eval89.0%
Applied egg-rr89.0%
if 1.9999999999999999e254 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) Initial program 20.5%
Simplified21.7%
Taylor expanded in d around inf 30.0%
add-sqr-sqrt29.4%
sqrt-unprod32.6%
pow232.6%
inv-pow32.6%
sqrt-pow132.6%
metadata-eval32.6%
Applied egg-rr32.6%
Final simplification69.2%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (sqrt (- d))))
(if (<= l -7.8e-303)
(*
(/ t_0 (sqrt (- h)))
(*
(/ t_0 (sqrt (- l)))
(+ 1.0 (* (/ h l) (* (pow (* (/ M 2.0) (/ D_m d)) 2.0) -0.5)))))
(if (<= l 1.3e-77)
(*
(* (sqrt (/ d h)) (/ (sqrt d) (sqrt l)))
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D_m d) (* M 0.5)) 2.0)) l))))
(*
(/ d (sqrt h))
(/
(fma (pow (* D_m (/ M (* d 2.0))) 2.0) (* (/ h l) -0.5) 1.0)
(sqrt l)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt(-d);
double tmp;
if (l <= -7.8e-303) {
tmp = (t_0 / sqrt(-h)) * ((t_0 / sqrt(-l)) * (1.0 + ((h / l) * (pow(((M / 2.0) * (D_m / d)), 2.0) * -0.5))));
} else if (l <= 1.3e-77) {
tmp = (sqrt((d / h)) * (sqrt(d) / sqrt(l))) * (1.0 - (0.5 * ((h * pow(((D_m / d) * (M * 0.5)), 2.0)) / l)));
} else {
tmp = (d / sqrt(h)) * (fma(pow((D_m * (M / (d * 2.0))), 2.0), ((h / l) * -0.5), 1.0) / sqrt(l));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -7.8e-303) tmp = Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.0) * -0.5))))); elseif (l <= 1.3e-77) tmp = Float64(Float64(sqrt(Float64(d / h)) * Float64(sqrt(d) / sqrt(l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D_m / d) * Float64(M * 0.5)) ^ 2.0)) / l)))); else tmp = Float64(Float64(d / sqrt(h)) * Float64(fma((Float64(D_m * Float64(M / Float64(d * 2.0))) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0) / sqrt(l))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -7.8e-303], N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.3e-77], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[N[(D$95$m * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -7.8 \cdot 10^{-303}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-h}} \cdot \left(\frac{t\_0}{\sqrt{-\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2} \cdot -0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 1.3 \cdot 10^{-77}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D\_m}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h}} \cdot \frac{\mathsf{fma}\left({\left(D\_m \cdot \frac{M}{d \cdot 2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -7.7999999999999998e-303Initial program 65.8%
Simplified65.9%
frac-2neg68.0%
sqrt-div77.8%
Applied egg-rr76.4%
frac-2neg68.4%
sqrt-div75.1%
Applied egg-rr81.8%
if -7.7999999999999998e-303 < l < 1.3000000000000001e-77Initial program 57.2%
Simplified57.2%
associate-*r/64.1%
add-sqr-sqrt36.5%
add-sqr-sqrt64.1%
div-inv64.1%
metadata-eval64.1%
Applied egg-rr64.1%
sqrt-div79.3%
Applied egg-rr79.3%
if 1.3000000000000001e-77 < l Initial program 68.9%
Simplified70.2%
Applied egg-rr32.1%
Simplified85.2%
Final simplification82.4%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1 (- 1.0 (* 0.5 (/ (* h (pow (* (/ D_m d) (* M 0.5)) 2.0)) l))))
(t_2 (sqrt (- d))))
(if (<= l -9e-126)
(*
(/ t_2 (sqrt (- h)))
(*
(+ 1.0 (* (/ h l) (* (pow (* (/ M 2.0) (/ D_m d)) 2.0) -0.5)))
(sqrt (/ d l))))
(if (<= l -1e-310)
(* t_1 (* (/ t_2 (sqrt (- l))) t_0))
(if (<= l 4.1e-77)
(* (* t_0 (/ (sqrt d) (sqrt l))) t_1)
(*
(/ d (sqrt h))
(/
(fma (pow (* D_m (/ M (* d 2.0))) 2.0) (* (/ h l) -0.5) 1.0)
(sqrt l))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt((d / h));
double t_1 = 1.0 - (0.5 * ((h * pow(((D_m / d) * (M * 0.5)), 2.0)) / l));
double t_2 = sqrt(-d);
double tmp;
if (l <= -9e-126) {
tmp = (t_2 / sqrt(-h)) * ((1.0 + ((h / l) * (pow(((M / 2.0) * (D_m / d)), 2.0) * -0.5))) * sqrt((d / l)));
} else if (l <= -1e-310) {
tmp = t_1 * ((t_2 / sqrt(-l)) * t_0);
} else if (l <= 4.1e-77) {
tmp = (t_0 * (sqrt(d) / sqrt(l))) * t_1;
} else {
tmp = (d / sqrt(h)) * (fma(pow((D_m * (M / (d * 2.0))), 2.0), ((h / l) * -0.5), 1.0) / sqrt(l));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(d / h)) t_1 = Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D_m / d) * Float64(M * 0.5)) ^ 2.0)) / l))) t_2 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -9e-126) tmp = Float64(Float64(t_2 / sqrt(Float64(-h))) * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.0) * -0.5))) * sqrt(Float64(d / l)))); elseif (l <= -1e-310) tmp = Float64(t_1 * Float64(Float64(t_2 / sqrt(Float64(-l))) * t_0)); elseif (l <= 4.1e-77) tmp = Float64(Float64(t_0 * Float64(sqrt(d) / sqrt(l))) * t_1); else tmp = Float64(Float64(d / sqrt(h)) * Float64(fma((Float64(D_m * Float64(M / Float64(d * 2.0))) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0) / sqrt(l))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -9e-126], N[(N[(t$95$2 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-310], N[(t$95$1 * N[(N[(t$95$2 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.1e-77], N[(N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[N[(D$95$m * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := 1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D\_m}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}}{\ell}\\
t_2 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -9 \cdot 10^{-126}:\\
\;\;\;\;\frac{t\_2}{\sqrt{-h}} \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2} \cdot -0.5\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;t\_1 \cdot \left(\frac{t\_2}{\sqrt{-\ell}} \cdot t\_0\right)\\
\mathbf{elif}\;\ell \leq 4.1 \cdot 10^{-77}:\\
\;\;\;\;\left(t\_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h}} \cdot \frac{\mathsf{fma}\left({\left(D\_m \cdot \frac{M}{d \cdot 2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -9.0000000000000005e-126Initial program 64.5%
Simplified64.5%
frac-2neg66.5%
sqrt-div77.8%
Applied egg-rr77.0%
if -9.0000000000000005e-126 < l < -9.999999999999969e-311Initial program 67.2%
Simplified70.1%
associate-*r/73.4%
add-sqr-sqrt34.5%
add-sqr-sqrt73.4%
div-inv73.4%
metadata-eval73.4%
Applied egg-rr73.4%
frac-2neg73.4%
sqrt-div94.1%
Applied egg-rr94.1%
if -9.999999999999969e-311 < l < 4.09999999999999962e-77Initial program 58.4%
Simplified58.4%
associate-*r/65.3%
add-sqr-sqrt37.2%
add-sqr-sqrt65.3%
div-inv65.3%
metadata-eval65.3%
Applied egg-rr65.3%
sqrt-div81.0%
Applied egg-rr81.0%
if 4.09999999999999962e-77 < l Initial program 68.9%
Simplified70.2%
Applied egg-rr32.1%
Simplified85.2%
Final simplification82.8%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1 (- 1.0 (* 0.5 (/ (* h (pow (* (/ D_m d) (* M 0.5)) 2.0)) l))))
(t_2 (sqrt (- d))))
(if (<= l -1.7e-125)
(*
(/ t_2 (sqrt (- h)))
(*
(sqrt (/ d l))
(+ 1.0 (* (/ h l) (* -0.5 (pow (/ M (* 2.0 (/ d D_m))) 2.0))))))
(if (<= l -1e-310)
(* t_1 (* (/ t_2 (sqrt (- l))) t_0))
(if (<= l 5e-77)
(* (* t_0 (/ (sqrt d) (sqrt l))) t_1)
(*
(/ d (sqrt h))
(/
(fma (pow (* D_m (/ M (* d 2.0))) 2.0) (* (/ h l) -0.5) 1.0)
(sqrt l))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt((d / h));
double t_1 = 1.0 - (0.5 * ((h * pow(((D_m / d) * (M * 0.5)), 2.0)) / l));
double t_2 = sqrt(-d);
double tmp;
if (l <= -1.7e-125) {
tmp = (t_2 / sqrt(-h)) * (sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * pow((M / (2.0 * (d / D_m))), 2.0)))));
} else if (l <= -1e-310) {
tmp = t_1 * ((t_2 / sqrt(-l)) * t_0);
} else if (l <= 5e-77) {
tmp = (t_0 * (sqrt(d) / sqrt(l))) * t_1;
} else {
tmp = (d / sqrt(h)) * (fma(pow((D_m * (M / (d * 2.0))), 2.0), ((h / l) * -0.5), 1.0) / sqrt(l));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(d / h)) t_1 = Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D_m / d) * Float64(M * 0.5)) ^ 2.0)) / l))) t_2 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -1.7e-125) tmp = Float64(Float64(t_2 / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(M / Float64(2.0 * Float64(d / D_m))) ^ 2.0)))))); elseif (l <= -1e-310) tmp = Float64(t_1 * Float64(Float64(t_2 / sqrt(Float64(-l))) * t_0)); elseif (l <= 5e-77) tmp = Float64(Float64(t_0 * Float64(sqrt(d) / sqrt(l))) * t_1); else tmp = Float64(Float64(d / sqrt(h)) * Float64(fma((Float64(D_m * Float64(M / Float64(d * 2.0))) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0) / sqrt(l))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -1.7e-125], N[(N[(t$95$2 / 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[(M / N[(2.0 * N[(d / D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-310], N[(t$95$1 * N[(N[(t$95$2 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5e-77], N[(N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[N[(D$95$m * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := 1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D\_m}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}}{\ell}\\
t_2 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -1.7 \cdot 10^{-125}:\\
\;\;\;\;\frac{t\_2}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M}{2 \cdot \frac{d}{D\_m}}\right)}^{2}\right)\right)\right)\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;t\_1 \cdot \left(\frac{t\_2}{\sqrt{-\ell}} \cdot t\_0\right)\\
\mathbf{elif}\;\ell \leq 5 \cdot 10^{-77}:\\
\;\;\;\;\left(t\_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h}} \cdot \frac{\mathsf{fma}\left({\left(D\_m \cdot \frac{M}{d \cdot 2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.69999999999999988e-125Initial program 64.5%
Simplified64.5%
frac-2neg66.5%
sqrt-div77.8%
Applied egg-rr77.0%
*-commutative77.0%
clear-num77.0%
frac-times77.0%
*-un-lft-identity77.0%
Applied egg-rr77.0%
if -1.69999999999999988e-125 < l < -9.999999999999969e-311Initial program 67.2%
Simplified70.1%
associate-*r/73.4%
add-sqr-sqrt34.5%
add-sqr-sqrt73.4%
div-inv73.4%
metadata-eval73.4%
Applied egg-rr73.4%
frac-2neg73.4%
sqrt-div94.1%
Applied egg-rr94.1%
if -9.999999999999969e-311 < l < 4.99999999999999963e-77Initial program 58.4%
Simplified58.4%
associate-*r/65.3%
add-sqr-sqrt37.2%
add-sqr-sqrt65.3%
div-inv65.3%
metadata-eval65.3%
Applied egg-rr65.3%
sqrt-div81.0%
Applied egg-rr81.0%
if 4.99999999999999963e-77 < l Initial program 68.9%
Simplified70.2%
Applied egg-rr32.1%
Simplified85.2%
Final simplification82.8%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d h))))
(if (<= d -1.65e-304)
(*
(*
(/ (sqrt (- d)) (sqrt (- l)))
(+ 1.0 (* (/ h l) (* (pow (* (/ M 2.0) (/ D_m d)) 2.0) -0.5))))
t_0)
(if (<= d 1.16e-39)
(*
(/ d (sqrt h))
(/
(fma (pow (* D_m (/ M (* d 2.0))) 2.0) (* (/ h l) -0.5) 1.0)
(sqrt l)))
(*
(* t_0 (/ (sqrt d) (sqrt l)))
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D_m d) (* M 0.5)) 2.0)) l))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt((d / h));
double tmp;
if (d <= -1.65e-304) {
tmp = ((sqrt(-d) / sqrt(-l)) * (1.0 + ((h / l) * (pow(((M / 2.0) * (D_m / d)), 2.0) * -0.5)))) * t_0;
} else if (d <= 1.16e-39) {
tmp = (d / sqrt(h)) * (fma(pow((D_m * (M / (d * 2.0))), 2.0), ((h / l) * -0.5), 1.0) / sqrt(l));
} else {
tmp = (t_0 * (sqrt(d) / sqrt(l))) * (1.0 - (0.5 * ((h * pow(((D_m / d) * (M * 0.5)), 2.0)) / l)));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(d / h)) tmp = 0.0 if (d <= -1.65e-304) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.0) * -0.5)))) * t_0); elseif (d <= 1.16e-39) tmp = Float64(Float64(d / sqrt(h)) * Float64(fma((Float64(D_m * Float64(M / Float64(d * 2.0))) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0) / sqrt(l))); else tmp = Float64(Float64(t_0 * Float64(sqrt(d) / sqrt(l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D_m / d) * Float64(M * 0.5)) ^ 2.0)) / l)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.65e-304], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[d, 1.16e-39], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[N[(D$95$m * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;d \leq -1.65 \cdot 10^{-304}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2} \cdot -0.5\right)\right)\right) \cdot t\_0\\
\mathbf{elif}\;d \leq 1.16 \cdot 10^{-39}:\\
\;\;\;\;\frac{d}{\sqrt{h}} \cdot \frac{\mathsf{fma}\left({\left(D\_m \cdot \frac{M}{d \cdot 2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D\_m}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}}{\ell}\right)\\
\end{array}
\end{array}
if d < -1.65000000000000006e-304Initial program 65.8%
Simplified65.9%
frac-2neg68.4%
sqrt-div75.8%
Applied egg-rr69.6%
if -1.65000000000000006e-304 < d < 1.16e-39Initial program 62.7%
Simplified60.8%
Applied egg-rr3.2%
Simplified80.4%
if 1.16e-39 < d Initial program 65.8%
Simplified68.3%
associate-*r/73.8%
add-sqr-sqrt45.9%
add-sqr-sqrt73.8%
div-inv73.8%
metadata-eval73.8%
Applied egg-rr73.8%
sqrt-div85.3%
Applied egg-rr85.3%
Final simplification76.6%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (- 1.0 (* 0.5 (/ (* h (pow (* (/ D_m d) (* M 0.5)) 2.0)) l))))
(t_1 (sqrt (/ d h))))
(if (<= l -1e-310)
(* t_0 (* (/ (sqrt (- d)) (sqrt (- l))) t_1))
(if (<= l 3.1e-77)
(* (* t_1 (/ (sqrt d) (sqrt l))) t_0)
(*
(/ d (sqrt h))
(/
(fma (pow (* D_m (/ M (* d 2.0))) 2.0) (* (/ h l) -0.5) 1.0)
(sqrt l)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = 1.0 - (0.5 * ((h * pow(((D_m / d) * (M * 0.5)), 2.0)) / l));
double t_1 = sqrt((d / h));
double tmp;
if (l <= -1e-310) {
tmp = t_0 * ((sqrt(-d) / sqrt(-l)) * t_1);
} else if (l <= 3.1e-77) {
tmp = (t_1 * (sqrt(d) / sqrt(l))) * t_0;
} else {
tmp = (d / sqrt(h)) * (fma(pow((D_m * (M / (d * 2.0))), 2.0), ((h / l) * -0.5), 1.0) / sqrt(l));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D_m / d) * Float64(M * 0.5)) ^ 2.0)) / l))) t_1 = sqrt(Float64(d / h)) tmp = 0.0 if (l <= -1e-310) tmp = Float64(t_0 * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * t_1)); elseif (l <= 3.1e-77) tmp = Float64(Float64(t_1 * Float64(sqrt(d) / sqrt(l))) * t_0); else tmp = Float64(Float64(d / sqrt(h)) * Float64(fma((Float64(D_m * Float64(M / Float64(d * 2.0))) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0) / sqrt(l))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1e-310], N[(t$95$0 * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.1e-77], N[(N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[N[(D$95$m * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := 1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D\_m}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}}{\ell}\\
t_1 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;t\_0 \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot t\_1\right)\\
\mathbf{elif}\;\ell \leq 3.1 \cdot 10^{-77}:\\
\;\;\;\;\left(t\_1 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h}} \cdot \frac{\mathsf{fma}\left({\left(D\_m \cdot \frac{M}{d \cdot 2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -9.999999999999969e-311Initial program 65.3%
Simplified66.1%
associate-*r/67.9%
add-sqr-sqrt40.0%
add-sqr-sqrt67.9%
div-inv67.9%
metadata-eval67.9%
Applied egg-rr67.9%
frac-2neg67.9%
sqrt-div75.3%
Applied egg-rr75.3%
if -9.999999999999969e-311 < l < 3.10000000000000008e-77Initial program 58.4%
Simplified58.4%
associate-*r/65.3%
add-sqr-sqrt37.2%
add-sqr-sqrt65.3%
div-inv65.3%
metadata-eval65.3%
Applied egg-rr65.3%
sqrt-div81.0%
Applied egg-rr81.0%
if 3.10000000000000008e-77 < l Initial program 68.9%
Simplified70.2%
Applied egg-rr32.1%
Simplified85.2%
Final simplification79.5%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= l 4.7e-268)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D_m d) (* M 0.5)) 2.0)) l)))
(* (sqrt (/ d h)) (sqrt (/ d l))))
(*
(/ d (sqrt h))
(/
(fma (pow (* D_m (/ M (* d 2.0))) 2.0) (* (/ h l) -0.5) 1.0)
(sqrt l)))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= 4.7e-268) {
tmp = (1.0 - (0.5 * ((h * pow(((D_m / d) * (M * 0.5)), 2.0)) / l))) * (sqrt((d / h)) * sqrt((d / l)));
} else {
tmp = (d / sqrt(h)) * (fma(pow((D_m * (M / (d * 2.0))), 2.0), ((h / l) * -0.5), 1.0) / sqrt(l));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= 4.7e-268) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D_m / d) * Float64(M * 0.5)) ^ 2.0)) / l))) * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))); else tmp = Float64(Float64(d / sqrt(h)) * Float64(fma((Float64(D_m * Float64(M / Float64(d * 2.0))) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0) / sqrt(l))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, 4.7e-268], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[N[(D$95$m * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 4.7 \cdot 10^{-268}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D\_m}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h}} \cdot \frac{\mathsf{fma}\left({\left(D\_m \cdot \frac{M}{d \cdot 2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < 4.69999999999999973e-268Initial program 66.4%
Simplified67.1%
associate-*r/68.8%
add-sqr-sqrt40.0%
add-sqr-sqrt68.8%
div-inv68.8%
metadata-eval68.8%
Applied egg-rr68.8%
if 4.69999999999999973e-268 < l Initial program 63.8%
Simplified64.8%
Applied egg-rr31.6%
Simplified81.4%
Final simplification74.7%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= l 1.4e+258)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(+ 1.0 (* (/ h l) (* -0.5 (pow (/ (/ (* M D_m) 2.0) d) 2.0))))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= 1.4e+258) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * pow((((M * D_m) / 2.0) / d), 2.0)))));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (l <= 1.4d+258) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 + ((h / l) * ((-0.5d0) * ((((m * d_m) / 2.0d0) / d) ** 2.0d0)))))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= 1.4e+258) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * Math.pow((((M * D_m) / 2.0) / d), 2.0)))));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if l <= 1.4e+258: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * math.pow((((M * D_m) / 2.0) / d), 2.0))))) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= 1.4e+258) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(Float64(M * D_m) / 2.0) / d) ^ 2.0)))))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= 1.4e+258)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * ((((M * D_m) / 2.0) / d) ^ 2.0)))));
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, 1.4e+258], N[(N[Sqrt[N[(d / 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[(N[(M * D$95$m), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.4 \cdot 10^{+258}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{\frac{M \cdot D\_m}{2}}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < 1.39999999999999991e258Initial program 66.6%
Simplified66.6%
frac-times66.2%
associate-/r*66.2%
Applied egg-rr66.2%
if 1.39999999999999991e258 < l Initial program 39.3%
Simplified47.3%
Taylor expanded in d around inf 40.2%
associate-/r*44.3%
sqrt-div76.7%
Applied egg-rr76.7%
Final simplification66.7%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (* (sqrt (/ d h)) (* (+ 1.0 (* (/ h l) (* (pow (* (/ M 2.0) (/ D_m d)) 2.0) -0.5))) (sqrt (/ d l)))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
return sqrt((d / h)) * ((1.0 + ((h / l) * (pow(((M / 2.0) * (D_m / d)), 2.0) * -0.5))) * sqrt((d / l)));
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
code = sqrt((d / h)) * ((1.0d0 + ((h / l) * ((((m / 2.0d0) * (d_m / d)) ** 2.0d0) * (-0.5d0)))) * sqrt((d / l)))
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
return Math.sqrt((d / h)) * ((1.0 + ((h / l) * (Math.pow(((M / 2.0) * (D_m / d)), 2.0) * -0.5))) * Math.sqrt((d / l)));
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): return math.sqrt((d / h)) * ((1.0 + ((h / l) * (math.pow(((M / 2.0) * (D_m / d)), 2.0) * -0.5))) * math.sqrt((d / l)))
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) return Float64(sqrt(Float64(d / h)) * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.0) * -0.5))) * sqrt(Float64(d / l)))) end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp = code(d, h, l, M, D_m)
tmp = sqrt((d / h)) * ((1.0 + ((h / l) * ((((M / 2.0) * (D_m / d)) ^ 2.0) * -0.5))) * sqrt((d / l)));
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\sqrt{\frac{d}{h}} \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2} \cdot -0.5\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right)
\end{array}
Initial program 65.2%
Simplified65.6%
Final simplification65.6%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (* (* (sqrt (/ d h)) (sqrt (/ d l))) (- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M 2.0) (/ D_m d)) 2.0))))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
return (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.5 * ((h / l) * pow(((M / 2.0) * (D_m / d)), 2.0))));
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
code = (sqrt((d / h)) * sqrt((d / l))) * (1.0d0 - (0.5d0 * ((h / l) * (((m / 2.0d0) * (d_m / d)) ** 2.0d0))))
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
return (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - (0.5 * ((h / l) * Math.pow(((M / 2.0) * (D_m / d)), 2.0))));
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): return (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - (0.5 * ((h / l) * math.pow(((M / 2.0) * (D_m / d)), 2.0))))
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) return Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.0))))) end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp = code(d, h, l, M, D_m)
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.5 * ((h / l) * (((M / 2.0) * (D_m / d)) ^ 2.0))));
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := N[(N[(N[Sqrt[N[(d / 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 / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right)
\end{array}
Initial program 65.2%
Simplified66.0%
Final simplification66.0%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= D_m 1.7e+55)
(* (sqrt (/ d l)) (pow (/ h d) -0.5))
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (* -0.5 (* h (/ (pow (* (/ M 2.0) (/ D_m d)) 2.0) l)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (D_m <= 1.7e+55) {
tmp = sqrt((d / l)) * pow((h / d), -0.5);
} else {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (h * (pow(((M / 2.0) * (D_m / d)), 2.0) / l))));
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (d_m <= 1.7d+55) then
tmp = sqrt((d / l)) * ((h / d) ** (-0.5d0))
else
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) * (h * ((((m / 2.0d0) * (d_m / d)) ** 2.0d0) / l))))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (D_m <= 1.7e+55) {
tmp = Math.sqrt((d / l)) * Math.pow((h / d), -0.5);
} else {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (h * (Math.pow(((M / 2.0) * (D_m / d)), 2.0) / l))));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if D_m <= 1.7e+55: tmp = math.sqrt((d / l)) * math.pow((h / d), -0.5) else: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (h * (math.pow(((M / 2.0) * (D_m / d)), 2.0) / l)))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (D_m <= 1.7e+55) tmp = Float64(sqrt(Float64(d / l)) * (Float64(h / d) ^ -0.5)); else tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(h * Float64((Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.0) / l))))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (D_m <= 1.7e+55)
tmp = sqrt((d / l)) * ((h / d) ^ -0.5);
else
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (h * ((((M / 2.0) * (D_m / d)) ^ 2.0) / l))));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[D$95$m, 1.7e+55], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Power[N[(h / d), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(h * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;D\_m \leq 1.7 \cdot 10^{+55}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot {\left(\frac{h}{d}\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(h \cdot \frac{{\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2}}{\ell}\right)\right)\\
\end{array}
\end{array}
if D < 1.6999999999999999e55Initial program 65.0%
Simplified65.0%
clear-num65.0%
sqrt-div65.7%
metadata-eval65.7%
Applied egg-rr65.7%
Taylor expanded in h around 0 41.8%
expm1-log1p-u40.4%
expm1-udef33.9%
pow1/233.9%
pow-flip33.9%
metadata-eval33.9%
Applied egg-rr33.9%
expm1-def40.4%
expm1-log1p41.8%
Simplified41.8%
if 1.6999999999999999e55 < D Initial program 66.1%
Simplified68.4%
associate-*r/66.6%
add-sqr-sqrt29.7%
add-sqr-sqrt66.6%
div-inv66.6%
metadata-eval66.6%
Applied egg-rr66.6%
expm1-log1p-u22.0%
expm1-udef13.4%
Applied egg-rr9.2%
expm1-def17.8%
expm1-log1p55.0%
*-commutative55.0%
associate-/r/55.3%
times-frac57.7%
Simplified57.7%
Final simplification44.5%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (if (<= d 1.4e-100) (* (- d) (pow (* l h) -0.5)) (* d (* (pow l -0.5) (pow h -0.5)))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= 1.4e-100) {
tmp = -d * pow((l * h), -0.5);
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (d <= 1.4d-100) then
tmp = -d * ((l * h) ** (-0.5d0))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= 1.4e-100) {
tmp = -d * Math.pow((l * h), -0.5);
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if d <= 1.4e-100: tmp = -d * math.pow((l * h), -0.5) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (d <= 1.4e-100) tmp = Float64(Float64(-d) * (Float64(l * h) ^ -0.5)); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (d <= 1.4e-100)
tmp = -d * ((l * h) ^ -0.5);
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[d, 1.4e-100], N[((-d) * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.4 \cdot 10^{-100}:\\
\;\;\;\;\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < 1.39999999999999998e-100Initial program 63.7%
Simplified63.1%
clear-num63.1%
sqrt-div63.7%
metadata-eval63.7%
Applied egg-rr63.7%
Taylor expanded in h around 0 34.0%
Taylor expanded in d around -inf 37.1%
associate-*r*37.1%
mul-1-neg37.1%
*-commutative37.1%
unpow-137.1%
metadata-eval37.1%
pow-sqr37.1%
rem-sqrt-square37.8%
rem-square-sqrt37.6%
fabs-sqr37.6%
rem-square-sqrt37.8%
Simplified37.8%
if 1.39999999999999998e-100 < d Initial program 67.5%
Simplified69.5%
associate-*r/73.8%
add-sqr-sqrt42.1%
add-sqr-sqrt73.8%
div-inv73.8%
metadata-eval73.8%
Applied egg-rr73.8%
Taylor expanded in d around inf 48.9%
unpow-148.9%
metadata-eval48.9%
pow-sqr48.9%
rem-sqrt-square48.9%
rem-square-sqrt48.7%
fabs-sqr48.7%
rem-square-sqrt48.9%
Simplified48.9%
*-commutative48.9%
unpow-prod-down59.7%
Applied egg-rr59.7%
Final simplification46.5%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (if (<= h -1.45e-306) (* (- d) (pow (* l h) -0.5)) (* d (pow (/ (/ 1.0 h) l) 0.5))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (h <= -1.45e-306) {
tmp = -d * pow((l * h), -0.5);
} else {
tmp = d * pow(((1.0 / h) / l), 0.5);
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (h <= (-1.45d-306)) then
tmp = -d * ((l * h) ** (-0.5d0))
else
tmp = d * (((1.0d0 / h) / l) ** 0.5d0)
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (h <= -1.45e-306) {
tmp = -d * Math.pow((l * h), -0.5);
} else {
tmp = d * Math.pow(((1.0 / h) / l), 0.5);
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if h <= -1.45e-306: tmp = -d * math.pow((l * h), -0.5) else: tmp = d * math.pow(((1.0 / h) / l), 0.5) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (h <= -1.45e-306) tmp = Float64(Float64(-d) * (Float64(l * h) ^ -0.5)); else tmp = Float64(d * (Float64(Float64(1.0 / h) / l) ^ 0.5)); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (h <= -1.45e-306)
tmp = -d * ((l * h) ^ -0.5);
else
tmp = d * (((1.0 / h) / l) ^ 0.5);
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[h, -1.45e-306], N[((-d) * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[Power[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1.45 \cdot 10^{-306}:\\
\;\;\;\;\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(\frac{\frac{1}{h}}{\ell}\right)}^{0.5}\\
\end{array}
\end{array}
if h < -1.4499999999999999e-306Initial program 64.7%
Simplified64.8%
clear-num64.7%
sqrt-div65.5%
metadata-eval65.5%
Applied egg-rr65.5%
Taylor expanded in h around 0 39.1%
Taylor expanded in d around -inf 41.1%
associate-*r*41.1%
mul-1-neg41.1%
*-commutative41.1%
unpow-141.1%
metadata-eval41.1%
pow-sqr41.1%
rem-sqrt-square42.0%
rem-square-sqrt41.8%
fabs-sqr41.8%
rem-square-sqrt42.0%
Simplified42.0%
if -1.4499999999999999e-306 < h Initial program 65.6%
Simplified66.4%
Taylor expanded in d around inf 42.9%
pow1/242.9%
associate-/r*43.3%
Applied egg-rr43.3%
Final simplification42.7%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (if (<= h -1.45e-306) (* (- d) (pow (* l h) -0.5)) (* d (sqrt (/ (/ 1.0 l) h)))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (h <= -1.45e-306) {
tmp = -d * pow((l * h), -0.5);
} else {
tmp = d * sqrt(((1.0 / l) / h));
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (h <= (-1.45d-306)) then
tmp = -d * ((l * h) ** (-0.5d0))
else
tmp = d * sqrt(((1.0d0 / l) / h))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (h <= -1.45e-306) {
tmp = -d * Math.pow((l * h), -0.5);
} else {
tmp = d * Math.sqrt(((1.0 / l) / h));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if h <= -1.45e-306: tmp = -d * math.pow((l * h), -0.5) else: tmp = d * math.sqrt(((1.0 / l) / h)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (h <= -1.45e-306) tmp = Float64(Float64(-d) * (Float64(l * h) ^ -0.5)); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (h <= -1.45e-306)
tmp = -d * ((l * h) ^ -0.5);
else
tmp = d * sqrt(((1.0 / l) / h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[h, -1.45e-306], N[((-d) * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1.45 \cdot 10^{-306}:\\
\;\;\;\;\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\end{array}
\end{array}
if h < -1.4499999999999999e-306Initial program 64.7%
Simplified64.8%
clear-num64.7%
sqrt-div65.5%
metadata-eval65.5%
Applied egg-rr65.5%
Taylor expanded in h around 0 39.1%
Taylor expanded in d around -inf 41.1%
associate-*r*41.1%
mul-1-neg41.1%
*-commutative41.1%
unpow-141.1%
metadata-eval41.1%
pow-sqr41.1%
rem-sqrt-square42.0%
rem-square-sqrt41.8%
fabs-sqr41.8%
rem-square-sqrt42.0%
Simplified42.0%
if -1.4499999999999999e-306 < h Initial program 65.6%
Simplified66.4%
Taylor expanded in d around inf 42.9%
*-commutative42.9%
associate-/r*43.2%
Simplified43.2%
Final simplification42.7%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (* d (sqrt (/ 1.0 (* l h)))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
return d * sqrt((1.0 / (l * h)));
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
code = d * sqrt((1.0d0 / (l * h)))
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
return d * Math.sqrt((1.0 / (l * h)));
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): return d * math.sqrt((1.0 / (l * h)))
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) return Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp = code(d, h, l, M, D_m)
tmp = d * sqrt((1.0 / (l * h)));
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
d \cdot \sqrt{\frac{1}{\ell \cdot h}}
\end{array}
Initial program 65.2%
Simplified66.0%
Taylor expanded in d around inf 26.1%
Final simplification26.1%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (* d (sqrt (/ (/ 1.0 l) h))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
return d * sqrt(((1.0 / l) / h));
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
code = d * sqrt(((1.0d0 / l) / h))
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
return d * Math.sqrt(((1.0 / l) / h));
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): return d * math.sqrt(((1.0 / l) / h))
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) return Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp = code(d, h, l, M, D_m)
tmp = d * sqrt(((1.0 / l) / h));
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}
\end{array}
Initial program 65.2%
Simplified66.0%
Taylor expanded in d around inf 26.1%
*-commutative26.1%
associate-/r*26.3%
Simplified26.3%
Final simplification26.3%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (* d (pow (* l h) -0.5)))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
return d * pow((l * h), -0.5);
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
code = d * ((l * h) ** (-0.5d0))
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
return d * Math.pow((l * h), -0.5);
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): return d * math.pow((l * h), -0.5)
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) return Float64(d * (Float64(l * h) ^ -0.5)) end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp = code(d, h, l, M, D_m)
tmp = d * ((l * h) ^ -0.5);
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
d \cdot {\left(\ell \cdot h\right)}^{-0.5}
\end{array}
Initial program 65.2%
Simplified66.0%
associate-*r/68.6%
add-sqr-sqrt39.7%
add-sqr-sqrt68.6%
div-inv68.6%
metadata-eval68.6%
Applied egg-rr68.6%
Taylor expanded in d around inf 26.1%
unpow-126.1%
metadata-eval26.1%
pow-sqr26.1%
rem-sqrt-square25.8%
rem-square-sqrt25.7%
fabs-sqr25.7%
rem-square-sqrt25.8%
Simplified25.8%
Final simplification25.8%
herbie shell --seed 2024033
(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)))))