
(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 26 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}
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (- d)))
(t_1 (+ 1.0 (/ (* h (* (pow (* (/ D (/ d M)) 0.5) 2.0) -0.5)) l))))
(if (<= h -1.2e+198)
(* (/ 1.0 (sqrt (/ l d))) (* (/ t_0 (sqrt (- h))) t_1))
(if (<= h -5e-310)
(* (/ t_0 (sqrt (- l))) (* t_1 (sqrt (/ d h))))
(*
(- 1.0 (/ (* h (* 0.5 (pow (* (* M 0.5) (/ D d)) 2.0))) l))
(/ d (* (sqrt l) (sqrt h))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(-d);
double t_1 = 1.0 + ((h * (pow(((D / (d / M)) * 0.5), 2.0) * -0.5)) / l);
double tmp;
if (h <= -1.2e+198) {
tmp = (1.0 / sqrt((l / d))) * ((t_0 / sqrt(-h)) * t_1);
} else if (h <= -5e-310) {
tmp = (t_0 / sqrt(-l)) * (t_1 * sqrt((d / h)));
} else {
tmp = (1.0 - ((h * (0.5 * pow(((M * 0.5) * (D / d)), 2.0))) / l)) * (d / (sqrt(l) * sqrt(h)));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt(-d)
t_1 = 1.0d0 + ((h * ((((d_1 / (d / m)) * 0.5d0) ** 2.0d0) * (-0.5d0))) / l)
if (h <= (-1.2d+198)) then
tmp = (1.0d0 / sqrt((l / d))) * ((t_0 / sqrt(-h)) * t_1)
else if (h <= (-5d-310)) then
tmp = (t_0 / sqrt(-l)) * (t_1 * sqrt((d / h)))
else
tmp = (1.0d0 - ((h * (0.5d0 * (((m * 0.5d0) * (d_1 / d)) ** 2.0d0))) / l)) * (d / (sqrt(l) * sqrt(h)))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt(-d);
double t_1 = 1.0 + ((h * (Math.pow(((D / (d / M)) * 0.5), 2.0) * -0.5)) / l);
double tmp;
if (h <= -1.2e+198) {
tmp = (1.0 / Math.sqrt((l / d))) * ((t_0 / Math.sqrt(-h)) * t_1);
} else if (h <= -5e-310) {
tmp = (t_0 / Math.sqrt(-l)) * (t_1 * Math.sqrt((d / h)));
} else {
tmp = (1.0 - ((h * (0.5 * Math.pow(((M * 0.5) * (D / d)), 2.0))) / l)) * (d / (Math.sqrt(l) * Math.sqrt(h)));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt(-d) t_1 = 1.0 + ((h * (math.pow(((D / (d / M)) * 0.5), 2.0) * -0.5)) / l) tmp = 0 if h <= -1.2e+198: tmp = (1.0 / math.sqrt((l / d))) * ((t_0 / math.sqrt(-h)) * t_1) elif h <= -5e-310: tmp = (t_0 / math.sqrt(-l)) * (t_1 * math.sqrt((d / h))) else: tmp = (1.0 - ((h * (0.5 * math.pow(((M * 0.5) * (D / d)), 2.0))) / l)) * (d / (math.sqrt(l) * math.sqrt(h))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(-d)) t_1 = Float64(1.0 + Float64(Float64(h * Float64((Float64(Float64(D / Float64(d / M)) * 0.5) ^ 2.0) * -0.5)) / l)) tmp = 0.0 if (h <= -1.2e+198) tmp = Float64(Float64(1.0 / sqrt(Float64(l / d))) * Float64(Float64(t_0 / sqrt(Float64(-h))) * t_1)); elseif (h <= -5e-310) tmp = Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(t_1 * sqrt(Float64(d / h)))); else tmp = Float64(Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(M * 0.5) * Float64(D / d)) ^ 2.0))) / l)) * Float64(d / Float64(sqrt(l) * sqrt(h)))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt(-d);
t_1 = 1.0 + ((h * ((((D / (d / M)) * 0.5) ^ 2.0) * -0.5)) / l);
tmp = 0.0;
if (h <= -1.2e+198)
tmp = (1.0 / sqrt((l / d))) * ((t_0 / sqrt(-h)) * t_1);
elseif (h <= -5e-310)
tmp = (t_0 / sqrt(-l)) * (t_1 * sqrt((d / h)));
else
tmp = (1.0 - ((h * (0.5 * (((M * 0.5) * (D / d)) ^ 2.0))) / l)) * (d / (sqrt(l) * sqrt(h)));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(N[(h * N[(N[Power[N[(N[(D / N[(d / M), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1.2e+198], N[(N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-310], N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(M * 0.5), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
t_1 := 1 + \frac{h \cdot \left({\left(\frac{D}{\frac{d}{M}} \cdot 0.5\right)}^{2} \cdot -0.5\right)}{\ell}\\
\mathbf{if}\;h \leq -1.2 \cdot 10^{+198}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(\frac{t_0}{\sqrt{-h}} \cdot t_1\right)\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{t_0}{\sqrt{-\ell}} \cdot \left(t_1 \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right) \cdot \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if h < -1.2000000000000001e198Initial program 55.0%
Simplified55.0%
associate-*l/55.4%
add-sqr-sqrt30.5%
add-sqr-sqrt55.4%
div-inv55.4%
metadata-eval55.4%
Applied egg-rr55.4%
Taylor expanded in M around 0 55.4%
*-commutative55.4%
associate-/l*55.4%
Simplified55.4%
clear-num55.2%
sqrt-div59.0%
metadata-eval59.0%
Applied egg-rr59.0%
frac-2neg59.0%
sqrt-div86.0%
Applied egg-rr86.0%
if -1.2000000000000001e198 < h < -4.999999999999985e-310Initial program 67.8%
Simplified68.6%
associate-*l/73.0%
add-sqr-sqrt43.9%
add-sqr-sqrt73.0%
div-inv73.0%
metadata-eval73.0%
Applied egg-rr73.0%
Taylor expanded in M around 0 72.1%
*-commutative72.1%
associate-/l*72.1%
Simplified72.1%
frac-2neg72.1%
sqrt-div83.2%
Applied egg-rr83.2%
if -4.999999999999985e-310 < h Initial program 73.1%
pow173.1%
Applied egg-rr87.1%
associate-*l/89.5%
*-commutative89.5%
Applied egg-rr89.5%
Final simplification86.5%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (- d)))
(t_1 (pow (* (/ D d) (/ M 2.0)) 2.0))
(t_2
(*
(/ t_0 (sqrt (- h)))
(* (sqrt (/ d l)) (- 1.0 (* 0.5 (* t_1 (/ h l))))))))
(if (<= h -1.7e+197)
t_2
(if (<= h -2.1e-70)
(*
(/ t_0 (sqrt (- l)))
(* (sqrt (/ d h)) (+ 1.0 (* (/ h l) (* -0.5 t_1)))))
(if (<= h -5e-310)
t_2
(*
(- 1.0 (/ (* h (* 0.5 (pow (* (* M 0.5) (/ D d)) 2.0))) l))
(/ d (* (sqrt l) (sqrt h)))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(-d);
double t_1 = pow(((D / d) * (M / 2.0)), 2.0);
double t_2 = (t_0 / sqrt(-h)) * (sqrt((d / l)) * (1.0 - (0.5 * (t_1 * (h / l)))));
double tmp;
if (h <= -1.7e+197) {
tmp = t_2;
} else if (h <= -2.1e-70) {
tmp = (t_0 / sqrt(-l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * t_1))));
} else if (h <= -5e-310) {
tmp = t_2;
} else {
tmp = (1.0 - ((h * (0.5 * pow(((M * 0.5) * (D / d)), 2.0))) / l)) * (d / (sqrt(l) * sqrt(h)));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = sqrt(-d)
t_1 = ((d_1 / d) * (m / 2.0d0)) ** 2.0d0
t_2 = (t_0 / sqrt(-h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * (t_1 * (h / l)))))
if (h <= (-1.7d+197)) then
tmp = t_2
else if (h <= (-2.1d-70)) then
tmp = (t_0 / sqrt(-l)) * (sqrt((d / h)) * (1.0d0 + ((h / l) * ((-0.5d0) * t_1))))
else if (h <= (-5d-310)) then
tmp = t_2
else
tmp = (1.0d0 - ((h * (0.5d0 * (((m * 0.5d0) * (d_1 / d)) ** 2.0d0))) / l)) * (d / (sqrt(l) * sqrt(h)))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt(-d);
double t_1 = Math.pow(((D / d) * (M / 2.0)), 2.0);
double t_2 = (t_0 / Math.sqrt(-h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * (t_1 * (h / l)))));
double tmp;
if (h <= -1.7e+197) {
tmp = t_2;
} else if (h <= -2.1e-70) {
tmp = (t_0 / Math.sqrt(-l)) * (Math.sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * t_1))));
} else if (h <= -5e-310) {
tmp = t_2;
} else {
tmp = (1.0 - ((h * (0.5 * Math.pow(((M * 0.5) * (D / d)), 2.0))) / l)) * (d / (Math.sqrt(l) * Math.sqrt(h)));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt(-d) t_1 = math.pow(((D / d) * (M / 2.0)), 2.0) t_2 = (t_0 / math.sqrt(-h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * (t_1 * (h / l))))) tmp = 0 if h <= -1.7e+197: tmp = t_2 elif h <= -2.1e-70: tmp = (t_0 / math.sqrt(-l)) * (math.sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * t_1)))) elif h <= -5e-310: tmp = t_2 else: tmp = (1.0 - ((h * (0.5 * math.pow(((M * 0.5) * (D / d)), 2.0))) / l)) * (d / (math.sqrt(l) * math.sqrt(h))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(-d)) t_1 = Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0 t_2 = Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(t_1 * Float64(h / l)))))) tmp = 0.0 if (h <= -1.7e+197) tmp = t_2; elseif (h <= -2.1e-70) tmp = Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * t_1))))); elseif (h <= -5e-310) tmp = t_2; else tmp = Float64(Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(M * 0.5) * Float64(D / d)) ^ 2.0))) / l)) * Float64(d / Float64(sqrt(l) * sqrt(h)))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt(-d);
t_1 = ((D / d) * (M / 2.0)) ^ 2.0;
t_2 = (t_0 / sqrt(-h)) * (sqrt((d / l)) * (1.0 - (0.5 * (t_1 * (h / l)))));
tmp = 0.0;
if (h <= -1.7e+197)
tmp = t_2;
elseif (h <= -2.1e-70)
tmp = (t_0 / sqrt(-l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * t_1))));
elseif (h <= -5e-310)
tmp = t_2;
else
tmp = (1.0 - ((h * (0.5 * (((M * 0.5) * (D / d)) ^ 2.0))) / l)) * (d / (sqrt(l) * sqrt(h)));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(t$95$1 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1.7e+197], t$95$2, If[LessEqual[h, -2.1e-70], N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-310], t$95$2, N[(N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(M * 0.5), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
t_1 := {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\\
t_2 := \frac{t_0}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(t_1 \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{if}\;h \leq -1.7 \cdot 10^{+197}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;h \leq -2.1 \cdot 10^{-70}:\\
\;\;\;\;\frac{t_0}{\sqrt{-\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot t_1\right)\right)\right)\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right) \cdot \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if h < -1.70000000000000008e197 or -2.1000000000000001e-70 < h < -4.999999999999985e-310Initial program 67.9%
Simplified69.3%
frac-2neg71.9%
sqrt-div87.6%
Applied egg-rr84.9%
if -1.70000000000000008e197 < h < -2.1000000000000001e-70Initial program 63.5%
Simplified63.5%
frac-2neg68.0%
sqrt-div85.0%
Applied egg-rr75.9%
if -4.999999999999985e-310 < h Initial program 73.1%
pow173.1%
Applied egg-rr87.1%
associate-*l/89.5%
*-commutative89.5%
Applied egg-rr89.5%
Final simplification85.0%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d -3.5e-308)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(*
(sqrt (/ d l))
(- 1.0 (* 0.5 (* (pow (* (/ D d) (/ M 2.0)) 2.0) (/ h l))))))
(*
(- 1.0 (/ (* h (* 0.5 (pow (* (* M 0.5) (/ D d)) 2.0))) l))
(/ d (* (sqrt l) (sqrt h))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -3.5e-308) {
tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0 - (0.5 * (pow(((D / d) * (M / 2.0)), 2.0) * (h / l)))));
} else {
tmp = (1.0 - ((h * (0.5 * pow(((M * 0.5) * (D / d)), 2.0))) / l)) * (d / (sqrt(l) * sqrt(h)));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (d <= (-3.5d-308)) then
tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * ((((d_1 / d) * (m / 2.0d0)) ** 2.0d0) * (h / l)))))
else
tmp = (1.0d0 - ((h * (0.5d0 * (((m * 0.5d0) * (d_1 / d)) ** 2.0d0))) / l)) * (d / (sqrt(l) * sqrt(h)))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -3.5e-308) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * (Math.pow(((D / d) * (M / 2.0)), 2.0) * (h / l)))));
} else {
tmp = (1.0 - ((h * (0.5 * Math.pow(((M * 0.5) * (D / d)), 2.0))) / l)) * (d / (Math.sqrt(l) * Math.sqrt(h)));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= -3.5e-308: tmp = (math.sqrt(-d) / math.sqrt(-h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * (math.pow(((D / d) * (M / 2.0)), 2.0) * (h / l))))) else: tmp = (1.0 - ((h * (0.5 * math.pow(((M * 0.5) * (D / d)), 2.0))) / l)) * (d / (math.sqrt(l) * math.sqrt(h))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -3.5e-308) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0) * Float64(h / l)))))); else tmp = Float64(Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(M * 0.5) * Float64(D / d)) ^ 2.0))) / l)) * Float64(d / Float64(sqrt(l) * sqrt(h)))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= -3.5e-308)
tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((((D / d) * (M / 2.0)) ^ 2.0) * (h / l)))));
else
tmp = (1.0 - ((h * (0.5 * (((M * 0.5) * (D / d)) ^ 2.0))) / l)) * (d / (sqrt(l) * sqrt(h)));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -3.5e-308], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(M * 0.5), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -3.5 \cdot 10^{-308}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right) \cdot \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -3.5e-308Initial program 66.4%
Simplified66.4%
frac-2neg70.7%
sqrt-div79.0%
Applied egg-rr74.8%
if -3.5e-308 < d Initial program 72.6%
pow172.6%
Applied egg-rr86.4%
associate-*l/88.8%
*-commutative88.8%
Applied egg-rr88.8%
Final simplification81.7%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (* (* M 0.5) (/ D d)) 2.0)))
(if (<= l -1e-310)
(*
(/ (sqrt (- d)) (sqrt (- l)))
(* (sqrt (/ d h)) (+ 1.0 (/ (* h (* -0.5 t_0)) l))))
(* (- 1.0 (/ (* h (* 0.5 t_0)) l)) (/ d (* (sqrt l) (sqrt h)))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow(((M * 0.5) * (D / d)), 2.0);
double tmp;
if (l <= -1e-310) {
tmp = (sqrt(-d) / sqrt(-l)) * (sqrt((d / h)) * (1.0 + ((h * (-0.5 * t_0)) / l)));
} else {
tmp = (1.0 - ((h * (0.5 * t_0)) / l)) * (d / (sqrt(l) * sqrt(h)));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: t_0
real(8) :: tmp
t_0 = ((m * 0.5d0) * (d_1 / d)) ** 2.0d0
if (l <= (-1d-310)) then
tmp = (sqrt(-d) / sqrt(-l)) * (sqrt((d / h)) * (1.0d0 + ((h * ((-0.5d0) * t_0)) / l)))
else
tmp = (1.0d0 - ((h * (0.5d0 * t_0)) / l)) * (d / (sqrt(l) * sqrt(h)))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow(((M * 0.5) * (D / d)), 2.0);
double tmp;
if (l <= -1e-310) {
tmp = (Math.sqrt(-d) / Math.sqrt(-l)) * (Math.sqrt((d / h)) * (1.0 + ((h * (-0.5 * t_0)) / l)));
} else {
tmp = (1.0 - ((h * (0.5 * t_0)) / l)) * (d / (Math.sqrt(l) * Math.sqrt(h)));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.pow(((M * 0.5) * (D / d)), 2.0) tmp = 0 if l <= -1e-310: tmp = (math.sqrt(-d) / math.sqrt(-l)) * (math.sqrt((d / h)) * (1.0 + ((h * (-0.5 * t_0)) / l))) else: tmp = (1.0 - ((h * (0.5 * t_0)) / l)) * (d / (math.sqrt(l) * math.sqrt(h))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(M * 0.5) * Float64(D / d)) ^ 2.0 tmp = 0.0 if (l <= -1e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h * Float64(-0.5 * t_0)) / l)))); else tmp = Float64(Float64(1.0 - Float64(Float64(h * Float64(0.5 * t_0)) / l)) * Float64(d / Float64(sqrt(l) * sqrt(h)))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = ((M * 0.5) * (D / d)) ^ 2.0;
tmp = 0.0;
if (l <= -1e-310)
tmp = (sqrt(-d) / sqrt(-l)) * (sqrt((d / h)) * (1.0 + ((h * (-0.5 * t_0)) / l)));
else
tmp = (1.0 - ((h * (0.5 * t_0)) / l)) * (d / (sqrt(l) * sqrt(h)));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(N[(M * 0.5), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[l, -1e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-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[(N[(1.0 - N[(N[(h * N[(0.5 * t$95$0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-\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}:\\
\;\;\;\;\left(1 - \frac{h \cdot \left(0.5 \cdot t_0\right)}{\ell}\right) \cdot \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -9.999999999999969e-311Initial program 65.8%
Simplified66.6%
associate-*l/70.3%
add-sqr-sqrt41.8%
add-sqr-sqrt70.3%
div-inv70.3%
metadata-eval70.3%
Applied egg-rr70.3%
frac-2neg69.6%
sqrt-div80.1%
Applied egg-rr80.1%
if -9.999999999999969e-311 < l Initial program 73.1%
pow173.1%
Applied egg-rr87.1%
associate-*l/89.5%
*-commutative89.5%
Applied egg-rr89.5%
Final simplification84.7%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -1e-310)
(*
(/ (sqrt (- d)) (sqrt (- l)))
(*
(+ 1.0 (/ (* h (* (pow (* (/ D (/ d M)) 0.5) 2.0) -0.5)) l))
(sqrt (/ d h))))
(*
(- 1.0 (/ (* h (* 0.5 (pow (* (* M 0.5) (/ D d)) 2.0))) l))
(/ d (* (sqrt l) (sqrt h))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1e-310) {
tmp = (sqrt(-d) / sqrt(-l)) * ((1.0 + ((h * (pow(((D / (d / M)) * 0.5), 2.0) * -0.5)) / l)) * sqrt((d / h)));
} else {
tmp = (1.0 - ((h * (0.5 * pow(((M * 0.5) * (D / d)), 2.0))) / l)) * (d / (sqrt(l) * sqrt(h)));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (l <= (-1d-310)) then
tmp = (sqrt(-d) / sqrt(-l)) * ((1.0d0 + ((h * ((((d_1 / (d / m)) * 0.5d0) ** 2.0d0) * (-0.5d0))) / l)) * sqrt((d / h)))
else
tmp = (1.0d0 - ((h * (0.5d0 * (((m * 0.5d0) * (d_1 / d)) ** 2.0d0))) / l)) * (d / (sqrt(l) * sqrt(h)))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1e-310) {
tmp = (Math.sqrt(-d) / Math.sqrt(-l)) * ((1.0 + ((h * (Math.pow(((D / (d / M)) * 0.5), 2.0) * -0.5)) / l)) * Math.sqrt((d / h)));
} else {
tmp = (1.0 - ((h * (0.5 * Math.pow(((M * 0.5) * (D / d)), 2.0))) / l)) * (d / (Math.sqrt(l) * Math.sqrt(h)));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -1e-310: tmp = (math.sqrt(-d) / math.sqrt(-l)) * ((1.0 + ((h * (math.pow(((D / (d / M)) * 0.5), 2.0) * -0.5)) / l)) * math.sqrt((d / h))) else: tmp = (1.0 - ((h * (0.5 * math.pow(((M * 0.5) * (D / d)), 2.0))) / l)) * (d / (math.sqrt(l) * math.sqrt(h))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -1e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * Float64(Float64(1.0 + Float64(Float64(h * Float64((Float64(Float64(D / Float64(d / M)) * 0.5) ^ 2.0) * -0.5)) / l)) * sqrt(Float64(d / h)))); else tmp = Float64(Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(M * 0.5) * Float64(D / d)) ^ 2.0))) / l)) * Float64(d / Float64(sqrt(l) * sqrt(h)))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -1e-310)
tmp = (sqrt(-d) / sqrt(-l)) * ((1.0 + ((h * ((((D / (d / M)) * 0.5) ^ 2.0) * -0.5)) / l)) * sqrt((d / h)));
else
tmp = (1.0 - ((h * (0.5 * (((M * 0.5) * (D / d)) ^ 2.0))) / l)) * (d / (sqrt(l) * sqrt(h)));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -1e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(h * N[(N[Power[N[(N[(D / N[(d / M), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(M * 0.5), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(\left(1 + \frac{h \cdot \left({\left(\frac{D}{\frac{d}{M}} \cdot 0.5\right)}^{2} \cdot -0.5\right)}{\ell}\right) \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right) \cdot \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -9.999999999999969e-311Initial program 65.8%
Simplified66.6%
associate-*l/70.3%
add-sqr-sqrt41.8%
add-sqr-sqrt70.3%
div-inv70.3%
metadata-eval70.3%
Applied egg-rr70.3%
Taylor expanded in M around 0 69.6%
*-commutative69.6%
associate-/l*69.6%
Simplified69.6%
frac-2neg69.6%
sqrt-div80.1%
Applied egg-rr80.1%
if -9.999999999999969e-311 < l Initial program 73.1%
pow173.1%
Applied egg-rr87.1%
associate-*l/89.5%
*-commutative89.5%
Applied egg-rr89.5%
Final simplification84.7%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l 6.2e-148)
(*
(/ 1.0 (sqrt (/ l d)))
(*
(+ 1.0 (/ (* h (* (pow (* (/ D (/ d M)) 0.5) 2.0) -0.5)) l))
(sqrt (/ d h))))
(*
(fma (pow (* (* D -0.5) (/ M d)) 2.0) (* -0.5 (/ h l)) 1.0)
(/ (/ d (sqrt l)) (sqrt h)))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 6.2e-148) {
tmp = (1.0 / sqrt((l / d))) * ((1.0 + ((h * (pow(((D / (d / M)) * 0.5), 2.0) * -0.5)) / l)) * sqrt((d / h)));
} else {
tmp = fma(pow(((D * -0.5) * (M / d)), 2.0), (-0.5 * (h / l)), 1.0) * ((d / sqrt(l)) / sqrt(h));
}
return tmp;
}
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 6.2e-148) tmp = Float64(Float64(1.0 / sqrt(Float64(l / d))) * Float64(Float64(1.0 + Float64(Float64(h * Float64((Float64(Float64(D / Float64(d / M)) * 0.5) ^ 2.0) * -0.5)) / l)) * sqrt(Float64(d / h)))); else tmp = Float64(fma((Float64(Float64(D * -0.5) * Float64(M / d)) ^ 2.0), Float64(-0.5 * Float64(h / l)), 1.0) * Float64(Float64(d / sqrt(l)) / sqrt(h))); end return tmp end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 6.2e-148], N[(N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(h * N[(N[Power[N[(N[(D / N[(d / M), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[N[(N[(D * -0.5), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 6.2 \cdot 10^{-148}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(\left(1 + \frac{h \cdot \left({\left(\frac{D}{\frac{d}{M}} \cdot 0.5\right)}^{2} \cdot -0.5\right)}{\ell}\right) \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left({\left(\left(D \cdot -0.5\right) \cdot \frac{M}{d}\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right) \cdot \frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < 6.2000000000000003e-148Initial program 66.8%
Simplified66.8%
associate-*l/71.1%
add-sqr-sqrt44.7%
add-sqr-sqrt71.1%
div-inv71.1%
metadata-eval71.1%
Applied egg-rr71.1%
Taylor expanded in M around 0 71.1%
*-commutative71.1%
associate-/l*71.1%
Simplified71.1%
clear-num71.1%
sqrt-div72.7%
metadata-eval72.7%
Applied egg-rr72.7%
if 6.2000000000000003e-148 < l Initial program 73.6%
Simplified74.5%
expm1-log1p-u52.9%
expm1-udef37.1%
Applied egg-rr42.2%
expm1-def63.3%
expm1-log1p88.6%
associate-/r*87.7%
associate-*r*87.7%
Simplified87.7%
Final simplification78.5%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l 4e-148)
(*
(/ 1.0 (sqrt (/ l d)))
(*
(+ 1.0 (/ (* h (* (pow (* (/ D (/ d M)) 0.5) 2.0) -0.5)) l))
(sqrt (/ d h))))
(*
(/ (/ d (sqrt l)) (sqrt h))
(- 1.0 (* 0.5 (* (/ h l) (pow (* M (* 0.5 (/ D d))) 2.0)))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 4e-148) {
tmp = (1.0 / sqrt((l / d))) * ((1.0 + ((h * (pow(((D / (d / M)) * 0.5), 2.0) * -0.5)) / l)) * sqrt((d / h)));
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (l <= 4d-148) then
tmp = (1.0d0 / sqrt((l / d))) * ((1.0d0 + ((h * ((((d_1 / (d / m)) * 0.5d0) ** 2.0d0) * (-0.5d0))) / l)) * sqrt((d / h)))
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0d0 - (0.5d0 * ((h / l) * ((m * (0.5d0 * (d_1 / d))) ** 2.0d0))))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 4e-148) {
tmp = (1.0 / Math.sqrt((l / d))) * ((1.0 + ((h * (Math.pow(((D / (d / M)) * 0.5), 2.0) * -0.5)) / l)) * Math.sqrt((d / h)));
} else {
tmp = ((d / Math.sqrt(l)) / Math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * Math.pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 4e-148: tmp = (1.0 / math.sqrt((l / d))) * ((1.0 + ((h * (math.pow(((D / (d / M)) * 0.5), 2.0) * -0.5)) / l)) * math.sqrt((d / h))) else: tmp = ((d / math.sqrt(l)) / math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * math.pow((M * (0.5 * (D / d))), 2.0)))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 4e-148) tmp = Float64(Float64(1.0 / sqrt(Float64(l / d))) * Float64(Float64(1.0 + Float64(Float64(h * Float64((Float64(Float64(D / Float64(d / M)) * 0.5) ^ 2.0) * -0.5)) / l)) * sqrt(Float64(d / h)))); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0))))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 4e-148)
tmp = (1.0 / sqrt((l / d))) * ((1.0 + ((h * ((((D / (d / M)) * 0.5) ^ 2.0) * -0.5)) / l)) * sqrt((d / h)));
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * ((M * (0.5 * (D / d))) ^ 2.0))));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 4e-148], N[(N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(h * N[(N[Power[N[(N[(D / N[(d / M), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 4 \cdot 10^{-148}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(\left(1 + \frac{h \cdot \left({\left(\frac{D}{\frac{d}{M}} \cdot 0.5\right)}^{2} \cdot -0.5\right)}{\ell}\right) \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if l < 3.99999999999999974e-148Initial program 66.8%
Simplified66.8%
associate-*l/71.1%
add-sqr-sqrt44.7%
add-sqr-sqrt71.1%
div-inv71.1%
metadata-eval71.1%
Applied egg-rr71.1%
Taylor expanded in M around 0 71.1%
*-commutative71.1%
associate-/l*71.1%
Simplified71.1%
clear-num71.1%
sqrt-div72.7%
metadata-eval72.7%
Applied egg-rr72.7%
if 3.99999999999999974e-148 < l Initial program 73.6%
Applied egg-rr42.2%
expm1-def63.3%
expm1-log1p88.5%
associate-/r*87.6%
associate-*r*87.6%
*-commutative87.6%
associate-*l*87.6%
Simplified87.6%
Final simplification78.4%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l 1.5e-307)
(*
(/ 1.0 (sqrt (/ l d)))
(*
(+ 1.0 (/ (* h (* (pow (* (/ D (/ d M)) 0.5) 2.0) -0.5)) l))
(sqrt (/ d h))))
(*
(- 1.0 (/ (* h (* 0.5 (pow (* (* M 0.5) (/ D d)) 2.0))) l))
(/ d (* (sqrt l) (sqrt h))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 1.5e-307) {
tmp = (1.0 / sqrt((l / d))) * ((1.0 + ((h * (pow(((D / (d / M)) * 0.5), 2.0) * -0.5)) / l)) * sqrt((d / h)));
} else {
tmp = (1.0 - ((h * (0.5 * pow(((M * 0.5) * (D / d)), 2.0))) / l)) * (d / (sqrt(l) * sqrt(h)));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (l <= 1.5d-307) then
tmp = (1.0d0 / sqrt((l / d))) * ((1.0d0 + ((h * ((((d_1 / (d / m)) * 0.5d0) ** 2.0d0) * (-0.5d0))) / l)) * sqrt((d / h)))
else
tmp = (1.0d0 - ((h * (0.5d0 * (((m * 0.5d0) * (d_1 / d)) ** 2.0d0))) / l)) * (d / (sqrt(l) * sqrt(h)))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 1.5e-307) {
tmp = (1.0 / Math.sqrt((l / d))) * ((1.0 + ((h * (Math.pow(((D / (d / M)) * 0.5), 2.0) * -0.5)) / l)) * Math.sqrt((d / h)));
} else {
tmp = (1.0 - ((h * (0.5 * Math.pow(((M * 0.5) * (D / d)), 2.0))) / l)) * (d / (Math.sqrt(l) * Math.sqrt(h)));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 1.5e-307: tmp = (1.0 / math.sqrt((l / d))) * ((1.0 + ((h * (math.pow(((D / (d / M)) * 0.5), 2.0) * -0.5)) / l)) * math.sqrt((d / h))) else: tmp = (1.0 - ((h * (0.5 * math.pow(((M * 0.5) * (D / d)), 2.0))) / l)) * (d / (math.sqrt(l) * math.sqrt(h))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 1.5e-307) tmp = Float64(Float64(1.0 / sqrt(Float64(l / d))) * Float64(Float64(1.0 + Float64(Float64(h * Float64((Float64(Float64(D / Float64(d / M)) * 0.5) ^ 2.0) * -0.5)) / l)) * sqrt(Float64(d / h)))); else tmp = Float64(Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(M * 0.5) * Float64(D / d)) ^ 2.0))) / l)) * Float64(d / Float64(sqrt(l) * sqrt(h)))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 1.5e-307)
tmp = (1.0 / sqrt((l / d))) * ((1.0 + ((h * ((((D / (d / M)) * 0.5) ^ 2.0) * -0.5)) / l)) * sqrt((d / h)));
else
tmp = (1.0 - ((h * (0.5 * (((M * 0.5) * (D / d)) ^ 2.0))) / l)) * (d / (sqrt(l) * sqrt(h)));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 1.5e-307], N[(N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(h * N[(N[Power[N[(N[(D / N[(d / M), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(M * 0.5), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.5 \cdot 10^{-307}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(\left(1 + \frac{h \cdot \left({\left(\frac{D}{\frac{d}{M}} \cdot 0.5\right)}^{2} \cdot -0.5\right)}{\ell}\right) \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right) \cdot \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 1.5e-307Initial program 66.1%
Simplified66.1%
associate-*l/69.8%
add-sqr-sqrt41.6%
add-sqr-sqrt69.8%
div-inv69.8%
metadata-eval69.8%
Applied egg-rr69.8%
Taylor expanded in M around 0 69.8%
*-commutative69.8%
associate-/l*69.8%
Simplified69.8%
clear-num69.8%
sqrt-div70.3%
metadata-eval70.3%
Applied egg-rr70.3%
if 1.5e-307 < l Initial program 72.9%
pow172.9%
Applied egg-rr87.7%
associate-*l/90.2%
*-commutative90.2%
Applied egg-rr90.2%
Final simplification79.9%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l 3e-191)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (/ h (/ (* l -2.0) (pow (* (* M 0.5) (/ D d)) 2.0))))))
(*
(/ (/ d (sqrt l)) (sqrt h))
(- 1.0 (* 0.5 (* (/ h l) (pow (* M (* 0.5 (/ D d))) 2.0)))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3e-191) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (h / ((l * -2.0) / pow(((M * 0.5) * (D / d)), 2.0)))));
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (l <= 3d-191) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + (h / ((l * (-2.0d0)) / (((m * 0.5d0) * (d_1 / d)) ** 2.0d0)))))
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0d0 - (0.5d0 * ((h / l) * ((m * (0.5d0 * (d_1 / d))) ** 2.0d0))))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3e-191) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + (h / ((l * -2.0) / Math.pow(((M * 0.5) * (D / d)), 2.0)))));
} else {
tmp = ((d / Math.sqrt(l)) / Math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * Math.pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 3e-191: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + (h / ((l * -2.0) / math.pow(((M * 0.5) * (D / d)), 2.0))))) else: tmp = ((d / math.sqrt(l)) / math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * math.pow((M * (0.5 * (D / d))), 2.0)))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 3e-191) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(h / Float64(Float64(l * -2.0) / (Float64(Float64(M * 0.5) * Float64(D / d)) ^ 2.0)))))); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0))))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 3e-191)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (h / ((l * -2.0) / (((M * 0.5) * (D / d)) ^ 2.0)))));
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * ((M * (0.5 * (D / d))) ^ 2.0))));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 3e-191], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h / N[(N[(l * -2.0), $MachinePrecision] / N[Power[N[(N[(M * 0.5), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 3 \cdot 10^{-191}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h}{\frac{\ell \cdot -2}{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if l < 3.0000000000000001e-191Initial program 66.5%
Simplified66.5%
associate-*l/70.4%
add-sqr-sqrt44.1%
add-sqr-sqrt70.4%
div-inv70.4%
metadata-eval70.4%
Applied egg-rr70.4%
expm1-log1p-u40.8%
expm1-udef40.8%
associate-/l*40.8%
*-un-lft-identity40.8%
*-commutative40.8%
times-frac40.8%
metadata-eval40.8%
Applied egg-rr40.8%
expm1-def40.8%
expm1-log1p70.7%
associate-*r/70.7%
Simplified70.7%
if 3.0000000000000001e-191 < l Initial program 73.6%
Applied egg-rr43.9%
expm1-def63.6%
expm1-log1p88.4%
associate-/r*87.6%
associate-*r*87.6%
*-commutative87.6%
associate-*l*87.6%
Simplified87.6%
Final simplification77.7%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l 9.8e-148)
(*
(*
(+ 1.0 (/ (* h (* (pow (* (/ D (/ d M)) 0.5) 2.0) -0.5)) l))
(sqrt (/ d h)))
(sqrt (/ d l)))
(*
(/ (/ d (sqrt l)) (sqrt h))
(- 1.0 (* 0.5 (* (/ h l) (pow (* M (* 0.5 (/ D d))) 2.0)))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 9.8e-148) {
tmp = ((1.0 + ((h * (pow(((D / (d / M)) * 0.5), 2.0) * -0.5)) / l)) * sqrt((d / h))) * sqrt((d / l));
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (l <= 9.8d-148) then
tmp = ((1.0d0 + ((h * ((((d_1 / (d / m)) * 0.5d0) ** 2.0d0) * (-0.5d0))) / l)) * sqrt((d / h))) * sqrt((d / l))
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0d0 - (0.5d0 * ((h / l) * ((m * (0.5d0 * (d_1 / d))) ** 2.0d0))))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 9.8e-148) {
tmp = ((1.0 + ((h * (Math.pow(((D / (d / M)) * 0.5), 2.0) * -0.5)) / l)) * Math.sqrt((d / h))) * Math.sqrt((d / l));
} else {
tmp = ((d / Math.sqrt(l)) / Math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * Math.pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 9.8e-148: tmp = ((1.0 + ((h * (math.pow(((D / (d / M)) * 0.5), 2.0) * -0.5)) / l)) * math.sqrt((d / h))) * math.sqrt((d / l)) else: tmp = ((d / math.sqrt(l)) / math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * math.pow((M * (0.5 * (D / d))), 2.0)))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 9.8e-148) tmp = Float64(Float64(Float64(1.0 + Float64(Float64(h * Float64((Float64(Float64(D / Float64(d / M)) * 0.5) ^ 2.0) * -0.5)) / l)) * sqrt(Float64(d / h))) * sqrt(Float64(d / l))); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0))))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 9.8e-148)
tmp = ((1.0 + ((h * ((((D / (d / M)) * 0.5) ^ 2.0) * -0.5)) / l)) * sqrt((d / h))) * sqrt((d / l));
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * ((M * (0.5 * (D / d))) ^ 2.0))));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 9.8e-148], N[(N[(N[(1.0 + N[(N[(h * N[(N[Power[N[(N[(D / N[(d / M), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 9.8 \cdot 10^{-148}:\\
\;\;\;\;\left(\left(1 + \frac{h \cdot \left({\left(\frac{D}{\frac{d}{M}} \cdot 0.5\right)}^{2} \cdot -0.5\right)}{\ell}\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if l < 9.8000000000000001e-148Initial program 66.8%
Simplified66.8%
associate-*l/71.1%
add-sqr-sqrt44.7%
add-sqr-sqrt71.1%
div-inv71.1%
metadata-eval71.1%
Applied egg-rr71.1%
Taylor expanded in M around 0 71.1%
*-commutative71.1%
associate-/l*71.1%
Simplified71.1%
if 9.8000000000000001e-148 < l Initial program 73.6%
Applied egg-rr42.2%
expm1-def63.3%
expm1-log1p88.5%
associate-/r*87.6%
associate-*r*87.6%
*-commutative87.6%
associate-*l*87.6%
Simplified87.6%
Final simplification77.5%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l 2.95e-148)
(*
(/ 1.0 (sqrt (/ l d)))
(* (sqrt (/ d h)) (+ 1.0 (/ (* (pow (* M (/ D d)) 2.0) (* h -0.125)) l))))
(*
(/ (/ d (sqrt l)) (sqrt h))
(- 1.0 (* 0.5 (* (/ h l) (pow (* M (* 0.5 (/ D d))) 2.0)))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 2.95e-148) {
tmp = (1.0 / sqrt((l / d))) * (sqrt((d / h)) * (1.0 + ((pow((M * (D / d)), 2.0) * (h * -0.125)) / l)));
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (l <= 2.95d-148) then
tmp = (1.0d0 / sqrt((l / d))) * (sqrt((d / h)) * (1.0d0 + ((((m * (d_1 / d)) ** 2.0d0) * (h * (-0.125d0))) / l)))
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0d0 - (0.5d0 * ((h / l) * ((m * (0.5d0 * (d_1 / d))) ** 2.0d0))))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 2.95e-148) {
tmp = (1.0 / Math.sqrt((l / d))) * (Math.sqrt((d / h)) * (1.0 + ((Math.pow((M * (D / d)), 2.0) * (h * -0.125)) / l)));
} else {
tmp = ((d / Math.sqrt(l)) / Math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * Math.pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 2.95e-148: tmp = (1.0 / math.sqrt((l / d))) * (math.sqrt((d / h)) * (1.0 + ((math.pow((M * (D / d)), 2.0) * (h * -0.125)) / l))) else: tmp = ((d / math.sqrt(l)) / math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * math.pow((M * (0.5 * (D / d))), 2.0)))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 2.95e-148) tmp = Float64(Float64(1.0 / sqrt(Float64(l / d))) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64((Float64(M * Float64(D / d)) ^ 2.0) * Float64(h * -0.125)) / l)))); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0))))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 2.95e-148)
tmp = (1.0 / sqrt((l / d))) * (sqrt((d / h)) * (1.0 + ((((M * (D / d)) ^ 2.0) * (h * -0.125)) / l)));
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * ((M * (0.5 * (D / d))) ^ 2.0))));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 2.95e-148], N[(N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(N[Power[N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * -0.125), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.95 \cdot 10^{-148}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{{\left(M \cdot \frac{D}{d}\right)}^{2} \cdot \left(h \cdot -0.125\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if l < 2.95000000000000008e-148Initial program 66.8%
Simplified66.8%
associate-*l/71.1%
add-sqr-sqrt44.7%
add-sqr-sqrt71.1%
div-inv71.1%
metadata-eval71.1%
Applied egg-rr71.1%
Taylor expanded in M around 0 71.1%
*-commutative71.1%
associate-/l*71.1%
Simplified71.1%
clear-num71.1%
sqrt-div72.7%
metadata-eval72.7%
Applied egg-rr72.7%
expm1-log1p-u65.9%
expm1-udef60.6%
unpow-prod-down60.6%
associate-/r/61.2%
metadata-eval61.2%
Applied egg-rr61.7%
expm1-def65.9%
expm1-log1p71.1%
*-commutative71.1%
associate-*l*71.1%
metadata-eval71.1%
associate-*l*71.2%
*-commutative71.2%
Simplified72.7%
if 2.95000000000000008e-148 < l Initial program 73.6%
Applied egg-rr42.2%
expm1-def63.3%
expm1-log1p88.5%
associate-/r*87.6%
associate-*r*87.6%
*-commutative87.6%
associate-*l*87.6%
Simplified87.6%
Final simplification78.5%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l 1.28e+70)
(*
(sqrt (/ d l))
(* (sqrt (/ d h)) (+ 1.0 (/ (* (pow (* M (/ D d)) 2.0) (* h -0.125)) l))))
(/ d (* (sqrt l) (sqrt h)))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 1.28e+70) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((pow((M * (D / d)), 2.0) * (h * -0.125)) / l)));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (l <= 1.28d+70) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((((m * (d_1 / d)) ** 2.0d0) * (h * (-0.125d0))) / l)))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 1.28e+70) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((Math.pow((M * (D / d)), 2.0) * (h * -0.125)) / l)));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 1.28e+70: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((math.pow((M * (D / d)), 2.0) * (h * -0.125)) / l))) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 1.28e+70) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64((Float64(M * Float64(D / d)) ^ 2.0) * Float64(h * -0.125)) / l)))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 1.28e+70)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((((M * (D / d)) ^ 2.0) * (h * -0.125)) / l)));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 1.28e+70], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(N[Power[N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * -0.125), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.28 \cdot 10^{+70}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{{\left(M \cdot \frac{D}{d}\right)}^{2} \cdot \left(h \cdot -0.125\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 1.27999999999999994e70Initial program 69.2%
Simplified69.2%
associate-*l/72.5%
add-sqr-sqrt45.4%
add-sqr-sqrt72.5%
div-inv72.5%
metadata-eval72.5%
Applied egg-rr72.5%
Taylor expanded in M around 0 72.5%
*-commutative72.5%
associate-/l*72.5%
Simplified72.5%
expm1-log1p-u60.0%
expm1-udef56.1%
unpow-prod-down56.1%
associate-/r/56.6%
metadata-eval56.6%
Applied egg-rr56.6%
expm1-def60.0%
expm1-log1p72.5%
*-commutative72.5%
associate-*l*72.5%
metadata-eval72.5%
associate-*l*72.5%
*-commutative72.5%
Simplified72.5%
if 1.27999999999999994e70 < l Initial program 70.2%
Simplified72.3%
Taylor expanded in d around inf 63.1%
sqrt-div63.0%
metadata-eval63.0%
*-commutative63.0%
sqrt-unprod78.6%
div-inv78.8%
associate-/r*76.7%
Applied egg-rr76.7%
associate-/l/78.8%
Simplified78.8%
Final simplification73.6%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l 5e-148)
(*
(sqrt (/ d l))
(* (sqrt (/ d h)) (+ 1.0 (/ (* (pow (* M (/ D d)) 2.0) (* h -0.125)) l))))
(*
(/ (/ d (sqrt l)) (sqrt h))
(- 1.0 (* 0.5 (* (/ h l) (pow (* M (* 0.5 (/ D d))) 2.0)))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 5e-148) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((pow((M * (D / d)), 2.0) * (h * -0.125)) / l)));
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (l <= 5d-148) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((((m * (d_1 / d)) ** 2.0d0) * (h * (-0.125d0))) / l)))
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0d0 - (0.5d0 * ((h / l) * ((m * (0.5d0 * (d_1 / d))) ** 2.0d0))))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 5e-148) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((Math.pow((M * (D / d)), 2.0) * (h * -0.125)) / l)));
} else {
tmp = ((d / Math.sqrt(l)) / Math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * Math.pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 5e-148: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((math.pow((M * (D / d)), 2.0) * (h * -0.125)) / l))) else: tmp = ((d / math.sqrt(l)) / math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * math.pow((M * (0.5 * (D / d))), 2.0)))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 5e-148) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64((Float64(M * Float64(D / d)) ^ 2.0) * Float64(h * -0.125)) / l)))); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0))))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 5e-148)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((((M * (D / d)) ^ 2.0) * (h * -0.125)) / l)));
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * ((M * (0.5 * (D / d))) ^ 2.0))));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 5e-148], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(N[Power[N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * -0.125), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 5 \cdot 10^{-148}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{{\left(M \cdot \frac{D}{d}\right)}^{2} \cdot \left(h \cdot -0.125\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if l < 4.9999999999999999e-148Initial program 66.8%
Simplified66.8%
associate-*l/71.1%
add-sqr-sqrt44.7%
add-sqr-sqrt71.1%
div-inv71.1%
metadata-eval71.1%
Applied egg-rr71.1%
Taylor expanded in M around 0 71.1%
*-commutative71.1%
associate-/l*71.1%
Simplified71.1%
expm1-log1p-u65.9%
expm1-udef60.6%
unpow-prod-down60.6%
associate-/r/61.2%
metadata-eval61.2%
Applied egg-rr61.2%
expm1-def65.9%
expm1-log1p71.1%
*-commutative71.1%
associate-*l*71.1%
metadata-eval71.1%
associate-*l*71.2%
*-commutative71.2%
Simplified71.2%
if 4.9999999999999999e-148 < l Initial program 73.6%
Applied egg-rr42.2%
expm1-def63.3%
expm1-log1p88.5%
associate-/r*87.6%
associate-*r*87.6%
*-commutative87.6%
associate-*l*87.6%
Simplified87.6%
Final simplification77.5%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (* (sqrt (/ d l)) (* (sqrt (/ d h)) (+ 1.0 (* (/ h l) (* (pow (* M (/ D d)) 2.0) -0.125))))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (pow((M * (D / d)), 2.0) * -0.125))));
}
NOTE: M and D should be sorted in increasing order before calling this function.
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 = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((h / l) * (((m * (d_1 / d)) ** 2.0d0) * (-0.125d0)))))
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h / l) * (Math.pow((M * (D / d)), 2.0) * -0.125))));
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): return math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((h / l) * (math.pow((M * (D / d)), 2.0) * -0.125))))
M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(M * Float64(D / d)) ^ 2.0) * -0.125))))) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (((M * (D / d)) ^ 2.0) * -0.125))));
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(M \cdot \frac{D}{d}\right)}^{2} \cdot -0.125\right)\right)\right)
\end{array}
Initial program 69.4%
Simplified69.8%
associate-*l/71.7%
add-sqr-sqrt45.0%
add-sqr-sqrt71.7%
div-inv71.7%
metadata-eval71.7%
Applied egg-rr71.7%
Taylor expanded in M around 0 72.1%
*-commutative72.1%
associate-/l*71.7%
Simplified71.7%
expm1-log1p-u45.7%
expm1-udef45.7%
associate-/l*45.7%
unpow-prod-down45.7%
associate-/r/45.7%
metadata-eval45.7%
Applied egg-rr45.7%
expm1-def45.7%
expm1-log1p73.0%
associate-/r/69.8%
associate-*l*69.8%
*-commutative69.8%
metadata-eval69.8%
Simplified69.8%
Final simplification69.8%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -2e-210)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= l -1e-310)
(* d (exp (* 0.5 (- (log1p (+ (* h l) -1.0))))))
(/ d (* (sqrt l) (sqrt h))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2e-210) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (l <= -1e-310) {
tmp = d * exp((0.5 * -log1p(((h * l) + -1.0))));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2e-210) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (l <= -1e-310) {
tmp = d * Math.exp((0.5 * -Math.log1p(((h * l) + -1.0))));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -2e-210: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) elif l <= -1e-310: tmp = d * math.exp((0.5 * -math.log1p(((h * l) + -1.0)))) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -2e-210) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (l <= -1e-310) tmp = Float64(d * exp(Float64(0.5 * Float64(-log1p(Float64(Float64(h * l) + -1.0)))))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2e-210], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-310], N[(d * N[Exp[N[(0.5 * (-N[Log[1 + N[(N[(h * l), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2 \cdot 10^{-210}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;d \cdot e^{0.5 \cdot \left(-\mathsf{log1p}\left(h \cdot \ell + -1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -2.0000000000000001e-210Initial program 66.0%
Simplified66.1%
Taylor expanded in M around 0 50.3%
if -2.0000000000000001e-210 < l < -9.999999999999969e-311Initial program 65.1%
Simplified65.1%
Taylor expanded in d around inf 34.1%
pow1/234.1%
pow-to-exp34.1%
log-rec33.9%
Applied egg-rr33.9%
log1p-expm1-u54.3%
expm1-udef54.3%
add-exp-log54.3%
Applied egg-rr54.3%
if -9.999999999999969e-311 < l Initial program 73.1%
Simplified73.9%
Taylor expanded in d around inf 54.2%
sqrt-div54.0%
metadata-eval54.0%
*-commutative54.0%
sqrt-unprod62.0%
div-inv62.1%
associate-/r*59.2%
Applied egg-rr59.2%
associate-/l/62.1%
Simplified62.1%
Final simplification56.5%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -4.5e-210)
(* (sqrt (/ d l)) (/ 1.0 (sqrt (/ h d))))
(if (<= l -1e-310)
(* d (exp (* 0.5 (- (log1p (+ (* h l) -1.0))))))
(/ d (* (sqrt l) (sqrt h))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -4.5e-210) {
tmp = sqrt((d / l)) * (1.0 / sqrt((h / d)));
} else if (l <= -1e-310) {
tmp = d * exp((0.5 * -log1p(((h * l) + -1.0))));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -4.5e-210) {
tmp = Math.sqrt((d / l)) * (1.0 / Math.sqrt((h / d)));
} else if (l <= -1e-310) {
tmp = d * Math.exp((0.5 * -Math.log1p(((h * l) + -1.0))));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -4.5e-210: tmp = math.sqrt((d / l)) * (1.0 / math.sqrt((h / d))) elif l <= -1e-310: tmp = d * math.exp((0.5 * -math.log1p(((h * l) + -1.0)))) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -4.5e-210) tmp = Float64(sqrt(Float64(d / l)) * Float64(1.0 / sqrt(Float64(h / d)))); elseif (l <= -1e-310) tmp = Float64(d * exp(Float64(0.5 * Float64(-log1p(Float64(Float64(h * l) + -1.0)))))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -4.5e-210], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-310], N[(d * N[Exp[N[(0.5 * (-N[Log[1 + N[(N[(h * l), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.5 \cdot 10^{-210}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \frac{1}{\sqrt{\frac{h}{d}}}\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;d \cdot e^{0.5 \cdot \left(-\mathsf{log1p}\left(h \cdot \ell + -1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -4.5000000000000002e-210Initial program 66.0%
Simplified66.1%
clear-num66.0%
sqrt-div66.7%
metadata-eval66.7%
Applied egg-rr66.7%
Taylor expanded in M around 0 51.0%
if -4.5000000000000002e-210 < l < -9.999999999999969e-311Initial program 65.1%
Simplified65.1%
Taylor expanded in d around inf 34.1%
pow1/234.1%
pow-to-exp34.1%
log-rec33.9%
Applied egg-rr33.9%
log1p-expm1-u54.3%
expm1-udef54.3%
add-exp-log54.3%
Applied egg-rr54.3%
if -9.999999999999969e-311 < l Initial program 73.1%
Simplified73.9%
Taylor expanded in d around inf 54.2%
sqrt-div54.0%
metadata-eval54.0%
*-commutative54.0%
sqrt-unprod62.0%
div-inv62.1%
associate-/r*59.2%
Applied egg-rr59.2%
associate-/l/62.1%
Simplified62.1%
Final simplification56.8%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -9.2e-248)
(sqrt (/ (/ (pow d 2.0) h) l))
(if (<= l 2.2e-134)
(* d (sqrt (+ (+ 1.0 (/ 1.0 (* h l))) -1.0)))
(/ d (* (sqrt l) (sqrt h))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -9.2e-248) {
tmp = sqrt(((pow(d, 2.0) / h) / l));
} else if (l <= 2.2e-134) {
tmp = d * sqrt(((1.0 + (1.0 / (h * l))) + -1.0));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (l <= (-9.2d-248)) then
tmp = sqrt((((d ** 2.0d0) / h) / l))
else if (l <= 2.2d-134) then
tmp = d * sqrt(((1.0d0 + (1.0d0 / (h * l))) + (-1.0d0)))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -9.2e-248) {
tmp = Math.sqrt(((Math.pow(d, 2.0) / h) / l));
} else if (l <= 2.2e-134) {
tmp = d * Math.sqrt(((1.0 + (1.0 / (h * l))) + -1.0));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -9.2e-248: tmp = math.sqrt(((math.pow(d, 2.0) / h) / l)) elif l <= 2.2e-134: tmp = d * math.sqrt(((1.0 + (1.0 / (h * l))) + -1.0)) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -9.2e-248) tmp = sqrt(Float64(Float64((d ^ 2.0) / h) / l)); elseif (l <= 2.2e-134) tmp = Float64(d * sqrt(Float64(Float64(1.0 + Float64(1.0 / Float64(h * l))) + -1.0))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -9.2e-248)
tmp = sqrt((((d ^ 2.0) / h) / l));
elseif (l <= 2.2e-134)
tmp = d * sqrt(((1.0 + (1.0 / (h * l))) + -1.0));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -9.2e-248], N[Sqrt[N[(N[(N[Power[d, 2.0], $MachinePrecision] / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 2.2e-134], N[(d * N[Sqrt[N[(N[(1.0 + N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -9.2 \cdot 10^{-248}:\\
\;\;\;\;\sqrt{\frac{\frac{{d}^{2}}{h}}{\ell}}\\
\mathbf{elif}\;\ell \leq 2.2 \cdot 10^{-134}:\\
\;\;\;\;d \cdot \sqrt{\left(1 + \frac{1}{h \cdot \ell}\right) + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -9.2000000000000001e-248Initial program 65.9%
Simplified65.9%
Taylor expanded in d around inf 8.3%
sqrt-div8.3%
metadata-eval8.3%
*-commutative8.3%
sqrt-unprod0.0%
div-inv0.0%
add-sqr-sqrt0.0%
sqrt-unprod0.0%
frac-times0.0%
pow20.0%
sqrt-unprod0.0%
sqrt-unprod31.9%
add-sqr-sqrt32.0%
*-commutative32.0%
Applied egg-rr32.0%
associate-/r*33.4%
Simplified33.4%
if -9.2000000000000001e-248 < l < 2.2e-134Initial program 69.7%
Simplified69.7%
Taylor expanded in d around inf 51.7%
expm1-log1p-u50.7%
expm1-udef50.7%
associate-/r*50.7%
Applied egg-rr50.7%
Taylor expanded in h around inf 51.8%
if 2.2e-134 < l Initial program 73.4%
Simplified74.5%
Taylor expanded in d around inf 54.4%
sqrt-div54.3%
metadata-eval54.3%
*-commutative54.3%
sqrt-unprod64.7%
div-inv64.8%
associate-/r*63.8%
Applied egg-rr63.8%
associate-/l/64.8%
Simplified64.8%
Final simplification48.4%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -1.16e-246)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= l 3.8e-134)
(* d (sqrt (+ (+ 1.0 (/ 1.0 (* h l))) -1.0)))
(/ d (* (sqrt l) (sqrt h))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1.16e-246) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (l <= 3.8e-134) {
tmp = d * sqrt(((1.0 + (1.0 / (h * l))) + -1.0));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (l <= (-1.16d-246)) then
tmp = sqrt((d / h)) * sqrt((d / l))
else if (l <= 3.8d-134) then
tmp = d * sqrt(((1.0d0 + (1.0d0 / (h * l))) + (-1.0d0)))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1.16e-246) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (l <= 3.8e-134) {
tmp = d * Math.sqrt(((1.0 + (1.0 / (h * l))) + -1.0));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -1.16e-246: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) elif l <= 3.8e-134: tmp = d * math.sqrt(((1.0 + (1.0 / (h * l))) + -1.0)) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -1.16e-246) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (l <= 3.8e-134) tmp = Float64(d * sqrt(Float64(Float64(1.0 + Float64(1.0 / Float64(h * l))) + -1.0))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -1.16e-246)
tmp = sqrt((d / h)) * sqrt((d / l));
elseif (l <= 3.8e-134)
tmp = d * sqrt(((1.0 + (1.0 / (h * l))) + -1.0));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -1.16e-246], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.8e-134], N[(d * N[Sqrt[N[(N[(1.0 + N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.16 \cdot 10^{-246}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq 3.8 \cdot 10^{-134}:\\
\;\;\;\;d \cdot \sqrt{\left(1 + \frac{1}{h \cdot \ell}\right) + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -1.16e-246Initial program 65.9%
Simplified65.9%
Taylor expanded in M around 0 48.2%
if -1.16e-246 < l < 3.80000000000000003e-134Initial program 69.7%
Simplified69.7%
Taylor expanded in d around inf 51.7%
expm1-log1p-u50.7%
expm1-udef50.7%
associate-/r*50.7%
Applied egg-rr50.7%
Taylor expanded in h around inf 51.8%
if 3.80000000000000003e-134 < l Initial program 73.4%
Simplified74.5%
Taylor expanded in d around inf 54.4%
sqrt-div54.3%
metadata-eval54.3%
*-commutative54.3%
sqrt-unprod64.7%
div-inv64.8%
associate-/r*63.8%
Applied egg-rr63.8%
associate-/l/64.8%
Simplified64.8%
Final simplification55.0%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= h 1.25e-264) (* d (sqrt (+ (+ 1.0 (/ 1.0 (* h l))) -1.0))) (/ d (* (sqrt l) (sqrt h)))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 1.25e-264) {
tmp = d * sqrt(((1.0 + (1.0 / (h * l))) + -1.0));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (h <= 1.25d-264) then
tmp = d * sqrt(((1.0d0 + (1.0d0 / (h * l))) + (-1.0d0)))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 1.25e-264) {
tmp = d * Math.sqrt(((1.0 + (1.0 / (h * l))) + -1.0));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if h <= 1.25e-264: tmp = d * math.sqrt(((1.0 + (1.0 / (h * l))) + -1.0)) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= 1.25e-264) tmp = Float64(d * sqrt(Float64(Float64(1.0 + Float64(1.0 / Float64(h * l))) + -1.0))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (h <= 1.25e-264)
tmp = d * sqrt(((1.0 + (1.0 / (h * l))) + -1.0));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, 1.25e-264], N[(d * N[Sqrt[N[(N[(1.0 + N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq 1.25 \cdot 10^{-264}:\\
\;\;\;\;d \cdot \sqrt{\left(1 + \frac{1}{h \cdot \ell}\right) + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if h < 1.25e-264Initial program 65.5%
Simplified65.6%
Taylor expanded in d around inf 16.5%
expm1-log1p-u16.3%
expm1-udef16.4%
associate-/r*16.4%
Applied egg-rr16.4%
Taylor expanded in h around inf 16.6%
if 1.25e-264 < h Initial program 73.9%
Simplified74.8%
Taylor expanded in d around inf 53.1%
sqrt-div53.0%
metadata-eval53.0%
*-commutative53.0%
sqrt-unprod61.5%
div-inv61.6%
associate-/r*58.5%
Applied egg-rr58.5%
associate-/l/61.6%
Simplified61.6%
Final simplification37.3%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (* d (sqrt (/ 1.0 (* h l)))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * sqrt((1.0 / (h * l)));
}
NOTE: M and D should be sorted in increasing order before calling this function.
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 * sqrt((1.0d0 / (h * l)))
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d * Math.sqrt((1.0 / (h * l)));
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.sqrt((1.0 / (h * l)))
M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * sqrt((1.0 / (h * l)));
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot \sqrt{\frac{1}{h \cdot \ell}}
\end{array}
Initial program 69.4%
Simplified69.8%
Taylor expanded in d around inf 33.4%
Final simplification33.4%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (* d (sqrt (/ (/ 1.0 h) l))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * sqrt(((1.0 / h) / l));
}
NOTE: M and D should be sorted in increasing order before calling this function.
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 * sqrt(((1.0d0 / h) / l))
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d * Math.sqrt(((1.0 / h) / l));
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.sqrt(((1.0 / h) / l))
M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * sqrt(Float64(Float64(1.0 / h) / l))) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * sqrt(((1.0 / h) / l));
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}
\end{array}
Initial program 69.4%
Simplified69.8%
Taylor expanded in d around inf 33.4%
expm1-log1p-u32.7%
expm1-udef22.1%
associate-/r*22.1%
Applied egg-rr22.1%
expm1-def33.0%
expm1-log1p33.7%
Simplified33.7%
Final simplification33.7%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (* d (sqrt (/ (/ 1.0 l) h))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * sqrt(((1.0 / l) / h));
}
NOTE: M and D should be sorted in increasing order before calling this function.
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 * sqrt(((1.0d0 / l) / h))
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d * Math.sqrt(((1.0 / l) / h));
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.sqrt(((1.0 / l) / h))
M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * sqrt(((1.0 / l) / h));
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}
\end{array}
Initial program 69.4%
Simplified69.8%
Taylor expanded in d around inf 33.4%
*-commutative33.4%
associate-/r*33.8%
Simplified33.8%
Final simplification33.8%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (* d (pow (* h l) -0.5)))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * pow((h * l), -0.5);
}
NOTE: M and D should be sorted in increasing order before calling this function.
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 * l) ** (-0.5d0))
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d * Math.pow((h * l), -0.5);
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.pow((h * l), -0.5)
M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * (Float64(h * l) ^ -0.5)) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * ((h * l) ^ -0.5);
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot {\left(h \cdot \ell\right)}^{-0.5}
\end{array}
Initial program 69.4%
Simplified69.8%
Taylor expanded in d around inf 33.4%
expm1-log1p-u32.7%
expm1-udef22.1%
inv-pow22.1%
sqrt-pow122.0%
metadata-eval22.0%
Applied egg-rr22.0%
expm1-def32.6%
expm1-log1p33.3%
Simplified33.3%
Final simplification33.3%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (/ d (sqrt (* h l))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d / sqrt((h * l));
}
NOTE: M and D should be sorted in increasing order before calling this function.
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 / sqrt((h * l))
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d / Math.sqrt((h * l));
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): return d / math.sqrt((h * l))
M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d / sqrt(Float64(h * l))) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d / sqrt((h * l));
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Initial program 69.4%
Simplified69.8%
Taylor expanded in d around inf 33.4%
add-cbrt-cube31.1%
pow1/329.8%
add-sqr-sqrt29.8%
pow129.8%
pow1/229.8%
pow-prod-up29.8%
associate-/r*29.8%
metadata-eval29.8%
Applied egg-rr29.8%
unpow1/331.1%
associate-/l/31.1%
associate-/r*31.1%
Simplified31.1%
pow1/329.8%
associate-/l/29.8%
pow-pow33.4%
metadata-eval33.4%
pow1/233.4%
sqrt-div33.3%
metadata-eval33.3%
div-inv33.3%
*-commutative33.3%
Applied egg-rr33.3%
Final simplification33.3%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (* d (sqrt -1.0)))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * sqrt(-1.0);
}
NOTE: M and D should be sorted in increasing order before calling this function.
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 * sqrt((-1.0d0))
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d * Math.sqrt(-1.0);
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.sqrt(-1.0)
M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * sqrt(-1.0)) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * sqrt(-1.0);
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d * N[Sqrt[-1.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot \sqrt{-1}
\end{array}
Initial program 69.4%
Simplified69.8%
Taylor expanded in d around inf 33.4%
expm1-log1p-u32.7%
expm1-udef22.1%
associate-/r*22.1%
Applied egg-rr22.1%
add-cube-cbrt22.1%
pow322.1%
log1p-udef22.1%
rem-exp-log22.7%
associate-/l/22.7%
*-commutative22.7%
Applied egg-rr22.7%
Taylor expanded in h around 0 0.0%
Final simplification0.0%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (* d (sqrt 0.0)))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * sqrt(0.0);
}
NOTE: M and D should be sorted in increasing order before calling this function.
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 * sqrt(0.0d0)
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d * Math.sqrt(0.0);
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.sqrt(0.0)
M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * sqrt(0.0)) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * sqrt(0.0);
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d * N[Sqrt[0.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot \sqrt{0}
\end{array}
Initial program 69.4%
Simplified69.8%
Taylor expanded in d around inf 33.4%
expm1-log1p-u32.7%
expm1-udef22.1%
associate-/r*22.1%
Applied egg-rr22.1%
Taylor expanded in h around inf 4.5%
Final simplification4.5%
herbie shell --seed 2023318
(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)))))