
(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 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= h -4e-310)
(*
(sqrt (/ d h))
(*
(/ (sqrt (- d)) (sqrt (- l)))
(- 1.0 (* 0.5 (* h (/ (pow (* 0.5 (/ (* D M) d)) 2.0) l))))))
(*
(/ (sqrt d) (sqrt h))
(*
(sqrt (/ d l))
(- 1.0 (* 0.5 (* (pow (* (/ M 2.0) (/ D d)) 2.0) (/ h l))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -4e-310) {
tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0 - (0.5 * (h * (pow((0.5 * ((D * M) / d)), 2.0) / l)))));
} else {
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0 - (0.5 * (pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (h <= (-4d-310)) then
tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0d0 - (0.5d0 * (h * (((0.5d0 * ((d_1 * m) / d)) ** 2.0d0) / l)))))
else
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * ((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (h / l)))))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -4e-310) {
tmp = Math.sqrt((d / h)) * ((Math.sqrt(-d) / Math.sqrt(-l)) * (1.0 - (0.5 * (h * (Math.pow((0.5 * ((D * M) / d)), 2.0) / l)))));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * (Math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if h <= -4e-310: tmp = math.sqrt((d / h)) * ((math.sqrt(-d) / math.sqrt(-l)) * (1.0 - (0.5 * (h * (math.pow((0.5 * ((D * M) / d)), 2.0) / l))))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * (math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l))))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= -4e-310) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(0.5 * Float64(Float64(D * M) / d)) ^ 2.0) / l)))))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(h / l)))))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (h <= -4e-310)
tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0 - (0.5 * (h * (((0.5 * ((D * M) / d)) ^ 2.0) / l)))));
else
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((((M / 2.0) * (D / d)) ^ 2.0) * (h / l)))));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, -4e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(0.5 * N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(0.5 \cdot \frac{D \cdot M}{d}\right)}^{2}}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\
\end{array}
\end{array}
if h < -3.999999999999988e-310Initial program 68.6%
associate-*l*68.6%
metadata-eval68.6%
unpow1/268.6%
metadata-eval68.6%
unpow1/268.6%
associate-*l*68.6%
metadata-eval68.6%
times-frac69.3%
Simplified69.3%
expm1-log1p-u68.9%
expm1-udef68.9%
add-sqr-sqrt41.4%
add-sqr-sqrt68.9%
div-inv68.9%
metadata-eval68.9%
Applied egg-rr68.9%
expm1-def68.9%
expm1-log1p69.3%
associate-*r/71.8%
associate-*l/71.7%
*-commutative71.7%
*-commutative71.7%
associate-*r*71.7%
associate-*r/71.0%
*-commutative71.0%
Simplified71.0%
frac-2neg71.0%
sqrt-div79.2%
Applied egg-rr79.2%
if -3.999999999999988e-310 < h Initial program 73.5%
associate-*l*73.5%
metadata-eval73.5%
unpow1/273.5%
metadata-eval73.5%
unpow1/273.5%
associate-*l*73.5%
metadata-eval73.5%
times-frac72.9%
Simplified72.9%
sqrt-div86.1%
div-inv86.0%
Applied egg-rr86.0%
associate-*r/86.1%
*-rgt-identity86.1%
Simplified86.1%
Final simplification82.7%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))) (t_1 (sqrt (/ d h))))
(if (<= l -3.2e+157)
(*
(* t_1 (/ (sqrt (- d)) (sqrt (- l))))
(- 1.0 (* (/ (* h (* M (* D (* D M)))) (* d (* d l))) 0.125)))
(if (<= l -2.1e-114)
(*
(* t_1 t_0)
(- 1.0 (pow (* (* D (* 0.5 (/ M d))) (sqrt (* h (/ 0.5 l)))) 2.0)))
(if (<= l 1.9e+69)
(*
t_1
(* (- 1.0 (* 0.5 (* h (/ (pow (* 0.5 (/ (* D M) d)) 2.0) l)))) t_0))
(* d (/ (sqrt (/ 1.0 l)) (sqrt h))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = sqrt((d / h));
double tmp;
if (l <= -3.2e+157) {
tmp = (t_1 * (sqrt(-d) / sqrt(-l))) * (1.0 - (((h * (M * (D * (D * M)))) / (d * (d * l))) * 0.125));
} else if (l <= -2.1e-114) {
tmp = (t_1 * t_0) * (1.0 - pow(((D * (0.5 * (M / d))) * sqrt((h * (0.5 / l)))), 2.0));
} else if (l <= 1.9e+69) {
tmp = t_1 * ((1.0 - (0.5 * (h * (pow((0.5 * ((D * M) / d)), 2.0) / l)))) * t_0);
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = sqrt((d / h))
if (l <= (-3.2d+157)) then
tmp = (t_1 * (sqrt(-d) / sqrt(-l))) * (1.0d0 - (((h * (m * (d_1 * (d_1 * m)))) / (d * (d * l))) * 0.125d0))
else if (l <= (-2.1d-114)) then
tmp = (t_1 * t_0) * (1.0d0 - (((d_1 * (0.5d0 * (m / d))) * sqrt((h * (0.5d0 / l)))) ** 2.0d0))
else if (l <= 1.9d+69) then
tmp = t_1 * ((1.0d0 - (0.5d0 * (h * (((0.5d0 * ((d_1 * m) / d)) ** 2.0d0) / l)))) * t_0)
else
tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double t_1 = Math.sqrt((d / h));
double tmp;
if (l <= -3.2e+157) {
tmp = (t_1 * (Math.sqrt(-d) / Math.sqrt(-l))) * (1.0 - (((h * (M * (D * (D * M)))) / (d * (d * l))) * 0.125));
} else if (l <= -2.1e-114) {
tmp = (t_1 * t_0) * (1.0 - Math.pow(((D * (0.5 * (M / d))) * Math.sqrt((h * (0.5 / l)))), 2.0));
} else if (l <= 1.9e+69) {
tmp = t_1 * ((1.0 - (0.5 * (h * (Math.pow((0.5 * ((D * M) / d)), 2.0) / l)))) * t_0);
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) t_1 = math.sqrt((d / h)) tmp = 0 if l <= -3.2e+157: tmp = (t_1 * (math.sqrt(-d) / math.sqrt(-l))) * (1.0 - (((h * (M * (D * (D * M)))) / (d * (d * l))) * 0.125)) elif l <= -2.1e-114: tmp = (t_1 * t_0) * (1.0 - math.pow(((D * (0.5 * (M / d))) * math.sqrt((h * (0.5 / l)))), 2.0)) elif l <= 1.9e+69: tmp = t_1 * ((1.0 - (0.5 * (h * (math.pow((0.5 * ((D * M) / d)), 2.0) / l)))) * t_0) else: tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = sqrt(Float64(d / h)) tmp = 0.0 if (l <= -3.2e+157) tmp = Float64(Float64(t_1 * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))) * Float64(1.0 - Float64(Float64(Float64(h * Float64(M * Float64(D * Float64(D * M)))) / Float64(d * Float64(d * l))) * 0.125))); elseif (l <= -2.1e-114) tmp = Float64(Float64(t_1 * t_0) * Float64(1.0 - (Float64(Float64(D * Float64(0.5 * Float64(M / d))) * sqrt(Float64(h * Float64(0.5 / l)))) ^ 2.0))); elseif (l <= 1.9e+69) tmp = Float64(t_1 * Float64(Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(0.5 * Float64(Float64(D * M) / d)) ^ 2.0) / l)))) * t_0)); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / l));
t_1 = sqrt((d / h));
tmp = 0.0;
if (l <= -3.2e+157)
tmp = (t_1 * (sqrt(-d) / sqrt(-l))) * (1.0 - (((h * (M * (D * (D * M)))) / (d * (d * l))) * 0.125));
elseif (l <= -2.1e-114)
tmp = (t_1 * t_0) * (1.0 - (((D * (0.5 * (M / d))) * sqrt((h * (0.5 / l)))) ^ 2.0));
elseif (l <= 1.9e+69)
tmp = t_1 * ((1.0 - (0.5 * (h * (((0.5 * ((D * M) / d)) ^ 2.0) / l)))) * t_0);
else
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -3.2e+157], N[(N[(t$95$1 * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(h * N[(M * N[(D * N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2.1e-114], N[(N[(t$95$1 * t$95$0), $MachinePrecision] * N[(1.0 - N[Power[N[(N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h * N[(0.5 / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.9e+69], N[(t$95$1 * N[(N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(0.5 * N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;\ell \leq -3.2 \cdot 10^{+157}:\\
\;\;\;\;\left(t_1 \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right) \cdot \left(1 - \frac{h \cdot \left(M \cdot \left(D \cdot \left(D \cdot M\right)\right)\right)}{d \cdot \left(d \cdot \ell\right)} \cdot 0.125\right)\\
\mathbf{elif}\;\ell \leq -2.1 \cdot 10^{-114}:\\
\;\;\;\;\left(t_1 \cdot t_0\right) \cdot \left(1 - {\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{h \cdot \frac{0.5}{\ell}}\right)}^{2}\right)\\
\mathbf{elif}\;\ell \leq 1.9 \cdot 10^{+69}:\\
\;\;\;\;t_1 \cdot \left(\left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(0.5 \cdot \frac{D \cdot M}{d}\right)}^{2}}{\ell}\right)\right) \cdot t_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -3.1999999999999999e157Initial program 41.6%
metadata-eval41.6%
unpow1/241.6%
metadata-eval41.6%
unpow1/241.6%
*-commutative41.6%
associate-*l*41.6%
times-frac41.6%
metadata-eval41.6%
Simplified41.6%
frac-2neg45.3%
sqrt-div67.4%
Applied egg-rr59.8%
Taylor expanded in M around 0 37.8%
associate-*r/30.8%
*-commutative30.8%
associate-*r/30.8%
*-commutative30.8%
*-commutative30.8%
*-commutative30.8%
associate-*l*34.4%
unpow234.4%
unpow234.4%
swap-sqr38.0%
associate-*l*38.0%
*-commutative38.0%
*-commutative38.0%
unpow238.0%
associate-*r*41.7%
Simplified67.0%
if -3.1999999999999999e157 < l < -2.09999999999999993e-114Initial program 76.8%
metadata-eval76.8%
unpow1/276.8%
metadata-eval76.8%
unpow1/276.8%
*-commutative76.8%
associate-*l*76.8%
times-frac78.5%
metadata-eval78.5%
Simplified78.5%
associate-*r*78.5%
frac-times76.8%
*-commutative76.8%
metadata-eval76.8%
add-sqr-sqrt76.8%
pow276.8%
Applied egg-rr82.4%
*-commutative82.4%
associate-*l/85.8%
associate-*r/84.0%
*-commutative84.0%
associate-*r/84.0%
associate-/r/84.1%
Simplified84.1%
if -2.09999999999999993e-114 < l < 1.90000000000000014e69Initial program 78.4%
associate-*l*78.4%
metadata-eval78.4%
unpow1/278.4%
metadata-eval78.4%
unpow1/278.4%
associate-*l*78.4%
metadata-eval78.4%
times-frac77.8%
Simplified77.8%
expm1-log1p-u77.3%
expm1-udef77.3%
add-sqr-sqrt48.4%
add-sqr-sqrt77.3%
div-inv77.3%
metadata-eval77.3%
Applied egg-rr77.3%
expm1-def77.3%
expm1-log1p77.8%
associate-*r/80.1%
associate-*l/80.1%
*-commutative80.1%
*-commutative80.1%
associate-*r*80.1%
associate-*r/80.1%
*-commutative80.1%
Simplified80.1%
if 1.90000000000000014e69 < l Initial program 59.2%
associate-*l*59.2%
metadata-eval59.2%
unpow1/259.2%
metadata-eval59.2%
unpow1/259.2%
sub-neg59.2%
+-commutative59.2%
*-commutative59.2%
distribute-rgt-neg-in59.2%
fma-def59.2%
Simplified59.3%
Taylor expanded in h around 0 47.6%
Taylor expanded in d around 0 59.9%
*-commutative59.9%
associate-/r*59.9%
Simplified59.9%
sqrt-div73.7%
Applied egg-rr73.7%
Final simplification78.5%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))) (t_1 (sqrt (/ d h))))
(if (<= l -3.2e+160)
(*
(* t_1 (/ (sqrt (- d)) (sqrt (- l))))
(- 1.0 (* (/ (* h (* M (* D (* D M)))) (* d (* d l))) 0.125)))
(if (<= l -1e-310)
(*
(* t_1 t_0)
(- 1.0 (pow (* (* D (* 0.5 (/ M d))) (sqrt (* h (/ 0.5 l)))) 2.0)))
(*
(/ (sqrt d) (sqrt h))
(*
t_0
(- 1.0 (* 0.5 (* (pow (* (/ M 2.0) (/ D d)) 2.0) (/ h l))))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = sqrt((d / h));
double tmp;
if (l <= -3.2e+160) {
tmp = (t_1 * (sqrt(-d) / sqrt(-l))) * (1.0 - (((h * (M * (D * (D * M)))) / (d * (d * l))) * 0.125));
} else if (l <= -1e-310) {
tmp = (t_1 * t_0) * (1.0 - pow(((D * (0.5 * (M / d))) * sqrt((h * (0.5 / l)))), 2.0));
} else {
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 - (0.5 * (pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = sqrt((d / h))
if (l <= (-3.2d+160)) then
tmp = (t_1 * (sqrt(-d) / sqrt(-l))) * (1.0d0 - (((h * (m * (d_1 * (d_1 * m)))) / (d * (d * l))) * 0.125d0))
else if (l <= (-1d-310)) then
tmp = (t_1 * t_0) * (1.0d0 - (((d_1 * (0.5d0 * (m / d))) * sqrt((h * (0.5d0 / l)))) ** 2.0d0))
else
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0d0 - (0.5d0 * ((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (h / l)))))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double t_1 = Math.sqrt((d / h));
double tmp;
if (l <= -3.2e+160) {
tmp = (t_1 * (Math.sqrt(-d) / Math.sqrt(-l))) * (1.0 - (((h * (M * (D * (D * M)))) / (d * (d * l))) * 0.125));
} else if (l <= -1e-310) {
tmp = (t_1 * t_0) * (1.0 - Math.pow(((D * (0.5 * (M / d))) * Math.sqrt((h * (0.5 / l)))), 2.0));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (t_0 * (1.0 - (0.5 * (Math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) t_1 = math.sqrt((d / h)) tmp = 0 if l <= -3.2e+160: tmp = (t_1 * (math.sqrt(-d) / math.sqrt(-l))) * (1.0 - (((h * (M * (D * (D * M)))) / (d * (d * l))) * 0.125)) elif l <= -1e-310: tmp = (t_1 * t_0) * (1.0 - math.pow(((D * (0.5 * (M / d))) * math.sqrt((h * (0.5 / l)))), 2.0)) else: tmp = (math.sqrt(d) / math.sqrt(h)) * (t_0 * (1.0 - (0.5 * (math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l))))) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = sqrt(Float64(d / h)) tmp = 0.0 if (l <= -3.2e+160) tmp = Float64(Float64(t_1 * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))) * Float64(1.0 - Float64(Float64(Float64(h * Float64(M * Float64(D * Float64(D * M)))) / Float64(d * Float64(d * l))) * 0.125))); elseif (l <= -1e-310) tmp = Float64(Float64(t_1 * t_0) * Float64(1.0 - (Float64(Float64(D * Float64(0.5 * Float64(M / d))) * sqrt(Float64(h * Float64(0.5 / l)))) ^ 2.0))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(h / l)))))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / l));
t_1 = sqrt((d / h));
tmp = 0.0;
if (l <= -3.2e+160)
tmp = (t_1 * (sqrt(-d) / sqrt(-l))) * (1.0 - (((h * (M * (D * (D * M)))) / (d * (d * l))) * 0.125));
elseif (l <= -1e-310)
tmp = (t_1 * t_0) * (1.0 - (((D * (0.5 * (M / d))) * sqrt((h * (0.5 / l)))) ^ 2.0));
else
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 - (0.5 * ((((M / 2.0) * (D / d)) ^ 2.0) * (h / l)))));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -3.2e+160], N[(N[(t$95$1 * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(h * N[(M * N[(D * N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-310], N[(N[(t$95$1 * t$95$0), $MachinePrecision] * N[(1.0 - N[Power[N[(N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h * N[(0.5 / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;\ell \leq -3.2 \cdot 10^{+160}:\\
\;\;\;\;\left(t_1 \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right) \cdot \left(1 - \frac{h \cdot \left(M \cdot \left(D \cdot \left(D \cdot M\right)\right)\right)}{d \cdot \left(d \cdot \ell\right)} \cdot 0.125\right)\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\left(t_1 \cdot t_0\right) \cdot \left(1 - {\left(\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right) \cdot \sqrt{h \cdot \frac{0.5}{\ell}}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\
\end{array}
\end{array}
if l < -3.1999999999999998e160Initial program 41.6%
metadata-eval41.6%
unpow1/241.6%
metadata-eval41.6%
unpow1/241.6%
*-commutative41.6%
associate-*l*41.6%
times-frac41.6%
metadata-eval41.6%
Simplified41.6%
frac-2neg45.3%
sqrt-div67.4%
Applied egg-rr59.8%
Taylor expanded in M around 0 37.8%
associate-*r/30.8%
*-commutative30.8%
associate-*r/30.8%
*-commutative30.8%
*-commutative30.8%
*-commutative30.8%
associate-*l*34.4%
unpow234.4%
unpow234.4%
swap-sqr38.0%
associate-*l*38.0%
*-commutative38.0%
*-commutative38.0%
unpow238.0%
associate-*r*41.7%
Simplified67.0%
if -3.1999999999999998e160 < l < -9.999999999999969e-311Initial program 75.8%
metadata-eval75.8%
unpow1/275.8%
metadata-eval75.8%
unpow1/275.8%
*-commutative75.8%
associate-*l*75.8%
times-frac76.7%
metadata-eval76.7%
Simplified76.7%
associate-*r*76.7%
frac-times75.8%
*-commutative75.8%
metadata-eval75.8%
add-sqr-sqrt75.8%
pow275.8%
Applied egg-rr78.8%
*-commutative78.8%
associate-*l/80.7%
associate-*r/79.7%
*-commutative79.7%
associate-*r/79.7%
associate-/r/79.7%
Simplified79.7%
if -9.999999999999969e-311 < l Initial program 73.5%
associate-*l*73.5%
metadata-eval73.5%
unpow1/273.5%
metadata-eval73.5%
unpow1/273.5%
associate-*l*73.5%
metadata-eval73.5%
times-frac72.9%
Simplified72.9%
sqrt-div86.1%
div-inv86.0%
Applied egg-rr86.0%
associate-*r/86.1%
*-rgt-identity86.1%
Simplified86.1%
Final simplification81.6%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d h))))
(if (<= l -3.4e+157)
(*
(* t_0 (/ (sqrt (- d)) (sqrt (- l))))
(- 1.0 (* (/ (* h (* M (* D (* D M)))) (* d (* d l))) 0.125)))
(if (<= l 8.2e+69)
(*
t_0
(*
(- 1.0 (* 0.5 (* h (/ (pow (* 0.5 (/ (* D M) d)) 2.0) l))))
(sqrt (/ d l))))
(* d (/ (sqrt (/ 1.0 l)) (sqrt h)))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double tmp;
if (l <= -3.4e+157) {
tmp = (t_0 * (sqrt(-d) / sqrt(-l))) * (1.0 - (((h * (M * (D * (D * M)))) / (d * (d * l))) * 0.125));
} else if (l <= 8.2e+69) {
tmp = t_0 * ((1.0 - (0.5 * (h * (pow((0.5 * ((D * M) / d)), 2.0) / l)))) * sqrt((d / l)));
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / h))
if (l <= (-3.4d+157)) then
tmp = (t_0 * (sqrt(-d) / sqrt(-l))) * (1.0d0 - (((h * (m * (d_1 * (d_1 * m)))) / (d * (d * l))) * 0.125d0))
else if (l <= 8.2d+69) then
tmp = t_0 * ((1.0d0 - (0.5d0 * (h * (((0.5d0 * ((d_1 * m) / d)) ** 2.0d0) / l)))) * sqrt((d / l)))
else
tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h));
double tmp;
if (l <= -3.4e+157) {
tmp = (t_0 * (Math.sqrt(-d) / Math.sqrt(-l))) * (1.0 - (((h * (M * (D * (D * M)))) / (d * (d * l))) * 0.125));
} else if (l <= 8.2e+69) {
tmp = t_0 * ((1.0 - (0.5 * (h * (Math.pow((0.5 * ((D * M) / d)), 2.0) / l)))) * Math.sqrt((d / l)));
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) tmp = 0 if l <= -3.4e+157: tmp = (t_0 * (math.sqrt(-d) / math.sqrt(-l))) * (1.0 - (((h * (M * (D * (D * M)))) / (d * (d * l))) * 0.125)) elif l <= 8.2e+69: tmp = t_0 * ((1.0 - (0.5 * (h * (math.pow((0.5 * ((D * M) / d)), 2.0) / l)))) * math.sqrt((d / l))) else: tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) tmp = 0.0 if (l <= -3.4e+157) tmp = Float64(Float64(t_0 * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))) * Float64(1.0 - Float64(Float64(Float64(h * Float64(M * Float64(D * Float64(D * M)))) / Float64(d * Float64(d * l))) * 0.125))); elseif (l <= 8.2e+69) tmp = Float64(t_0 * Float64(Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(0.5 * Float64(Float64(D * M) / d)) ^ 2.0) / l)))) * sqrt(Float64(d / l)))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / h));
tmp = 0.0;
if (l <= -3.4e+157)
tmp = (t_0 * (sqrt(-d) / sqrt(-l))) * (1.0 - (((h * (M * (D * (D * M)))) / (d * (d * l))) * 0.125));
elseif (l <= 8.2e+69)
tmp = t_0 * ((1.0 - (0.5 * (h * (((0.5 * ((D * M) / d)) ^ 2.0) / l)))) * sqrt((d / l)));
else
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -3.4e+157], N[(N[(t$95$0 * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(h * N[(M * N[(D * N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8.2e+69], N[(t$95$0 * N[(N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(0.5 * N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;\ell \leq -3.4 \cdot 10^{+157}:\\
\;\;\;\;\left(t_0 \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right) \cdot \left(1 - \frac{h \cdot \left(M \cdot \left(D \cdot \left(D \cdot M\right)\right)\right)}{d \cdot \left(d \cdot \ell\right)} \cdot 0.125\right)\\
\mathbf{elif}\;\ell \leq 8.2 \cdot 10^{+69}:\\
\;\;\;\;t_0 \cdot \left(\left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(0.5 \cdot \frac{D \cdot M}{d}\right)}^{2}}{\ell}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -3.39999999999999979e157Initial program 41.6%
metadata-eval41.6%
unpow1/241.6%
metadata-eval41.6%
unpow1/241.6%
*-commutative41.6%
associate-*l*41.6%
times-frac41.6%
metadata-eval41.6%
Simplified41.6%
frac-2neg45.3%
sqrt-div67.4%
Applied egg-rr59.8%
Taylor expanded in M around 0 37.8%
associate-*r/30.8%
*-commutative30.8%
associate-*r/30.8%
*-commutative30.8%
*-commutative30.8%
*-commutative30.8%
associate-*l*34.4%
unpow234.4%
unpow234.4%
swap-sqr38.0%
associate-*l*38.0%
*-commutative38.0%
*-commutative38.0%
unpow238.0%
associate-*r*41.7%
Simplified67.0%
if -3.39999999999999979e157 < l < 8.1999999999999998e69Initial program 78.0%
associate-*l*78.0%
metadata-eval78.0%
unpow1/278.0%
metadata-eval78.0%
unpow1/278.0%
associate-*l*78.0%
metadata-eval78.0%
times-frac78.0%
Simplified78.0%
expm1-log1p-u77.4%
expm1-udef77.4%
add-sqr-sqrt48.5%
add-sqr-sqrt77.4%
div-inv77.4%
metadata-eval77.4%
Applied egg-rr77.4%
expm1-def77.4%
expm1-log1p78.0%
associate-*r/80.2%
associate-*l/80.2%
*-commutative80.2%
*-commutative80.2%
associate-*r*80.2%
associate-*r/79.7%
*-commutative79.7%
Simplified79.7%
if 8.1999999999999998e69 < l Initial program 59.2%
associate-*l*59.2%
metadata-eval59.2%
unpow1/259.2%
metadata-eval59.2%
unpow1/259.2%
sub-neg59.2%
+-commutative59.2%
*-commutative59.2%
distribute-rgt-neg-in59.2%
fma-def59.2%
Simplified59.3%
Taylor expanded in h around 0 47.6%
Taylor expanded in d around 0 59.9%
*-commutative59.9%
associate-/r*59.9%
Simplified59.9%
sqrt-div73.7%
Applied egg-rr73.7%
Final simplification77.4%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d h))) (t_1 (sqrt (/ d l))))
(if (<= d -1.9e-155)
(*
t_0
(* (- 1.0 (* 0.5 (* h (/ (pow (* 0.5 (/ (* D M) d)) 2.0) l)))) t_1))
(if (<= d -3.55e-295)
(-
(* (* M (* D (* D (/ M d)))) (* 0.125 (sqrt (/ h (pow l 3.0)))))
(* d (sqrt (/ (/ 1.0 l) h))))
(if (<= d 3.8e+100)
(*
t_0
(* t_1 (- 1.0 (* 0.5 (* (pow (* (/ M 2.0) (/ D d)) 2.0) (/ h l))))))
(* d (/ (sqrt (/ 1.0 l)) (sqrt h))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double t_1 = sqrt((d / l));
double tmp;
if (d <= -1.9e-155) {
tmp = t_0 * ((1.0 - (0.5 * (h * (pow((0.5 * ((D * M) / d)), 2.0) / l)))) * t_1);
} else if (d <= -3.55e-295) {
tmp = ((M * (D * (D * (M / d)))) * (0.125 * sqrt((h / pow(l, 3.0))))) - (d * sqrt(((1.0 / l) / h)));
} else if (d <= 3.8e+100) {
tmp = t_0 * (t_1 * (1.0 - (0.5 * (pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))));
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((d / h))
t_1 = sqrt((d / l))
if (d <= (-1.9d-155)) then
tmp = t_0 * ((1.0d0 - (0.5d0 * (h * (((0.5d0 * ((d_1 * m) / d)) ** 2.0d0) / l)))) * t_1)
else if (d <= (-3.55d-295)) then
tmp = ((m * (d_1 * (d_1 * (m / d)))) * (0.125d0 * sqrt((h / (l ** 3.0d0))))) - (d * sqrt(((1.0d0 / l) / h)))
else if (d <= 3.8d+100) then
tmp = t_0 * (t_1 * (1.0d0 - (0.5d0 * ((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (h / l)))))
else
tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h));
double t_1 = Math.sqrt((d / l));
double tmp;
if (d <= -1.9e-155) {
tmp = t_0 * ((1.0 - (0.5 * (h * (Math.pow((0.5 * ((D * M) / d)), 2.0) / l)))) * t_1);
} else if (d <= -3.55e-295) {
tmp = ((M * (D * (D * (M / d)))) * (0.125 * Math.sqrt((h / Math.pow(l, 3.0))))) - (d * Math.sqrt(((1.0 / l) / h)));
} else if (d <= 3.8e+100) {
tmp = t_0 * (t_1 * (1.0 - (0.5 * (Math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))));
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) t_1 = math.sqrt((d / l)) tmp = 0 if d <= -1.9e-155: tmp = t_0 * ((1.0 - (0.5 * (h * (math.pow((0.5 * ((D * M) / d)), 2.0) / l)))) * t_1) elif d <= -3.55e-295: tmp = ((M * (D * (D * (M / d)))) * (0.125 * math.sqrt((h / math.pow(l, 3.0))))) - (d * math.sqrt(((1.0 / l) / h))) elif d <= 3.8e+100: tmp = t_0 * (t_1 * (1.0 - (0.5 * (math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l))))) else: tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (d <= -1.9e-155) tmp = Float64(t_0 * Float64(Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(0.5 * Float64(Float64(D * M) / d)) ^ 2.0) / l)))) * t_1)); elseif (d <= -3.55e-295) tmp = Float64(Float64(Float64(M * Float64(D * Float64(D * Float64(M / d)))) * Float64(0.125 * sqrt(Float64(h / (l ^ 3.0))))) - Float64(d * sqrt(Float64(Float64(1.0 / l) / h)))); elseif (d <= 3.8e+100) tmp = Float64(t_0 * Float64(t_1 * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(h / l)))))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / h));
t_1 = sqrt((d / l));
tmp = 0.0;
if (d <= -1.9e-155)
tmp = t_0 * ((1.0 - (0.5 * (h * (((0.5 * ((D * M) / d)) ^ 2.0) / l)))) * t_1);
elseif (d <= -3.55e-295)
tmp = ((M * (D * (D * (M / d)))) * (0.125 * sqrt((h / (l ^ 3.0))))) - (d * sqrt(((1.0 / l) / h)));
elseif (d <= 3.8e+100)
tmp = t_0 * (t_1 * (1.0 - (0.5 * ((((M / 2.0) * (D / d)) ^ 2.0) * (h / l)))));
else
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.9e-155], N[(t$95$0 * N[(N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(0.5 * N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -3.55e-295], N[(N[(N[(M * N[(D * N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.125 * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.8e+100], N[(t$95$0 * N[(t$95$1 * N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $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}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -1.9 \cdot 10^{-155}:\\
\;\;\;\;t_0 \cdot \left(\left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(0.5 \cdot \frac{D \cdot M}{d}\right)}^{2}}{\ell}\right)\right) \cdot t_1\right)\\
\mathbf{elif}\;d \leq -3.55 \cdot 10^{-295}:\\
\;\;\;\;\left(M \cdot \left(D \cdot \left(D \cdot \frac{M}{d}\right)\right)\right) \cdot \left(0.125 \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) - d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{elif}\;d \leq 3.8 \cdot 10^{+100}:\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -1.8999999999999999e-155Initial program 79.4%
associate-*l*79.4%
metadata-eval79.4%
unpow1/279.4%
metadata-eval79.4%
unpow1/279.4%
associate-*l*79.4%
metadata-eval79.4%
times-frac80.5%
Simplified80.5%
expm1-log1p-u80.0%
expm1-udef80.0%
add-sqr-sqrt51.2%
add-sqr-sqrt80.0%
div-inv80.0%
metadata-eval80.0%
Applied egg-rr80.0%
expm1-def80.0%
expm1-log1p80.5%
associate-*r/83.9%
associate-*l/83.9%
*-commutative83.9%
*-commutative83.9%
associate-*r*83.9%
associate-*r/82.9%
*-commutative82.9%
Simplified82.9%
if -1.8999999999999999e-155 < d < -3.54999999999999979e-295Initial program 35.4%
metadata-eval35.4%
unpow1/235.4%
metadata-eval35.4%
unpow1/235.4%
*-commutative35.4%
associate-*l*35.4%
times-frac35.4%
metadata-eval35.4%
Simplified35.4%
frac-2neg35.4%
sqrt-div54.1%
Applied egg-rr50.7%
Taylor expanded in d around -inf 47.1%
mul-1-neg47.1%
unsub-neg47.1%
Simplified53.9%
if -3.54999999999999979e-295 < d < 3.79999999999999963e100Initial program 76.8%
associate-*l*76.8%
metadata-eval76.8%
unpow1/276.8%
metadata-eval76.8%
unpow1/276.8%
associate-*l*76.8%
metadata-eval76.8%
times-frac75.7%
Simplified75.7%
if 3.79999999999999963e100 < d Initial program 69.7%
associate-*l*69.7%
metadata-eval69.7%
unpow1/269.7%
metadata-eval69.7%
unpow1/269.7%
sub-neg69.7%
+-commutative69.7%
*-commutative69.7%
distribute-rgt-neg-in69.7%
fma-def69.7%
Simplified67.9%
Taylor expanded in h around 0 56.6%
Taylor expanded in d around 0 70.0%
*-commutative70.0%
associate-/r*70.1%
Simplified70.1%
sqrt-div80.9%
Applied egg-rr80.9%
Final simplification76.6%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d 2.25e+228)
(*
(sqrt (/ d h))
(*
(- 1.0 (* 0.5 (* h (/ (pow (* 0.5 (/ (* D M) d)) 2.0) l))))
(sqrt (/ d l))))
(* d (/ (sqrt (/ 1.0 l)) (sqrt h)))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 2.25e+228) {
tmp = sqrt((d / h)) * ((1.0 - (0.5 * (h * (pow((0.5 * ((D * M) / d)), 2.0) / l)))) * sqrt((d / l)));
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= 2.25d+228) then
tmp = sqrt((d / h)) * ((1.0d0 - (0.5d0 * (h * (((0.5d0 * ((d_1 * m) / d)) ** 2.0d0) / l)))) * sqrt((d / l)))
else
tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 2.25e+228) {
tmp = Math.sqrt((d / h)) * ((1.0 - (0.5 * (h * (Math.pow((0.5 * ((D * M) / d)), 2.0) / l)))) * Math.sqrt((d / l)));
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= 2.25e+228: tmp = math.sqrt((d / h)) * ((1.0 - (0.5 * (h * (math.pow((0.5 * ((D * M) / d)), 2.0) / l)))) * math.sqrt((d / l))) else: tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= 2.25e+228) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(0.5 * Float64(Float64(D * M) / d)) ^ 2.0) / l)))) * sqrt(Float64(d / l)))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= 2.25e+228)
tmp = sqrt((d / h)) * ((1.0 - (0.5 * (h * (((0.5 * ((D * M) / d)) ^ 2.0) / l)))) * sqrt((d / l)));
else
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, 2.25e+228], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(0.5 * N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 2.25 \cdot 10^{+228}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(0.5 \cdot \frac{D \cdot M}{d}\right)}^{2}}{\ell}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < 2.24999999999999991e228Initial program 71.5%
associate-*l*71.4%
metadata-eval71.4%
unpow1/271.5%
metadata-eval71.5%
unpow1/271.5%
associate-*l*71.5%
metadata-eval71.5%
times-frac71.5%
Simplified71.5%
expm1-log1p-u71.0%
expm1-udef71.0%
add-sqr-sqrt44.2%
add-sqr-sqrt71.0%
div-inv71.0%
metadata-eval71.0%
Applied egg-rr71.0%
expm1-def71.0%
expm1-log1p71.5%
associate-*r/73.2%
associate-*l/73.6%
*-commutative73.6%
*-commutative73.6%
associate-*r*73.6%
associate-*r/73.2%
*-commutative73.2%
Simplified73.2%
if 2.24999999999999991e228 < d Initial program 66.0%
associate-*l*66.0%
metadata-eval66.0%
unpow1/266.0%
metadata-eval66.0%
unpow1/266.0%
sub-neg66.0%
+-commutative66.0%
*-commutative66.0%
distribute-rgt-neg-in66.0%
fma-def66.0%
Simplified66.3%
Taylor expanded in h around 0 60.8%
Taylor expanded in d around 0 79.0%
*-commutative79.0%
associate-/r*78.9%
Simplified78.9%
sqrt-div89.1%
Applied egg-rr89.1%
Final simplification74.4%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d h))))
(if (<= l -1.9e+92)
(* (sqrt (- d)) (/ t_0 (sqrt (- l))))
(if (<= l 3.2e+48)
(*
(- 1.0 (* (/ (* h (* M (* D (* D M)))) (* d (* d l))) 0.125))
(* t_0 (sqrt (/ d l))))
(* d (/ (sqrt (/ 1.0 l)) (sqrt h)))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double tmp;
if (l <= -1.9e+92) {
tmp = sqrt(-d) * (t_0 / sqrt(-l));
} else if (l <= 3.2e+48) {
tmp = (1.0 - (((h * (M * (D * (D * M)))) / (d * (d * l))) * 0.125)) * (t_0 * sqrt((d / l)));
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / h))
if (l <= (-1.9d+92)) then
tmp = sqrt(-d) * (t_0 / sqrt(-l))
else if (l <= 3.2d+48) then
tmp = (1.0d0 - (((h * (m * (d_1 * (d_1 * m)))) / (d * (d * l))) * 0.125d0)) * (t_0 * sqrt((d / l)))
else
tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h));
double tmp;
if (l <= -1.9e+92) {
tmp = Math.sqrt(-d) * (t_0 / Math.sqrt(-l));
} else if (l <= 3.2e+48) {
tmp = (1.0 - (((h * (M * (D * (D * M)))) / (d * (d * l))) * 0.125)) * (t_0 * Math.sqrt((d / l)));
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) tmp = 0 if l <= -1.9e+92: tmp = math.sqrt(-d) * (t_0 / math.sqrt(-l)) elif l <= 3.2e+48: tmp = (1.0 - (((h * (M * (D * (D * M)))) / (d * (d * l))) * 0.125)) * (t_0 * math.sqrt((d / l))) else: tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) tmp = 0.0 if (l <= -1.9e+92) tmp = Float64(sqrt(Float64(-d)) * Float64(t_0 / sqrt(Float64(-l)))); elseif (l <= 3.2e+48) tmp = Float64(Float64(1.0 - Float64(Float64(Float64(h * Float64(M * Float64(D * Float64(D * M)))) / Float64(d * Float64(d * l))) * 0.125)) * Float64(t_0 * sqrt(Float64(d / l)))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / h));
tmp = 0.0;
if (l <= -1.9e+92)
tmp = sqrt(-d) * (t_0 / sqrt(-l));
elseif (l <= 3.2e+48)
tmp = (1.0 - (((h * (M * (D * (D * M)))) / (d * (d * l))) * 0.125)) * (t_0 * sqrt((d / l)));
else
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.9e+92], N[(N[Sqrt[(-d)], $MachinePrecision] * N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.2e+48], N[(N[(1.0 - N[(N[(N[(h * N[(M * N[(D * N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;\ell \leq -1.9 \cdot 10^{+92}:\\
\;\;\;\;\sqrt{-d} \cdot \frac{t_0}{\sqrt{-\ell}}\\
\mathbf{elif}\;\ell \leq 3.2 \cdot 10^{+48}:\\
\;\;\;\;\left(1 - \frac{h \cdot \left(M \cdot \left(D \cdot \left(D \cdot M\right)\right)\right)}{d \cdot \left(d \cdot \ell\right)} \cdot 0.125\right) \cdot \left(t_0 \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -1.9e92Initial program 49.6%
associate-*l*49.6%
metadata-eval49.6%
unpow1/249.6%
metadata-eval49.6%
unpow1/249.6%
sub-neg49.6%
+-commutative49.6%
*-commutative49.6%
distribute-rgt-neg-in49.6%
fma-def49.6%
Simplified49.3%
Taylor expanded in h around 0 47.0%
*-rgt-identity47.0%
frac-2neg47.0%
sqrt-undiv60.1%
associate-*r/60.4%
Applied egg-rr60.4%
associate-/l*60.3%
associate-/r/60.2%
Simplified60.2%
if -1.9e92 < l < 3.2000000000000001e48Initial program 78.0%
metadata-eval78.0%
unpow1/278.0%
metadata-eval78.0%
unpow1/278.0%
*-commutative78.0%
associate-*l*78.0%
times-frac78.0%
metadata-eval78.0%
Simplified78.0%
Taylor expanded in M around 0 46.9%
associate-*r/46.9%
*-commutative46.9%
associate-*r/46.9%
*-commutative46.9%
*-commutative46.9%
*-commutative46.9%
associate-*l*48.2%
unpow248.2%
unpow248.2%
swap-sqr62.6%
associate-*l*61.4%
*-commutative61.4%
*-commutative61.4%
unpow261.4%
associate-*r*66.0%
Simplified66.0%
if 3.2000000000000001e48 < l Initial program 61.9%
associate-*l*61.9%
metadata-eval61.9%
unpow1/261.9%
metadata-eval61.9%
unpow1/261.9%
sub-neg61.9%
+-commutative61.9%
*-commutative61.9%
distribute-rgt-neg-in61.9%
fma-def61.9%
Simplified62.1%
Taylor expanded in h around 0 48.9%
Taylor expanded in d around 0 60.4%
*-commutative60.4%
associate-/r*60.4%
Simplified60.4%
sqrt-div73.2%
Applied egg-rr73.2%
Final simplification66.4%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d h))))
(if (<= l -1.1e+92)
(/ t_0 (/ (sqrt (- l)) (sqrt (- d))))
(if (<= l 1.4e+48)
(*
(- 1.0 (* (/ (* h (* M (* D (* D M)))) (* d (* d l))) 0.125))
(* t_0 (sqrt (/ d l))))
(* d (/ (sqrt (/ 1.0 l)) (sqrt h)))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double tmp;
if (l <= -1.1e+92) {
tmp = t_0 / (sqrt(-l) / sqrt(-d));
} else if (l <= 1.4e+48) {
tmp = (1.0 - (((h * (M * (D * (D * M)))) / (d * (d * l))) * 0.125)) * (t_0 * sqrt((d / l)));
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / h))
if (l <= (-1.1d+92)) then
tmp = t_0 / (sqrt(-l) / sqrt(-d))
else if (l <= 1.4d+48) then
tmp = (1.0d0 - (((h * (m * (d_1 * (d_1 * m)))) / (d * (d * l))) * 0.125d0)) * (t_0 * sqrt((d / l)))
else
tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h));
double tmp;
if (l <= -1.1e+92) {
tmp = t_0 / (Math.sqrt(-l) / Math.sqrt(-d));
} else if (l <= 1.4e+48) {
tmp = (1.0 - (((h * (M * (D * (D * M)))) / (d * (d * l))) * 0.125)) * (t_0 * Math.sqrt((d / l)));
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) tmp = 0 if l <= -1.1e+92: tmp = t_0 / (math.sqrt(-l) / math.sqrt(-d)) elif l <= 1.4e+48: tmp = (1.0 - (((h * (M * (D * (D * M)))) / (d * (d * l))) * 0.125)) * (t_0 * math.sqrt((d / l))) else: tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) tmp = 0.0 if (l <= -1.1e+92) tmp = Float64(t_0 / Float64(sqrt(Float64(-l)) / sqrt(Float64(-d)))); elseif (l <= 1.4e+48) tmp = Float64(Float64(1.0 - Float64(Float64(Float64(h * Float64(M * Float64(D * Float64(D * M)))) / Float64(d * Float64(d * l))) * 0.125)) * Float64(t_0 * sqrt(Float64(d / l)))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / h));
tmp = 0.0;
if (l <= -1.1e+92)
tmp = t_0 / (sqrt(-l) / sqrt(-d));
elseif (l <= 1.4e+48)
tmp = (1.0 - (((h * (M * (D * (D * M)))) / (d * (d * l))) * 0.125)) * (t_0 * sqrt((d / l)));
else
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.1e+92], N[(t$95$0 / N[(N[Sqrt[(-l)], $MachinePrecision] / N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.4e+48], N[(N[(1.0 - N[(N[(N[(h * N[(M * N[(D * N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;\ell \leq -1.1 \cdot 10^{+92}:\\
\;\;\;\;\frac{t_0}{\frac{\sqrt{-\ell}}{\sqrt{-d}}}\\
\mathbf{elif}\;\ell \leq 1.4 \cdot 10^{+48}:\\
\;\;\;\;\left(1 - \frac{h \cdot \left(M \cdot \left(D \cdot \left(D \cdot M\right)\right)\right)}{d \cdot \left(d \cdot \ell\right)} \cdot 0.125\right) \cdot \left(t_0 \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -1.09999999999999996e92Initial program 49.6%
associate-*l*49.6%
metadata-eval49.6%
unpow1/249.6%
metadata-eval49.6%
unpow1/249.6%
sub-neg49.6%
+-commutative49.6%
*-commutative49.6%
distribute-rgt-neg-in49.6%
fma-def49.6%
Simplified49.3%
Taylor expanded in h around 0 47.0%
*-rgt-identity47.0%
frac-2neg47.0%
sqrt-undiv60.1%
associate-*r/60.4%
Applied egg-rr60.4%
associate-/l*60.3%
Simplified60.3%
if -1.09999999999999996e92 < l < 1.40000000000000006e48Initial program 78.0%
metadata-eval78.0%
unpow1/278.0%
metadata-eval78.0%
unpow1/278.0%
*-commutative78.0%
associate-*l*78.0%
times-frac78.0%
metadata-eval78.0%
Simplified78.0%
Taylor expanded in M around 0 46.9%
associate-*r/46.9%
*-commutative46.9%
associate-*r/46.9%
*-commutative46.9%
*-commutative46.9%
*-commutative46.9%
associate-*l*48.2%
unpow248.2%
unpow248.2%
swap-sqr62.6%
associate-*l*61.4%
*-commutative61.4%
*-commutative61.4%
unpow261.4%
associate-*r*66.0%
Simplified66.0%
if 1.40000000000000006e48 < l Initial program 61.9%
associate-*l*61.9%
metadata-eval61.9%
unpow1/261.9%
metadata-eval61.9%
unpow1/261.9%
sub-neg61.9%
+-commutative61.9%
*-commutative61.9%
distribute-rgt-neg-in61.9%
fma-def61.9%
Simplified62.1%
Taylor expanded in h around 0 48.9%
Taylor expanded in d around 0 60.4%
*-commutative60.4%
associate-/r*60.4%
Simplified60.4%
sqrt-div73.2%
Applied egg-rr73.2%
Final simplification66.5%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (sqrt (/ d h)) (sqrt (/ d l))))
(t_1
(*
(- 1.0 (* (/ (* h (* M (* D (* D M)))) (* d (* d l))) 0.125))
t_0)))
(if (<= d -1.7e+191)
(* d (- (pow (* h l) -0.5)))
(if (<= d -1e-95)
t_1
(if (<= d 4.2e-139)
(* t_0 (- 1.0 (* 0.125 (* (* (/ D d) (/ D d)) (/ (* M M) (/ l h))))))
(if (<= d 5.5e+96) t_1 (* d (/ (sqrt (/ 1.0 l)) (sqrt h)))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h)) * sqrt((d / l));
double t_1 = (1.0 - (((h * (M * (D * (D * M)))) / (d * (d * l))) * 0.125)) * t_0;
double tmp;
if (d <= -1.7e+191) {
tmp = d * -pow((h * l), -0.5);
} else if (d <= -1e-95) {
tmp = t_1;
} else if (d <= 4.2e-139) {
tmp = t_0 * (1.0 - (0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)))));
} else if (d <= 5.5e+96) {
tmp = t_1;
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((d / h)) * sqrt((d / l))
t_1 = (1.0d0 - (((h * (m * (d_1 * (d_1 * m)))) / (d * (d * l))) * 0.125d0)) * t_0
if (d <= (-1.7d+191)) then
tmp = d * -((h * l) ** (-0.5d0))
else if (d <= (-1d-95)) then
tmp = t_1
else if (d <= 4.2d-139) then
tmp = t_0 * (1.0d0 - (0.125d0 * (((d_1 / d) * (d_1 / d)) * ((m * m) / (l / h)))))
else if (d <= 5.5d+96) then
tmp = t_1
else
tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h)) * Math.sqrt((d / l));
double t_1 = (1.0 - (((h * (M * (D * (D * M)))) / (d * (d * l))) * 0.125)) * t_0;
double tmp;
if (d <= -1.7e+191) {
tmp = d * -Math.pow((h * l), -0.5);
} else if (d <= -1e-95) {
tmp = t_1;
} else if (d <= 4.2e-139) {
tmp = t_0 * (1.0 - (0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)))));
} else if (d <= 5.5e+96) {
tmp = t_1;
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) * math.sqrt((d / l)) t_1 = (1.0 - (((h * (M * (D * (D * M)))) / (d * (d * l))) * 0.125)) * t_0 tmp = 0 if d <= -1.7e+191: tmp = d * -math.pow((h * l), -0.5) elif d <= -1e-95: tmp = t_1 elif d <= 4.2e-139: tmp = t_0 * (1.0 - (0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h))))) elif d <= 5.5e+96: tmp = t_1 else: tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) t_1 = Float64(Float64(1.0 - Float64(Float64(Float64(h * Float64(M * Float64(D * Float64(D * M)))) / Float64(d * Float64(d * l))) * 0.125)) * t_0) tmp = 0.0 if (d <= -1.7e+191) tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5))); elseif (d <= -1e-95) tmp = t_1; elseif (d <= 4.2e-139) tmp = Float64(t_0 * Float64(1.0 - Float64(0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(M * M) / Float64(l / h)))))); elseif (d <= 5.5e+96) tmp = t_1; else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / h)) * sqrt((d / l));
t_1 = (1.0 - (((h * (M * (D * (D * M)))) / (d * (d * l))) * 0.125)) * t_0;
tmp = 0.0;
if (d <= -1.7e+191)
tmp = d * -((h * l) ^ -0.5);
elseif (d <= -1e-95)
tmp = t_1;
elseif (d <= 4.2e-139)
tmp = t_0 * (1.0 - (0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)))));
elseif (d <= 5.5e+96)
tmp = t_1;
else
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 - N[(N[(N[(h * N[(M * N[(D * N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[d, -1.7e+191], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -1e-95], t$95$1, If[LessEqual[d, 4.2e-139], N[(t$95$0 * N[(1.0 - N[(0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.5e+96], t$95$1, N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
t_1 := \left(1 - \frac{h \cdot \left(M \cdot \left(D \cdot \left(D \cdot M\right)\right)\right)}{d \cdot \left(d \cdot \ell\right)} \cdot 0.125\right) \cdot t_0\\
\mathbf{if}\;d \leq -1.7 \cdot 10^{+191}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-95}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq 4.2 \cdot 10^{-139}:\\
\;\;\;\;t_0 \cdot \left(1 - 0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\
\mathbf{elif}\;d \leq 5.5 \cdot 10^{+96}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -1.70000000000000004e191Initial program 63.8%
associate-*l*63.8%
metadata-eval63.8%
unpow1/263.8%
metadata-eval63.8%
unpow1/263.8%
sub-neg63.8%
+-commutative63.8%
*-commutative63.8%
distribute-rgt-neg-in63.8%
fma-def63.8%
Simplified67.7%
Taylor expanded in h around 0 59.9%
*-rgt-identity59.9%
frac-2neg59.9%
sqrt-undiv71.5%
associate-*r/71.5%
Applied egg-rr71.5%
associate-/l*71.6%
associate-/r/71.5%
Simplified71.5%
Taylor expanded in d around -inf 71.0%
mul-1-neg71.0%
associate-/l/71.0%
unpow1/271.0%
distribute-rgt-neg-in71.0%
exp-to-pow68.9%
associate-/l/68.9%
log-rec68.9%
*-commutative68.9%
distribute-lft-neg-out68.9%
distribute-rgt-neg-in68.9%
metadata-eval68.9%
exp-prod68.9%
*-commutative68.9%
rem-exp-log71.1%
*-commutative71.1%
Simplified71.1%
if -1.70000000000000004e191 < d < -9.99999999999999989e-96 or 4.20000000000000016e-139 < d < 5.5000000000000002e96Initial program 90.8%
metadata-eval90.8%
unpow1/290.8%
metadata-eval90.8%
unpow1/290.8%
*-commutative90.8%
associate-*l*90.8%
times-frac90.0%
metadata-eval90.0%
Simplified90.0%
Taylor expanded in M around 0 69.8%
associate-*r/69.8%
*-commutative69.8%
associate-*r/69.8%
*-commutative69.8%
*-commutative69.8%
*-commutative69.8%
associate-*l*71.8%
unpow271.8%
unpow271.8%
swap-sqr83.7%
associate-*l*82.8%
*-commutative82.8%
*-commutative82.8%
unpow282.8%
associate-*r*84.8%
Simplified84.8%
if -9.99999999999999989e-96 < d < 4.20000000000000016e-139Initial program 48.2%
metadata-eval48.2%
unpow1/248.2%
metadata-eval48.2%
unpow1/248.2%
*-commutative48.2%
associate-*l*48.2%
times-frac48.3%
metadata-eval48.3%
Simplified48.3%
associate-*r*48.3%
frac-times48.2%
*-commutative48.2%
metadata-eval48.2%
expm1-log1p-u47.6%
expm1-udef47.6%
Applied egg-rr47.6%
expm1-def47.6%
expm1-log1p48.2%
associate-/r/48.2%
*-commutative48.2%
associate-*r*48.2%
associate-*r/48.2%
*-commutative48.2%
*-commutative48.2%
Simplified48.2%
Taylor expanded in D around 0 14.9%
associate-*r/14.9%
*-commutative14.9%
associate-*r/14.9%
times-frac22.7%
unpow222.7%
unpow222.7%
times-frac41.3%
associate-/l*42.5%
unpow242.5%
Simplified42.5%
if 5.5000000000000002e96 < d Initial program 70.2%
associate-*l*70.2%
metadata-eval70.2%
unpow1/270.2%
metadata-eval70.2%
unpow1/270.2%
sub-neg70.2%
+-commutative70.2%
*-commutative70.2%
distribute-rgt-neg-in70.2%
fma-def70.2%
Simplified68.5%
Taylor expanded in h around 0 56.2%
Taylor expanded in d around 0 68.8%
*-commutative68.8%
associate-/r*68.8%
Simplified68.8%
sqrt-div80.5%
Applied egg-rr80.5%
Final simplification70.0%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1 (sqrt (/ d l)))
(t_2
(*
t_0
(* t_1 (* (* (/ (* D D) l) (* h (* (/ M d) (/ M d)))) -0.125))))
(t_3 (* t_0 t_1)))
(if (<= D -3.2e-105)
t_2
(if (<= D 2e+90)
t_3
(if (<= D 8e+191)
(* t_0 (* t_1 (* -0.125 (/ (* D (/ D l)) (* (/ d (* h M)) (/ d M))))))
(if (<= D 1.52e+206) t_3 t_2))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double t_1 = sqrt((d / l));
double t_2 = t_0 * (t_1 * ((((D * D) / l) * (h * ((M / d) * (M / d)))) * -0.125));
double t_3 = t_0 * t_1;
double tmp;
if (D <= -3.2e-105) {
tmp = t_2;
} else if (D <= 2e+90) {
tmp = t_3;
} else if (D <= 8e+191) {
tmp = t_0 * (t_1 * (-0.125 * ((D * (D / l)) / ((d / (h * M)) * (d / M)))));
} else if (D <= 1.52e+206) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = sqrt((d / h))
t_1 = sqrt((d / l))
t_2 = t_0 * (t_1 * ((((d_1 * d_1) / l) * (h * ((m / d) * (m / d)))) * (-0.125d0)))
t_3 = t_0 * t_1
if (d_1 <= (-3.2d-105)) then
tmp = t_2
else if (d_1 <= 2d+90) then
tmp = t_3
else if (d_1 <= 8d+191) then
tmp = t_0 * (t_1 * ((-0.125d0) * ((d_1 * (d_1 / l)) / ((d / (h * m)) * (d / m)))))
else if (d_1 <= 1.52d+206) then
tmp = t_3
else
tmp = t_2
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h));
double t_1 = Math.sqrt((d / l));
double t_2 = t_0 * (t_1 * ((((D * D) / l) * (h * ((M / d) * (M / d)))) * -0.125));
double t_3 = t_0 * t_1;
double tmp;
if (D <= -3.2e-105) {
tmp = t_2;
} else if (D <= 2e+90) {
tmp = t_3;
} else if (D <= 8e+191) {
tmp = t_0 * (t_1 * (-0.125 * ((D * (D / l)) / ((d / (h * M)) * (d / M)))));
} else if (D <= 1.52e+206) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) t_1 = math.sqrt((d / l)) t_2 = t_0 * (t_1 * ((((D * D) / l) * (h * ((M / d) * (M / d)))) * -0.125)) t_3 = t_0 * t_1 tmp = 0 if D <= -3.2e-105: tmp = t_2 elif D <= 2e+90: tmp = t_3 elif D <= 8e+191: tmp = t_0 * (t_1 * (-0.125 * ((D * (D / l)) / ((d / (h * M)) * (d / M))))) elif D <= 1.52e+206: tmp = t_3 else: tmp = t_2 return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) t_1 = sqrt(Float64(d / l)) t_2 = Float64(t_0 * Float64(t_1 * Float64(Float64(Float64(Float64(D * D) / l) * Float64(h * Float64(Float64(M / d) * Float64(M / d)))) * -0.125))) t_3 = Float64(t_0 * t_1) tmp = 0.0 if (D <= -3.2e-105) tmp = t_2; elseif (D <= 2e+90) tmp = t_3; elseif (D <= 8e+191) tmp = Float64(t_0 * Float64(t_1 * Float64(-0.125 * Float64(Float64(D * Float64(D / l)) / Float64(Float64(d / Float64(h * M)) * Float64(d / M)))))); elseif (D <= 1.52e+206) tmp = t_3; else tmp = t_2; end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / h));
t_1 = sqrt((d / l));
t_2 = t_0 * (t_1 * ((((D * D) / l) * (h * ((M / d) * (M / d)))) * -0.125));
t_3 = t_0 * t_1;
tmp = 0.0;
if (D <= -3.2e-105)
tmp = t_2;
elseif (D <= 2e+90)
tmp = t_3;
elseif (D <= 8e+191)
tmp = t_0 * (t_1 * (-0.125 * ((D * (D / l)) / ((d / (h * M)) * (d / M)))));
elseif (D <= 1.52e+206)
tmp = t_3;
else
tmp = t_2;
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * N[(t$95$1 * N[(N[(N[(N[(D * D), $MachinePrecision] / l), $MachinePrecision] * N[(h * N[(N[(M / d), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$0 * t$95$1), $MachinePrecision]}, If[LessEqual[D, -3.2e-105], t$95$2, If[LessEqual[D, 2e+90], t$95$3, If[LessEqual[D, 8e+191], N[(t$95$0 * N[(t$95$1 * N[(-0.125 * N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] / N[(N[(d / N[(h * M), $MachinePrecision]), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[D, 1.52e+206], t$95$3, t$95$2]]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := t_0 \cdot \left(t_1 \cdot \left(\left(\frac{D \cdot D}{\ell} \cdot \left(h \cdot \left(\frac{M}{d} \cdot \frac{M}{d}\right)\right)\right) \cdot -0.125\right)\right)\\
t_3 := t_0 \cdot t_1\\
\mathbf{if}\;D \leq -3.2 \cdot 10^{-105}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;D \leq 2 \cdot 10^{+90}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;D \leq 8 \cdot 10^{+191}:\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot \left(-0.125 \cdot \frac{D \cdot \frac{D}{\ell}}{\frac{d}{h \cdot M} \cdot \frac{d}{M}}\right)\right)\\
\mathbf{elif}\;D \leq 1.52 \cdot 10^{+206}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if D < -3.19999999999999981e-105 or 1.52e206 < D Initial program 76.3%
associate-*l*76.3%
metadata-eval76.3%
unpow1/276.3%
metadata-eval76.3%
unpow1/276.3%
sub-neg76.3%
+-commutative76.3%
*-commutative76.3%
distribute-rgt-neg-in76.3%
fma-def76.3%
Simplified75.4%
Taylor expanded in h around inf 31.1%
*-commutative31.1%
times-frac33.1%
unpow233.1%
*-commutative33.1%
unpow233.1%
unpow233.1%
Simplified33.1%
Taylor expanded in M around 0 33.1%
associate-/l*34.0%
associate-/r/34.1%
*-rgt-identity34.1%
associate-*r/34.0%
unpow234.0%
*-commutative34.0%
unpow234.0%
associate-*r/34.1%
*-rgt-identity34.1%
unpow234.1%
unpow234.1%
times-frac46.0%
Simplified46.0%
if -3.19999999999999981e-105 < D < 1.99999999999999993e90 or 8.00000000000000058e191 < D < 1.52e206Initial program 68.1%
associate-*l*68.1%
metadata-eval68.1%
unpow1/268.1%
metadata-eval68.1%
unpow1/268.1%
sub-neg68.1%
+-commutative68.1%
*-commutative68.1%
distribute-rgt-neg-in68.1%
fma-def68.1%
Simplified68.0%
Taylor expanded in h around 0 53.8%
*-rgt-identity53.8%
frac-2neg53.8%
sqrt-undiv34.3%
expm1-log1p-u33.4%
expm1-udef19.9%
sqrt-undiv36.1%
frac-2neg36.1%
Applied egg-rr36.1%
expm1-def52.0%
expm1-log1p53.8%
Simplified53.8%
if 1.99999999999999993e90 < D < 8.00000000000000058e191Initial program 63.7%
associate-*l*63.6%
metadata-eval63.6%
unpow1/263.6%
metadata-eval63.6%
unpow1/263.6%
sub-neg63.6%
+-commutative63.6%
*-commutative63.6%
distribute-rgt-neg-in63.6%
fma-def63.6%
Simplified63.4%
Taylor expanded in h around inf 21.5%
*-commutative21.5%
times-frac21.4%
unpow221.4%
*-commutative21.4%
unpow221.4%
unpow221.4%
Simplified21.4%
Taylor expanded in D around 0 21.5%
*-commutative21.5%
*-commutative21.5%
unpow221.5%
unpow221.5%
associate-*l*22.2%
associate-/l*22.2%
*-commutative22.2%
*-commutative22.2%
times-frac22.1%
associate-/l/21.6%
associate-/r/21.6%
unpow221.6%
associate-*r*21.6%
times-frac31.9%
*-commutative31.9%
Simplified31.9%
Final simplification49.1%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -1.6e+139)
(* d (- (pow (* h l) -0.5)))
(if (<= l 5.6e-20)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(- 1.0 (* 0.125 (* (* (/ D d) (/ D d)) (/ (* M M) (/ l h))))))
(* d (/ (sqrt (/ 1.0 l)) (sqrt h))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1.6e+139) {
tmp = d * -pow((h * l), -0.5);
} else if (l <= 5.6e-20) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)))));
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-1.6d+139)) then
tmp = d * -((h * l) ** (-0.5d0))
else if (l <= 5.6d-20) then
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0d0 - (0.125d0 * (((d_1 / d) * (d_1 / d)) * ((m * m) / (l / h)))))
else
tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1.6e+139) {
tmp = d * -Math.pow((h * l), -0.5);
} else if (l <= 5.6e-20) {
tmp = (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - (0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)))));
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -1.6e+139: tmp = d * -math.pow((h * l), -0.5) elif l <= 5.6e-20: tmp = (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - (0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h))))) else: tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -1.6e+139) tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5))); elseif (l <= 5.6e-20) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(M * M) / Float64(l / h)))))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -1.6e+139)
tmp = d * -((h * l) ^ -0.5);
elseif (l <= 5.6e-20)
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)))));
else
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -1.6e+139], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 5.6e-20], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(l / h), $MachinePrecision]), $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}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.6 \cdot 10^{+139}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{elif}\;\ell \leq 5.6 \cdot 10^{-20}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -1.6000000000000001e139Initial program 47.4%
associate-*l*47.4%
metadata-eval47.4%
unpow1/247.4%
metadata-eval47.4%
unpow1/247.4%
sub-neg47.4%
+-commutative47.4%
*-commutative47.4%
distribute-rgt-neg-in47.4%
fma-def47.4%
Simplified47.1%
Taylor expanded in h around 0 44.6%
*-rgt-identity44.6%
frac-2neg44.6%
sqrt-undiv60.8%
associate-*r/61.1%
Applied egg-rr61.1%
associate-/l*61.0%
associate-/r/60.8%
Simplified60.8%
Taylor expanded in d around -inf 57.5%
mul-1-neg57.5%
associate-/l/57.4%
unpow1/257.4%
distribute-rgt-neg-in57.4%
exp-to-pow54.2%
associate-/l/54.2%
log-rec54.2%
*-commutative54.2%
distribute-lft-neg-out54.2%
distribute-rgt-neg-in54.2%
metadata-eval54.2%
exp-prod54.2%
*-commutative54.2%
rem-exp-log57.7%
*-commutative57.7%
Simplified57.7%
if -1.6000000000000001e139 < l < 5.6000000000000005e-20Initial program 77.2%
metadata-eval77.2%
unpow1/277.2%
metadata-eval77.2%
unpow1/277.2%
*-commutative77.2%
associate-*l*77.2%
times-frac77.3%
metadata-eval77.3%
Simplified77.3%
associate-*r*77.3%
frac-times77.2%
*-commutative77.2%
metadata-eval77.2%
expm1-log1p-u76.6%
expm1-udef76.6%
Applied egg-rr76.6%
expm1-def76.6%
expm1-log1p77.3%
associate-/r/77.2%
*-commutative77.2%
associate-*r*77.2%
associate-*r/77.2%
*-commutative77.2%
*-commutative77.2%
Simplified77.2%
Taylor expanded in D around 0 46.2%
associate-*r/46.2%
*-commutative46.2%
associate-*r/46.2%
times-frac47.4%
unpow247.4%
unpow247.4%
times-frac64.7%
associate-/l*64.6%
unpow264.6%
Simplified64.6%
if 5.6000000000000005e-20 < l Initial program 65.4%
associate-*l*65.4%
metadata-eval65.4%
unpow1/265.4%
metadata-eval65.4%
unpow1/265.4%
sub-neg65.4%
+-commutative65.4%
*-commutative65.4%
distribute-rgt-neg-in65.4%
fma-def65.4%
Simplified65.5%
Taylor expanded in h around 0 53.5%
Taylor expanded in d around 0 62.4%
*-commutative62.4%
associate-/r*62.4%
Simplified62.4%
sqrt-div72.4%
Applied egg-rr72.4%
Final simplification65.6%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* d (- (pow (* h l) -0.5)))))
(if (<= d -5.6e+118)
t_0
(if (<= d -6e-156)
(/ (sqrt (/ (* d (- d)) h)) (sqrt (- l)))
(if (<= d -1.75e-295)
t_0
(if (<= d 2.5e-288)
(/ d (sqrt (* h l)))
(if (or (<= d 3.9e-134)
(and (not (<= d 1.25e-64)) (<= d 47000000.0)))
(* (sqrt (/ h (pow l 3.0))) (/ -0.125 (/ (/ d (* M M)) (* D D))))
(* d (/ (sqrt (/ 1.0 l)) (sqrt h))))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = d * -pow((h * l), -0.5);
double tmp;
if (d <= -5.6e+118) {
tmp = t_0;
} else if (d <= -6e-156) {
tmp = sqrt(((d * -d) / h)) / sqrt(-l);
} else if (d <= -1.75e-295) {
tmp = t_0;
} else if (d <= 2.5e-288) {
tmp = d / sqrt((h * l));
} else if ((d <= 3.9e-134) || (!(d <= 1.25e-64) && (d <= 47000000.0))) {
tmp = sqrt((h / pow(l, 3.0))) * (-0.125 / ((d / (M * M)) / (D * D)));
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = d * -((h * l) ** (-0.5d0))
if (d <= (-5.6d+118)) then
tmp = t_0
else if (d <= (-6d-156)) then
tmp = sqrt(((d * -d) / h)) / sqrt(-l)
else if (d <= (-1.75d-295)) then
tmp = t_0
else if (d <= 2.5d-288) then
tmp = d / sqrt((h * l))
else if ((d <= 3.9d-134) .or. (.not. (d <= 1.25d-64)) .and. (d <= 47000000.0d0)) then
tmp = sqrt((h / (l ** 3.0d0))) * ((-0.125d0) / ((d / (m * m)) / (d_1 * d_1)))
else
tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = d * -Math.pow((h * l), -0.5);
double tmp;
if (d <= -5.6e+118) {
tmp = t_0;
} else if (d <= -6e-156) {
tmp = Math.sqrt(((d * -d) / h)) / Math.sqrt(-l);
} else if (d <= -1.75e-295) {
tmp = t_0;
} else if (d <= 2.5e-288) {
tmp = d / Math.sqrt((h * l));
} else if ((d <= 3.9e-134) || (!(d <= 1.25e-64) && (d <= 47000000.0))) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (-0.125 / ((d / (M * M)) / (D * D)));
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = d * -math.pow((h * l), -0.5) tmp = 0 if d <= -5.6e+118: tmp = t_0 elif d <= -6e-156: tmp = math.sqrt(((d * -d) / h)) / math.sqrt(-l) elif d <= -1.75e-295: tmp = t_0 elif d <= 2.5e-288: tmp = d / math.sqrt((h * l)) elif (d <= 3.9e-134) or (not (d <= 1.25e-64) and (d <= 47000000.0)): tmp = math.sqrt((h / math.pow(l, 3.0))) * (-0.125 / ((d / (M * M)) / (D * D))) else: tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(d * Float64(-(Float64(h * l) ^ -0.5))) tmp = 0.0 if (d <= -5.6e+118) tmp = t_0; elseif (d <= -6e-156) tmp = Float64(sqrt(Float64(Float64(d * Float64(-d)) / h)) / sqrt(Float64(-l))); elseif (d <= -1.75e-295) tmp = t_0; elseif (d <= 2.5e-288) tmp = Float64(d / sqrt(Float64(h * l))); elseif ((d <= 3.9e-134) || (!(d <= 1.25e-64) && (d <= 47000000.0))) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(-0.125 / Float64(Float64(d / Float64(M * M)) / Float64(D * D)))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = d * -((h * l) ^ -0.5);
tmp = 0.0;
if (d <= -5.6e+118)
tmp = t_0;
elseif (d <= -6e-156)
tmp = sqrt(((d * -d) / h)) / sqrt(-l);
elseif (d <= -1.75e-295)
tmp = t_0;
elseif (d <= 2.5e-288)
tmp = d / sqrt((h * l));
elseif ((d <= 3.9e-134) || (~((d <= 1.25e-64)) && (d <= 47000000.0)))
tmp = sqrt((h / (l ^ 3.0))) * (-0.125 / ((d / (M * M)) / (D * D)));
else
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[d, -5.6e+118], t$95$0, If[LessEqual[d, -6e-156], N[(N[Sqrt[N[(N[(d * (-d)), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.75e-295], t$95$0, If[LessEqual[d, 2.5e-288], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d, 3.9e-134], And[N[Not[LessEqual[d, 1.25e-64]], $MachinePrecision], LessEqual[d, 47000000.0]]], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 / N[(N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{if}\;d \leq -5.6 \cdot 10^{+118}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -6 \cdot 10^{-156}:\\
\;\;\;\;\frac{\sqrt{\frac{d \cdot \left(-d\right)}{h}}}{\sqrt{-\ell}}\\
\mathbf{elif}\;d \leq -1.75 \cdot 10^{-295}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 2.5 \cdot 10^{-288}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq 3.9 \cdot 10^{-134} \lor \neg \left(d \leq 1.25 \cdot 10^{-64}\right) \land d \leq 47000000:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{-0.125}{\frac{\frac{d}{M \cdot M}}{D \cdot D}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -5.59999999999999972e118 or -6e-156 < d < -1.74999999999999994e-295Initial program 57.7%
associate-*l*57.7%
metadata-eval57.7%
unpow1/257.7%
metadata-eval57.7%
unpow1/257.7%
sub-neg57.7%
+-commutative57.7%
*-commutative57.7%
distribute-rgt-neg-in57.7%
fma-def57.7%
Simplified57.5%
Taylor expanded in h around 0 40.7%
*-rgt-identity40.7%
frac-2neg40.7%
sqrt-undiv53.3%
associate-*r/53.3%
Applied egg-rr53.3%
associate-/l*53.4%
associate-/r/53.2%
Simplified53.2%
Taylor expanded in d around -inf 54.4%
mul-1-neg54.4%
associate-/l/54.4%
unpow1/254.4%
distribute-rgt-neg-in54.4%
exp-to-pow51.9%
associate-/l/51.9%
log-rec51.9%
*-commutative51.9%
distribute-lft-neg-out51.9%
distribute-rgt-neg-in51.9%
metadata-eval51.9%
exp-prod51.9%
*-commutative51.9%
rem-exp-log54.5%
*-commutative54.5%
Simplified54.5%
if -5.59999999999999972e118 < d < -6e-156Initial program 83.5%
associate-*l*83.5%
metadata-eval83.5%
unpow1/283.5%
metadata-eval83.5%
unpow1/283.5%
sub-neg83.5%
+-commutative83.5%
*-commutative83.5%
distribute-rgt-neg-in83.5%
fma-def83.5%
Simplified83.6%
Taylor expanded in h around 0 42.2%
*-rgt-identity42.2%
frac-2neg42.2%
sqrt-undiv44.0%
associate-*r/44.1%
Applied egg-rr44.1%
associate-/l*44.0%
associate-/r/44.0%
Simplified44.0%
associate-*l/44.1%
pow1/244.1%
pow1/244.1%
pow-prod-down43.0%
Applied egg-rr43.0%
unpow1/243.0%
associate-*l/43.0%
distribute-rgt-neg-out43.0%
Simplified43.0%
if -1.74999999999999994e-295 < d < 2.50000000000000005e-288Initial program 50.8%
associate-*l*50.8%
metadata-eval50.8%
unpow1/250.8%
metadata-eval50.8%
unpow1/250.8%
sub-neg50.8%
+-commutative50.8%
*-commutative50.8%
distribute-rgt-neg-in50.8%
fma-def50.8%
Simplified50.8%
Taylor expanded in h around 0 12.2%
Taylor expanded in d around 0 52.0%
*-commutative52.0%
associate-/r*51.9%
Simplified51.9%
Taylor expanded in l around 0 52.0%
*-commutative52.0%
associate-/r*52.0%
Simplified52.0%
div-inv52.0%
inv-pow52.0%
inv-pow52.0%
pow-prod-down52.0%
inv-pow52.0%
associate-/l/51.9%
add-cbrt-cube51.9%
add-cbrt-cube51.9%
add-sqr-sqrt51.9%
expm1-log1p-u11.9%
expm1-udef3.0%
Applied egg-rr3.0%
expm1-def12.0%
expm1-log1p52.0%
associate-*r/52.0%
*-rgt-identity52.0%
Simplified52.0%
if 2.50000000000000005e-288 < d < 3.9000000000000001e-134 or 1.25000000000000008e-64 < d < 4.7e7Initial program 72.5%
metadata-eval72.5%
unpow1/272.5%
metadata-eval72.5%
unpow1/272.5%
*-commutative72.5%
associate-*l*72.5%
times-frac72.5%
metadata-eval72.5%
Simplified72.5%
frac-2neg72.5%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around 0 51.0%
associate-*r*51.0%
*-commutative51.0%
associate-/l*53.7%
associate-*r/53.7%
associate-/l*53.7%
unpow253.7%
unpow253.7%
Simplified53.7%
if 3.9000000000000001e-134 < d < 1.25000000000000008e-64 or 4.7e7 < d Initial program 77.2%
associate-*l*77.2%
metadata-eval77.2%
unpow1/277.2%
metadata-eval77.2%
unpow1/277.2%
sub-neg77.2%
+-commutative77.2%
*-commutative77.2%
distribute-rgt-neg-in77.2%
fma-def77.2%
Simplified76.1%
Taylor expanded in h around 0 54.6%
Taylor expanded in d around 0 59.4%
*-commutative59.4%
associate-/r*59.5%
Simplified59.5%
sqrt-div70.3%
Applied egg-rr70.3%
Final simplification57.5%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))) (t_1 (sqrt (/ d h))))
(if (or (<= D -4.2e-105) (not (<= D 1.5e+91)))
(* t_1 (* t_0 (* -0.125 (* (/ h d) (* (* D (/ D l)) (* M (/ M d)))))))
(* t_1 t_0))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = sqrt((d / h));
double tmp;
if ((D <= -4.2e-105) || !(D <= 1.5e+91)) {
tmp = t_1 * (t_0 * (-0.125 * ((h / d) * ((D * (D / l)) * (M * (M / d))))));
} else {
tmp = t_1 * t_0;
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = sqrt((d / h))
if ((d_1 <= (-4.2d-105)) .or. (.not. (d_1 <= 1.5d+91))) then
tmp = t_1 * (t_0 * ((-0.125d0) * ((h / d) * ((d_1 * (d_1 / l)) * (m * (m / d))))))
else
tmp = t_1 * t_0
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double t_1 = Math.sqrt((d / h));
double tmp;
if ((D <= -4.2e-105) || !(D <= 1.5e+91)) {
tmp = t_1 * (t_0 * (-0.125 * ((h / d) * ((D * (D / l)) * (M * (M / d))))));
} else {
tmp = t_1 * t_0;
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) t_1 = math.sqrt((d / h)) tmp = 0 if (D <= -4.2e-105) or not (D <= 1.5e+91): tmp = t_1 * (t_0 * (-0.125 * ((h / d) * ((D * (D / l)) * (M * (M / d)))))) else: tmp = t_1 * t_0 return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = sqrt(Float64(d / h)) tmp = 0.0 if ((D <= -4.2e-105) || !(D <= 1.5e+91)) tmp = Float64(t_1 * Float64(t_0 * Float64(-0.125 * Float64(Float64(h / d) * Float64(Float64(D * Float64(D / l)) * Float64(M * Float64(M / d))))))); else tmp = Float64(t_1 * t_0); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / l));
t_1 = sqrt((d / h));
tmp = 0.0;
if ((D <= -4.2e-105) || ~((D <= 1.5e+91)))
tmp = t_1 * (t_0 * (-0.125 * ((h / d) * ((D * (D / l)) * (M * (M / d))))));
else
tmp = t_1 * t_0;
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[D, -4.2e-105], N[Not[LessEqual[D, 1.5e+91]], $MachinePrecision]], N[(t$95$1 * N[(t$95$0 * N[(-0.125 * N[(N[(h / d), $MachinePrecision] * N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;D \leq -4.2 \cdot 10^{-105} \lor \neg \left(D \leq 1.5 \cdot 10^{+91}\right):\\
\;\;\;\;t_1 \cdot \left(t_0 \cdot \left(-0.125 \cdot \left(\frac{h}{d} \cdot \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \left(M \cdot \frac{M}{d}\right)\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot t_0\\
\end{array}
\end{array}
if D < -4.2e-105 or 1.50000000000000003e91 < D Initial program 73.1%
associate-*l*73.1%
metadata-eval73.1%
unpow1/273.1%
metadata-eval73.1%
unpow1/273.1%
sub-neg73.1%
+-commutative73.1%
*-commutative73.1%
distribute-rgt-neg-in73.1%
fma-def73.1%
Simplified72.4%
Taylor expanded in h around inf 28.5%
*-commutative28.5%
times-frac30.0%
unpow230.0%
*-commutative30.0%
unpow230.0%
unpow230.0%
Simplified30.0%
Taylor expanded in D around 0 28.5%
*-commutative28.5%
times-frac30.0%
unpow230.0%
associate-/l*30.1%
unpow230.1%
times-frac37.4%
unpow237.4%
*-commutative37.4%
*-commutative37.4%
associate-*l*38.9%
associate-/l*40.5%
associate-/r/40.5%
associate-/r/40.5%
*-commutative40.5%
Simplified40.5%
if -4.2e-105 < D < 1.50000000000000003e91Initial program 69.1%
associate-*l*69.0%
metadata-eval69.0%
unpow1/269.0%
metadata-eval69.0%
unpow1/269.0%
sub-neg69.0%
+-commutative69.0%
*-commutative69.0%
distribute-rgt-neg-in69.0%
fma-def69.0%
Simplified69.0%
Taylor expanded in h around 0 54.2%
*-rgt-identity54.2%
frac-2neg54.2%
sqrt-undiv34.1%
expm1-log1p-u33.1%
expm1-udef19.2%
sqrt-undiv35.9%
frac-2neg35.9%
Applied egg-rr35.9%
expm1-def52.4%
expm1-log1p54.2%
Simplified54.2%
Final simplification47.5%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))) (t_1 (sqrt (/ d h))))
(if (or (<= D -2.6e-105) (not (<= D 5e+90)))
(* t_1 (* t_0 (* (* (/ (* D D) l) (* h (* (/ M d) (/ M d)))) -0.125)))
(* t_1 t_0))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = sqrt((d / h));
double tmp;
if ((D <= -2.6e-105) || !(D <= 5e+90)) {
tmp = t_1 * (t_0 * ((((D * D) / l) * (h * ((M / d) * (M / d)))) * -0.125));
} else {
tmp = t_1 * t_0;
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = sqrt((d / h))
if ((d_1 <= (-2.6d-105)) .or. (.not. (d_1 <= 5d+90))) then
tmp = t_1 * (t_0 * ((((d_1 * d_1) / l) * (h * ((m / d) * (m / d)))) * (-0.125d0)))
else
tmp = t_1 * t_0
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double t_1 = Math.sqrt((d / h));
double tmp;
if ((D <= -2.6e-105) || !(D <= 5e+90)) {
tmp = t_1 * (t_0 * ((((D * D) / l) * (h * ((M / d) * (M / d)))) * -0.125));
} else {
tmp = t_1 * t_0;
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) t_1 = math.sqrt((d / h)) tmp = 0 if (D <= -2.6e-105) or not (D <= 5e+90): tmp = t_1 * (t_0 * ((((D * D) / l) * (h * ((M / d) * (M / d)))) * -0.125)) else: tmp = t_1 * t_0 return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = sqrt(Float64(d / h)) tmp = 0.0 if ((D <= -2.6e-105) || !(D <= 5e+90)) tmp = Float64(t_1 * Float64(t_0 * Float64(Float64(Float64(Float64(D * D) / l) * Float64(h * Float64(Float64(M / d) * Float64(M / d)))) * -0.125))); else tmp = Float64(t_1 * t_0); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / l));
t_1 = sqrt((d / h));
tmp = 0.0;
if ((D <= -2.6e-105) || ~((D <= 5e+90)))
tmp = t_1 * (t_0 * ((((D * D) / l) * (h * ((M / d) * (M / d)))) * -0.125));
else
tmp = t_1 * t_0;
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[D, -2.6e-105], N[Not[LessEqual[D, 5e+90]], $MachinePrecision]], N[(t$95$1 * N[(t$95$0 * N[(N[(N[(N[(D * D), $MachinePrecision] / l), $MachinePrecision] * N[(h * N[(N[(M / d), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;D \leq -2.6 \cdot 10^{-105} \lor \neg \left(D \leq 5 \cdot 10^{+90}\right):\\
\;\;\;\;t_1 \cdot \left(t_0 \cdot \left(\left(\frac{D \cdot D}{\ell} \cdot \left(h \cdot \left(\frac{M}{d} \cdot \frac{M}{d}\right)\right)\right) \cdot -0.125\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot t_0\\
\end{array}
\end{array}
if D < -2.5999999999999999e-105 or 5.0000000000000004e90 < D Initial program 73.1%
associate-*l*73.1%
metadata-eval73.1%
unpow1/273.1%
metadata-eval73.1%
unpow1/273.1%
sub-neg73.1%
+-commutative73.1%
*-commutative73.1%
distribute-rgt-neg-in73.1%
fma-def73.1%
Simplified72.4%
Taylor expanded in h around inf 28.5%
*-commutative28.5%
times-frac30.0%
unpow230.0%
*-commutative30.0%
unpow230.0%
unpow230.0%
Simplified30.0%
Taylor expanded in M around 0 30.0%
associate-/l*30.3%
associate-/r/31.2%
*-rgt-identity31.2%
associate-*r/30.8%
unpow230.8%
*-commutative30.8%
unpow230.8%
associate-*r/31.2%
*-rgt-identity31.2%
unpow231.2%
unpow231.2%
times-frac42.1%
Simplified42.1%
if -2.5999999999999999e-105 < D < 5.0000000000000004e90Initial program 69.1%
associate-*l*69.0%
metadata-eval69.0%
unpow1/269.0%
metadata-eval69.0%
unpow1/269.0%
sub-neg69.0%
+-commutative69.0%
*-commutative69.0%
distribute-rgt-neg-in69.0%
fma-def69.0%
Simplified69.0%
Taylor expanded in h around 0 54.2%
*-rgt-identity54.2%
frac-2neg54.2%
sqrt-undiv34.1%
expm1-log1p-u33.1%
expm1-udef19.2%
sqrt-undiv35.9%
frac-2neg35.9%
Applied egg-rr35.9%
expm1-def52.4%
expm1-log1p54.2%
Simplified54.2%
Final simplification48.2%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ (/ 1.0 l) h)))
(if (<= d -3e+124)
(* d (- (pow (* h l) -0.5)))
(if (<= d -8.2e-171)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= d 2.5e-288)
(* d (sqrt (cbrt (* t_0 (* t_0 t_0)))))
(if (or (<= d 3.5e-134) (and (not (<= d 1.24e-64)) (<= d 47000000.0)))
(* (sqrt (/ h (pow l 3.0))) (/ -0.125 (/ (/ d (* M M)) (* D D))))
(* d (/ (sqrt (/ 1.0 l)) (sqrt h)))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (1.0 / l) / h;
double tmp;
if (d <= -3e+124) {
tmp = d * -pow((h * l), -0.5);
} else if (d <= -8.2e-171) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (d <= 2.5e-288) {
tmp = d * sqrt(cbrt((t_0 * (t_0 * t_0))));
} else if ((d <= 3.5e-134) || (!(d <= 1.24e-64) && (d <= 47000000.0))) {
tmp = sqrt((h / pow(l, 3.0))) * (-0.125 / ((d / (M * M)) / (D * D)));
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (1.0 / l) / h;
double tmp;
if (d <= -3e+124) {
tmp = d * -Math.pow((h * l), -0.5);
} else if (d <= -8.2e-171) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (d <= 2.5e-288) {
tmp = d * Math.sqrt(Math.cbrt((t_0 * (t_0 * t_0))));
} else if ((d <= 3.5e-134) || (!(d <= 1.24e-64) && (d <= 47000000.0))) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (-0.125 / ((d / (M * M)) / (D * D)));
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
return tmp;
}
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(1.0 / l) / h) tmp = 0.0 if (d <= -3e+124) tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5))); elseif (d <= -8.2e-171) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (d <= 2.5e-288) tmp = Float64(d * sqrt(cbrt(Float64(t_0 * Float64(t_0 * t_0))))); elseif ((d <= 3.5e-134) || (!(d <= 1.24e-64) && (d <= 47000000.0))) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(-0.125 / Float64(Float64(d / Float64(M * M)) / Float64(D * D)))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]}, If[LessEqual[d, -3e+124], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -8.2e-171], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.5e-288], N[(d * N[Sqrt[N[Power[N[(t$95$0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d, 3.5e-134], And[N[Not[LessEqual[d, 1.24e-64]], $MachinePrecision], LessEqual[d, 47000000.0]]], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 / N[(N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \frac{\frac{1}{\ell}}{h}\\
\mathbf{if}\;d \leq -3 \cdot 10^{+124}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{elif}\;d \leq -8.2 \cdot 10^{-171}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;d \leq 2.5 \cdot 10^{-288}:\\
\;\;\;\;d \cdot \sqrt{\sqrt[3]{t_0 \cdot \left(t_0 \cdot t_0\right)}}\\
\mathbf{elif}\;d \leq 3.5 \cdot 10^{-134} \lor \neg \left(d \leq 1.24 \cdot 10^{-64}\right) \land d \leq 47000000:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{-0.125}{\frac{\frac{d}{M \cdot M}}{D \cdot D}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -3e124Initial program 72.1%
associate-*l*72.1%
metadata-eval72.1%
unpow1/272.1%
metadata-eval72.1%
unpow1/272.1%
sub-neg72.1%
+-commutative72.1%
*-commutative72.1%
distribute-rgt-neg-in72.1%
fma-def72.1%
Simplified74.5%
Taylor expanded in h around 0 53.8%
*-rgt-identity53.8%
frac-2neg53.8%
sqrt-undiv63.5%
associate-*r/63.6%
Applied egg-rr63.6%
associate-/l*63.8%
associate-/r/63.6%
Simplified63.6%
Taylor expanded in d around -inf 65.7%
mul-1-neg65.7%
associate-/l/65.7%
unpow1/265.7%
distribute-rgt-neg-in65.7%
exp-to-pow63.4%
associate-/l/63.4%
log-rec63.4%
*-commutative63.4%
distribute-lft-neg-out63.4%
distribute-rgt-neg-in63.4%
metadata-eval63.4%
exp-prod63.4%
*-commutative63.4%
rem-exp-log65.9%
*-commutative65.9%
Simplified65.9%
if -3e124 < d < -8.2e-171Initial program 80.2%
associate-*l*80.2%
metadata-eval80.2%
unpow1/280.2%
metadata-eval80.2%
unpow1/280.2%
sub-neg80.2%
+-commutative80.2%
*-commutative80.2%
distribute-rgt-neg-in80.2%
fma-def80.2%
Simplified80.2%
Taylor expanded in h around 0 46.5%
*-rgt-identity46.5%
frac-2neg46.5%
sqrt-undiv52.7%
expm1-log1p-u51.3%
expm1-udef24.2%
sqrt-undiv22.7%
frac-2neg22.7%
Applied egg-rr22.7%
expm1-def45.3%
expm1-log1p46.5%
Simplified46.5%
if -8.2e-171 < d < 2.50000000000000005e-288Initial program 37.6%
associate-*l*37.6%
metadata-eval37.6%
unpow1/237.6%
metadata-eval37.6%
unpow1/237.6%
sub-neg37.6%
+-commutative37.6%
*-commutative37.6%
distribute-rgt-neg-in37.6%
fma-def37.6%
Simplified34.6%
Taylor expanded in h around 0 10.4%
Taylor expanded in d around 0 19.3%
*-commutative19.3%
associate-/r*19.2%
Simplified19.2%
add-cbrt-cube27.6%
Applied egg-rr27.6%
if 2.50000000000000005e-288 < d < 3.4999999999999998e-134 or 1.24000000000000006e-64 < d < 4.7e7Initial program 72.5%
metadata-eval72.5%
unpow1/272.5%
metadata-eval72.5%
unpow1/272.5%
*-commutative72.5%
associate-*l*72.5%
times-frac72.5%
metadata-eval72.5%
Simplified72.5%
frac-2neg72.5%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around 0 51.0%
associate-*r*51.0%
*-commutative51.0%
associate-/l*53.7%
associate-*r/53.7%
associate-/l*53.7%
unpow253.7%
unpow253.7%
Simplified53.7%
if 3.4999999999999998e-134 < d < 1.24000000000000006e-64 or 4.7e7 < d Initial program 77.2%
associate-*l*77.2%
metadata-eval77.2%
unpow1/277.2%
metadata-eval77.2%
unpow1/277.2%
sub-neg77.2%
+-commutative77.2%
*-commutative77.2%
distribute-rgt-neg-in77.2%
fma-def77.2%
Simplified76.1%
Taylor expanded in h around 0 54.6%
Taylor expanded in d around 0 59.4%
*-commutative59.4%
associate-/r*59.5%
Simplified59.5%
sqrt-div70.3%
Applied egg-rr70.3%
Final simplification56.0%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d -1.45e+125)
(* d (- (pow (* h l) -0.5)))
(if (<= d -5.4e-170)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= d 2.5e-288)
(*
d
(sqrt (cbrt (* (/ (/ 1.0 l) h) (/ (* (/ 1.0 l) (/ (/ 1.0 h) l)) h)))))
(if (or (<= d 6.2e-134) (and (not (<= d 1.06e-64)) (<= d 58000000.0)))
(* (sqrt (/ h (pow l 3.0))) (/ -0.125 (/ (/ d (* M M)) (* D D))))
(* d (/ (sqrt (/ 1.0 l)) (sqrt h))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -1.45e+125) {
tmp = d * -pow((h * l), -0.5);
} else if (d <= -5.4e-170) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (d <= 2.5e-288) {
tmp = d * sqrt(cbrt((((1.0 / l) / h) * (((1.0 / l) * ((1.0 / h) / l)) / h))));
} else if ((d <= 6.2e-134) || (!(d <= 1.06e-64) && (d <= 58000000.0))) {
tmp = sqrt((h / pow(l, 3.0))) * (-0.125 / ((d / (M * M)) / (D * D)));
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -1.45e+125) {
tmp = d * -Math.pow((h * l), -0.5);
} else if (d <= -5.4e-170) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (d <= 2.5e-288) {
tmp = d * Math.sqrt(Math.cbrt((((1.0 / l) / h) * (((1.0 / l) * ((1.0 / h) / l)) / h))));
} else if ((d <= 6.2e-134) || (!(d <= 1.06e-64) && (d <= 58000000.0))) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (-0.125 / ((d / (M * M)) / (D * D)));
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
return tmp;
}
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -1.45e+125) tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5))); elseif (d <= -5.4e-170) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (d <= 2.5e-288) tmp = Float64(d * sqrt(cbrt(Float64(Float64(Float64(1.0 / l) / h) * Float64(Float64(Float64(1.0 / l) * Float64(Float64(1.0 / h) / l)) / h))))); elseif ((d <= 6.2e-134) || (!(d <= 1.06e-64) && (d <= 58000000.0))) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(-0.125 / Float64(Float64(d / Float64(M * M)) / Float64(D * D)))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -1.45e+125], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -5.4e-170], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.5e-288], N[(d * N[Sqrt[N[Power[N[(N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision] * N[(N[(N[(1.0 / l), $MachinePrecision] * N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d, 6.2e-134], And[N[Not[LessEqual[d, 1.06e-64]], $MachinePrecision], LessEqual[d, 58000000.0]]], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 / N[(N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.45 \cdot 10^{+125}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{elif}\;d \leq -5.4 \cdot 10^{-170}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;d \leq 2.5 \cdot 10^{-288}:\\
\;\;\;\;d \cdot \sqrt{\sqrt[3]{\frac{\frac{1}{\ell}}{h} \cdot \frac{\frac{1}{\ell} \cdot \frac{\frac{1}{h}}{\ell}}{h}}}\\
\mathbf{elif}\;d \leq 6.2 \cdot 10^{-134} \lor \neg \left(d \leq 1.06 \cdot 10^{-64}\right) \land d \leq 58000000:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{-0.125}{\frac{\frac{d}{M \cdot M}}{D \cdot D}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -1.44999999999999997e125Initial program 72.1%
associate-*l*72.1%
metadata-eval72.1%
unpow1/272.1%
metadata-eval72.1%
unpow1/272.1%
sub-neg72.1%
+-commutative72.1%
*-commutative72.1%
distribute-rgt-neg-in72.1%
fma-def72.1%
Simplified74.5%
Taylor expanded in h around 0 53.8%
*-rgt-identity53.8%
frac-2neg53.8%
sqrt-undiv63.5%
associate-*r/63.6%
Applied egg-rr63.6%
associate-/l*63.8%
associate-/r/63.6%
Simplified63.6%
Taylor expanded in d around -inf 65.7%
mul-1-neg65.7%
associate-/l/65.7%
unpow1/265.7%
distribute-rgt-neg-in65.7%
exp-to-pow63.4%
associate-/l/63.4%
log-rec63.4%
*-commutative63.4%
distribute-lft-neg-out63.4%
distribute-rgt-neg-in63.4%
metadata-eval63.4%
exp-prod63.4%
*-commutative63.4%
rem-exp-log65.9%
*-commutative65.9%
Simplified65.9%
if -1.44999999999999997e125 < d < -5.3999999999999997e-170Initial program 80.2%
associate-*l*80.2%
metadata-eval80.2%
unpow1/280.2%
metadata-eval80.2%
unpow1/280.2%
sub-neg80.2%
+-commutative80.2%
*-commutative80.2%
distribute-rgt-neg-in80.2%
fma-def80.2%
Simplified80.2%
Taylor expanded in h around 0 46.5%
*-rgt-identity46.5%
frac-2neg46.5%
sqrt-undiv52.7%
expm1-log1p-u51.3%
expm1-udef24.2%
sqrt-undiv22.7%
frac-2neg22.7%
Applied egg-rr22.7%
expm1-def45.3%
expm1-log1p46.5%
Simplified46.5%
if -5.3999999999999997e-170 < d < 2.50000000000000005e-288Initial program 37.6%
associate-*l*37.6%
metadata-eval37.6%
unpow1/237.6%
metadata-eval37.6%
unpow1/237.6%
sub-neg37.6%
+-commutative37.6%
*-commutative37.6%
distribute-rgt-neg-in37.6%
fma-def37.6%
Simplified34.6%
Taylor expanded in h around 0 10.4%
Taylor expanded in d around 0 19.3%
*-commutative19.3%
associate-/r*19.2%
Simplified19.2%
add-cbrt-cube27.6%
Applied egg-rr27.6%
associate-*r/27.7%
associate-/l/27.7%
inv-pow27.7%
pow-prod-down27.7%
inv-pow27.7%
inv-pow27.7%
div-inv27.7%
Applied egg-rr27.7%
if 2.50000000000000005e-288 < d < 6.20000000000000012e-134 or 1.06000000000000007e-64 < d < 5.8e7Initial program 72.5%
metadata-eval72.5%
unpow1/272.5%
metadata-eval72.5%
unpow1/272.5%
*-commutative72.5%
associate-*l*72.5%
times-frac72.5%
metadata-eval72.5%
Simplified72.5%
frac-2neg72.5%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around 0 51.0%
associate-*r*51.0%
*-commutative51.0%
associate-/l*53.7%
associate-*r/53.7%
associate-/l*53.7%
unpow253.7%
unpow253.7%
Simplified53.7%
if 6.20000000000000012e-134 < d < 1.06000000000000007e-64 or 5.8e7 < d Initial program 77.2%
associate-*l*77.2%
metadata-eval77.2%
unpow1/277.2%
metadata-eval77.2%
unpow1/277.2%
sub-neg77.2%
+-commutative77.2%
*-commutative77.2%
distribute-rgt-neg-in77.2%
fma-def77.2%
Simplified76.1%
Taylor expanded in h around 0 54.6%
Taylor expanded in d around 0 59.4%
*-commutative59.4%
associate-/r*59.5%
Simplified59.5%
sqrt-div70.3%
Applied egg-rr70.3%
Final simplification56.0%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* d (- (pow (* h l) -0.5)))))
(if (<= d -1.2e+125)
t_0
(if (<= d -3.4e-155)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= d -3.25e-295)
t_0
(if (<= d 1.45e-269)
(/ d (sqrt (* h l)))
(if (<= d 5e-211)
(* d (- (sqrt (/ (/ 1.0 h) l))))
(* d (/ (sqrt (/ 1.0 l)) (sqrt h))))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = d * -pow((h * l), -0.5);
double tmp;
if (d <= -1.2e+125) {
tmp = t_0;
} else if (d <= -3.4e-155) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (d <= -3.25e-295) {
tmp = t_0;
} else if (d <= 1.45e-269) {
tmp = d / sqrt((h * l));
} else if (d <= 5e-211) {
tmp = d * -sqrt(((1.0 / h) / l));
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = d * -((h * l) ** (-0.5d0))
if (d <= (-1.2d+125)) then
tmp = t_0
else if (d <= (-3.4d-155)) then
tmp = sqrt((d / h)) * sqrt((d / l))
else if (d <= (-3.25d-295)) then
tmp = t_0
else if (d <= 1.45d-269) then
tmp = d / sqrt((h * l))
else if (d <= 5d-211) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else
tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = d * -Math.pow((h * l), -0.5);
double tmp;
if (d <= -1.2e+125) {
tmp = t_0;
} else if (d <= -3.4e-155) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (d <= -3.25e-295) {
tmp = t_0;
} else if (d <= 1.45e-269) {
tmp = d / Math.sqrt((h * l));
} else if (d <= 5e-211) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = d * -math.pow((h * l), -0.5) tmp = 0 if d <= -1.2e+125: tmp = t_0 elif d <= -3.4e-155: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) elif d <= -3.25e-295: tmp = t_0 elif d <= 1.45e-269: tmp = d / math.sqrt((h * l)) elif d <= 5e-211: tmp = d * -math.sqrt(((1.0 / h) / l)) else: tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(d * Float64(-(Float64(h * l) ^ -0.5))) tmp = 0.0 if (d <= -1.2e+125) tmp = t_0; elseif (d <= -3.4e-155) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (d <= -3.25e-295) tmp = t_0; elseif (d <= 1.45e-269) tmp = Float64(d / sqrt(Float64(h * l))); elseif (d <= 5e-211) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = d * -((h * l) ^ -0.5);
tmp = 0.0;
if (d <= -1.2e+125)
tmp = t_0;
elseif (d <= -3.4e-155)
tmp = sqrt((d / h)) * sqrt((d / l));
elseif (d <= -3.25e-295)
tmp = t_0;
elseif (d <= 1.45e-269)
tmp = d / sqrt((h * l));
elseif (d <= 5e-211)
tmp = d * -sqrt(((1.0 / h) / l));
else
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[d, -1.2e+125], t$95$0, If[LessEqual[d, -3.4e-155], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -3.25e-295], t$95$0, If[LessEqual[d, 1.45e-269], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5e-211], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{if}\;d \leq -1.2 \cdot 10^{+125}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -3.4 \cdot 10^{-155}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;d \leq -3.25 \cdot 10^{-295}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 1.45 \cdot 10^{-269}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq 5 \cdot 10^{-211}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -1.2e125 or -3.4e-155 < d < -3.2499999999999999e-295Initial program 55.3%
associate-*l*55.3%
metadata-eval55.3%
unpow1/255.3%
metadata-eval55.3%
unpow1/255.3%
sub-neg55.3%
+-commutative55.3%
*-commutative55.3%
distribute-rgt-neg-in55.3%
fma-def55.3%
Simplified55.1%
Taylor expanded in h around 0 37.3%
*-rgt-identity37.3%
frac-2neg37.3%
sqrt-undiv50.6%
associate-*r/50.7%
Applied egg-rr50.7%
associate-/l*50.7%
associate-/r/50.6%
Simplified50.6%
Taylor expanded in d around -inf 51.9%
mul-1-neg51.9%
associate-/l/51.9%
unpow1/251.9%
distribute-rgt-neg-in51.9%
exp-to-pow49.5%
associate-/l/49.5%
log-rec49.5%
*-commutative49.5%
distribute-lft-neg-out49.5%
distribute-rgt-neg-in49.5%
metadata-eval49.5%
exp-prod49.5%
*-commutative49.5%
rem-exp-log51.9%
*-commutative51.9%
Simplified51.9%
if -1.2e125 < d < -3.4e-155Initial program 84.7%
associate-*l*84.8%
metadata-eval84.8%
unpow1/284.8%
metadata-eval84.8%
unpow1/284.8%
sub-neg84.8%
+-commutative84.8%
*-commutative84.8%
distribute-rgt-neg-in84.8%
fma-def84.8%
Simplified84.8%
Taylor expanded in h around 0 46.6%
*-rgt-identity46.6%
frac-2neg46.6%
sqrt-undiv48.3%
expm1-log1p-u46.7%
expm1-udef26.8%
sqrt-undiv25.1%
frac-2neg25.1%
Applied egg-rr25.1%
expm1-def45.2%
expm1-log1p46.6%
Simplified46.6%
if -3.2499999999999999e-295 < d < 1.45e-269Initial program 43.4%
associate-*l*43.4%
metadata-eval43.4%
unpow1/243.4%
metadata-eval43.4%
unpow1/243.4%
sub-neg43.4%
+-commutative43.4%
*-commutative43.4%
distribute-rgt-neg-in43.4%
fma-def43.4%
Simplified43.4%
Taylor expanded in h around 0 16.2%
Taylor expanded in d around 0 44.6%
*-commutative44.6%
associate-/r*44.5%
Simplified44.5%
Taylor expanded in l around 0 44.6%
*-commutative44.6%
associate-/r*44.6%
Simplified44.6%
div-inv44.6%
inv-pow44.6%
inv-pow44.6%
pow-prod-down44.6%
inv-pow44.6%
associate-/l/44.5%
add-cbrt-cube37.4%
add-cbrt-cube44.5%
add-sqr-sqrt44.5%
expm1-log1p-u15.9%
expm1-udef2.8%
Applied egg-rr2.8%
expm1-def16.0%
expm1-log1p44.6%
associate-*r/44.6%
*-rgt-identity44.6%
Simplified44.6%
if 1.45e-269 < d < 5.0000000000000002e-211Initial program 73.1%
associate-*l*73.1%
metadata-eval73.1%
unpow1/273.1%
metadata-eval73.1%
unpow1/273.1%
sub-neg73.1%
+-commutative73.1%
*-commutative73.1%
distribute-rgt-neg-in73.1%
fma-def73.1%
Simplified73.1%
Taylor expanded in h around 0 1.2%
*-rgt-identity1.2%
frac-2neg1.2%
sqrt-undiv0.0%
associate-*r/0.0%
Applied egg-rr0.0%
associate-/l*0.0%
associate-/r/0.0%
Simplified0.0%
Taylor expanded in d around -inf 46.9%
mul-1-neg46.9%
associate-/l/46.9%
unpow1/246.9%
distribute-rgt-neg-in46.9%
unpow1/246.9%
Simplified46.9%
if 5.0000000000000002e-211 < d Initial program 78.0%
associate-*l*78.0%
metadata-eval78.0%
unpow1/278.0%
metadata-eval78.0%
unpow1/278.0%
sub-neg78.0%
+-commutative78.0%
*-commutative78.0%
distribute-rgt-neg-in78.0%
fma-def78.0%
Simplified77.1%
Taylor expanded in h around 0 47.9%
Taylor expanded in d around 0 50.0%
*-commutative50.0%
associate-/r*50.1%
Simplified50.1%
sqrt-div60.5%
Applied egg-rr60.5%
Final simplification53.9%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* d (- (pow (* h l) -0.5)))))
(if (<= d -1.25e+118)
t_0
(if (<= d -1.55e-155)
(/ (sqrt (/ (* d (- d)) h)) (sqrt (- l)))
(if (<= d -7e-295)
t_0
(if (<= d 1.7e-270)
(/ d (sqrt (* h l)))
(if (<= d 4.9e-210)
(* d (- (sqrt (/ (/ 1.0 h) l))))
(* d (/ (sqrt (/ 1.0 l)) (sqrt h))))))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = d * -pow((h * l), -0.5);
double tmp;
if (d <= -1.25e+118) {
tmp = t_0;
} else if (d <= -1.55e-155) {
tmp = sqrt(((d * -d) / h)) / sqrt(-l);
} else if (d <= -7e-295) {
tmp = t_0;
} else if (d <= 1.7e-270) {
tmp = d / sqrt((h * l));
} else if (d <= 4.9e-210) {
tmp = d * -sqrt(((1.0 / h) / l));
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = d * -((h * l) ** (-0.5d0))
if (d <= (-1.25d+118)) then
tmp = t_0
else if (d <= (-1.55d-155)) then
tmp = sqrt(((d * -d) / h)) / sqrt(-l)
else if (d <= (-7d-295)) then
tmp = t_0
else if (d <= 1.7d-270) then
tmp = d / sqrt((h * l))
else if (d <= 4.9d-210) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else
tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = d * -Math.pow((h * l), -0.5);
double tmp;
if (d <= -1.25e+118) {
tmp = t_0;
} else if (d <= -1.55e-155) {
tmp = Math.sqrt(((d * -d) / h)) / Math.sqrt(-l);
} else if (d <= -7e-295) {
tmp = t_0;
} else if (d <= 1.7e-270) {
tmp = d / Math.sqrt((h * l));
} else if (d <= 4.9e-210) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = d * -math.pow((h * l), -0.5) tmp = 0 if d <= -1.25e+118: tmp = t_0 elif d <= -1.55e-155: tmp = math.sqrt(((d * -d) / h)) / math.sqrt(-l) elif d <= -7e-295: tmp = t_0 elif d <= 1.7e-270: tmp = d / math.sqrt((h * l)) elif d <= 4.9e-210: tmp = d * -math.sqrt(((1.0 / h) / l)) else: tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(d * Float64(-(Float64(h * l) ^ -0.5))) tmp = 0.0 if (d <= -1.25e+118) tmp = t_0; elseif (d <= -1.55e-155) tmp = Float64(sqrt(Float64(Float64(d * Float64(-d)) / h)) / sqrt(Float64(-l))); elseif (d <= -7e-295) tmp = t_0; elseif (d <= 1.7e-270) tmp = Float64(d / sqrt(Float64(h * l))); elseif (d <= 4.9e-210) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = d * -((h * l) ^ -0.5);
tmp = 0.0;
if (d <= -1.25e+118)
tmp = t_0;
elseif (d <= -1.55e-155)
tmp = sqrt(((d * -d) / h)) / sqrt(-l);
elseif (d <= -7e-295)
tmp = t_0;
elseif (d <= 1.7e-270)
tmp = d / sqrt((h * l));
elseif (d <= 4.9e-210)
tmp = d * -sqrt(((1.0 / h) / l));
else
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[d, -1.25e+118], t$95$0, If[LessEqual[d, -1.55e-155], N[(N[Sqrt[N[(N[(d * (-d)), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -7e-295], t$95$0, If[LessEqual[d, 1.7e-270], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4.9e-210], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{if}\;d \leq -1.25 \cdot 10^{+118}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -1.55 \cdot 10^{-155}:\\
\;\;\;\;\frac{\sqrt{\frac{d \cdot \left(-d\right)}{h}}}{\sqrt{-\ell}}\\
\mathbf{elif}\;d \leq -7 \cdot 10^{-295}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 1.7 \cdot 10^{-270}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq 4.9 \cdot 10^{-210}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -1.24999999999999993e118 or -1.55e-155 < d < -6.99999999999999977e-295Initial program 57.7%
associate-*l*57.7%
metadata-eval57.7%
unpow1/257.7%
metadata-eval57.7%
unpow1/257.7%
sub-neg57.7%
+-commutative57.7%
*-commutative57.7%
distribute-rgt-neg-in57.7%
fma-def57.7%
Simplified57.5%
Taylor expanded in h around 0 40.7%
*-rgt-identity40.7%
frac-2neg40.7%
sqrt-undiv53.3%
associate-*r/53.3%
Applied egg-rr53.3%
associate-/l*53.4%
associate-/r/53.2%
Simplified53.2%
Taylor expanded in d around -inf 54.4%
mul-1-neg54.4%
associate-/l/54.4%
unpow1/254.4%
distribute-rgt-neg-in54.4%
exp-to-pow51.9%
associate-/l/51.9%
log-rec51.9%
*-commutative51.9%
distribute-lft-neg-out51.9%
distribute-rgt-neg-in51.9%
metadata-eval51.9%
exp-prod51.9%
*-commutative51.9%
rem-exp-log54.5%
*-commutative54.5%
Simplified54.5%
if -1.24999999999999993e118 < d < -1.55e-155Initial program 83.5%
associate-*l*83.5%
metadata-eval83.5%
unpow1/283.5%
metadata-eval83.5%
unpow1/283.5%
sub-neg83.5%
+-commutative83.5%
*-commutative83.5%
distribute-rgt-neg-in83.5%
fma-def83.5%
Simplified83.6%
Taylor expanded in h around 0 42.2%
*-rgt-identity42.2%
frac-2neg42.2%
sqrt-undiv44.0%
associate-*r/44.1%
Applied egg-rr44.1%
associate-/l*44.0%
associate-/r/44.0%
Simplified44.0%
associate-*l/44.1%
pow1/244.1%
pow1/244.1%
pow-prod-down43.0%
Applied egg-rr43.0%
unpow1/243.0%
associate-*l/43.0%
distribute-rgt-neg-out43.0%
Simplified43.0%
if -6.99999999999999977e-295 < d < 1.7e-270Initial program 43.4%
associate-*l*43.4%
metadata-eval43.4%
unpow1/243.4%
metadata-eval43.4%
unpow1/243.4%
sub-neg43.4%
+-commutative43.4%
*-commutative43.4%
distribute-rgt-neg-in43.4%
fma-def43.4%
Simplified43.4%
Taylor expanded in h around 0 16.2%
Taylor expanded in d around 0 44.6%
*-commutative44.6%
associate-/r*44.5%
Simplified44.5%
Taylor expanded in l around 0 44.6%
*-commutative44.6%
associate-/r*44.6%
Simplified44.6%
div-inv44.6%
inv-pow44.6%
inv-pow44.6%
pow-prod-down44.6%
inv-pow44.6%
associate-/l/44.5%
add-cbrt-cube37.4%
add-cbrt-cube44.5%
add-sqr-sqrt44.5%
expm1-log1p-u15.9%
expm1-udef2.8%
Applied egg-rr2.8%
expm1-def16.0%
expm1-log1p44.6%
associate-*r/44.6%
*-rgt-identity44.6%
Simplified44.6%
if 1.7e-270 < d < 4.8999999999999998e-210Initial program 73.1%
associate-*l*73.1%
metadata-eval73.1%
unpow1/273.1%
metadata-eval73.1%
unpow1/273.1%
sub-neg73.1%
+-commutative73.1%
*-commutative73.1%
distribute-rgt-neg-in73.1%
fma-def73.1%
Simplified73.1%
Taylor expanded in h around 0 1.2%
*-rgt-identity1.2%
frac-2neg1.2%
sqrt-undiv0.0%
associate-*r/0.0%
Applied egg-rr0.0%
associate-/l*0.0%
associate-/r/0.0%
Simplified0.0%
Taylor expanded in d around -inf 46.9%
mul-1-neg46.9%
associate-/l/46.9%
unpow1/246.9%
distribute-rgt-neg-in46.9%
unpow1/246.9%
Simplified46.9%
if 4.8999999999999998e-210 < d Initial program 78.0%
associate-*l*78.0%
metadata-eval78.0%
unpow1/278.0%
metadata-eval78.0%
unpow1/278.0%
sub-neg78.0%
+-commutative78.0%
*-commutative78.0%
distribute-rgt-neg-in78.0%
fma-def78.0%
Simplified77.1%
Taylor expanded in h around 0 47.9%
Taylor expanded in d around 0 50.0%
*-commutative50.0%
associate-/r*50.1%
Simplified50.1%
sqrt-div60.5%
Applied egg-rr60.5%
Final simplification54.0%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d -4.4e-295)
(* d (- (pow (* h l) -0.5)))
(if (<= d 8e-269)
(/ d (sqrt (* h l)))
(if (<= d 3.8e-211)
(* d (- (sqrt (/ (/ 1.0 h) l))))
(* d (/ (sqrt (/ 1.0 l)) (sqrt h)))))))assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -4.4e-295) {
tmp = d * -pow((h * l), -0.5);
} else if (d <= 8e-269) {
tmp = d / sqrt((h * l));
} else if (d <= 3.8e-211) {
tmp = d * -sqrt(((1.0 / h) / l));
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= (-4.4d-295)) then
tmp = d * -((h * l) ** (-0.5d0))
else if (d <= 8d-269) then
tmp = d / sqrt((h * l))
else if (d <= 3.8d-211) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else
tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -4.4e-295) {
tmp = d * -Math.pow((h * l), -0.5);
} else if (d <= 8e-269) {
tmp = d / Math.sqrt((h * l));
} else if (d <= 3.8e-211) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= -4.4e-295: tmp = d * -math.pow((h * l), -0.5) elif d <= 8e-269: tmp = d / math.sqrt((h * l)) elif d <= 3.8e-211: tmp = d * -math.sqrt(((1.0 / h) / l)) else: tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -4.4e-295) tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5))); elseif (d <= 8e-269) tmp = Float64(d / sqrt(Float64(h * l))); elseif (d <= 3.8e-211) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= -4.4e-295)
tmp = d * -((h * l) ^ -0.5);
elseif (d <= 8e-269)
tmp = d / sqrt((h * l));
elseif (d <= 3.8e-211)
tmp = d * -sqrt(((1.0 / h) / l));
else
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -4.4e-295], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, 8e-269], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.8e-211], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -4.4 \cdot 10^{-295}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{elif}\;d \leq 8 \cdot 10^{-269}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq 3.8 \cdot 10^{-211}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -4.4000000000000004e-295Initial program 67.8%
associate-*l*67.8%
metadata-eval67.8%
unpow1/267.8%
metadata-eval67.8%
unpow1/267.8%
sub-neg67.8%
+-commutative67.8%
*-commutative67.8%
distribute-rgt-neg-in67.8%
fma-def67.8%
Simplified67.8%
Taylor expanded in h around 0 41.2%
*-rgt-identity41.2%
frac-2neg41.2%
sqrt-undiv49.6%
associate-*r/49.7%
Applied egg-rr49.7%
associate-/l*49.7%
associate-/r/49.6%
Simplified49.6%
Taylor expanded in d around -inf 41.8%
mul-1-neg41.8%
associate-/l/41.8%
unpow1/241.8%
distribute-rgt-neg-in41.8%
exp-to-pow39.8%
associate-/l/39.8%
log-rec41.0%
*-commutative41.0%
distribute-lft-neg-out41.0%
distribute-rgt-neg-in41.0%
metadata-eval41.0%
exp-prod41.0%
*-commutative41.0%
rem-exp-log43.0%
*-commutative43.0%
Simplified43.0%
if -4.4000000000000004e-295 < d < 7.9999999999999997e-269Initial program 43.4%
associate-*l*43.4%
metadata-eval43.4%
unpow1/243.4%
metadata-eval43.4%
unpow1/243.4%
sub-neg43.4%
+-commutative43.4%
*-commutative43.4%
distribute-rgt-neg-in43.4%
fma-def43.4%
Simplified43.4%
Taylor expanded in h around 0 16.2%
Taylor expanded in d around 0 44.6%
*-commutative44.6%
associate-/r*44.5%
Simplified44.5%
Taylor expanded in l around 0 44.6%
*-commutative44.6%
associate-/r*44.6%
Simplified44.6%
div-inv44.6%
inv-pow44.6%
inv-pow44.6%
pow-prod-down44.6%
inv-pow44.6%
associate-/l/44.5%
add-cbrt-cube37.4%
add-cbrt-cube44.5%
add-sqr-sqrt44.5%
expm1-log1p-u15.9%
expm1-udef2.8%
Applied egg-rr2.8%
expm1-def16.0%
expm1-log1p44.6%
associate-*r/44.6%
*-rgt-identity44.6%
Simplified44.6%
if 7.9999999999999997e-269 < d < 3.80000000000000012e-211Initial program 73.1%
associate-*l*73.1%
metadata-eval73.1%
unpow1/273.1%
metadata-eval73.1%
unpow1/273.1%
sub-neg73.1%
+-commutative73.1%
*-commutative73.1%
distribute-rgt-neg-in73.1%
fma-def73.1%
Simplified73.1%
Taylor expanded in h around 0 1.2%
*-rgt-identity1.2%
frac-2neg1.2%
sqrt-undiv0.0%
associate-*r/0.0%
Applied egg-rr0.0%
associate-/l*0.0%
associate-/r/0.0%
Simplified0.0%
Taylor expanded in d around -inf 46.9%
mul-1-neg46.9%
associate-/l/46.9%
unpow1/246.9%
distribute-rgt-neg-in46.9%
unpow1/246.9%
Simplified46.9%
if 3.80000000000000012e-211 < d Initial program 78.0%
associate-*l*78.0%
metadata-eval78.0%
unpow1/278.0%
metadata-eval78.0%
unpow1/278.0%
sub-neg78.0%
+-commutative78.0%
*-commutative78.0%
distribute-rgt-neg-in78.0%
fma-def78.0%
Simplified77.1%
Taylor expanded in h around 0 47.9%
Taylor expanded in d around 0 50.0%
*-commutative50.0%
associate-/r*50.1%
Simplified50.1%
sqrt-div60.5%
Applied egg-rr60.5%
Final simplification50.7%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= l -2.1e-265) (* d (- (pow (* h l) -0.5))) (/ d (sqrt (* h l)))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2.1e-265) {
tmp = d * -pow((h * l), -0.5);
} else {
tmp = d / sqrt((h * l));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-2.1d-265)) then
tmp = d * -((h * l) ** (-0.5d0))
else
tmp = d / sqrt((h * l))
end if
code = tmp
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2.1e-265) {
tmp = d * -Math.pow((h * l), -0.5);
} else {
tmp = d / Math.sqrt((h * l));
}
return tmp;
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -2.1e-265: tmp = d * -math.pow((h * l), -0.5) else: tmp = d / math.sqrt((h * l)) return tmp
M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -2.1e-265) tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5))); else tmp = Float64(d / sqrt(Float64(h * l))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -2.1e-265)
tmp = d * -((h * l) ^ -0.5);
else
tmp = d / sqrt((h * l));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2.1e-265], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.1 \cdot 10^{-265}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if l < -2.10000000000000004e-265Initial program 66.8%
associate-*l*66.8%
metadata-eval66.8%
unpow1/266.8%
metadata-eval66.8%
unpow1/266.8%
sub-neg66.8%
+-commutative66.8%
*-commutative66.8%
distribute-rgt-neg-in66.8%
fma-def66.8%
Simplified66.7%
Taylor expanded in h around 0 42.9%
*-rgt-identity42.9%
frac-2neg42.9%
sqrt-undiv51.8%
associate-*r/51.8%
Applied egg-rr51.8%
associate-/l*51.9%
associate-/r/51.8%
Simplified51.8%
Taylor expanded in d around -inf 44.3%
mul-1-neg44.3%
associate-/l/44.3%
unpow1/244.3%
distribute-rgt-neg-in44.3%
exp-to-pow42.2%
associate-/l/42.2%
log-rec43.4%
*-commutative43.4%
distribute-lft-neg-out43.4%
distribute-rgt-neg-in43.4%
metadata-eval43.4%
exp-prod43.4%
*-commutative43.4%
rem-exp-log45.6%
*-commutative45.6%
Simplified45.6%
if -2.10000000000000004e-265 < l Initial program 74.5%
associate-*l*74.5%
metadata-eval74.5%
unpow1/274.5%
metadata-eval74.5%
unpow1/274.5%
sub-neg74.5%
+-commutative74.5%
*-commutative74.5%
distribute-rgt-neg-in74.5%
fma-def74.5%
Simplified73.9%
Taylor expanded in h around 0 39.4%
Taylor expanded in d around 0 42.7%
*-commutative42.7%
associate-/r*42.7%
Simplified42.7%
Taylor expanded in l around 0 42.7%
*-commutative42.7%
associate-/r*42.7%
Simplified42.7%
div-inv42.7%
inv-pow42.7%
inv-pow42.7%
pow-prod-down42.7%
inv-pow42.7%
associate-/l/42.7%
add-cbrt-cube29.8%
add-cbrt-cube42.7%
add-sqr-sqrt42.6%
expm1-log1p-u38.4%
expm1-udef30.7%
Applied egg-rr31.4%
expm1-def39.1%
expm1-log1p43.3%
associate-*r/43.4%
*-rgt-identity43.4%
Simplified43.4%
Final simplification44.4%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (/ d (sqrt (* h l))))
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d / sqrt((h * l));
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = d / sqrt((h * l))
end function
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d / Math.sqrt((h * l));
}
[M, D] = sort([M, D]) def code(d, h, l, M, D): return d / math.sqrt((h * l))
M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d / sqrt(Float64(h * l))) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d / sqrt((h * l));
end
NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Initial program 71.1%
associate-*l*71.0%
metadata-eval71.0%
unpow1/271.0%
metadata-eval71.0%
unpow1/271.0%
sub-neg71.0%
+-commutative71.0%
*-commutative71.0%
distribute-rgt-neg-in71.0%
fma-def71.0%
Simplified70.6%
Taylor expanded in h around 0 41.0%
Taylor expanded in d around 0 26.1%
*-commutative26.1%
associate-/r*26.1%
Simplified26.1%
Taylor expanded in l around 0 26.1%
*-commutative26.1%
associate-/r*26.1%
Simplified26.1%
div-inv26.1%
inv-pow26.1%
inv-pow26.1%
pow-prod-down26.1%
inv-pow26.1%
associate-/l/26.1%
add-cbrt-cube21.3%
add-cbrt-cube26.1%
add-sqr-sqrt26.0%
expm1-log1p-u22.3%
expm1-udef18.0%
Applied egg-rr18.3%
expm1-def22.6%
expm1-log1p26.4%
associate-*r/26.5%
*-rgt-identity26.5%
Simplified26.5%
Final simplification26.5%
herbie shell --seed 2023174
(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)))))