
(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 14 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: d, h, l, 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 (* (* 0.5 M) (/ D d)))
(t_2 (- 1.0 (* 0.5 (* h (* t_1 (/ t_1 l))))))
(t_3 (sqrt (/ d l))))
(if (<= l -1.18e+182)
(* (* (sqrt (/ d h)) (/ t_0 (sqrt (- l)))) t_2)
(if (<= l -1e-311)
(*
t_3
(*
(/ t_0 (sqrt (- h)))
(+ 1.0 (* h (* (pow (* D (/ M (* d 2.0))) 2.0) (/ -0.5 l))))))
(* t_2 (* t_3 (/ (sqrt d) (sqrt h))))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(-d);
double t_1 = (0.5 * M) * (D / d);
double t_2 = 1.0 - (0.5 * (h * (t_1 * (t_1 / l))));
double t_3 = sqrt((d / l));
double tmp;
if (l <= -1.18e+182) {
tmp = (sqrt((d / h)) * (t_0 / sqrt(-l))) * t_2;
} else if (l <= -1e-311) {
tmp = t_3 * ((t_0 / sqrt(-h)) * (1.0 + (h * (pow((D * (M / (d * 2.0))), 2.0) * (-0.5 / l)))));
} else {
tmp = t_2 * (t_3 * (sqrt(d) / sqrt(h)));
}
return tmp;
}
NOTE: d, h, l, 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) :: t_3
real(8) :: tmp
t_0 = sqrt(-d)
t_1 = (0.5d0 * m) * (d_1 / d)
t_2 = 1.0d0 - (0.5d0 * (h * (t_1 * (t_1 / l))))
t_3 = sqrt((d / l))
if (l <= (-1.18d+182)) then
tmp = (sqrt((d / h)) * (t_0 / sqrt(-l))) * t_2
else if (l <= (-1d-311)) then
tmp = t_3 * ((t_0 / sqrt(-h)) * (1.0d0 + (h * (((d_1 * (m / (d * 2.0d0))) ** 2.0d0) * ((-0.5d0) / l)))))
else
tmp = t_2 * (t_3 * (sqrt(d) / sqrt(h)))
end if
code = tmp
end function
assert d < h && h < l && l < M && 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 = (0.5 * M) * (D / d);
double t_2 = 1.0 - (0.5 * (h * (t_1 * (t_1 / l))));
double t_3 = Math.sqrt((d / l));
double tmp;
if (l <= -1.18e+182) {
tmp = (Math.sqrt((d / h)) * (t_0 / Math.sqrt(-l))) * t_2;
} else if (l <= -1e-311) {
tmp = t_3 * ((t_0 / Math.sqrt(-h)) * (1.0 + (h * (Math.pow((D * (M / (d * 2.0))), 2.0) * (-0.5 / l)))));
} else {
tmp = t_2 * (t_3 * (Math.sqrt(d) / Math.sqrt(h)));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): t_0 = math.sqrt(-d) t_1 = (0.5 * M) * (D / d) t_2 = 1.0 - (0.5 * (h * (t_1 * (t_1 / l)))) t_3 = math.sqrt((d / l)) tmp = 0 if l <= -1.18e+182: tmp = (math.sqrt((d / h)) * (t_0 / math.sqrt(-l))) * t_2 elif l <= -1e-311: tmp = t_3 * ((t_0 / math.sqrt(-h)) * (1.0 + (h * (math.pow((D * (M / (d * 2.0))), 2.0) * (-0.5 / l))))) else: tmp = t_2 * (t_3 * (math.sqrt(d) / math.sqrt(h))) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(-d)) t_1 = Float64(Float64(0.5 * M) * Float64(D / d)) t_2 = Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_1 * Float64(t_1 / l))))) t_3 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -1.18e+182) tmp = Float64(Float64(sqrt(Float64(d / h)) * Float64(t_0 / sqrt(Float64(-l)))) * t_2); elseif (l <= -1e-311) tmp = Float64(t_3 * Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(1.0 + Float64(h * Float64((Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0) * Float64(-0.5 / l)))))); else tmp = Float64(t_2 * Float64(t_3 * Float64(sqrt(d) / sqrt(h)))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt(-d);
t_1 = (0.5 * M) * (D / d);
t_2 = 1.0 - (0.5 * (h * (t_1 * (t_1 / l))));
t_3 = sqrt((d / l));
tmp = 0.0;
if (l <= -1.18e+182)
tmp = (sqrt((d / h)) * (t_0 / sqrt(-l))) * t_2;
elseif (l <= -1e-311)
tmp = t_3 * ((t_0 / sqrt(-h)) * (1.0 + (h * (((D * (M / (d * 2.0))) ^ 2.0) * (-0.5 / l)))));
else
tmp = t_2 * (t_3 * (sqrt(d) / sqrt(h)));
end
tmp_2 = tmp;
end
NOTE: d, h, l, 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[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(0.5 * N[(h * N[(t$95$1 * N[(t$95$1 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.18e+182], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[l, -1e-311], N[(t$95$3 * N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(h * N[(N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[(t$95$3 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
t_1 := \left(0.5 \cdot M\right) \cdot \frac{D}{d}\\
t_2 := 1 - 0.5 \cdot \left(h \cdot \left(t\_1 \cdot \frac{t\_1}{\ell}\right)\right)\\
t_3 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -1.18 \cdot 10^{+182}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \frac{t\_0}{\sqrt{-\ell}}\right) \cdot t\_2\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-311}:\\
\;\;\;\;t\_3 \cdot \left(\frac{t\_0}{\sqrt{-h}} \cdot \left(1 + h \cdot \left({\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2} \cdot \frac{-0.5}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \left(t\_3 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\end{array}
\end{array}
if l < -1.1799999999999999e182Initial program 44.1%
Simplified44.1%
expm1-log1p-u43.8%
expm1-undefine43.8%
Applied egg-rr43.8%
sub-neg43.8%
metadata-eval43.8%
+-commutative43.8%
log1p-undefine43.8%
rem-exp-log44.1%
associate-+r+44.1%
metadata-eval44.1%
metadata-eval44.1%
associate--r-44.1%
neg-sub044.1%
associate-*l/44.4%
distribute-frac-neg244.4%
neg-sub044.4%
distribute-neg-frac244.4%
remove-double-neg44.4%
Simplified47.9%
unpow247.9%
*-un-lft-identity47.9%
times-frac51.3%
associate-*r/47.9%
frac-times51.3%
*-commutative51.3%
div-inv51.3%
metadata-eval51.3%
associate-*r/47.9%
frac-times51.3%
*-commutative51.3%
div-inv51.3%
metadata-eval51.3%
Applied egg-rr51.3%
frac-2neg51.3%
sqrt-div72.3%
Applied egg-rr72.3%
if -1.1799999999999999e182 < l < -9.99999999999948e-312Initial program 70.9%
Simplified70.9%
expm1-log1p-u40.1%
expm1-undefine40.1%
*-commutative40.1%
associate-*l*40.1%
associate-*r/40.2%
associate-*l/39.2%
*-commutative39.2%
div-inv39.2%
metadata-eval39.2%
associate-*l*39.2%
Applied egg-rr39.2%
Simplified74.0%
frac-2neg74.0%
sqrt-div85.9%
Applied egg-rr85.9%
if -9.99999999999948e-312 < l Initial program 71.8%
Simplified71.1%
expm1-log1p-u70.8%
expm1-undefine70.8%
Applied egg-rr70.8%
sub-neg70.8%
metadata-eval70.8%
+-commutative70.8%
log1p-undefine70.8%
rem-exp-log71.1%
associate-+r+71.1%
metadata-eval71.1%
metadata-eval71.1%
associate--r-71.1%
neg-sub071.1%
associate-*l/72.9%
distribute-frac-neg272.9%
neg-sub072.9%
distribute-neg-frac272.9%
remove-double-neg72.9%
Simplified74.5%
unpow274.5%
*-un-lft-identity74.5%
times-frac78.4%
associate-*r/77.7%
frac-times77.6%
*-commutative77.6%
div-inv77.6%
metadata-eval77.6%
associate-*r/76.9%
frac-times77.6%
*-commutative77.6%
div-inv77.6%
metadata-eval77.6%
Applied egg-rr77.6%
sqrt-div89.5%
div-inv89.5%
Applied egg-rr89.5%
associate-*r/89.5%
*-rgt-identity89.5%
Simplified89.5%
Final simplification86.2%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (* 0.5 M) (/ D d)))
(t_1 (- 1.0 (* 0.5 (* h (* t_0 (/ t_0 l)))))))
(if (<= l -1e-311)
(* (* (sqrt (/ d h)) (/ (sqrt (- d)) (sqrt (- l)))) t_1)
(* t_1 (* (sqrt (/ d l)) (/ (sqrt d) (sqrt h)))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (0.5 * M) * (D / d);
double t_1 = 1.0 - (0.5 * (h * (t_0 * (t_0 / l))));
double tmp;
if (l <= -1e-311) {
tmp = (sqrt((d / h)) * (sqrt(-d) / sqrt(-l))) * t_1;
} else {
tmp = t_1 * (sqrt((d / l)) * (sqrt(d) / sqrt(h)));
}
return tmp;
}
NOTE: d, h, l, 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 = (0.5d0 * m) * (d_1 / d)
t_1 = 1.0d0 - (0.5d0 * (h * (t_0 * (t_0 / l))))
if (l <= (-1d-311)) then
tmp = (sqrt((d / h)) * (sqrt(-d) / sqrt(-l))) * t_1
else
tmp = t_1 * (sqrt((d / l)) * (sqrt(d) / sqrt(h)))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (0.5 * M) * (D / d);
double t_1 = 1.0 - (0.5 * (h * (t_0 * (t_0 / l))));
double tmp;
if (l <= -1e-311) {
tmp = (Math.sqrt((d / h)) * (Math.sqrt(-d) / Math.sqrt(-l))) * t_1;
} else {
tmp = t_1 * (Math.sqrt((d / l)) * (Math.sqrt(d) / Math.sqrt(h)));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): t_0 = (0.5 * M) * (D / d) t_1 = 1.0 - (0.5 * (h * (t_0 * (t_0 / l)))) tmp = 0 if l <= -1e-311: tmp = (math.sqrt((d / h)) * (math.sqrt(-d) / math.sqrt(-l))) * t_1 else: tmp = t_1 * (math.sqrt((d / l)) * (math.sqrt(d) / math.sqrt(h))) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(0.5 * M) * Float64(D / d)) t_1 = Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_0 * Float64(t_0 / l))))) tmp = 0.0 if (l <= -1e-311) tmp = Float64(Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))) * t_1); else tmp = Float64(t_1 * Float64(sqrt(Float64(d / l)) * Float64(sqrt(d) / sqrt(h)))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (0.5 * M) * (D / d);
t_1 = 1.0 - (0.5 * (h * (t_0 * (t_0 / l))));
tmp = 0.0;
if (l <= -1e-311)
tmp = (sqrt((d / h)) * (sqrt(-d) / sqrt(-l))) * t_1;
else
tmp = t_1 * (sqrt((d / l)) * (sqrt(d) / sqrt(h)));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(0.5 * N[(h * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1e-311], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(t$95$1 * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \left(0.5 \cdot M\right) \cdot \frac{D}{d}\\
t_1 := 1 - 0.5 \cdot \left(h \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-311}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\end{array}
\end{array}
if l < -9.99999999999948e-312Initial program 65.3%
Simplified63.8%
expm1-log1p-u63.5%
expm1-undefine63.5%
Applied egg-rr63.5%
sub-neg63.5%
metadata-eval63.5%
+-commutative63.5%
log1p-undefine63.5%
rem-exp-log63.8%
associate-+r+63.8%
metadata-eval63.8%
metadata-eval63.8%
associate--r-63.8%
neg-sub063.8%
associate-*l/66.3%
distribute-frac-neg266.3%
neg-sub066.3%
distribute-neg-frac266.3%
remove-double-neg66.3%
Simplified68.5%
unpow268.5%
*-un-lft-identity68.5%
times-frac70.0%
associate-*r/69.3%
frac-times68.5%
*-commutative68.5%
div-inv68.5%
metadata-eval68.5%
associate-*r/67.8%
frac-times68.5%
*-commutative68.5%
div-inv68.5%
metadata-eval68.5%
Applied egg-rr68.5%
frac-2neg68.5%
sqrt-div77.2%
Applied egg-rr77.2%
if -9.99999999999948e-312 < l Initial program 71.8%
Simplified71.1%
expm1-log1p-u70.8%
expm1-undefine70.8%
Applied egg-rr70.8%
sub-neg70.8%
metadata-eval70.8%
+-commutative70.8%
log1p-undefine70.8%
rem-exp-log71.1%
associate-+r+71.1%
metadata-eval71.1%
metadata-eval71.1%
associate--r-71.1%
neg-sub071.1%
associate-*l/72.9%
distribute-frac-neg272.9%
neg-sub072.9%
distribute-neg-frac272.9%
remove-double-neg72.9%
Simplified74.5%
unpow274.5%
*-un-lft-identity74.5%
times-frac78.4%
associate-*r/77.7%
frac-times77.6%
*-commutative77.6%
div-inv77.6%
metadata-eval77.6%
associate-*r/76.9%
frac-times77.6%
*-commutative77.6%
div-inv77.6%
metadata-eval77.6%
Applied egg-rr77.6%
sqrt-div89.5%
div-inv89.5%
Applied egg-rr89.5%
associate-*r/89.5%
*-rgt-identity89.5%
Simplified89.5%
Final simplification83.1%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (* 0.5 M) (/ D d)))
(t_1 (sqrt (/ d l)))
(t_2 (- 1.0 (* 0.5 (* h (* t_0 (/ t_0 l)))))))
(if (<= d -4e-310)
(* t_2 (* t_1 (/ (sqrt (- d)) (sqrt (- h)))))
(* t_2 (* t_1 (/ (sqrt d) (sqrt h)))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (0.5 * M) * (D / d);
double t_1 = sqrt((d / l));
double t_2 = 1.0 - (0.5 * (h * (t_0 * (t_0 / l))));
double tmp;
if (d <= -4e-310) {
tmp = t_2 * (t_1 * (sqrt(-d) / sqrt(-h)));
} else {
tmp = t_2 * (t_1 * (sqrt(d) / sqrt(h)));
}
return tmp;
}
NOTE: d, h, l, 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 = (0.5d0 * m) * (d_1 / d)
t_1 = sqrt((d / l))
t_2 = 1.0d0 - (0.5d0 * (h * (t_0 * (t_0 / l))))
if (d <= (-4d-310)) then
tmp = t_2 * (t_1 * (sqrt(-d) / sqrt(-h)))
else
tmp = t_2 * (t_1 * (sqrt(d) / sqrt(h)))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (0.5 * M) * (D / d);
double t_1 = Math.sqrt((d / l));
double t_2 = 1.0 - (0.5 * (h * (t_0 * (t_0 / l))));
double tmp;
if (d <= -4e-310) {
tmp = t_2 * (t_1 * (Math.sqrt(-d) / Math.sqrt(-h)));
} else {
tmp = t_2 * (t_1 * (Math.sqrt(d) / Math.sqrt(h)));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): t_0 = (0.5 * M) * (D / d) t_1 = math.sqrt((d / l)) t_2 = 1.0 - (0.5 * (h * (t_0 * (t_0 / l)))) tmp = 0 if d <= -4e-310: tmp = t_2 * (t_1 * (math.sqrt(-d) / math.sqrt(-h))) else: tmp = t_2 * (t_1 * (math.sqrt(d) / math.sqrt(h))) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(0.5 * M) * Float64(D / d)) t_1 = sqrt(Float64(d / l)) t_2 = Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_0 * Float64(t_0 / l))))) tmp = 0.0 if (d <= -4e-310) tmp = Float64(t_2 * Float64(t_1 * Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))))); else tmp = Float64(t_2 * Float64(t_1 * Float64(sqrt(d) / sqrt(h)))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (0.5 * M) * (D / d);
t_1 = sqrt((d / l));
t_2 = 1.0 - (0.5 * (h * (t_0 * (t_0 / l))));
tmp = 0.0;
if (d <= -4e-310)
tmp = t_2 * (t_1 * (sqrt(-d) / sqrt(-h)));
else
tmp = t_2 * (t_1 * (sqrt(d) / sqrt(h)));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(0.5 * N[(h * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -4e-310], N[(t$95$2 * N[(t$95$1 * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \left(0.5 \cdot M\right) \cdot \frac{D}{d}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := 1 - 0.5 \cdot \left(h \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\\
\mathbf{if}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;t\_2 \cdot \left(t\_1 \cdot \frac{\sqrt{-d}}{\sqrt{-h}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \left(t\_1 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\end{array}
\end{array}
if d < -3.999999999999988e-310Initial program 65.3%
Simplified63.8%
expm1-log1p-u63.5%
expm1-undefine63.5%
Applied egg-rr63.5%
sub-neg63.5%
metadata-eval63.5%
+-commutative63.5%
log1p-undefine63.5%
rem-exp-log63.8%
associate-+r+63.8%
metadata-eval63.8%
metadata-eval63.8%
associate--r-63.8%
neg-sub063.8%
associate-*l/66.3%
distribute-frac-neg266.3%
neg-sub066.3%
distribute-neg-frac266.3%
remove-double-neg66.3%
Simplified68.5%
unpow268.5%
*-un-lft-identity68.5%
times-frac70.0%
associate-*r/69.3%
frac-times68.5%
*-commutative68.5%
div-inv68.5%
metadata-eval68.5%
associate-*r/67.8%
frac-times68.5%
*-commutative68.5%
div-inv68.5%
metadata-eval68.5%
Applied egg-rr68.5%
frac-2neg68.5%
sqrt-div80.0%
Applied egg-rr78.5%
if -3.999999999999988e-310 < d Initial program 71.8%
Simplified71.1%
expm1-log1p-u70.8%
expm1-undefine70.8%
Applied egg-rr70.8%
sub-neg70.8%
metadata-eval70.8%
+-commutative70.8%
log1p-undefine70.8%
rem-exp-log71.1%
associate-+r+71.1%
metadata-eval71.1%
metadata-eval71.1%
associate--r-71.1%
neg-sub071.1%
associate-*l/72.9%
distribute-frac-neg272.9%
neg-sub072.9%
distribute-neg-frac272.9%
remove-double-neg72.9%
Simplified74.5%
unpow274.5%
*-un-lft-identity74.5%
times-frac78.4%
associate-*r/77.7%
frac-times77.6%
*-commutative77.6%
div-inv77.6%
metadata-eval77.6%
associate-*r/76.9%
frac-times77.6%
*-commutative77.6%
div-inv77.6%
metadata-eval77.6%
Applied egg-rr77.6%
sqrt-div89.5%
div-inv89.5%
Applied egg-rr89.5%
associate-*r/89.5%
*-rgt-identity89.5%
Simplified89.5%
Final simplification83.8%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (* 0.5 M) (/ D d))) (t_1 (sqrt (/ d l))))
(if (<= l -1e-311)
(*
(* (sqrt (/ d h)) t_1)
(- 1.0 (* 0.5 (* h (* t_0 (/ (* D (/ (* 0.5 M) d)) l))))))
(*
(- 1.0 (* 0.5 (* h (* t_0 (/ t_0 l)))))
(* t_1 (/ (sqrt d) (sqrt h)))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (0.5 * M) * (D / d);
double t_1 = sqrt((d / l));
double tmp;
if (l <= -1e-311) {
tmp = (sqrt((d / h)) * t_1) * (1.0 - (0.5 * (h * (t_0 * ((D * ((0.5 * M) / d)) / l)))));
} else {
tmp = (1.0 - (0.5 * (h * (t_0 * (t_0 / l))))) * (t_1 * (sqrt(d) / sqrt(h)));
}
return tmp;
}
NOTE: d, h, l, 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 = (0.5d0 * m) * (d_1 / d)
t_1 = sqrt((d / l))
if (l <= (-1d-311)) then
tmp = (sqrt((d / h)) * t_1) * (1.0d0 - (0.5d0 * (h * (t_0 * ((d_1 * ((0.5d0 * m) / d)) / l)))))
else
tmp = (1.0d0 - (0.5d0 * (h * (t_0 * (t_0 / l))))) * (t_1 * (sqrt(d) / sqrt(h)))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (0.5 * M) * (D / d);
double t_1 = Math.sqrt((d / l));
double tmp;
if (l <= -1e-311) {
tmp = (Math.sqrt((d / h)) * t_1) * (1.0 - (0.5 * (h * (t_0 * ((D * ((0.5 * M) / d)) / l)))));
} else {
tmp = (1.0 - (0.5 * (h * (t_0 * (t_0 / l))))) * (t_1 * (Math.sqrt(d) / Math.sqrt(h)));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): t_0 = (0.5 * M) * (D / d) t_1 = math.sqrt((d / l)) tmp = 0 if l <= -1e-311: tmp = (math.sqrt((d / h)) * t_1) * (1.0 - (0.5 * (h * (t_0 * ((D * ((0.5 * M) / d)) / l))))) else: tmp = (1.0 - (0.5 * (h * (t_0 * (t_0 / l))))) * (t_1 * (math.sqrt(d) / math.sqrt(h))) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(0.5 * M) * Float64(D / d)) t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -1e-311) tmp = Float64(Float64(sqrt(Float64(d / h)) * t_1) * Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_0 * Float64(Float64(D * Float64(Float64(0.5 * M) / d)) / l)))))); else tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_0 * Float64(t_0 / l))))) * Float64(t_1 * Float64(sqrt(d) / sqrt(h)))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (0.5 * M) * (D / d);
t_1 = sqrt((d / l));
tmp = 0.0;
if (l <= -1e-311)
tmp = (sqrt((d / h)) * t_1) * (1.0 - (0.5 * (h * (t_0 * ((D * ((0.5 * M) / d)) / l)))));
else
tmp = (1.0 - (0.5 * (h * (t_0 * (t_0 / l))))) * (t_1 * (sqrt(d) / sqrt(h)));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1e-311], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(t$95$0 * N[(N[(D * N[(N[(0.5 * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(h * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \left(0.5 \cdot M\right) \cdot \frac{D}{d}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-311}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot t\_1\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \left(t\_0 \cdot \frac{D \cdot \frac{0.5 \cdot M}{d}}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(h \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\right) \cdot \left(t\_1 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\end{array}
\end{array}
if l < -9.99999999999948e-312Initial program 65.3%
Simplified63.8%
expm1-log1p-u63.5%
expm1-undefine63.5%
Applied egg-rr63.5%
sub-neg63.5%
metadata-eval63.5%
+-commutative63.5%
log1p-undefine63.5%
rem-exp-log63.8%
associate-+r+63.8%
metadata-eval63.8%
metadata-eval63.8%
associate--r-63.8%
neg-sub063.8%
associate-*l/66.3%
distribute-frac-neg266.3%
neg-sub066.3%
distribute-neg-frac266.3%
remove-double-neg66.3%
Simplified68.5%
unpow268.5%
*-un-lft-identity68.5%
times-frac70.0%
associate-*r/69.3%
frac-times68.5%
*-commutative68.5%
div-inv68.5%
metadata-eval68.5%
associate-*r/67.8%
frac-times68.5%
*-commutative68.5%
div-inv68.5%
metadata-eval68.5%
Applied egg-rr68.5%
Taylor expanded in M around 0 67.8%
*-commutative67.8%
associate-/l*68.5%
associate-*l*68.5%
associate-*l/68.5%
Simplified68.5%
if -9.99999999999948e-312 < l Initial program 71.8%
Simplified71.1%
expm1-log1p-u70.8%
expm1-undefine70.8%
Applied egg-rr70.8%
sub-neg70.8%
metadata-eval70.8%
+-commutative70.8%
log1p-undefine70.8%
rem-exp-log71.1%
associate-+r+71.1%
metadata-eval71.1%
metadata-eval71.1%
associate--r-71.1%
neg-sub071.1%
associate-*l/72.9%
distribute-frac-neg272.9%
neg-sub072.9%
distribute-neg-frac272.9%
remove-double-neg72.9%
Simplified74.5%
unpow274.5%
*-un-lft-identity74.5%
times-frac78.4%
associate-*r/77.7%
frac-times77.6%
*-commutative77.6%
div-inv77.6%
metadata-eval77.6%
associate-*r/76.9%
frac-times77.6%
*-commutative77.6%
div-inv77.6%
metadata-eval77.6%
Applied egg-rr77.6%
sqrt-div89.5%
div-inv89.5%
Applied egg-rr89.5%
associate-*r/89.5%
*-rgt-identity89.5%
Simplified89.5%
Final simplification78.6%
NOTE: d, h, l, 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+75)
(* (- d) (sqrt (/ (/ 1.0 l) h)))
(if (<= l 7e-6)
(*
(sqrt (/ d (* l (/ h d))))
(+ 1.0 (* -0.5 (* (/ h l) (pow (* (* 0.5 M) (/ D d)) 2.0)))))
(* d (/ (sqrt (/ 1.0 l)) (sqrt h))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -6.2e+75) {
tmp = -d * sqrt(((1.0 / l) / h));
} else if (l <= 7e-6) {
tmp = sqrt((d / (l * (h / d)))) * (1.0 + (-0.5 * ((h / l) * pow(((0.5 * M) * (D / d)), 2.0))));
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
NOTE: d, h, l, 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 <= (-6.2d+75)) then
tmp = -d * sqrt(((1.0d0 / l) / h))
else if (l <= 7d-6) then
tmp = sqrt((d / (l * (h / d)))) * (1.0d0 + ((-0.5d0) * ((h / l) * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0))))
else
tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -6.2e+75) {
tmp = -d * Math.sqrt(((1.0 / l) / h));
} else if (l <= 7e-6) {
tmp = Math.sqrt((d / (l * (h / d)))) * (1.0 + (-0.5 * ((h / l) * Math.pow(((0.5 * M) * (D / d)), 2.0))));
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -6.2e+75: tmp = -d * math.sqrt(((1.0 / l) / h)) elif l <= 7e-6: tmp = math.sqrt((d / (l * (h / d)))) * (1.0 + (-0.5 * ((h / l) * math.pow(((0.5 * M) * (D / d)), 2.0)))) else: tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h)) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -6.2e+75) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h))); elseif (l <= 7e-6) tmp = Float64(sqrt(Float64(d / Float64(l * Float64(h / d)))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0))))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -6.2e+75)
tmp = -d * sqrt(((1.0 / l) / h));
elseif (l <= 7e-6)
tmp = sqrt((d / (l * (h / d)))) * (1.0 + (-0.5 * ((h / l) * (((0.5 * M) * (D / d)) ^ 2.0))));
else
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -6.2e+75], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7e-6], N[(N[Sqrt[N[(d / N[(l * N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.2 \cdot 10^{+75}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{elif}\;\ell \leq 7 \cdot 10^{-6}:\\
\;\;\;\;\sqrt{\frac{d}{\ell \cdot \frac{h}{d}}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -6.2000000000000002e75Initial program 53.8%
Simplified52.0%
sqrt-div0.0%
clear-num0.0%
Applied egg-rr0.0%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt60.1%
neg-mul-160.1%
Simplified60.1%
if -6.2000000000000002e75 < l < 6.99999999999999989e-6Initial program 76.7%
Simplified75.3%
sqrt-div35.0%
clear-num35.0%
Applied egg-rr35.0%
pow135.0%
Applied egg-rr62.3%
unpow162.3%
associate-/l/61.6%
*-commutative61.6%
Simplified61.6%
if 6.99999999999999989e-6 < l Initial program 64.2%
Simplified64.2%
sqrt-div76.9%
clear-num76.9%
Applied egg-rr76.9%
Taylor expanded in h around 0 56.8%
*-commutative56.8%
Simplified56.8%
associate-/r*58.4%
sqrt-div69.6%
Applied egg-rr69.6%
Final simplification63.5%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (* 0.5 M) (/ D d))))
(*
(- 1.0 (* 0.5 (* h (* t_0 (/ t_0 l)))))
(* (sqrt (/ d l)) (/ 1.0 (sqrt (/ h d)))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (0.5 * M) * (D / d);
return (1.0 - (0.5 * (h * (t_0 * (t_0 / l))))) * (sqrt((d / l)) * (1.0 / sqrt((h / d))));
}
NOTE: d, h, l, 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
t_0 = (0.5d0 * m) * (d_1 / d)
code = (1.0d0 - (0.5d0 * (h * (t_0 * (t_0 / l))))) * (sqrt((d / l)) * (1.0d0 / sqrt((h / d))))
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (0.5 * M) * (D / d);
return (1.0 - (0.5 * (h * (t_0 * (t_0 / l))))) * (Math.sqrt((d / l)) * (1.0 / Math.sqrt((h / d))));
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): t_0 = (0.5 * M) * (D / d) return (1.0 - (0.5 * (h * (t_0 * (t_0 / l))))) * (math.sqrt((d / l)) * (1.0 / math.sqrt((h / d))))
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(0.5 * M) * Float64(D / d)) return Float64(Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_0 * Float64(t_0 / l))))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 / sqrt(Float64(h / d))))) end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp = code(d, h, l, M, D)
t_0 = (0.5 * M) * (D / d);
tmp = (1.0 - (0.5 * (h * (t_0 * (t_0 / l))))) * (sqrt((d / l)) * (1.0 / sqrt((h / d))));
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]}, N[(N[(1.0 - N[(0.5 * N[(h * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \left(0.5 \cdot M\right) \cdot \frac{D}{d}\\
\left(1 - 0.5 \cdot \left(h \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \frac{1}{\sqrt{\frac{h}{d}}}\right)
\end{array}
\end{array}
Initial program 68.4%
Simplified67.3%
expm1-log1p-u67.0%
expm1-undefine67.0%
Applied egg-rr67.0%
sub-neg67.0%
metadata-eval67.0%
+-commutative67.0%
log1p-undefine67.0%
rem-exp-log67.3%
associate-+r+67.3%
metadata-eval67.3%
metadata-eval67.3%
associate--r-67.3%
neg-sub067.3%
associate-*l/69.5%
distribute-frac-neg269.5%
neg-sub069.5%
distribute-neg-frac269.5%
remove-double-neg69.5%
Simplified71.4%
unpow271.4%
*-un-lft-identity71.4%
times-frac74.0%
associate-*r/73.3%
frac-times72.9%
*-commutative72.9%
div-inv72.9%
metadata-eval72.9%
associate-*r/72.2%
frac-times72.9%
*-commutative72.9%
div-inv72.9%
metadata-eval72.9%
Applied egg-rr72.9%
clear-num72.4%
sqrt-div73.0%
metadata-eval73.0%
Applied egg-rr73.0%
Final simplification73.0%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (* (* (sqrt (/ d h)) (sqrt (/ d l))) (- 1.0 (* 0.5 (* h (* (* (* 0.5 M) (/ D d)) (/ (* D (* M (/ 0.5 d))) l)))))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
return (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.5 * (h * (((0.5 * M) * (D / d)) * ((D * (M * (0.5 / d))) / l)))));
}
NOTE: d, h, l, 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 / h)) * sqrt((d / l))) * (1.0d0 - (0.5d0 * (h * (((0.5d0 * m) * (d_1 / d)) * ((d_1 * (m * (0.5d0 / d))) / l)))))
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
return (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - (0.5 * (h * (((0.5 * M) * (D / d)) * ((D * (M * (0.5 / d))) / l)))));
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): return (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - (0.5 * (h * (((0.5 * M) * (D / d)) * ((D * (M * (0.5 / d))) / l)))))
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) return Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(h * Float64(Float64(Float64(0.5 * M) * Float64(D / d)) * Float64(Float64(D * Float64(M * Float64(0.5 / d))) / l)))))) end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.5 * (h * (((0.5 * M) * (D / d)) * ((D * (M * (0.5 / d))) / l)))));
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(D * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \left(\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right) \cdot \frac{D \cdot \left(M \cdot \frac{0.5}{d}\right)}{\ell}\right)\right)\right)
\end{array}
Initial program 68.4%
Simplified67.3%
expm1-log1p-u67.0%
expm1-undefine67.0%
Applied egg-rr67.0%
sub-neg67.0%
metadata-eval67.0%
+-commutative67.0%
log1p-undefine67.0%
rem-exp-log67.3%
associate-+r+67.3%
metadata-eval67.3%
metadata-eval67.3%
associate--r-67.3%
neg-sub067.3%
associate-*l/69.5%
distribute-frac-neg269.5%
neg-sub069.5%
distribute-neg-frac269.5%
remove-double-neg69.5%
Simplified71.4%
unpow271.4%
*-un-lft-identity71.4%
times-frac74.0%
associate-*r/73.3%
frac-times72.9%
*-commutative72.9%
div-inv72.9%
metadata-eval72.9%
associate-*r/72.2%
frac-times72.9%
*-commutative72.9%
div-inv72.9%
metadata-eval72.9%
Applied egg-rr72.9%
Taylor expanded in M around 0 72.2%
*-commutative72.2%
associate-/l*72.9%
associate-*l*72.9%
associate-*l/72.9%
associate-/l*72.9%
Simplified72.9%
Final simplification72.9%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= d 2.85e-257) (* (- d) (sqrt (/ (/ 1.0 l) h))) (* d (/ (sqrt (/ 1.0 l)) (sqrt h)))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 2.85e-257) {
tmp = -d * sqrt(((1.0 / l) / h));
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
NOTE: d, h, l, 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 <= 2.85d-257) then
tmp = -d * sqrt(((1.0d0 / l) / h))
else
tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 2.85e-257) {
tmp = -d * Math.sqrt(((1.0 / l) / h));
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if d <= 2.85e-257: tmp = -d * math.sqrt(((1.0 / l) / h)) else: tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h)) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= 2.85e-257) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= 2.85e-257)
tmp = -d * sqrt(((1.0 / l) / h));
else
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, 2.85e-257], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 2.85 \cdot 10^{-257}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < 2.8499999999999999e-257Initial program 65.3%
Simplified64.0%
sqrt-div5.0%
clear-num5.0%
Applied egg-rr5.0%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt49.7%
neg-mul-149.7%
Simplified49.7%
if 2.8499999999999999e-257 < d Initial program 72.2%
Simplified71.4%
sqrt-div80.9%
clear-num80.9%
Applied egg-rr80.9%
Taylor expanded in h around 0 47.0%
*-commutative47.0%
Simplified47.0%
associate-/r*48.0%
sqrt-div58.9%
Applied egg-rr58.9%
Final simplification53.8%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= d 1.95e-257) (* (- d) (sqrt (/ (/ 1.0 l) h))) (* d (/ (pow l -0.5) (sqrt h)))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 1.95e-257) {
tmp = -d * sqrt(((1.0 / l) / h));
} else {
tmp = d * (pow(l, -0.5) / sqrt(h));
}
return tmp;
}
NOTE: d, h, l, 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 <= 1.95d-257) then
tmp = -d * sqrt(((1.0d0 / l) / h))
else
tmp = d * ((l ** (-0.5d0)) / sqrt(h))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 1.95e-257) {
tmp = -d * Math.sqrt(((1.0 / l) / h));
} else {
tmp = d * (Math.pow(l, -0.5) / Math.sqrt(h));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if d <= 1.95e-257: tmp = -d * math.sqrt(((1.0 / l) / h)) else: tmp = d * (math.pow(l, -0.5) / math.sqrt(h)) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= 1.95e-257) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h))); else tmp = Float64(d * Float64((l ^ -0.5) / sqrt(h))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= 1.95e-257)
tmp = -d * sqrt(((1.0 / l) / h));
else
tmp = d * ((l ^ -0.5) / sqrt(h));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, 1.95e-257], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.95 \cdot 10^{-257}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{\ell}^{-0.5}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < 1.9500000000000001e-257Initial program 65.3%
Simplified64.0%
sqrt-div5.0%
clear-num5.0%
Applied egg-rr5.0%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt49.7%
neg-mul-149.7%
Simplified49.7%
if 1.9500000000000001e-257 < d Initial program 72.2%
Simplified71.4%
sqrt-div80.9%
clear-num80.9%
Applied egg-rr80.9%
Taylor expanded in h around 0 47.0%
*-commutative47.0%
Simplified47.0%
Taylor expanded in l around 0 47.0%
unpow-147.0%
metadata-eval47.0%
pow-sqr47.0%
rem-sqrt-square47.0%
rem-square-sqrt47.0%
fabs-sqr47.0%
rem-square-sqrt47.0%
Simplified47.0%
add-sqr-sqrt47.0%
sqrt-unprod47.0%
pow-prod-up47.0%
metadata-eval47.0%
inv-pow47.0%
associate-/l/48.0%
sqrt-div58.9%
inv-pow58.9%
sqrt-pow158.9%
metadata-eval58.9%
Applied egg-rr58.9%
Final simplification53.8%
NOTE: d, h, l, 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 (/ (/ 1.0 l) h)))) (if (<= l -5.9e-274) (* (- d) t_0) (* d t_0))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(((1.0 / l) / h));
double tmp;
if (l <= -5.9e-274) {
tmp = -d * t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
NOTE: d, h, l, 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 = sqrt(((1.0d0 / l) / h))
if (l <= (-5.9d-274)) then
tmp = -d * t_0
else
tmp = d * t_0
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt(((1.0 / l) / h));
double tmp;
if (l <= -5.9e-274) {
tmp = -d * t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): t_0 = math.sqrt(((1.0 / l) / h)) tmp = 0 if l <= -5.9e-274: tmp = -d * t_0 else: tmp = d * t_0 return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(Float64(1.0 / l) / h)) tmp = 0.0 if (l <= -5.9e-274) tmp = Float64(Float64(-d) * t_0); else tmp = Float64(d * t_0); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt(((1.0 / l) / h));
tmp = 0.0;
if (l <= -5.9e-274)
tmp = -d * t_0;
else
tmp = d * t_0;
end
tmp_2 = tmp;
end
NOTE: d, h, l, 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[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -5.9e-274], N[((-d) * t$95$0), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{if}\;\ell \leq -5.9 \cdot 10^{-274}:\\
\;\;\;\;\left(-d\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
\end{array}
if l < -5.89999999999999953e-274Initial program 64.0%
Simplified62.4%
sqrt-div0.0%
clear-num0.0%
Applied egg-rr0.0%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt51.5%
neg-mul-151.5%
Simplified51.5%
if -5.89999999999999953e-274 < l Initial program 72.5%
Simplified71.8%
sqrt-div74.6%
clear-num74.6%
Applied egg-rr74.6%
Taylor expanded in h around 0 46.4%
*-commutative46.4%
associate-/r*47.3%
Simplified47.3%
Final simplification49.3%
NOTE: d, h, l, 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 (* l h) -0.5))) (if (<= l -4.3e-271) (* (- d) t_0) (* d t_0))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((l * h), -0.5);
double tmp;
if (l <= -4.3e-271) {
tmp = -d * t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
NOTE: d, h, l, 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 = (l * h) ** (-0.5d0)
if (l <= (-4.3d-271)) then
tmp = -d * t_0
else
tmp = d * t_0
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow((l * h), -0.5);
double tmp;
if (l <= -4.3e-271) {
tmp = -d * t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): t_0 = math.pow((l * h), -0.5) tmp = 0 if l <= -4.3e-271: tmp = -d * t_0 else: tmp = d * t_0 return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(l * h) ^ -0.5 tmp = 0.0 if (l <= -4.3e-271) tmp = Float64(Float64(-d) * t_0); else tmp = Float64(d * t_0); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (l * h) ^ -0.5;
tmp = 0.0;
if (l <= -4.3e-271)
tmp = -d * t_0;
else
tmp = d * t_0;
end
tmp_2 = tmp;
end
NOTE: d, h, l, 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[(l * h), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[l, -4.3e-271], N[((-d) * t$95$0), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -4.3 \cdot 10^{-271}:\\
\;\;\;\;\left(-d\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
\end{array}
if l < -4.3e-271Initial program 64.0%
Simplified62.4%
sqrt-div0.0%
clear-num0.0%
Applied egg-rr0.0%
Taylor expanded in h around 0 8.5%
*-commutative8.5%
Simplified8.5%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt51.2%
unpow-151.2%
metadata-eval51.2%
pow-sqr51.2%
rem-sqrt-square51.2%
rem-square-sqrt51.1%
fabs-sqr51.1%
rem-square-sqrt51.2%
mul-1-neg51.2%
Simplified51.2%
if -4.3e-271 < l Initial program 72.5%
Simplified71.8%
sqrt-div74.6%
clear-num74.6%
Applied egg-rr74.6%
Taylor expanded in h around 0 46.4%
*-commutative46.4%
Simplified46.4%
Taylor expanded in l around 0 46.4%
unpow-146.4%
metadata-eval46.4%
pow-sqr46.4%
rem-sqrt-square46.4%
rem-square-sqrt46.4%
fabs-sqr46.4%
rem-square-sqrt46.4%
Simplified46.4%
Final simplification48.7%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= l -7.7e-265) (* (- d) (pow (* l h) -0.5)) (* d (sqrt (/ (/ 1.0 h) l)))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -7.7e-265) {
tmp = -d * pow((l * h), -0.5);
} else {
tmp = d * sqrt(((1.0 / h) / l));
}
return tmp;
}
NOTE: d, h, l, 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 <= (-7.7d-265)) then
tmp = -d * ((l * h) ** (-0.5d0))
else
tmp = d * sqrt(((1.0d0 / h) / l))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -7.7e-265) {
tmp = -d * Math.pow((l * h), -0.5);
} else {
tmp = d * Math.sqrt(((1.0 / h) / l));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -7.7e-265: tmp = -d * math.pow((l * h), -0.5) else: tmp = d * math.sqrt(((1.0 / h) / l)) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -7.7e-265) tmp = Float64(Float64(-d) * (Float64(l * h) ^ -0.5)); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -7.7e-265)
tmp = -d * ((l * h) ^ -0.5);
else
tmp = d * sqrt(((1.0 / h) / l));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -7.7e-265], N[((-d) * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -7.7 \cdot 10^{-265}:\\
\;\;\;\;\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if l < -7.70000000000000023e-265Initial program 64.0%
Simplified62.4%
sqrt-div0.0%
clear-num0.0%
Applied egg-rr0.0%
Taylor expanded in h around 0 8.5%
*-commutative8.5%
Simplified8.5%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt51.2%
unpow-151.2%
metadata-eval51.2%
pow-sqr51.2%
rem-sqrt-square51.2%
rem-square-sqrt51.1%
fabs-sqr51.1%
rem-square-sqrt51.2%
mul-1-neg51.2%
Simplified51.2%
if -7.70000000000000023e-265 < l Initial program 72.5%
Simplified71.8%
sqrt-div74.6%
clear-num74.6%
Applied egg-rr74.6%
Taylor expanded in h around 0 46.4%
*-commutative46.4%
Simplified46.4%
Taylor expanded in l around 0 46.4%
unpow-146.4%
metadata-eval46.4%
pow-sqr46.4%
rem-sqrt-square46.4%
rem-square-sqrt46.4%
fabs-sqr46.4%
rem-square-sqrt46.4%
Simplified46.4%
Taylor expanded in h around 0 46.4%
associate-/r*47.3%
Simplified47.3%
Final simplification49.2%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= l -2.3e-267) (* (- d) (pow (* l h) -0.5)) (* d (sqrt (/ (/ 1.0 l) h)))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2.3e-267) {
tmp = -d * pow((l * h), -0.5);
} else {
tmp = d * sqrt(((1.0 / l) / h));
}
return tmp;
}
NOTE: d, h, l, 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.3d-267)) then
tmp = -d * ((l * h) ** (-0.5d0))
else
tmp = d * sqrt(((1.0d0 / l) / h))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2.3e-267) {
tmp = -d * Math.pow((l * h), -0.5);
} else {
tmp = d * Math.sqrt(((1.0 / l) / h));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -2.3e-267: tmp = -d * math.pow((l * h), -0.5) else: tmp = d * math.sqrt(((1.0 / l) / h)) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -2.3e-267) tmp = Float64(Float64(-d) * (Float64(l * h) ^ -0.5)); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -2.3e-267)
tmp = -d * ((l * h) ^ -0.5);
else
tmp = d * sqrt(((1.0 / l) / h));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2.3e-267], N[((-d) * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.3 \cdot 10^{-267}:\\
\;\;\;\;\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\end{array}
\end{array}
if l < -2.30000000000000005e-267Initial program 64.0%
Simplified62.4%
sqrt-div0.0%
clear-num0.0%
Applied egg-rr0.0%
Taylor expanded in h around 0 8.5%
*-commutative8.5%
Simplified8.5%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt51.2%
unpow-151.2%
metadata-eval51.2%
pow-sqr51.2%
rem-sqrt-square51.2%
rem-square-sqrt51.1%
fabs-sqr51.1%
rem-square-sqrt51.2%
mul-1-neg51.2%
Simplified51.2%
if -2.30000000000000005e-267 < l Initial program 72.5%
Simplified71.8%
sqrt-div74.6%
clear-num74.6%
Applied egg-rr74.6%
Taylor expanded in h around 0 46.4%
*-commutative46.4%
associate-/r*47.3%
Simplified47.3%
Final simplification49.2%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (* d (pow (* l h) -0.5)))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
return d * pow((l * h), -0.5);
}
NOTE: d, h, l, 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 * ((l * h) ** (-0.5d0))
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
return d * Math.pow((l * h), -0.5);
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): return d * math.pow((l * h), -0.5)
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) return Float64(d * (Float64(l * h) ^ -0.5)) end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * ((l * h) ^ -0.5);
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
d \cdot {\left(\ell \cdot h\right)}^{-0.5}
\end{array}
Initial program 68.4%
Simplified67.3%
sqrt-div38.8%
clear-num38.8%
Applied egg-rr38.8%
Taylor expanded in h around 0 28.2%
*-commutative28.2%
Simplified28.2%
Taylor expanded in l around 0 28.2%
unpow-128.2%
metadata-eval28.2%
pow-sqr28.2%
rem-sqrt-square28.2%
rem-square-sqrt28.2%
fabs-sqr28.2%
rem-square-sqrt28.2%
Simplified28.2%
Final simplification28.2%
herbie shell --seed 2024084
(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)))))