
(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 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (sqrt (- d))))
(if (<= h -2e-310)
(*
(/ t_0 (sqrt (- l)))
(*
(/ t_0 (sqrt (- h)))
(+ 1.0 (* (/ h l) (* (pow (* (/ M 2.0) (/ D_m d)) 2.0) -0.5)))))
(*
(+ 1.0 (* h (/ (* -0.5 (pow (* M (* (/ D_m d) 0.5)) 2.0)) l)))
(/ d (* (sqrt h) (sqrt l)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt(-d);
double tmp;
if (h <= -2e-310) {
tmp = (t_0 / sqrt(-l)) * ((t_0 / sqrt(-h)) * (1.0 + ((h / l) * (pow(((M / 2.0) * (D_m / d)), 2.0) * -0.5))));
} else {
tmp = (1.0 + (h * ((-0.5 * pow((M * ((D_m / d) * 0.5)), 2.0)) / l))) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(-d)
if (h <= (-2d-310)) then
tmp = (t_0 / sqrt(-l)) * ((t_0 / sqrt(-h)) * (1.0d0 + ((h / l) * ((((m / 2.0d0) * (d_m / d)) ** 2.0d0) * (-0.5d0)))))
else
tmp = (1.0d0 + (h * (((-0.5d0) * ((m * ((d_m / d) * 0.5d0)) ** 2.0d0)) / l))) * (d / (sqrt(h) * sqrt(l)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.sqrt(-d);
double tmp;
if (h <= -2e-310) {
tmp = (t_0 / Math.sqrt(-l)) * ((t_0 / Math.sqrt(-h)) * (1.0 + ((h / l) * (Math.pow(((M / 2.0) * (D_m / d)), 2.0) * -0.5))));
} else {
tmp = (1.0 + (h * ((-0.5 * Math.pow((M * ((D_m / d) * 0.5)), 2.0)) / l))) * (d / (Math.sqrt(h) * Math.sqrt(l)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.sqrt(-d) tmp = 0 if h <= -2e-310: tmp = (t_0 / math.sqrt(-l)) * ((t_0 / math.sqrt(-h)) * (1.0 + ((h / l) * (math.pow(((M / 2.0) * (D_m / d)), 2.0) * -0.5)))) else: tmp = (1.0 + (h * ((-0.5 * math.pow((M * ((D_m / d) * 0.5)), 2.0)) / l))) * (d / (math.sqrt(h) * math.sqrt(l))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(-d)) tmp = 0.0 if (h <= -2e-310) tmp = Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.0) * -0.5))))); else tmp = Float64(Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(M * Float64(Float64(D_m / d) * 0.5)) ^ 2.0)) / l))) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = sqrt(-d);
tmp = 0.0;
if (h <= -2e-310)
tmp = (t_0 / sqrt(-l)) * ((t_0 / sqrt(-h)) * (1.0 + ((h / l) * ((((M / 2.0) * (D_m / d)) ^ 2.0) * -0.5))));
else
tmp = (1.0 + (h * ((-0.5 * ((M * ((D_m / d) * 0.5)) ^ 2.0)) / l))) * (d / (sqrt(h) * sqrt(l)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[h, -2e-310], N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(M * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-\ell}} \cdot \left(\frac{t\_0}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2} \cdot -0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + h \cdot \frac{-0.5 \cdot {\left(M \cdot \left(\frac{D\_m}{d} \cdot 0.5\right)\right)}^{2}}{\ell}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -1.999999999999994e-310Initial program 66.7%
Simplified67.3%
frac-2neg67.3%
sqrt-div71.7%
Applied egg-rr71.7%
frac-2neg71.7%
sqrt-div83.8%
Applied egg-rr83.8%
if -1.999999999999994e-310 < h Initial program 62.6%
Simplified61.7%
sub-neg61.7%
distribute-rgt-in49.5%
*-un-lft-identity49.5%
sqrt-div54.7%
sqrt-div56.4%
frac-times56.5%
add-sqr-sqrt56.6%
Applied egg-rr73.2%
distribute-rgt1-in80.1%
+-commutative80.1%
associate-*l/81.2%
associate-/l*83.7%
associate-*l*83.7%
Simplified83.7%
Final simplification83.8%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= h -2e-310)
(*
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (* (/ h l) (* (pow (* (/ M 2.0) (/ D_m d)) 2.0) -0.5))))
(sqrt (/ d l)))
(*
(+ 1.0 (* h (/ (* -0.5 (pow (* M (* (/ D_m d) 0.5)) 2.0)) l)))
(/ d (* (sqrt h) (sqrt l))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (h <= -2e-310) {
tmp = ((sqrt(-d) / sqrt(-h)) * (1.0 + ((h / l) * (pow(((M / 2.0) * (D_m / d)), 2.0) * -0.5)))) * sqrt((d / l));
} else {
tmp = (1.0 + (h * ((-0.5 * pow((M * ((D_m / d) * 0.5)), 2.0)) / l))) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: tmp
if (h <= (-2d-310)) then
tmp = ((sqrt(-d) / sqrt(-h)) * (1.0d0 + ((h / l) * ((((m / 2.0d0) * (d_m / d)) ** 2.0d0) * (-0.5d0))))) * sqrt((d / l))
else
tmp = (1.0d0 + (h * (((-0.5d0) * ((m * ((d_m / d) * 0.5d0)) ** 2.0d0)) / l))) * (d / (sqrt(h) * sqrt(l)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (h <= -2e-310) {
tmp = ((Math.sqrt(-d) / Math.sqrt(-h)) * (1.0 + ((h / l) * (Math.pow(((M / 2.0) * (D_m / d)), 2.0) * -0.5)))) * Math.sqrt((d / l));
} else {
tmp = (1.0 + (h * ((-0.5 * Math.pow((M * ((D_m / d) * 0.5)), 2.0)) / l))) * (d / (Math.sqrt(h) * Math.sqrt(l)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if h <= -2e-310: tmp = ((math.sqrt(-d) / math.sqrt(-h)) * (1.0 + ((h / l) * (math.pow(((M / 2.0) * (D_m / d)), 2.0) * -0.5)))) * math.sqrt((d / l)) else: tmp = (1.0 + (h * ((-0.5 * math.pow((M * ((D_m / d) * 0.5)), 2.0)) / l))) * (d / (math.sqrt(h) * math.sqrt(l))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (h <= -2e-310) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.0) * -0.5)))) * sqrt(Float64(d / l))); else tmp = Float64(Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(M * Float64(Float64(D_m / d) * 0.5)) ^ 2.0)) / l))) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (h <= -2e-310)
tmp = ((sqrt(-d) / sqrt(-h)) * (1.0 + ((h / l) * ((((M / 2.0) * (D_m / d)) ^ 2.0) * -0.5)))) * sqrt((d / l));
else
tmp = (1.0 + (h * ((-0.5 * ((M * ((D_m / d) * 0.5)) ^ 2.0)) / l))) * (d / (sqrt(h) * sqrt(l)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[h, -2e-310], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(M * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2} \cdot -0.5\right)\right)\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + h \cdot \frac{-0.5 \cdot {\left(M \cdot \left(\frac{D\_m}{d} \cdot 0.5\right)\right)}^{2}}{\ell}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -1.999999999999994e-310Initial program 66.7%
Simplified67.3%
frac-2neg71.7%
sqrt-div83.8%
Applied egg-rr77.3%
if -1.999999999999994e-310 < h Initial program 62.6%
Simplified61.7%
sub-neg61.7%
distribute-rgt-in49.5%
*-un-lft-identity49.5%
sqrt-div54.7%
sqrt-div56.4%
frac-times56.5%
add-sqr-sqrt56.6%
Applied egg-rr73.2%
distribute-rgt1-in80.1%
+-commutative80.1%
associate-*l/81.2%
associate-/l*83.7%
associate-*l*83.7%
Simplified83.7%
Final simplification80.2%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= l -1.8e-149)
(* (/ (sqrt (- d)) (sqrt (- l))) (sqrt (/ d h)))
(if (<= l -5e-310)
(* d (sqrt (log (exp (/ 1.0 (* h l))))))
(*
d
(/
(+ 1.0 (/ -0.5 (/ l (* h (pow (* (/ M d) (/ D_m 2.0)) 2.0)))))
(* (sqrt h) (sqrt l)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -1.8e-149) {
tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h));
} else if (l <= -5e-310) {
tmp = d * sqrt(log(exp((1.0 / (h * l)))));
} else {
tmp = d * ((1.0 + (-0.5 / (l / (h * pow(((M / d) * (D_m / 2.0)), 2.0))))) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-1.8d-149)) then
tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h))
else if (l <= (-5d-310)) then
tmp = d * sqrt(log(exp((1.0d0 / (h * l)))))
else
tmp = d * ((1.0d0 + ((-0.5d0) / (l / (h * (((m / d) * (d_m / 2.0d0)) ** 2.0d0))))) / (sqrt(h) * sqrt(l)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -1.8e-149) {
tmp = (Math.sqrt(-d) / Math.sqrt(-l)) * Math.sqrt((d / h));
} else if (l <= -5e-310) {
tmp = d * Math.sqrt(Math.log(Math.exp((1.0 / (h * l)))));
} else {
tmp = d * ((1.0 + (-0.5 / (l / (h * Math.pow(((M / d) * (D_m / 2.0)), 2.0))))) / (Math.sqrt(h) * Math.sqrt(l)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if l <= -1.8e-149: tmp = (math.sqrt(-d) / math.sqrt(-l)) * math.sqrt((d / h)) elif l <= -5e-310: tmp = d * math.sqrt(math.log(math.exp((1.0 / (h * l))))) else: tmp = d * ((1.0 + (-0.5 / (l / (h * math.pow(((M / d) * (D_m / 2.0)), 2.0))))) / (math.sqrt(h) * math.sqrt(l))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= -1.8e-149) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * sqrt(Float64(d / h))); elseif (l <= -5e-310) tmp = Float64(d * sqrt(log(exp(Float64(1.0 / Float64(h * l)))))); else tmp = Float64(d * Float64(Float64(1.0 + Float64(-0.5 / Float64(l / Float64(h * (Float64(Float64(M / d) * Float64(D_m / 2.0)) ^ 2.0))))) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= -1.8e-149)
tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h));
elseif (l <= -5e-310)
tmp = d * sqrt(log(exp((1.0 / (h * l)))));
else
tmp = d * ((1.0 + (-0.5 / (l / (h * (((M / d) * (D_m / 2.0)) ^ 2.0))))) / (sqrt(h) * sqrt(l)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -1.8e-149], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(d * N[Sqrt[N[Log[N[Exp[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(1.0 + N[(-0.5 / N[(l / N[(h * N[Power[N[(N[(M / d), $MachinePrecision] * N[(D$95$m / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.8 \cdot 10^{-149}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\log \left(e^{\frac{1}{h \cdot \ell}}\right)}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{1 + \frac{-0.5}{\frac{\ell}{h \cdot {\left(\frac{M}{d} \cdot \frac{D\_m}{2}\right)}^{2}}}}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.8000000000000001e-149Initial program 63.7%
Simplified64.5%
frac-2neg64.5%
sqrt-div70.7%
Applied egg-rr70.7%
Taylor expanded in l around inf 54.5%
if -1.8000000000000001e-149 < l < -4.999999999999985e-310Initial program 74.0%
Simplified74.1%
Taylor expanded in d around inf 19.1%
*-commutative19.1%
associate-/r*19.1%
Simplified19.1%
add-log-exp53.4%
associate-/l/53.4%
Applied egg-rr53.4%
if -4.999999999999985e-310 < l Initial program 62.6%
Simplified61.7%
associate-*r/61.9%
clear-num61.9%
div-inv61.9%
metadata-eval61.9%
Applied egg-rr61.9%
pow161.9%
Applied egg-rr81.2%
unpow181.2%
associate-*l/81.3%
associate-/l*82.2%
sub-neg82.2%
distribute-neg-frac82.2%
metadata-eval82.2%
*-commutative82.2%
times-frac83.1%
Simplified83.1%
Final simplification67.1%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= l -6.5e-154)
(* (/ (sqrt (- d)) (sqrt (- l))) (sqrt (/ d h)))
(if (<= l -5e-310)
(* d (sqrt (log (exp (/ 1.0 (* h l))))))
(*
(+ 1.0 (* h (/ (* -0.5 (pow (* M (* (/ D_m d) 0.5)) 2.0)) l)))
(/ d (* (sqrt h) (sqrt l)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -6.5e-154) {
tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h));
} else if (l <= -5e-310) {
tmp = d * sqrt(log(exp((1.0 / (h * l)))));
} else {
tmp = (1.0 + (h * ((-0.5 * pow((M * ((D_m / d) * 0.5)), 2.0)) / l))) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-6.5d-154)) then
tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h))
else if (l <= (-5d-310)) then
tmp = d * sqrt(log(exp((1.0d0 / (h * l)))))
else
tmp = (1.0d0 + (h * (((-0.5d0) * ((m * ((d_m / d) * 0.5d0)) ** 2.0d0)) / l))) * (d / (sqrt(h) * sqrt(l)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -6.5e-154) {
tmp = (Math.sqrt(-d) / Math.sqrt(-l)) * Math.sqrt((d / h));
} else if (l <= -5e-310) {
tmp = d * Math.sqrt(Math.log(Math.exp((1.0 / (h * l)))));
} else {
tmp = (1.0 + (h * ((-0.5 * Math.pow((M * ((D_m / d) * 0.5)), 2.0)) / l))) * (d / (Math.sqrt(h) * Math.sqrt(l)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if l <= -6.5e-154: tmp = (math.sqrt(-d) / math.sqrt(-l)) * math.sqrt((d / h)) elif l <= -5e-310: tmp = d * math.sqrt(math.log(math.exp((1.0 / (h * l))))) else: tmp = (1.0 + (h * ((-0.5 * math.pow((M * ((D_m / d) * 0.5)), 2.0)) / l))) * (d / (math.sqrt(h) * math.sqrt(l))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= -6.5e-154) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * sqrt(Float64(d / h))); elseif (l <= -5e-310) tmp = Float64(d * sqrt(log(exp(Float64(1.0 / Float64(h * l)))))); else tmp = Float64(Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(M * Float64(Float64(D_m / d) * 0.5)) ^ 2.0)) / l))) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= -6.5e-154)
tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h));
elseif (l <= -5e-310)
tmp = d * sqrt(log(exp((1.0 / (h * l)))));
else
tmp = (1.0 + (h * ((-0.5 * ((M * ((D_m / d) * 0.5)) ^ 2.0)) / l))) * (d / (sqrt(h) * sqrt(l)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -6.5e-154], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(d * N[Sqrt[N[Log[N[Exp[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(M * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.5 \cdot 10^{-154}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\log \left(e^{\frac{1}{h \cdot \ell}}\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + h \cdot \frac{-0.5 \cdot {\left(M \cdot \left(\frac{D\_m}{d} \cdot 0.5\right)\right)}^{2}}{\ell}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -6.5000000000000003e-154Initial program 63.7%
Simplified64.5%
frac-2neg64.5%
sqrt-div70.7%
Applied egg-rr70.7%
Taylor expanded in l around inf 54.5%
if -6.5000000000000003e-154 < l < -4.999999999999985e-310Initial program 74.0%
Simplified74.1%
Taylor expanded in d around inf 19.1%
*-commutative19.1%
associate-/r*19.1%
Simplified19.1%
add-log-exp53.4%
associate-/l/53.4%
Applied egg-rr53.4%
if -4.999999999999985e-310 < l Initial program 62.6%
Simplified61.7%
sub-neg61.7%
distribute-rgt-in49.5%
*-un-lft-identity49.5%
sqrt-div54.7%
sqrt-div56.4%
frac-times56.5%
add-sqr-sqrt56.6%
Applied egg-rr73.2%
distribute-rgt1-in80.1%
+-commutative80.1%
associate-*l/81.2%
associate-/l*83.7%
associate-*l*83.7%
Simplified83.7%
Final simplification67.4%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= d -1.65e-303)
(*
(sqrt (/ d l))
(*
(+ 1.0 (* (/ h l) (* (pow (* (/ M 2.0) (/ D_m d)) 2.0) -0.5)))
(sqrt (/ d h))))
(*
(+ 1.0 (* h (/ (* -0.5 (pow (* M (* (/ D_m d) 0.5)) 2.0)) l)))
(/ d (* (sqrt h) (sqrt l))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= -1.65e-303) {
tmp = sqrt((d / l)) * ((1.0 + ((h / l) * (pow(((M / 2.0) * (D_m / d)), 2.0) * -0.5))) * sqrt((d / h)));
} else {
tmp = (1.0 + (h * ((-0.5 * pow((M * ((D_m / d) * 0.5)), 2.0)) / l))) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: tmp
if (d <= (-1.65d-303)) then
tmp = sqrt((d / l)) * ((1.0d0 + ((h / l) * ((((m / 2.0d0) * (d_m / d)) ** 2.0d0) * (-0.5d0)))) * sqrt((d / h)))
else
tmp = (1.0d0 + (h * (((-0.5d0) * ((m * ((d_m / d) * 0.5d0)) ** 2.0d0)) / l))) * (d / (sqrt(h) * sqrt(l)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= -1.65e-303) {
tmp = Math.sqrt((d / l)) * ((1.0 + ((h / l) * (Math.pow(((M / 2.0) * (D_m / d)), 2.0) * -0.5))) * Math.sqrt((d / h)));
} else {
tmp = (1.0 + (h * ((-0.5 * Math.pow((M * ((D_m / d) * 0.5)), 2.0)) / l))) * (d / (Math.sqrt(h) * Math.sqrt(l)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if d <= -1.65e-303: tmp = math.sqrt((d / l)) * ((1.0 + ((h / l) * (math.pow(((M / 2.0) * (D_m / d)), 2.0) * -0.5))) * math.sqrt((d / h))) else: tmp = (1.0 + (h * ((-0.5 * math.pow((M * ((D_m / d) * 0.5)), 2.0)) / l))) * (d / (math.sqrt(h) * math.sqrt(l))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (d <= -1.65e-303) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M / 2.0) * Float64(D_m / d)) ^ 2.0) * -0.5))) * sqrt(Float64(d / h)))); else tmp = Float64(Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(M * Float64(Float64(D_m / d) * 0.5)) ^ 2.0)) / l))) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (d <= -1.65e-303)
tmp = sqrt((d / l)) * ((1.0 + ((h / l) * ((((M / 2.0) * (D_m / d)) ^ 2.0) * -0.5))) * sqrt((d / h)));
else
tmp = (1.0 + (h * ((-0.5 * ((M * ((D_m / d) * 0.5)) ^ 2.0)) / l))) * (d / (sqrt(h) * sqrt(l)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[d, -1.65e-303], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(M * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.65 \cdot 10^{-303}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D\_m}{d}\right)}^{2} \cdot -0.5\right)\right) \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + h \cdot \frac{-0.5 \cdot {\left(M \cdot \left(\frac{D\_m}{d} \cdot 0.5\right)\right)}^{2}}{\ell}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.6499999999999999e-303Initial program 67.7%
Simplified68.3%
if -1.6499999999999999e-303 < d Initial program 61.5%
Simplified60.6%
sub-neg60.6%
distribute-rgt-in48.7%
*-un-lft-identity48.7%
sqrt-div53.8%
sqrt-div55.5%
frac-times55.6%
add-sqr-sqrt55.6%
Applied egg-rr71.9%
distribute-rgt1-in78.8%
+-commutative78.8%
associate-*l/79.8%
associate-/l*82.3%
associate-*l*82.3%
Simplified82.3%
Final simplification74.7%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= l -5e-310)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (* (/ h l) (* -0.5 (pow (/ D_m (* d (/ 2.0 M))) 2.0))))))
(*
(+ 1.0 (* h (/ (* -0.5 (pow (* M (* (/ D_m d) 0.5)) 2.0)) l)))
(/ d (* (sqrt h) (sqrt l))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * pow((D_m / (d * (2.0 / M))), 2.0)))));
} else {
tmp = (1.0 + (h * ((-0.5 * pow((M * ((D_m / d) * 0.5)), 2.0)) / l))) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-5d-310)) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((h / l) * ((-0.5d0) * ((d_m / (d * (2.0d0 / m))) ** 2.0d0)))))
else
tmp = (1.0d0 + (h * (((-0.5d0) * ((m * ((d_m / d) * 0.5d0)) ** 2.0d0)) / l))) * (d / (sqrt(h) * sqrt(l)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * Math.pow((D_m / (d * (2.0 / M))), 2.0)))));
} else {
tmp = (1.0 + (h * ((-0.5 * Math.pow((M * ((D_m / d) * 0.5)), 2.0)) / l))) * (d / (Math.sqrt(h) * Math.sqrt(l)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if l <= -5e-310: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * math.pow((D_m / (d * (2.0 / M))), 2.0))))) else: tmp = (1.0 + (h * ((-0.5 * math.pow((M * ((D_m / d) * 0.5)), 2.0)) / l))) * (d / (math.sqrt(h) * math.sqrt(l))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= -5e-310) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D_m / Float64(d * Float64(2.0 / M))) ^ 2.0)))))); else tmp = Float64(Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(M * Float64(Float64(D_m / d) * 0.5)) ^ 2.0)) / l))) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= -5e-310)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * ((D_m / (d * (2.0 / M))) ^ 2.0)))));
else
tmp = (1.0 + (h * ((-0.5 * ((M * ((D_m / d) * 0.5)) ^ 2.0)) / l))) * (d / (sqrt(h) * sqrt(l)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -5e-310], 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[(-0.5 * N[Power[N[(D$95$m / N[(d * N[(2.0 / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(M * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{D\_m}{d \cdot \frac{2}{M}}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + h \cdot \frac{-0.5 \cdot {\left(M \cdot \left(\frac{D\_m}{d} \cdot 0.5\right)\right)}^{2}}{\ell}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.7%
Simplified67.3%
clear-num67.3%
frac-times67.6%
*-un-lft-identity67.6%
Applied egg-rr67.6%
if -4.999999999999985e-310 < l Initial program 62.6%
Simplified61.7%
sub-neg61.7%
distribute-rgt-in49.5%
*-un-lft-identity49.5%
sqrt-div54.7%
sqrt-div56.4%
frac-times56.5%
add-sqr-sqrt56.6%
Applied egg-rr73.2%
distribute-rgt1-in80.1%
+-commutative80.1%
associate-*l/81.2%
associate-/l*83.7%
associate-*l*83.7%
Simplified83.7%
Final simplification74.9%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= l -5e-310)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (/ (* h (* -0.5 (pow (* (/ D_m d) (* M 0.5)) 2.0))) l))))
(*
(+ 1.0 (* h (/ (* -0.5 (pow (* M (* (/ D_m d) 0.5)) 2.0)) l)))
(/ d (* (sqrt h) (sqrt l))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * (-0.5 * pow(((D_m / d) * (M * 0.5)), 2.0))) / l)));
} else {
tmp = (1.0 + (h * ((-0.5 * pow((M * ((D_m / d) * 0.5)), 2.0)) / l))) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-5d-310)) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((h * ((-0.5d0) * (((d_m / d) * (m * 0.5d0)) ** 2.0d0))) / l)))
else
tmp = (1.0d0 + (h * (((-0.5d0) * ((m * ((d_m / d) * 0.5d0)) ** 2.0d0)) / l))) * (d / (sqrt(h) * sqrt(l)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h * (-0.5 * Math.pow(((D_m / d) * (M * 0.5)), 2.0))) / l)));
} else {
tmp = (1.0 + (h * ((-0.5 * Math.pow((M * ((D_m / d) * 0.5)), 2.0)) / l))) * (d / (Math.sqrt(h) * Math.sqrt(l)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if l <= -5e-310: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((h * (-0.5 * math.pow(((D_m / d) * (M * 0.5)), 2.0))) / l))) else: tmp = (1.0 + (h * ((-0.5 * math.pow((M * ((D_m / d) * 0.5)), 2.0)) / l))) * (d / (math.sqrt(h) * math.sqrt(l))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= -5e-310) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(Float64(D_m / d) * Float64(M * 0.5)) ^ 2.0))) / l)))); else tmp = Float64(Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(M * Float64(Float64(D_m / d) * 0.5)) ^ 2.0)) / l))) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= -5e-310)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * (-0.5 * (((D_m / d) * (M * 0.5)) ^ 2.0))) / l)));
else
tmp = (1.0 + (h * ((-0.5 * ((M * ((D_m / d) * 0.5)) ^ 2.0)) / l))) * (d / (sqrt(h) * sqrt(l)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -5e-310], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(M * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(\frac{D\_m}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + h \cdot \frac{-0.5 \cdot {\left(M \cdot \left(\frac{D\_m}{d} \cdot 0.5\right)\right)}^{2}}{\ell}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.7%
Simplified67.3%
associate-*l/69.5%
div-inv69.5%
metadata-eval69.5%
Applied egg-rr69.5%
if -4.999999999999985e-310 < l Initial program 62.6%
Simplified61.7%
sub-neg61.7%
distribute-rgt-in49.5%
*-un-lft-identity49.5%
sqrt-div54.7%
sqrt-div56.4%
frac-times56.5%
add-sqr-sqrt56.6%
Applied egg-rr73.2%
distribute-rgt1-in80.1%
+-commutative80.1%
associate-*l/81.2%
associate-/l*83.7%
associate-*l*83.7%
Simplified83.7%
Final simplification75.9%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= l -1.8e-150)
(* (/ (sqrt (- d)) (sqrt (- l))) (sqrt (/ d h)))
(if (<= l -5e-310)
(* d (sqrt (log (exp (/ 1.0 (* h l))))))
(* d (/ (pow l -0.5) (sqrt h))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -1.8e-150) {
tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h));
} else if (l <= -5e-310) {
tmp = d * sqrt(log(exp((1.0 / (h * l)))));
} else {
tmp = d * (pow(l, -0.5) / sqrt(h));
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-1.8d-150)) then
tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h))
else if (l <= (-5d-310)) then
tmp = d * sqrt(log(exp((1.0d0 / (h * l)))))
else
tmp = d * ((l ** (-0.5d0)) / sqrt(h))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -1.8e-150) {
tmp = (Math.sqrt(-d) / Math.sqrt(-l)) * Math.sqrt((d / h));
} else if (l <= -5e-310) {
tmp = d * Math.sqrt(Math.log(Math.exp((1.0 / (h * l)))));
} else {
tmp = d * (Math.pow(l, -0.5) / Math.sqrt(h));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if l <= -1.8e-150: tmp = (math.sqrt(-d) / math.sqrt(-l)) * math.sqrt((d / h)) elif l <= -5e-310: tmp = d * math.sqrt(math.log(math.exp((1.0 / (h * l))))) else: tmp = d * (math.pow(l, -0.5) / math.sqrt(h)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= -1.8e-150) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * sqrt(Float64(d / h))); elseif (l <= -5e-310) tmp = Float64(d * sqrt(log(exp(Float64(1.0 / Float64(h * l)))))); else tmp = Float64(d * Float64((l ^ -0.5) / sqrt(h))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= -1.8e-150)
tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h));
elseif (l <= -5e-310)
tmp = d * sqrt(log(exp((1.0 / (h * l)))));
else
tmp = d * ((l ^ -0.5) / sqrt(h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -1.8e-150], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(d * N[Sqrt[N[Log[N[Exp[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.8 \cdot 10^{-150}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\log \left(e^{\frac{1}{h \cdot \ell}}\right)}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{\ell}^{-0.5}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -1.8000000000000001e-150Initial program 63.7%
Simplified64.5%
frac-2neg64.5%
sqrt-div70.7%
Applied egg-rr70.7%
Taylor expanded in l around inf 54.5%
if -1.8000000000000001e-150 < l < -4.999999999999985e-310Initial program 74.0%
Simplified74.1%
Taylor expanded in d around inf 19.1%
*-commutative19.1%
associate-/r*19.1%
Simplified19.1%
add-log-exp53.4%
associate-/l/53.4%
Applied egg-rr53.4%
if -4.999999999999985e-310 < l Initial program 62.6%
Simplified61.7%
Taylor expanded in d around inf 50.7%
*-commutative50.7%
associate-/r*50.7%
Simplified50.7%
*-un-lft-identity50.7%
sqrt-div58.5%
inv-pow58.5%
sqrt-pow158.5%
metadata-eval58.5%
Applied egg-rr58.5%
*-lft-identity58.5%
Simplified58.5%
Final simplification56.1%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (if (<= l -5e-310) (* d (sqrt (log (exp (/ 1.0 (* h l)))))) (* d (/ (pow l -0.5) (sqrt h)))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = d * sqrt(log(exp((1.0 / (h * l)))));
} else {
tmp = d * (pow(l, -0.5) / sqrt(h));
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-5d-310)) then
tmp = d * sqrt(log(exp((1.0d0 / (h * l)))))
else
tmp = d * ((l ** (-0.5d0)) / sqrt(h))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = d * Math.sqrt(Math.log(Math.exp((1.0 / (h * l)))));
} else {
tmp = d * (Math.pow(l, -0.5) / Math.sqrt(h));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if l <= -5e-310: tmp = d * math.sqrt(math.log(math.exp((1.0 / (h * l))))) else: tmp = d * (math.pow(l, -0.5) / math.sqrt(h)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= -5e-310) tmp = Float64(d * sqrt(log(exp(Float64(1.0 / Float64(h * l)))))); else tmp = Float64(d * Float64((l ^ -0.5) / sqrt(h))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= -5e-310)
tmp = d * sqrt(log(exp((1.0 / (h * l)))));
else
tmp = d * ((l ^ -0.5) / sqrt(h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -5e-310], N[(d * N[Sqrt[N[Log[N[Exp[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\log \left(e^{\frac{1}{h \cdot \ell}}\right)}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{\ell}^{-0.5}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.7%
Simplified67.3%
Taylor expanded in d around inf 12.4%
*-commutative12.4%
associate-/r*12.4%
Simplified12.4%
add-log-exp25.4%
associate-/l/25.4%
Applied egg-rr25.4%
if -4.999999999999985e-310 < l Initial program 62.6%
Simplified61.7%
Taylor expanded in d around inf 50.7%
*-commutative50.7%
associate-/r*50.7%
Simplified50.7%
*-un-lft-identity50.7%
sqrt-div58.5%
inv-pow58.5%
sqrt-pow158.5%
metadata-eval58.5%
Applied egg-rr58.5%
*-lft-identity58.5%
Simplified58.5%
Final simplification40.3%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (if (<= l -5e-310) (* d (sqrt (sqrt (pow (* h l) -2.0)))) (* d (/ (pow l -0.5) (sqrt h)))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = d * sqrt(sqrt(pow((h * l), -2.0)));
} else {
tmp = d * (pow(l, -0.5) / sqrt(h));
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-5d-310)) then
tmp = d * sqrt(sqrt(((h * l) ** (-2.0d0))))
else
tmp = d * ((l ** (-0.5d0)) / sqrt(h))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = d * Math.sqrt(Math.sqrt(Math.pow((h * l), -2.0)));
} else {
tmp = d * (Math.pow(l, -0.5) / Math.sqrt(h));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if l <= -5e-310: tmp = d * math.sqrt(math.sqrt(math.pow((h * l), -2.0))) else: tmp = d * (math.pow(l, -0.5) / math.sqrt(h)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= -5e-310) tmp = Float64(d * sqrt(sqrt((Float64(h * l) ^ -2.0)))); else tmp = Float64(d * Float64((l ^ -0.5) / sqrt(h))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= -5e-310)
tmp = d * sqrt(sqrt(((h * l) ^ -2.0)));
else
tmp = d * ((l ^ -0.5) / sqrt(h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -5e-310], N[(d * N[Sqrt[N[Sqrt[N[Power[N[(h * l), $MachinePrecision], -2.0], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\sqrt{{\left(h \cdot \ell\right)}^{-2}}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{\ell}^{-0.5}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.7%
Simplified67.3%
Taylor expanded in d around inf 12.4%
*-commutative12.4%
associate-/r*12.4%
Simplified12.4%
add-sqr-sqrt12.4%
pow1/212.4%
pow1/212.4%
pow-prod-down18.5%
frac-times21.7%
inv-pow21.7%
inv-pow21.7%
pow-prod-up21.7%
metadata-eval21.7%
pow221.7%
Applied egg-rr21.7%
unpow1/221.7%
metadata-eval21.7%
pow-sqr21.7%
unpow-121.7%
unpow-121.7%
unpow221.7%
times-frac18.5%
associate-/r*18.5%
*-commutative18.5%
associate-/r*18.5%
*-commutative18.5%
unpow-118.5%
unpow-118.5%
pow-sqr18.5%
metadata-eval18.5%
Simplified18.5%
if -4.999999999999985e-310 < l Initial program 62.6%
Simplified61.7%
Taylor expanded in d around inf 50.7%
*-commutative50.7%
associate-/r*50.7%
Simplified50.7%
*-un-lft-identity50.7%
sqrt-div58.5%
inv-pow58.5%
sqrt-pow158.5%
metadata-eval58.5%
Applied egg-rr58.5%
*-lft-identity58.5%
Simplified58.5%
Final simplification36.5%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (if (<= l -5e-310) (* d (cbrt (pow (/ 1.0 (* h l)) 1.5))) (* d (/ (pow l -0.5) (sqrt h)))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = d * cbrt(pow((1.0 / (h * l)), 1.5));
} else {
tmp = d * (pow(l, -0.5) / sqrt(h));
}
return tmp;
}
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = d * Math.cbrt(Math.pow((1.0 / (h * l)), 1.5));
} else {
tmp = d * (Math.pow(l, -0.5) / Math.sqrt(h));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= -5e-310) tmp = Float64(d * cbrt((Float64(1.0 / Float64(h * l)) ^ 1.5))); else tmp = Float64(d * Float64((l ^ -0.5) / sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -5e-310], N[(d * N[Power[N[Power[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt[3]{{\left(\frac{1}{h \cdot \ell}\right)}^{1.5}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{\ell}^{-0.5}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.7%
Simplified67.3%
Taylor expanded in d around inf 12.4%
*-commutative12.4%
associate-/r*12.4%
Simplified12.4%
add-cbrt-cube16.5%
pow1/316.5%
add-sqr-sqrt16.5%
pow116.5%
pow1/216.5%
pow-prod-up16.5%
associate-/l/16.5%
metadata-eval16.5%
Applied egg-rr16.5%
unpow1/316.5%
Simplified16.5%
if -4.999999999999985e-310 < l Initial program 62.6%
Simplified61.7%
Taylor expanded in d around inf 50.7%
*-commutative50.7%
associate-/r*50.7%
Simplified50.7%
*-un-lft-identity50.7%
sqrt-div58.5%
inv-pow58.5%
sqrt-pow158.5%
metadata-eval58.5%
Applied egg-rr58.5%
*-lft-identity58.5%
Simplified58.5%
Final simplification35.4%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (if (<= l -5e-310) (* d (pow (* h l) -0.5)) (* d (/ (pow l -0.5) (sqrt h)))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = d * pow((h * l), -0.5);
} else {
tmp = d * (pow(l, -0.5) / sqrt(h));
}
return tmp;
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-5d-310)) then
tmp = d * ((h * l) ** (-0.5d0))
else
tmp = d * ((l ** (-0.5d0)) / sqrt(h))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = d * Math.pow((h * l), -0.5);
} else {
tmp = d * (Math.pow(l, -0.5) / Math.sqrt(h));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if l <= -5e-310: tmp = d * math.pow((h * l), -0.5) else: tmp = d * (math.pow(l, -0.5) / math.sqrt(h)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= -5e-310) tmp = Float64(d * (Float64(h * l) ^ -0.5)); else tmp = Float64(d * Float64((l ^ -0.5) / sqrt(h))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= -5e-310)
tmp = d * ((h * l) ^ -0.5);
else
tmp = d * ((l ^ -0.5) / sqrt(h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -5e-310], N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{\ell}^{-0.5}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.7%
Simplified67.3%
associate-*r/69.5%
clear-num69.5%
div-inv69.5%
metadata-eval69.5%
Applied egg-rr69.5%
Taylor expanded in d around inf 12.4%
unpow-112.4%
sqr-pow12.4%
rem-sqrt-square12.4%
metadata-eval12.4%
sqr-pow12.4%
fabs-sqr12.4%
sqr-pow12.4%
Simplified12.4%
if -4.999999999999985e-310 < l Initial program 62.6%
Simplified61.7%
Taylor expanded in d around inf 50.7%
*-commutative50.7%
associate-/r*50.7%
Simplified50.7%
*-un-lft-identity50.7%
sqrt-div58.5%
inv-pow58.5%
sqrt-pow158.5%
metadata-eval58.5%
Applied egg-rr58.5%
*-lft-identity58.5%
Simplified58.5%
Final simplification33.1%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (* d (pow (* h l) -0.5)))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
return d * pow((h * l), -0.5);
}
D_m = abs(D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_m
code = d * ((h * l) ** (-0.5d0))
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
return d * Math.pow((h * l), -0.5);
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): return d * math.pow((h * l), -0.5)
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) return Float64(d * (Float64(h * l) ^ -0.5)) end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp = code(d, h, l, M, D_m)
tmp = d * ((h * l) ^ -0.5);
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
d \cdot {\left(h \cdot \ell\right)}^{-0.5}
\end{array}
Initial program 64.9%
Simplified64.8%
associate-*r/66.1%
clear-num66.1%
div-inv66.1%
metadata-eval66.1%
Applied egg-rr66.1%
Taylor expanded in d around inf 29.6%
unpow-129.6%
sqr-pow29.6%
rem-sqrt-square29.9%
metadata-eval29.9%
sqr-pow29.7%
fabs-sqr29.7%
sqr-pow29.9%
Simplified29.9%
Final simplification29.9%
herbie shell --seed 2024041
(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)))))