
(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 24 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 (sqrt (- d))))
(if (<= l -1e-309)
(*
(* (/ t_0 (sqrt (- h))) (/ t_0 (sqrt (- l))))
(- 1.0 (* 0.5 (/ (* h (pow (* M (/ D_m (* d 2.0))) 2.0)) l))))
(if (<= l 1.55e-134)
(*
(/ (sqrt d) (sqrt l))
(*
(sqrt (/ d h))
(+ 1.0 (/ (* -0.125 (* h (pow (* M (/ D_m d)) 2.0))) l))))
(*
d
(/
(fma (* (/ h l) -0.5) (pow (/ (* M D_m) (* d 2.0)) 2.0) 1.0)
(* (sqrt l) (sqrt 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 t_0 = sqrt(-d);
double tmp;
if (l <= -1e-309) {
tmp = ((t_0 / sqrt(-h)) * (t_0 / sqrt(-l))) * (1.0 - (0.5 * ((h * pow((M * (D_m / (d * 2.0))), 2.0)) / l)));
} else if (l <= 1.55e-134) {
tmp = (sqrt(d) / sqrt(l)) * (sqrt((d / h)) * (1.0 + ((-0.125 * (h * pow((M * (D_m / d)), 2.0))) / l)));
} else {
tmp = d * (fma(((h / l) * -0.5), pow(((M * D_m) / (d * 2.0)), 2.0), 1.0) / (sqrt(l) * sqrt(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) t_0 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -1e-309) tmp = Float64(Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(t_0 / sqrt(Float64(-l)))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M * Float64(D_m / Float64(d * 2.0))) ^ 2.0)) / l)))); elseif (l <= 1.55e-134) tmp = Float64(Float64(sqrt(d) / sqrt(l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(-0.125 * Float64(h * (Float64(M * Float64(D_m / d)) ^ 2.0))) / l)))); else tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(M * D_m) / Float64(d * 2.0)) ^ 2.0), 1.0) / Float64(sqrt(l) * sqrt(h)))); 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, -1e-309], N[(N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M * N[(D$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.55e-134], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(-0.125 * N[(h * N[Power[N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(M * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[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])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\left(\frac{t\_0}{\sqrt{-h}} \cdot \frac{t\_0}{\sqrt{-\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(M \cdot \frac{D\_m}{d \cdot 2}\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;\ell \leq 1.55 \cdot 10^{-134}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{-0.125 \cdot \left(h \cdot {\left(M \cdot \frac{D\_m}{d}\right)}^{2}\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{M \cdot D\_m}{d \cdot 2}\right)}^{2}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -1.000000000000002e-309Initial program 78.9%
Simplified77.2%
frac-2neg77.2%
sqrt-div83.0%
Applied egg-rr83.0%
associate-*r/84.7%
frac-times86.5%
associate-/l*84.7%
*-commutative84.7%
Applied egg-rr84.7%
frac-2neg84.7%
sqrt-div89.5%
Applied egg-rr89.5%
if -1.000000000000002e-309 < l < 1.55000000000000003e-134Initial program 66.0%
Simplified66.0%
associate-*l/74.9%
*-commutative74.9%
add-sqr-sqrt74.9%
pow274.9%
sqrt-pow174.9%
metadata-eval74.9%
pow174.9%
associate-/l/74.9%
Applied egg-rr74.9%
Taylor expanded in h around 0 42.4%
associate-*r*42.3%
*-commutative42.3%
associate-/l*42.4%
associate-/l*40.8%
unpow240.8%
unpow240.8%
unpow240.8%
times-frac66.6%
swap-sqr74.9%
unpow274.9%
associate-*r/75.0%
*-commutative75.0%
associate-*r/74.9%
Simplified74.9%
sqrt-div87.2%
Applied egg-rr87.2%
if 1.55000000000000003e-134 < l Initial program 67.0%
Simplified65.2%
Applied egg-rr81.1%
unpow181.1%
associate-*l/85.8%
associate-/l*86.7%
+-commutative86.7%
associate-*r*86.7%
fma-define86.7%
*-commutative86.7%
associate-*r/87.6%
*-commutative87.6%
Simplified87.6%
Final simplification88.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))))
(if (<= l -1e-309)
(*
(* (/ t_0 (sqrt (- h))) (/ t_0 (sqrt (- l))))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0)))))
(if (<= l 5.8e-135)
(*
(/ (sqrt d) (sqrt l))
(*
(sqrt (/ d h))
(+ 1.0 (/ (* -0.125 (* h (pow (* M (/ D_m d)) 2.0))) l))))
(*
d
(/
(fma (* (/ h l) -0.5) (pow (/ (* M D_m) (* d 2.0)) 2.0) 1.0)
(* (sqrt l) (sqrt 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 t_0 = sqrt(-d);
double tmp;
if (l <= -1e-309) {
tmp = ((t_0 / sqrt(-h)) * (t_0 / sqrt(-l))) * (1.0 - (0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0))));
} else if (l <= 5.8e-135) {
tmp = (sqrt(d) / sqrt(l)) * (sqrt((d / h)) * (1.0 + ((-0.125 * (h * pow((M * (D_m / d)), 2.0))) / l)));
} else {
tmp = d * (fma(((h / l) * -0.5), pow(((M * D_m) / (d * 2.0)), 2.0), 1.0) / (sqrt(l) * sqrt(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) t_0 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -1e-309) tmp = Float64(Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(t_0 / sqrt(Float64(-l)))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0))))); elseif (l <= 5.8e-135) tmp = Float64(Float64(sqrt(d) / sqrt(l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(-0.125 * Float64(h * (Float64(M * Float64(D_m / d)) ^ 2.0))) / l)))); else tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(M * D_m) / Float64(d * 2.0)) ^ 2.0), 1.0) / Float64(sqrt(l) * sqrt(h)))); 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, -1e-309], N[(N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.8e-135], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(-0.125 * N[(h * N[Power[N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(M * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[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])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\left(\frac{t\_0}{\sqrt{-h}} \cdot \frac{t\_0}{\sqrt{-\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right)\\
\mathbf{elif}\;\ell \leq 5.8 \cdot 10^{-135}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{-0.125 \cdot \left(h \cdot {\left(M \cdot \frac{D\_m}{d}\right)}^{2}\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{M \cdot D\_m}{d \cdot 2}\right)}^{2}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -1.000000000000002e-309Initial program 78.9%
Simplified77.2%
frac-2neg77.2%
sqrt-div83.0%
Applied egg-rr83.0%
frac-2neg84.7%
sqrt-div89.5%
Applied egg-rr85.2%
if -1.000000000000002e-309 < l < 5.8000000000000004e-135Initial program 66.0%
Simplified66.0%
associate-*l/74.9%
*-commutative74.9%
add-sqr-sqrt74.9%
pow274.9%
sqrt-pow174.9%
metadata-eval74.9%
pow174.9%
associate-/l/74.9%
Applied egg-rr74.9%
Taylor expanded in h around 0 42.4%
associate-*r*42.3%
*-commutative42.3%
associate-/l*42.4%
associate-/l*40.8%
unpow240.8%
unpow240.8%
unpow240.8%
times-frac66.6%
swap-sqr74.9%
unpow274.9%
associate-*r/75.0%
*-commutative75.0%
associate-*r/74.9%
Simplified74.9%
sqrt-div87.2%
Applied egg-rr87.2%
if 5.8000000000000004e-135 < l Initial program 67.0%
Simplified65.2%
Applied egg-rr81.1%
unpow181.1%
associate-*l/85.8%
associate-/l*86.7%
+-commutative86.7%
associate-*r*86.7%
fma-define86.7%
*-commutative86.7%
associate-*r/87.6%
*-commutative87.6%
Simplified87.6%
Final simplification86.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 (+ 1.0 (/ (* -0.125 (* h (pow (* M (/ D_m d)) 2.0))) l))))
(if (<= l -1e-309)
(* (sqrt (/ d l)) (* (/ (sqrt (- d)) (sqrt (- h))) t_0))
(if (<= l 3.5e-134)
(* (/ (sqrt d) (sqrt l)) (* (sqrt (/ d h)) t_0))
(*
d
(/
(fma (* (/ h l) -0.5) (pow (/ (* M D_m) (* d 2.0)) 2.0) 1.0)
(* (sqrt l) (sqrt 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 t_0 = 1.0 + ((-0.125 * (h * pow((M * (D_m / d)), 2.0))) / l);
double tmp;
if (l <= -1e-309) {
tmp = sqrt((d / l)) * ((sqrt(-d) / sqrt(-h)) * t_0);
} else if (l <= 3.5e-134) {
tmp = (sqrt(d) / sqrt(l)) * (sqrt((d / h)) * t_0);
} else {
tmp = d * (fma(((h / l) * -0.5), pow(((M * D_m) / (d * 2.0)), 2.0), 1.0) / (sqrt(l) * sqrt(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) t_0 = Float64(1.0 + Float64(Float64(-0.125 * Float64(h * (Float64(M * Float64(D_m / d)) ^ 2.0))) / l)) tmp = 0.0 if (l <= -1e-309) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0)); elseif (l <= 3.5e-134) tmp = Float64(Float64(sqrt(d) / sqrt(l)) * Float64(sqrt(Float64(d / h)) * t_0)); else tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(M * D_m) / Float64(d * 2.0)) ^ 2.0), 1.0) / Float64(sqrt(l) * sqrt(h)))); 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[(N[(-0.125 * N[(h * N[Power[N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1e-309], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.5e-134], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(M * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[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])\\
\\
\begin{array}{l}
t_0 := 1 + \frac{-0.125 \cdot \left(h \cdot {\left(M \cdot \frac{D\_m}{d}\right)}^{2}\right)}{\ell}\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_0\right)\\
\mathbf{elif}\;\ell \leq 3.5 \cdot 10^{-134}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{M \cdot D\_m}{d \cdot 2}\right)}^{2}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -1.000000000000002e-309Initial program 78.9%
Simplified78.0%
associate-*l/79.6%
*-commutative79.6%
add-sqr-sqrt79.6%
pow279.6%
sqrt-pow179.6%
metadata-eval79.6%
pow179.6%
associate-/l/79.6%
Applied egg-rr79.6%
Taylor expanded in h around 0 48.7%
associate-*r*52.1%
*-commutative52.1%
associate-/l*52.1%
associate-/l*51.2%
unpow251.2%
unpow251.2%
unpow251.2%
times-frac65.8%
swap-sqr79.6%
unpow279.6%
associate-*r/80.5%
*-commutative80.5%
associate-*r/78.8%
Simplified78.8%
frac-2neg77.2%
sqrt-div83.0%
Applied egg-rr84.7%
if -1.000000000000002e-309 < l < 3.4999999999999998e-134Initial program 66.0%
Simplified66.0%
associate-*l/74.9%
*-commutative74.9%
add-sqr-sqrt74.9%
pow274.9%
sqrt-pow174.9%
metadata-eval74.9%
pow174.9%
associate-/l/74.9%
Applied egg-rr74.9%
Taylor expanded in h around 0 42.4%
associate-*r*42.3%
*-commutative42.3%
associate-/l*42.4%
associate-/l*40.8%
unpow240.8%
unpow240.8%
unpow240.8%
times-frac66.6%
swap-sqr74.9%
unpow274.9%
associate-*r/75.0%
*-commutative75.0%
associate-*r/74.9%
Simplified74.9%
sqrt-div87.2%
Applied egg-rr87.2%
if 3.4999999999999998e-134 < l Initial program 67.0%
Simplified65.2%
Applied egg-rr81.1%
unpow181.1%
associate-*l/85.8%
associate-/l*86.7%
+-commutative86.7%
associate-*r*86.7%
fma-define86.7%
*-commutative86.7%
associate-*r/87.6%
*-commutative87.6%
Simplified87.6%
Final simplification86.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 (pow (/ (* M D_m) (* d 2.0)) 2.0)))
(if (<= l 3.8e-216)
(* (sqrt (/ d l)) (* (sqrt (/ d h)) (+ 1.0 (/ (* h (* -0.5 t_0)) l))))
(* d (/ (fma (* (/ h l) -0.5) t_0 1.0) (* (sqrt l) (sqrt 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 t_0 = pow(((M * D_m) / (d * 2.0)), 2.0);
double tmp;
if (l <= 3.8e-216) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * (-0.5 * t_0)) / l)));
} else {
tmp = d * (fma(((h / l) * -0.5), t_0, 1.0) / (sqrt(l) * sqrt(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) t_0 = Float64(Float64(M * D_m) / Float64(d * 2.0)) ^ 2.0 tmp = 0.0 if (l <= 3.8e-216) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h * Float64(-0.5 * t_0)) / l)))); else tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), t_0, 1.0) / Float64(sqrt(l) * sqrt(h)))); 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[Power[N[(N[(M * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[l, 3.8e-216], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * N[(-0.5 * t$95$0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[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])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{M \cdot D\_m}{d \cdot 2}\right)}^{2}\\
\mathbf{if}\;\ell \leq 3.8 \cdot 10^{-216}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot \left(-0.5 \cdot t\_0\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, t\_0, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 3.8e-216Initial program 77.6%
Simplified76.7%
associate-*l/80.4%
*-commutative80.4%
add-sqr-sqrt80.4%
pow280.4%
sqrt-pow180.4%
metadata-eval80.4%
pow180.4%
associate-/l/80.4%
Applied egg-rr80.4%
associate-*r/81.2%
Applied egg-rr81.2%
if 3.8e-216 < l Initial program 66.2%
Simplified64.6%
Applied egg-rr81.7%
unpow181.7%
associate-*l/85.9%
associate-/l*85.8%
+-commutative85.8%
associate-*r*85.8%
fma-define85.8%
*-commutative85.8%
associate-*r/86.6%
*-commutative86.6%
Simplified86.6%
Final simplification83.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 (or (<= h 4.8e-296) (not (<= h 1.5e+121)))
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (* h (* (pow (* D_m (/ M d)) 2.0) (/ -0.125 l))))))
(/
(* d (fma (/ h l) (* -0.5 (pow (* D_m (* 0.5 (/ M d))) 2.0)) 1.0))
(sqrt (* 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 <= 4.8e-296) || !(h <= 1.5e+121)) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (h * (pow((D_m * (M / d)), 2.0) * (-0.125 / l)))));
} else {
tmp = (d * fma((h / l), (-0.5 * pow((D_m * (0.5 * (M / d))), 2.0)), 1.0)) / sqrt((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 <= 4.8e-296) || !(h <= 1.5e+121)) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(h * Float64((Float64(D_m * Float64(M / d)) ^ 2.0) * Float64(-0.125 / l)))))); else tmp = Float64(Float64(d * fma(Float64(h / l), Float64(-0.5 * (Float64(D_m * Float64(0.5 * Float64(M / d))) ^ 2.0)), 1.0)) / sqrt(Float64(l * h))); 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[Or[LessEqual[h, 4.8e-296], N[Not[LessEqual[h, 1.5e+121]], $MachinePrecision]], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(N[Power[N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.125 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d * N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * 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 4.8 \cdot 10^{-296} \lor \neg \left(h \leq 1.5 \cdot 10^{+121}\right):\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + h \cdot \left({\left(D\_m \cdot \frac{M}{d}\right)}^{2} \cdot \frac{-0.125}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(D\_m \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}, 1\right)}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if h < 4.79999999999999992e-296 or 1.5000000000000001e121 < h Initial program 73.4%
Simplified72.7%
associate-*l/75.8%
*-commutative75.8%
add-sqr-sqrt75.8%
pow275.8%
sqrt-pow175.8%
metadata-eval75.8%
pow175.8%
associate-/l/75.8%
Applied egg-rr75.8%
Taylor expanded in h around 0 43.1%
associate-*r*48.0%
*-commutative48.0%
associate-/l*48.0%
associate-/l*47.4%
unpow247.4%
unpow247.4%
unpow247.4%
times-frac64.6%
swap-sqr75.8%
unpow275.8%
associate-*r/76.4%
*-commutative76.4%
associate-*r/75.2%
Simplified75.2%
Taylor expanded in h around 0 40.6%
*-commutative40.6%
associate-*r*45.5%
times-frac45.5%
*-commutative45.5%
associate-/l*45.4%
unpow245.4%
unpow245.4%
unpow245.4%
times-frac59.1%
swap-sqr72.1%
unpow272.1%
associate-/l*75.2%
*-commutative75.2%
associate-*l/75.2%
*-rgt-identity75.2%
associate-*r/75.2%
Simplified75.2%
if 4.79999999999999992e-296 < h < 1.5000000000000001e121Initial program 70.3%
Simplified68.3%
Applied egg-rr85.9%
unpow185.9%
associate-*r*85.9%
*-commutative85.9%
associate-*r/88.0%
*-commutative88.0%
associate-*r/86.9%
associate-*r*86.9%
associate-*r*86.9%
associate-/r*86.9%
Simplified86.9%
associate-*l/90.2%
+-commutative90.2%
associate-*l*90.2%
fma-define90.2%
div-inv90.2%
metadata-eval90.2%
sqrt-unprod86.9%
*-commutative86.9%
Applied egg-rr86.9%
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
(let* ((t_0 (sqrt (/ d h))) (t_1 (sqrt (/ d l))))
(if (<= h 6.5e-295)
(* (* t_0 (+ 1.0 (/ (* -0.125 (* h (pow (* M (/ D_m d)) 2.0))) l))) t_1)
(if (<= h 1.76e+120)
(/
(* d (fma (/ h l) (* -0.5 (pow (* D_m (* 0.5 (/ M d))) 2.0)) 1.0))
(sqrt (* l h)))
(*
t_1
(* t_0 (+ 1.0 (* h (* (pow (* D_m (/ M d)) 2.0) (/ -0.125 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 = sqrt((d / l));
double tmp;
if (h <= 6.5e-295) {
tmp = (t_0 * (1.0 + ((-0.125 * (h * pow((M * (D_m / d)), 2.0))) / l))) * t_1;
} else if (h <= 1.76e+120) {
tmp = (d * fma((h / l), (-0.5 * pow((D_m * (0.5 * (M / d))), 2.0)), 1.0)) / sqrt((l * h));
} else {
tmp = t_1 * (t_0 * (1.0 + (h * (pow((D_m * (M / d)), 2.0) * (-0.125 / 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 = sqrt(Float64(d / l)) tmp = 0.0 if (h <= 6.5e-295) tmp = Float64(Float64(t_0 * Float64(1.0 + Float64(Float64(-0.125 * Float64(h * (Float64(M * Float64(D_m / d)) ^ 2.0))) / l))) * t_1); elseif (h <= 1.76e+120) tmp = Float64(Float64(d * fma(Float64(h / l), Float64(-0.5 * (Float64(D_m * Float64(0.5 * Float64(M / d))) ^ 2.0)), 1.0)) / sqrt(Float64(l * h))); else tmp = Float64(t_1 * Float64(t_0 * Float64(1.0 + Float64(h * Float64((Float64(D_m * Float64(M / d)) ^ 2.0) * Float64(-0.125 / 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[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, 6.5e-295], N[(N[(t$95$0 * N[(1.0 + N[(N[(-0.125 * N[(h * N[Power[N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[h, 1.76e+120], N[(N[(d * N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(t$95$0 * N[(1.0 + N[(h * N[(N[Power[N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.125 / l), $MachinePrecision]), $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}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;h \leq 6.5 \cdot 10^{-295}:\\
\;\;\;\;\left(t\_0 \cdot \left(1 + \frac{-0.125 \cdot \left(h \cdot {\left(M \cdot \frac{D\_m}{d}\right)}^{2}\right)}{\ell}\right)\right) \cdot t\_1\\
\mathbf{elif}\;h \leq 1.76 \cdot 10^{+120}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(D\_m \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}, 1\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(t\_0 \cdot \left(1 + h \cdot \left({\left(D\_m \cdot \frac{M}{d}\right)}^{2} \cdot \frac{-0.125}{\ell}\right)\right)\right)\\
\end{array}
\end{array}
if h < 6.4999999999999998e-295Initial program 78.6%
Simplified77.7%
associate-*l/79.4%
*-commutative79.4%
add-sqr-sqrt79.4%
pow279.4%
sqrt-pow179.4%
metadata-eval79.4%
pow179.4%
associate-/l/79.4%
Applied egg-rr79.4%
Taylor expanded in h around 0 48.3%
associate-*r*51.6%
*-commutative51.6%
associate-/l*51.6%
associate-/l*50.8%
unpow250.8%
unpow250.8%
unpow250.8%
times-frac65.8%
swap-sqr79.4%
unpow279.4%
associate-*r/80.2%
*-commutative80.2%
associate-*r/78.6%
Simplified78.6%
if 6.4999999999999998e-295 < h < 1.7600000000000001e120Initial program 70.3%
Simplified68.3%
Applied egg-rr85.9%
unpow185.9%
associate-*r*85.9%
*-commutative85.9%
associate-*r/88.0%
*-commutative88.0%
associate-*r/86.9%
associate-*r*86.9%
associate-*r*86.9%
associate-/r*86.9%
Simplified86.9%
associate-*l/90.2%
+-commutative90.2%
associate-*l*90.2%
fma-define90.2%
div-inv90.2%
metadata-eval90.2%
sqrt-unprod86.9%
*-commutative86.9%
Applied egg-rr86.9%
if 1.7600000000000001e120 < h Initial program 58.7%
Simplified58.7%
associate-*l/65.8%
*-commutative65.8%
add-sqr-sqrt65.8%
pow265.8%
sqrt-pow165.8%
metadata-eval65.8%
pow165.8%
associate-/l/65.8%
Applied egg-rr65.8%
Taylor expanded in h around 0 28.7%
associate-*r*37.9%
*-commutative37.9%
associate-/l*37.9%
associate-/l*37.9%
unpow237.9%
unpow237.9%
unpow237.9%
times-frac61.1%
swap-sqr65.8%
unpow265.8%
associate-*r/65.9%
*-commutative65.9%
associate-*r/65.9%
Simplified65.9%
Taylor expanded in h around 0 23.9%
*-commutative23.9%
associate-*r*33.2%
times-frac30.8%
*-commutative30.8%
associate-/l*30.7%
unpow230.7%
unpow230.7%
unpow230.7%
times-frac47.0%
swap-sqr58.7%
unpow258.7%
associate-/l*65.9%
*-commutative65.9%
associate-*l/65.9%
*-rgt-identity65.9%
associate-*r/65.9%
Simplified65.9%
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 (or (<= h 2.5e-296) (not (<= h 6.8e+254)))
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (* -0.5 (* (/ h l) (pow (* D_m (/ M (* d 2.0))) 2.0)))))
(/
(* d (fma (/ h l) (* -0.5 (pow (* D_m (* 0.5 (/ M d))) 2.0)) 1.0))
(sqrt (* 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 <= 2.5e-296) || !(h <= 6.8e+254)) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * pow((D_m * (M / (d * 2.0))), 2.0))));
} else {
tmp = (d * fma((h / l), (-0.5 * pow((D_m * (0.5 * (M / d))), 2.0)), 1.0)) / sqrt((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 <= 2.5e-296) || !(h <= 6.8e+254)) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(D_m * Float64(M / Float64(d * 2.0))) ^ 2.0))))); else tmp = Float64(Float64(d * fma(Float64(h / l), Float64(-0.5 * (Float64(D_m * Float64(0.5 * Float64(M / d))) ^ 2.0)), 1.0)) / sqrt(Float64(l * h))); 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[Or[LessEqual[h, 2.5e-296], N[Not[LessEqual[h, 6.8e+254]], $MachinePrecision]], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d * N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * 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 2.5 \cdot 10^{-296} \lor \neg \left(h \leq 6.8 \cdot 10^{+254}\right):\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D\_m \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(D\_m \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}, 1\right)}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if h < 2.50000000000000015e-296 or 6.8000000000000001e254 < h Initial program 78.4%
Simplified76.9%
frac-2neg76.9%
sqrt-div73.5%
Applied egg-rr73.5%
associate-*r/75.0%
frac-times76.6%
associate-/l*75.0%
*-commutative75.0%
Applied egg-rr75.0%
pow175.0%
Applied egg-rr67.0%
unpow167.0%
unpow1/267.0%
associate-*r/68.5%
*-commutative68.5%
associate-*r/68.5%
associate-*l*68.5%
*-commutative68.5%
*-commutative68.5%
associate-*l*68.5%
associate-*r/68.5%
associate-*l/67.0%
Simplified67.0%
if 2.50000000000000015e-296 < h < 6.8000000000000001e254Initial program 65.7%
Simplified64.2%
Applied egg-rr80.7%
unpow180.7%
associate-*r*80.7%
*-commutative80.7%
associate-*r/82.2%
*-commutative82.2%
associate-*r/81.4%
associate-*r*81.4%
associate-*r*81.4%
associate-/r*81.4%
Simplified81.4%
associate-*l/85.4%
+-commutative85.4%
associate-*l*85.4%
fma-define85.4%
div-inv85.4%
metadata-eval85.4%
sqrt-unprod78.3%
*-commutative78.3%
Applied egg-rr78.3%
Final simplification72.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
(let* ((t_0 (sqrt (* (/ d h) (/ d l)))))
(if (<= h 2.55e-294)
(* (fma (pow (* D_m (/ M d)) 2.0) (* (- h) (/ 0.125 l)) 1.0) t_0)
(if (<= h 3.6e+255)
(/
(* d (fma (/ h l) (* -0.5 (pow (* D_m (* 0.5 (/ M d))) 2.0)) 1.0))
(sqrt (* l h)))
(*
t_0
(+ 1.0 (* -0.5 (* (/ h l) (pow (* D_m (/ M (* d 2.0))) 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 t_0 = sqrt(((d / h) * (d / l)));
double tmp;
if (h <= 2.55e-294) {
tmp = fma(pow((D_m * (M / d)), 2.0), (-h * (0.125 / l)), 1.0) * t_0;
} else if (h <= 3.6e+255) {
tmp = (d * fma((h / l), (-0.5 * pow((D_m * (0.5 * (M / d))), 2.0)), 1.0)) / sqrt((l * h));
} else {
tmp = t_0 * (1.0 + (-0.5 * ((h / l) * pow((D_m * (M / (d * 2.0))), 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) t_0 = sqrt(Float64(Float64(d / h) * Float64(d / l))) tmp = 0.0 if (h <= 2.55e-294) tmp = Float64(fma((Float64(D_m * Float64(M / d)) ^ 2.0), Float64(Float64(-h) * Float64(0.125 / l)), 1.0) * t_0); elseif (h <= 3.6e+255) tmp = Float64(Float64(d * fma(Float64(h / l), Float64(-0.5 * (Float64(D_m * Float64(0.5 * Float64(M / d))) ^ 2.0)), 1.0)) / sqrt(Float64(l * h))); else tmp = Float64(t_0 * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(D_m * Float64(M / Float64(d * 2.0))) ^ 2.0))))); 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[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, 2.55e-294], N[(N[(N[Power[N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[((-h) * N[(0.125 / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[h, 3.6e+255], N[(N[(d * N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m * N[(M / N[(d * 2.0), $MachinePrecision]), $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])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{if}\;h \leq 2.55 \cdot 10^{-294}:\\
\;\;\;\;\mathsf{fma}\left({\left(D\_m \cdot \frac{M}{d}\right)}^{2}, \left(-h\right) \cdot \frac{0.125}{\ell}, 1\right) \cdot t\_0\\
\mathbf{elif}\;h \leq 3.6 \cdot 10^{+255}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(D\_m \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}, 1\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D\_m \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if h < 2.55000000000000003e-294Initial program 78.6%
Simplified76.2%
Taylor expanded in h around -inf 49.9%
associate-*r*49.9%
neg-mul-149.9%
sub-neg49.9%
distribute-rgt-in49.9%
fma-define49.9%
Simplified77.8%
fma-undefine77.8%
Applied egg-rr77.8%
pow177.8%
associate-*r*78.5%
pow1/278.5%
pow1/278.5%
pow-prod-down66.9%
associate-*l*66.1%
fma-define66.1%
Applied egg-rr66.1%
unpow166.1%
*-commutative66.1%
*-commutative66.1%
unpow1/266.1%
Simplified66.1%
if 2.55000000000000003e-294 < h < 3.5999999999999999e255Initial program 65.7%
Simplified64.2%
Applied egg-rr80.7%
unpow180.7%
associate-*r*80.7%
*-commutative80.7%
associate-*r/82.2%
*-commutative82.2%
associate-*r/81.4%
associate-*r*81.4%
associate-*r*81.4%
associate-/r*81.4%
Simplified81.4%
associate-*l/85.4%
+-commutative85.4%
associate-*l*85.4%
fma-define85.4%
div-inv85.4%
metadata-eval85.4%
sqrt-unprod78.3%
*-commutative78.3%
Applied egg-rr78.3%
if 3.5999999999999999e255 < h Initial program 76.3%
Simplified76.3%
frac-2neg76.3%
sqrt-div0.0%
Applied egg-rr0.0%
associate-*r/0.0%
frac-times0.0%
associate-/l*0.0%
*-commutative0.0%
Applied egg-rr0.0%
pow10.0%
Applied egg-rr75.7%
unpow175.7%
unpow1/275.7%
associate-*r/75.7%
*-commutative75.7%
associate-*r/75.7%
associate-*l*75.7%
*-commutative75.7%
*-commutative75.7%
associate-*l*75.7%
associate-*r/75.7%
associate-*l/75.7%
Simplified75.7%
Final simplification72.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 6.5e-217)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (/ (* h (* -0.5 (pow (/ (* M D_m) (* d 2.0)) 2.0))) l))))
(*
(/ d (* (sqrt l) (sqrt h)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D_m (/ (/ M d) 2.0)) 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 (l <= 6.5e-217) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * (-0.5 * pow(((M * D_m) / (d * 2.0)), 2.0))) / l)));
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + (((h / l) * -0.5) * pow((D_m * ((M / d) / 2.0)), 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 (l <= 6.5d-217) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((h * ((-0.5d0) * (((m * d_m) / (d * 2.0d0)) ** 2.0d0))) / l)))
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((d_m * ((m / d) / 2.0d0)) ** 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 (l <= 6.5e-217) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h * (-0.5 * Math.pow(((M * D_m) / (d * 2.0)), 2.0))) / l)));
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 + (((h / l) * -0.5) * Math.pow((D_m * ((M / d) / 2.0)), 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 l <= 6.5e-217: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((h * (-0.5 * math.pow(((M * D_m) / (d * 2.0)), 2.0))) / l))) else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 + (((h / l) * -0.5) * math.pow((D_m * ((M / d) / 2.0)), 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 (l <= 6.5e-217) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(Float64(M * D_m) / Float64(d * 2.0)) ^ 2.0))) / l)))); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(Float64(M / d) / 2.0)) ^ 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 (l <= 6.5e-217)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * (-0.5 * (((M * D_m) / (d * 2.0)) ^ 2.0))) / l)));
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + (((h / l) * -0.5) * ((D_m * ((M / d) / 2.0)) ^ 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[l, 6.5e-217], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(N[(M * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(N[(M / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $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}\;\ell \leq 6.5 \cdot 10^{-217}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(\frac{M \cdot D\_m}{d \cdot 2}\right)}^{2}\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{\frac{M}{d}}{2}\right)}^{2}\right)\\
\end{array}
\end{array}
if l < 6.4999999999999996e-217Initial program 77.6%
Simplified76.7%
associate-*l/80.4%
*-commutative80.4%
add-sqr-sqrt80.4%
pow280.4%
sqrt-pow180.4%
metadata-eval80.4%
pow180.4%
associate-/l/80.4%
Applied egg-rr80.4%
associate-*r/81.2%
Applied egg-rr81.2%
if 6.4999999999999996e-217 < l Initial program 66.2%
Simplified64.6%
Applied egg-rr81.7%
unpow181.7%
associate-*r*81.7%
*-commutative81.7%
associate-*r/83.3%
*-commutative83.3%
associate-*r/82.5%
associate-*r*82.5%
associate-*r*82.5%
associate-/r*82.5%
Simplified82.5%
Final simplification81.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
(if (<= l 2.8e-217)
(*
(* (sqrt (/ d h)) (+ 1.0 (/ (* -0.125 (* h (pow (* M (/ D_m d)) 2.0))) l)))
(sqrt (/ d l)))
(*
(/ d (* (sqrt l) (sqrt h)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D_m (/ (/ M d) 2.0)) 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 (l <= 2.8e-217) {
tmp = (sqrt((d / h)) * (1.0 + ((-0.125 * (h * pow((M * (D_m / d)), 2.0))) / l))) * sqrt((d / l));
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + (((h / l) * -0.5) * pow((D_m * ((M / d) / 2.0)), 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 (l <= 2.8d-217) then
tmp = (sqrt((d / h)) * (1.0d0 + (((-0.125d0) * (h * ((m * (d_m / d)) ** 2.0d0))) / l))) * sqrt((d / l))
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((d_m * ((m / d) / 2.0d0)) ** 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 (l <= 2.8e-217) {
tmp = (Math.sqrt((d / h)) * (1.0 + ((-0.125 * (h * Math.pow((M * (D_m / d)), 2.0))) / l))) * Math.sqrt((d / l));
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 + (((h / l) * -0.5) * Math.pow((D_m * ((M / d) / 2.0)), 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 l <= 2.8e-217: tmp = (math.sqrt((d / h)) * (1.0 + ((-0.125 * (h * math.pow((M * (D_m / d)), 2.0))) / l))) * math.sqrt((d / l)) else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 + (((h / l) * -0.5) * math.pow((D_m * ((M / d) / 2.0)), 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 (l <= 2.8e-217) tmp = Float64(Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(-0.125 * Float64(h * (Float64(M * Float64(D_m / d)) ^ 2.0))) / l))) * sqrt(Float64(d / l))); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(Float64(M / d) / 2.0)) ^ 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 (l <= 2.8e-217)
tmp = (sqrt((d / h)) * (1.0 + ((-0.125 * (h * ((M * (D_m / d)) ^ 2.0))) / l))) * sqrt((d / l));
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + (((h / l) * -0.5) * ((D_m * ((M / d) / 2.0)) ^ 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[l, 2.8e-217], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(-0.125 * N[(h * N[Power[N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(N[(M / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $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}\;\ell \leq 2.8 \cdot 10^{-217}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{-0.125 \cdot \left(h \cdot {\left(M \cdot \frac{D\_m}{d}\right)}^{2}\right)}{\ell}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{\frac{M}{d}}{2}\right)}^{2}\right)\\
\end{array}
\end{array}
if l < 2.8e-217Initial program 77.6%
Simplified76.7%
associate-*l/80.4%
*-commutative80.4%
add-sqr-sqrt80.4%
pow280.4%
sqrt-pow180.4%
metadata-eval80.4%
pow180.4%
associate-/l/80.4%
Applied egg-rr80.4%
Taylor expanded in h around 0 48.9%
associate-*r*51.8%
*-commutative51.8%
associate-/l*51.8%
associate-/l*51.1%
unpow251.1%
unpow251.1%
unpow251.1%
times-frac68.6%
swap-sqr80.4%
unpow280.4%
associate-*r/81.2%
*-commutative81.2%
associate-*r/79.7%
Simplified79.7%
if 2.8e-217 < l Initial program 66.2%
Simplified64.6%
Applied egg-rr81.7%
unpow181.7%
associate-*r*81.7%
*-commutative81.7%
associate-*r/83.3%
*-commutative83.3%
associate-*r/82.5%
associate-*r*82.5%
associate-*r*82.5%
associate-/r*82.5%
Simplified82.5%
Final simplification81.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 (<= l 7e-217)
(*
(* (sqrt (/ d h)) (+ 1.0 (/ (* -0.125 (* h (pow (* M (/ D_m d)) 2.0))) l)))
(sqrt (/ d l)))
(*
(/ d (* (sqrt l) (sqrt h)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* 0.5 (/ (* M 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) {
double tmp;
if (l <= 7e-217) {
tmp = (sqrt((d / h)) * (1.0 + ((-0.125 * (h * pow((M * (D_m / d)), 2.0))) / l))) * sqrt((d / l));
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + (((h / l) * -0.5) * pow((0.5 * ((M * D_m) / d)), 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 (l <= 7d-217) then
tmp = (sqrt((d / h)) * (1.0d0 + (((-0.125d0) * (h * ((m * (d_m / d)) ** 2.0d0))) / l))) * sqrt((d / l))
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((0.5d0 * ((m * d_m) / d)) ** 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 (l <= 7e-217) {
tmp = (Math.sqrt((d / h)) * (1.0 + ((-0.125 * (h * Math.pow((M * (D_m / d)), 2.0))) / l))) * Math.sqrt((d / l));
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 + (((h / l) * -0.5) * Math.pow((0.5 * ((M * D_m) / d)), 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 l <= 7e-217: tmp = (math.sqrt((d / h)) * (1.0 + ((-0.125 * (h * math.pow((M * (D_m / d)), 2.0))) / l))) * math.sqrt((d / l)) else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 + (((h / l) * -0.5) * math.pow((0.5 * ((M * D_m) / d)), 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 (l <= 7e-217) tmp = Float64(Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(-0.125 * Float64(h * (Float64(M * Float64(D_m / d)) ^ 2.0))) / l))) * sqrt(Float64(d / l))); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(0.5 * Float64(Float64(M * D_m) / d)) ^ 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 (l <= 7e-217)
tmp = (sqrt((d / h)) * (1.0 + ((-0.125 * (h * ((M * (D_m / d)) ^ 2.0))) / l))) * sqrt((d / l));
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + (((h / l) * -0.5) * ((0.5 * ((M * D_m) / d)) ^ 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[l, 7e-217], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(-0.125 * N[(h * N[Power[N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(0.5 * N[(N[(M * D$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $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}\;\ell \leq 7 \cdot 10^{-217}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{-0.125 \cdot \left(h \cdot {\left(M \cdot \frac{D\_m}{d}\right)}^{2}\right)}{\ell}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(0.5 \cdot \frac{M \cdot D\_m}{d}\right)}^{2}\right)\\
\end{array}
\end{array}
if l < 7e-217Initial program 77.6%
Simplified76.7%
associate-*l/80.4%
*-commutative80.4%
add-sqr-sqrt80.4%
pow280.4%
sqrt-pow180.4%
metadata-eval80.4%
pow180.4%
associate-/l/80.4%
Applied egg-rr80.4%
Taylor expanded in h around 0 48.9%
associate-*r*51.8%
*-commutative51.8%
associate-/l*51.8%
associate-/l*51.1%
unpow251.1%
unpow251.1%
unpow251.1%
times-frac68.6%
swap-sqr80.4%
unpow280.4%
associate-*r/81.2%
*-commutative81.2%
associate-*r/79.7%
Simplified79.7%
if 7e-217 < l Initial program 66.2%
Simplified64.6%
Applied egg-rr81.7%
unpow181.7%
associate-*r*81.7%
*-commutative81.7%
associate-*r/83.3%
*-commutative83.3%
associate-*r/82.5%
associate-*r*82.5%
associate-*r*82.5%
associate-/r*82.5%
Simplified82.5%
Taylor expanded in D around 0 83.3%
Final simplification81.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
(if (or (<= h 9.2e-296) (not (<= h 1.65e+254)))
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (* -0.5 (* (/ h l) (pow (* D_m (/ M (* d 2.0))) 2.0)))))
(*
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D_m (/ (/ M d) 2.0)) 2.0)))
(/ d (sqrt (* 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 <= 9.2e-296) || !(h <= 1.65e+254)) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * pow((D_m * (M / (d * 2.0))), 2.0))));
} else {
tmp = (1.0 + (((h / l) * -0.5) * pow((D_m * ((M / d) / 2.0)), 2.0))) * (d / sqrt((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 <= 9.2d-296) .or. (.not. (h <= 1.65d+254))) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) * ((h / l) * ((d_m * (m / (d * 2.0d0))) ** 2.0d0))))
else
tmp = (1.0d0 + (((h / l) * (-0.5d0)) * ((d_m * ((m / d) / 2.0d0)) ** 2.0d0))) * (d / sqrt((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 <= 9.2e-296) || !(h <= 1.65e+254)) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * Math.pow((D_m * (M / (d * 2.0))), 2.0))));
} else {
tmp = (1.0 + (((h / l) * -0.5) * Math.pow((D_m * ((M / d) / 2.0)), 2.0))) * (d / Math.sqrt((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 <= 9.2e-296) or not (h <= 1.65e+254): tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * math.pow((D_m * (M / (d * 2.0))), 2.0)))) else: tmp = (1.0 + (((h / l) * -0.5) * math.pow((D_m * ((M / d) / 2.0)), 2.0))) * (d / math.sqrt((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 <= 9.2e-296) || !(h <= 1.65e+254)) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(D_m * Float64(M / Float64(d * 2.0))) ^ 2.0))))); else tmp = Float64(Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(Float64(M / d) / 2.0)) ^ 2.0))) * Float64(d / sqrt(Float64(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 <= 9.2e-296) || ~((h <= 1.65e+254)))
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * ((D_m * (M / (d * 2.0))) ^ 2.0))));
else
tmp = (1.0 + (((h / l) * -0.5) * ((D_m * ((M / d) / 2.0)) ^ 2.0))) * (d / sqrt((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[Or[LessEqual[h, 9.2e-296], N[Not[LessEqual[h, 1.65e+254]], $MachinePrecision]], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(N[(M / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[Sqrt[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])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq 9.2 \cdot 10^{-296} \lor \neg \left(h \leq 1.65 \cdot 10^{+254}\right):\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D\_m \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{\frac{M}{d}}{2}\right)}^{2}\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if h < 9.20000000000000016e-296 or 1.64999999999999996e254 < h Initial program 78.4%
Simplified76.9%
frac-2neg76.9%
sqrt-div73.5%
Applied egg-rr73.5%
associate-*r/75.0%
frac-times76.6%
associate-/l*75.0%
*-commutative75.0%
Applied egg-rr75.0%
pow175.0%
Applied egg-rr67.0%
unpow167.0%
unpow1/267.0%
associate-*r/68.5%
*-commutative68.5%
associate-*r/68.5%
associate-*l*68.5%
*-commutative68.5%
*-commutative68.5%
associate-*l*68.5%
associate-*r/68.5%
associate-*l/67.0%
Simplified67.0%
if 9.20000000000000016e-296 < h < 1.64999999999999996e254Initial program 65.7%
Simplified64.2%
Applied egg-rr80.7%
unpow180.7%
associate-*r*80.7%
*-commutative80.7%
associate-*r/82.2%
*-commutative82.2%
associate-*r/81.4%
associate-*r*81.4%
associate-*r*81.4%
associate-/r*81.4%
Simplified81.4%
Taylor expanded in l around 0 75.9%
Final simplification71.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
(if (<= l -4.8e-155)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= l 2.15e-280)
(* d (cbrt (pow (* l h) -1.5)))
(*
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D_m (/ (/ M d) 2.0)) 2.0)))
(/ d (sqrt (* 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 (l <= -4.8e-155) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (l <= 2.15e-280) {
tmp = d * cbrt(pow((l * h), -1.5));
} else {
tmp = (1.0 + (((h / l) * -0.5) * pow((D_m * ((M / d) / 2.0)), 2.0))) * (d / sqrt((l * h)));
}
return tmp;
}
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 <= -4.8e-155) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (l <= 2.15e-280) {
tmp = d * Math.cbrt(Math.pow((l * h), -1.5));
} else {
tmp = (1.0 + (((h / l) * -0.5) * Math.pow((D_m * ((M / d) / 2.0)), 2.0))) * (d / Math.sqrt((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 (l <= -4.8e-155) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (l <= 2.15e-280) tmp = Float64(d * cbrt((Float64(l * h) ^ -1.5))); else tmp = Float64(Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(Float64(M / d) / 2.0)) ^ 2.0))) * Float64(d / sqrt(Float64(l * h)))); 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.8e-155], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.15e-280], N[(d * N[Power[N[Power[N[(l * h), $MachinePrecision], -1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(N[(M / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[Sqrt[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])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.8 \cdot 10^{-155}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq 2.15 \cdot 10^{-280}:\\
\;\;\;\;d \cdot \sqrt[3]{{\left(\ell \cdot h\right)}^{-1.5}}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{\frac{M}{d}}{2}\right)}^{2}\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if l < -4.8e-155Initial program 81.0%
Simplified79.8%
associate-*l/79.8%
*-commutative79.8%
add-sqr-sqrt79.8%
pow279.8%
sqrt-pow179.8%
metadata-eval79.8%
pow179.8%
associate-/l/79.8%
Applied egg-rr79.8%
associate-*r/80.9%
Applied egg-rr80.9%
Taylor expanded in d around inf 47.2%
if -4.8e-155 < l < 2.1499999999999999e-280Initial program 69.5%
Simplified66.9%
Taylor expanded in d around inf 25.1%
associate-/r*25.0%
Simplified25.0%
associate-/r*25.1%
pow1/225.1%
metadata-eval25.1%
pow-pow34.6%
inv-pow34.6%
pow-pow34.6%
metadata-eval34.6%
Applied egg-rr34.6%
unpow1/335.0%
Simplified35.0%
if 2.1499999999999999e-280 < l Initial program 67.7%
Simplified66.3%
Applied egg-rr82.2%
unpow182.2%
associate-*r*82.2%
*-commutative82.2%
associate-*r/83.7%
*-commutative83.7%
associate-*r/82.9%
associate-*r*82.9%
associate-*r*82.9%
associate-/r*82.9%
Simplified82.9%
Taylor expanded in l around 0 72.0%
Final simplification58.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
(if (<= l -5.6e-153)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= l -1e-309)
(* d (cbrt (pow (* l h) -1.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 (l <= -5.6e-153) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (l <= -1e-309) {
tmp = d * cbrt(pow((l * h), -1.5));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
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 <= -5.6e-153) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (l <= -1e-309) {
tmp = d * Math.cbrt(Math.pow((l * h), -1.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 (l <= -5.6e-153) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (l <= -1e-309) tmp = Float64(d * cbrt((Float64(l * h) ^ -1.5))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); 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, -5.6e-153], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-309], N[(d * N[Power[N[Power[N[(l * h), $MachinePrecision], -1.5], $MachinePrecision], 1/3], $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}\;\ell \leq -5.6 \cdot 10^{-153}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-309}:\\
\;\;\;\;d \cdot \sqrt[3]{{\left(\ell \cdot h\right)}^{-1.5}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -5.6000000000000001e-153Initial program 81.0%
Simplified79.8%
associate-*l/79.8%
*-commutative79.8%
add-sqr-sqrt79.8%
pow279.8%
sqrt-pow179.8%
metadata-eval79.8%
pow179.8%
associate-/l/79.8%
Applied egg-rr79.8%
associate-*r/80.9%
Applied egg-rr80.9%
Taylor expanded in d around inf 47.2%
if -5.6000000000000001e-153 < l < -1.000000000000002e-309Initial program 73.8%
Simplified70.9%
Taylor expanded in d around inf 19.9%
associate-/r*19.9%
Simplified19.9%
associate-/r*19.9%
pow1/219.9%
metadata-eval19.9%
pow-pow31.4%
inv-pow31.4%
pow-pow31.4%
metadata-eval31.4%
Applied egg-rr31.4%
unpow1/331.4%
Simplified31.4%
if -1.000000000000002e-309 < l Initial program 66.7%
Simplified65.4%
frac-2neg65.4%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 47.3%
unpow-147.3%
metadata-eval47.3%
pow-sqr47.3%
rem-sqrt-square47.3%
rem-square-sqrt47.1%
fabs-sqr47.1%
rem-square-sqrt47.3%
Simplified47.3%
*-commutative47.3%
unpow-prod-down52.8%
Applied egg-rr52.8%
Final simplification48.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
(if (<= l -5.5e-154)
(* (- d) (pow (* l h) -0.5))
(if (<= l -1e-309)
(* d (cbrt (pow (* l h) -1.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 (l <= -5.5e-154) {
tmp = -d * pow((l * h), -0.5);
} else if (l <= -1e-309) {
tmp = d * cbrt(pow((l * h), -1.5));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
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 <= -5.5e-154) {
tmp = -d * Math.pow((l * h), -0.5);
} else if (l <= -1e-309) {
tmp = d * Math.cbrt(Math.pow((l * h), -1.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 (l <= -5.5e-154) tmp = Float64(Float64(-d) * (Float64(l * h) ^ -0.5)); elseif (l <= -1e-309) tmp = Float64(d * cbrt((Float64(l * h) ^ -1.5))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); 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, -5.5e-154], N[((-d) * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-309], N[(d * N[Power[N[Power[N[(l * h), $MachinePrecision], -1.5], $MachinePrecision], 1/3], $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}\;\ell \leq -5.5 \cdot 10^{-154}:\\
\;\;\;\;\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-309}:\\
\;\;\;\;d \cdot \sqrt[3]{{\left(\ell \cdot h\right)}^{-1.5}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -5.50000000000000002e-154Initial program 81.0%
Simplified79.8%
Taylor expanded in d around inf 7.4%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt44.8%
neg-mul-144.8%
Simplified44.8%
if -5.50000000000000002e-154 < l < -1.000000000000002e-309Initial program 73.8%
Simplified70.9%
Taylor expanded in d around inf 19.9%
associate-/r*19.9%
Simplified19.9%
associate-/r*19.9%
pow1/219.9%
metadata-eval19.9%
pow-pow31.4%
inv-pow31.4%
pow-pow31.4%
metadata-eval31.4%
Applied egg-rr31.4%
unpow1/331.4%
Simplified31.4%
if -1.000000000000002e-309 < l Initial program 66.7%
Simplified65.4%
frac-2neg65.4%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 47.3%
unpow-147.3%
metadata-eval47.3%
pow-sqr47.3%
rem-sqrt-square47.3%
rem-square-sqrt47.1%
fabs-sqr47.1%
rem-square-sqrt47.3%
Simplified47.3%
*-commutative47.3%
unpow-prod-down52.8%
Applied egg-rr52.8%
Final simplification47.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
(if (<= l -5.5e-155)
(* (- d) (pow (* l h) -0.5))
(if (<= l -1e-309)
(* d (cbrt (pow (* l h) -1.5)))
(* d (/ (pow h -0.5) (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 <= -5.5e-155) {
tmp = -d * pow((l * h), -0.5);
} else if (l <= -1e-309) {
tmp = d * cbrt(pow((l * h), -1.5));
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
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 <= -5.5e-155) {
tmp = -d * Math.pow((l * h), -0.5);
} else if (l <= -1e-309) {
tmp = d * Math.cbrt(Math.pow((l * h), -1.5));
} else {
tmp = d * (Math.pow(h, -0.5) / 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 <= -5.5e-155) tmp = Float64(Float64(-d) * (Float64(l * h) ^ -0.5)); elseif (l <= -1e-309) tmp = Float64(d * cbrt((Float64(l * h) ^ -1.5))); else tmp = Float64(d * Float64((h ^ -0.5) / 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, -5.5e-155], N[((-d) * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-309], N[(d * N[Power[N[Power[N[(l * h), $MachinePrecision], -1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
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 -5.5 \cdot 10^{-155}:\\
\;\;\;\;\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-309}:\\
\;\;\;\;d \cdot \sqrt[3]{{\left(\ell \cdot h\right)}^{-1.5}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -5.50000000000000018e-155Initial program 81.0%
Simplified79.8%
Taylor expanded in d around inf 7.4%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt44.8%
neg-mul-144.8%
Simplified44.8%
if -5.50000000000000018e-155 < l < -1.000000000000002e-309Initial program 73.8%
Simplified70.9%
Taylor expanded in d around inf 19.9%
associate-/r*19.9%
Simplified19.9%
associate-/r*19.9%
pow1/219.9%
metadata-eval19.9%
pow-pow31.4%
inv-pow31.4%
pow-pow31.4%
metadata-eval31.4%
Applied egg-rr31.4%
unpow1/331.4%
Simplified31.4%
if -1.000000000000002e-309 < l Initial program 66.7%
Simplified65.4%
Taylor expanded in d around inf 47.3%
associate-/r*48.0%
Simplified48.0%
sqrt-div52.9%
inv-pow52.9%
sqrt-pow152.8%
metadata-eval52.8%
Applied egg-rr52.8%
Final simplification47.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
(if (<= l -2.8e-155)
(* (- d) (pow (* l h) -0.5))
(if (<= l -1e-309)
(* d (cbrt (pow (* l h) -1.5)))
(/ (/ d (sqrt l)) (sqrt 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 (l <= -2.8e-155) {
tmp = -d * pow((l * h), -0.5);
} else if (l <= -1e-309) {
tmp = d * cbrt(pow((l * h), -1.5));
} else {
tmp = (d / sqrt(l)) / sqrt(h);
}
return tmp;
}
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 <= -2.8e-155) {
tmp = -d * Math.pow((l * h), -0.5);
} else if (l <= -1e-309) {
tmp = d * Math.cbrt(Math.pow((l * h), -1.5));
} else {
tmp = (d / Math.sqrt(l)) / Math.sqrt(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 (l <= -2.8e-155) tmp = Float64(Float64(-d) * (Float64(l * h) ^ -0.5)); elseif (l <= -1e-309) tmp = Float64(d * cbrt((Float64(l * h) ^ -1.5))); else tmp = Float64(Float64(d / sqrt(l)) / sqrt(h)); 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, -2.8e-155], N[((-d) * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-309], N[(d * N[Power[N[Power[N[(l * h), $MachinePrecision], -1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $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 -2.8 \cdot 10^{-155}:\\
\;\;\;\;\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-309}:\\
\;\;\;\;d \cdot \sqrt[3]{{\left(\ell \cdot h\right)}^{-1.5}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -2.8e-155Initial program 81.0%
Simplified79.8%
Taylor expanded in d around inf 7.4%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt44.8%
neg-mul-144.8%
Simplified44.8%
if -2.8e-155 < l < -1.000000000000002e-309Initial program 73.8%
Simplified70.9%
Taylor expanded in d around inf 19.9%
associate-/r*19.9%
Simplified19.9%
associate-/r*19.9%
pow1/219.9%
metadata-eval19.9%
pow-pow31.4%
inv-pow31.4%
pow-pow31.4%
metadata-eval31.4%
Applied egg-rr31.4%
unpow1/331.4%
Simplified31.4%
if -1.000000000000002e-309 < l Initial program 66.7%
Simplified65.4%
Taylor expanded in d around inf 47.3%
associate-/r*48.0%
Simplified48.0%
associate-/r*47.3%
sqrt-div47.1%
metadata-eval47.1%
*-commutative47.1%
sqrt-unprod52.8%
div-inv52.9%
associate-/r*50.9%
Applied egg-rr50.9%
Final simplification46.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 (if (<= l 2.1e-301) (/ (- d) (sqrt (* l h))) (/ (/ d (sqrt l)) (sqrt 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 (l <= 2.1e-301) {
tmp = -d / sqrt((l * h));
} else {
tmp = (d / sqrt(l)) / sqrt(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 (l <= 2.1d-301) then
tmp = -d / sqrt((l * h))
else
tmp = (d / sqrt(l)) / sqrt(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 (l <= 2.1e-301) {
tmp = -d / Math.sqrt((l * h));
} else {
tmp = (d / Math.sqrt(l)) / Math.sqrt(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 l <= 2.1e-301: tmp = -d / math.sqrt((l * h)) else: tmp = (d / math.sqrt(l)) / math.sqrt(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 (l <= 2.1e-301) tmp = Float64(Float64(-d) / sqrt(Float64(l * h))); else tmp = Float64(Float64(d / sqrt(l)) / sqrt(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 (l <= 2.1e-301)
tmp = -d / sqrt((l * h));
else
tmp = (d / sqrt(l)) / sqrt(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[l, 2.1e-301], N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $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 2.1 \cdot 10^{-301}:\\
\;\;\;\;\frac{-d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < 2.0999999999999999e-301Initial program 79.1%
Simplified77.4%
Taylor expanded in d around inf 11.0%
associate-/r*11.0%
Simplified11.0%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt35.8%
associate-*l*35.8%
unpow1/235.8%
rem-exp-log34.2%
exp-neg34.2%
exp-prod34.2%
distribute-lft-neg-out34.2%
exp-neg34.2%
exp-to-pow35.9%
unpow1/235.9%
associate-/l*35.9%
*-rgt-identity35.9%
associate-/l*35.9%
neg-mul-135.9%
Simplified35.9%
if 2.0999999999999999e-301 < l Initial program 66.5%
Simplified65.1%
Taylor expanded in d around inf 47.6%
associate-/r*48.4%
Simplified48.4%
associate-/r*47.6%
sqrt-div47.5%
metadata-eval47.5%
*-commutative47.5%
sqrt-unprod53.2%
div-inv53.2%
associate-/r*51.3%
Applied egg-rr51.3%
Final simplification44.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 (if (<= l -3.3e-155) (* (- d) (pow (* l h) -0.5)) (* d (sqrt (/ (/ 1.0 h) 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 <= -3.3e-155) {
tmp = -d * pow((l * h), -0.5);
} else {
tmp = d * sqrt(((1.0 / h) / 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 <= (-3.3d-155)) then
tmp = -d * ((l * h) ** (-0.5d0))
else
tmp = d * sqrt(((1.0d0 / h) / 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 <= -3.3e-155) {
tmp = -d * Math.pow((l * h), -0.5);
} else {
tmp = d * Math.sqrt(((1.0 / h) / 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 <= -3.3e-155: tmp = -d * math.pow((l * h), -0.5) else: tmp = d * math.sqrt(((1.0 / h) / 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 <= -3.3e-155) tmp = Float64(Float64(-d) * (Float64(l * h) ^ -0.5)); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / 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 <= -3.3e-155)
tmp = -d * ((l * h) ^ -0.5);
else
tmp = d * sqrt(((1.0 / h) / 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, -3.3e-155], N[((-d) * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / 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 -3.3 \cdot 10^{-155}:\\
\;\;\;\;\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if l < -3.29999999999999986e-155Initial program 81.0%
Simplified79.8%
Taylor expanded in d around inf 7.4%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt44.8%
neg-mul-144.8%
Simplified44.8%
if -3.29999999999999986e-155 < l Initial program 68.1%
Simplified66.4%
Taylor expanded in d around inf 41.9%
associate-/r*42.5%
Simplified42.5%
Final simplification43.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 (if (<= l -2.8e-155) (* d (/ -1.0 (sqrt (* l h)))) (* d (sqrt (/ (/ 1.0 h) 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 <= -2.8e-155) {
tmp = d * (-1.0 / sqrt((l * h)));
} else {
tmp = d * sqrt(((1.0 / h) / 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 <= (-2.8d-155)) then
tmp = d * ((-1.0d0) / sqrt((l * h)))
else
tmp = d * sqrt(((1.0d0 / h) / 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 <= -2.8e-155) {
tmp = d * (-1.0 / Math.sqrt((l * h)));
} else {
tmp = d * Math.sqrt(((1.0 / h) / 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 <= -2.8e-155: tmp = d * (-1.0 / math.sqrt((l * h))) else: tmp = d * math.sqrt(((1.0 / h) / 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 <= -2.8e-155) tmp = Float64(d * Float64(-1.0 / sqrt(Float64(l * h)))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / 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 <= -2.8e-155)
tmp = d * (-1.0 / sqrt((l * h)));
else
tmp = d * sqrt(((1.0 / h) / 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, -2.8e-155], N[(d * N[(-1.0 / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / 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 -2.8 \cdot 10^{-155}:\\
\;\;\;\;d \cdot \frac{-1}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if l < -2.8e-155Initial program 81.0%
Simplified79.8%
Taylor expanded in d around inf 7.4%
associate-/r*7.4%
Simplified7.4%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt44.7%
mul-1-neg44.7%
unpow1/244.7%
rem-exp-log42.5%
exp-neg42.5%
exp-prod42.5%
distribute-lft-neg-out42.5%
exp-neg42.5%
exp-to-pow44.8%
unpow1/244.8%
distribute-neg-frac44.8%
metadata-eval44.8%
Simplified44.8%
if -2.8e-155 < l Initial program 68.1%
Simplified66.4%
Taylor expanded in d around inf 41.9%
associate-/r*42.5%
Simplified42.5%
Final simplification43.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 (if (<= l -2.9e-155) (/ (- d) (sqrt (* l h))) (* d (sqrt (/ (/ 1.0 h) 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 <= -2.9e-155) {
tmp = -d / sqrt((l * h));
} else {
tmp = d * sqrt(((1.0 / h) / 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 <= (-2.9d-155)) then
tmp = -d / sqrt((l * h))
else
tmp = d * sqrt(((1.0d0 / h) / 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 <= -2.9e-155) {
tmp = -d / Math.sqrt((l * h));
} else {
tmp = d * Math.sqrt(((1.0 / h) / 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 <= -2.9e-155: tmp = -d / math.sqrt((l * h)) else: tmp = d * math.sqrt(((1.0 / h) / 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 <= -2.9e-155) tmp = Float64(Float64(-d) / sqrt(Float64(l * h))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / 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 <= -2.9e-155)
tmp = -d / sqrt((l * h));
else
tmp = d * sqrt(((1.0 / h) / 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, -2.9e-155], N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / 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 -2.9 \cdot 10^{-155}:\\
\;\;\;\;\frac{-d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if l < -2.9000000000000001e-155Initial program 81.0%
Simplified79.8%
Taylor expanded in d around inf 7.4%
associate-/r*7.4%
Simplified7.4%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt44.7%
associate-*l*44.7%
unpow1/244.7%
rem-exp-log42.5%
exp-neg42.5%
exp-prod42.5%
distribute-lft-neg-out42.5%
exp-neg42.5%
exp-to-pow44.8%
unpow1/244.8%
associate-/l*44.7%
*-rgt-identity44.7%
associate-/l*44.7%
neg-mul-144.7%
Simplified44.7%
if -2.9000000000000001e-155 < l Initial program 68.1%
Simplified66.4%
Taylor expanded in d around inf 41.9%
associate-/r*42.5%
Simplified42.5%
Final simplification43.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 (if (<= l -3.7e-155) (/ (- d) (sqrt (* l h))) (* 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) {
double tmp;
if (l <= -3.7e-155) {
tmp = -d / sqrt((l * h));
} else {
tmp = d * pow((l * 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 (l <= (-3.7d-155)) then
tmp = -d / sqrt((l * h))
else
tmp = d * ((l * 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 (l <= -3.7e-155) {
tmp = -d / Math.sqrt((l * h));
} else {
tmp = d * Math.pow((l * 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 l <= -3.7e-155: tmp = -d / math.sqrt((l * h)) else: tmp = d * math.pow((l * 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 (l <= -3.7e-155) tmp = Float64(Float64(-d) / sqrt(Float64(l * h))); else tmp = Float64(d * (Float64(l * 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 (l <= -3.7e-155)
tmp = -d / sqrt((l * h));
else
tmp = d * ((l * 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[l, -3.7e-155], N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.7 \cdot 10^{-155}:\\
\;\;\;\;\frac{-d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\end{array}
\end{array}
if l < -3.7e-155Initial program 81.0%
Simplified79.8%
Taylor expanded in d around inf 7.4%
associate-/r*7.4%
Simplified7.4%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt44.7%
associate-*l*44.7%
unpow1/244.7%
rem-exp-log42.5%
exp-neg42.5%
exp-prod42.5%
distribute-lft-neg-out42.5%
exp-neg42.5%
exp-to-pow44.8%
unpow1/244.8%
associate-/l*44.7%
*-rgt-identity44.7%
associate-/l*44.7%
neg-mul-144.7%
Simplified44.7%
if -3.7e-155 < l Initial program 68.1%
Simplified66.4%
frac-2neg66.4%
sqrt-div15.6%
Applied egg-rr15.6%
Taylor expanded in d around inf 41.9%
unpow-141.9%
metadata-eval41.9%
pow-sqr41.9%
rem-sqrt-square41.9%
rem-square-sqrt41.8%
fabs-sqr41.8%
rem-square-sqrt41.9%
Simplified41.9%
Final simplification42.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 (* 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 72.2%
Simplified70.7%
frac-2neg70.7%
sqrt-div37.6%
Applied egg-rr37.6%
Taylor expanded in d around inf 30.9%
unpow-130.9%
metadata-eval30.9%
pow-sqr30.9%
rem-sqrt-square30.5%
rem-square-sqrt30.4%
fabs-sqr30.4%
rem-square-sqrt30.5%
Simplified30.5%
Final simplification30.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 (/ d (sqrt (* 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((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((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((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((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(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((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[(l * 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])\\
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 72.2%
Simplified70.7%
Taylor expanded in d around inf 30.9%
associate-/r*31.3%
Simplified31.3%
Taylor expanded in d around 0 30.9%
unpow1/230.9%
rem-exp-log29.5%
exp-neg29.5%
exp-prod29.1%
distribute-lft-neg-out29.1%
exp-neg29.1%
exp-to-pow30.4%
unpow1/230.4%
associate-/l*30.5%
*-rgt-identity30.5%
Simplified30.5%
Final simplification30.5%
herbie shell --seed 2024095
(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)))))