
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 24 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 (* 0.5 (* (pow (* (/ M 2.0) (/ D d)) 2.0) (/ h l)))))
(t_1 (sqrt (- d))))
(if (<= h -5e-311)
(* (/ t_1 (sqrt (- h))) (* (/ t_1 (sqrt (- l))) t_0))
(if (<= h 5.9e+172)
(*
(sqrt (/ d h))
(*
(/ (sqrt d) (sqrt l))
(- 1.0 (* 0.5 (pow (* (* D (* M (/ 0.5 d))) (sqrt (/ h l))) 2.0)))))
(* (/ (sqrt d) (sqrt h)) (* t_0 (sqrt (/ d l))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 - (0.5 * (pow(((M / 2.0) * (D / d)), 2.0) * (h / l)));
double t_1 = sqrt(-d);
double tmp;
if (h <= -5e-311) {
tmp = (t_1 / sqrt(-h)) * ((t_1 / sqrt(-l)) * t_0);
} else if (h <= 5.9e+172) {
tmp = sqrt((d / h)) * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * pow(((D * (M * (0.5 / d))) * sqrt((h / l))), 2.0))));
} else {
tmp = (sqrt(d) / sqrt(h)) * (t_0 * sqrt((d / l)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 = 1.0d0 - (0.5d0 * ((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (h / l)))
t_1 = sqrt(-d)
if (h <= (-5d-311)) then
tmp = (t_1 / sqrt(-h)) * ((t_1 / sqrt(-l)) * t_0)
else if (h <= 5.9d+172) then
tmp = sqrt((d / h)) * ((sqrt(d) / sqrt(l)) * (1.0d0 - (0.5d0 * (((d_1 * (m * (0.5d0 / d))) * sqrt((h / l))) ** 2.0d0))))
else
tmp = (sqrt(d) / sqrt(h)) * (t_0 * sqrt((d / l)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 - (0.5 * (Math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l)));
double t_1 = Math.sqrt(-d);
double tmp;
if (h <= -5e-311) {
tmp = (t_1 / Math.sqrt(-h)) * ((t_1 / Math.sqrt(-l)) * t_0);
} else if (h <= 5.9e+172) {
tmp = Math.sqrt((d / h)) * ((Math.sqrt(d) / Math.sqrt(l)) * (1.0 - (0.5 * Math.pow(((D * (M * (0.5 / d))) * Math.sqrt((h / l))), 2.0))));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (t_0 * Math.sqrt((d / l)));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 1.0 - (0.5 * (math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l))) t_1 = math.sqrt(-d) tmp = 0 if h <= -5e-311: tmp = (t_1 / math.sqrt(-h)) * ((t_1 / math.sqrt(-l)) * t_0) elif h <= 5.9e+172: tmp = math.sqrt((d / h)) * ((math.sqrt(d) / math.sqrt(l)) * (1.0 - (0.5 * math.pow(((D * (M * (0.5 / d))) * math.sqrt((h / l))), 2.0)))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * (t_0 * math.sqrt((d / l))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(h / l)))) t_1 = sqrt(Float64(-d)) tmp = 0.0 if (h <= -5e-311) tmp = Float64(Float64(t_1 / sqrt(Float64(-h))) * Float64(Float64(t_1 / sqrt(Float64(-l))) * t_0)); elseif (h <= 5.9e+172) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(sqrt(d) / sqrt(l)) * Float64(1.0 - Float64(0.5 * (Float64(Float64(D * Float64(M * Float64(0.5 / d))) * sqrt(Float64(h / l))) ^ 2.0))))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_0 * sqrt(Float64(d / l)))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 1.0 - (0.5 * ((((M / 2.0) * (D / d)) ^ 2.0) * (h / l)));
t_1 = sqrt(-d);
tmp = 0.0;
if (h <= -5e-311)
tmp = (t_1 / sqrt(-h)) * ((t_1 / sqrt(-l)) * t_0);
elseif (h <= 5.9e+172)
tmp = sqrt((d / h)) * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * (((D * (M * (0.5 / d))) * sqrt((h / l))) ^ 2.0))));
else
tmp = (sqrt(d) / sqrt(h)) * (t_0 * sqrt((d / l)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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[(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]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[h, -5e-311], N[(N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 5.9e+172], 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[Power[N[(N[(D * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\\
t_1 := \sqrt{-d}\\
\mathbf{if}\;h \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\frac{t_1}{\sqrt{-h}} \cdot \left(\frac{t_1}{\sqrt{-\ell}} \cdot t_0\right)\\
\mathbf{elif}\;h \leq 5.9 \cdot 10^{+172}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(1 - 0.5 \cdot {\left(\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t_0 \cdot \sqrt{\frac{d}{\ell}}\right)\\
\end{array}
\end{array}
if h < -5.00000000000023e-311Initial program 67.2%
Simplified67.7%
frac-2neg67.7%
sqrt-div81.7%
Applied egg-rr81.7%
frac-2neg81.7%
sqrt-div85.3%
Applied egg-rr85.3%
if -5.00000000000023e-311 < h < 5.8999999999999998e172Initial program 69.0%
Simplified66.9%
add-sqr-sqrt66.9%
pow266.9%
times-frac69.0%
sqrt-prod69.0%
sqrt-pow171.9%
metadata-eval71.9%
pow171.9%
div-inv71.9%
associate-*r*68.9%
associate-/r*68.9%
metadata-eval68.9%
Applied egg-rr68.9%
associate-*r*71.9%
*-commutative71.9%
associate-*r*72.1%
Simplified72.1%
sqrt-div82.2%
div-inv82.2%
Applied egg-rr82.2%
associate-*r/82.2%
*-rgt-identity82.2%
Simplified82.2%
if 5.8999999999999998e172 < h Initial program 45.0%
Simplified45.0%
sqrt-div78.7%
div-inv78.7%
Applied egg-rr78.7%
associate-*r/78.7%
*-rgt-identity78.7%
Simplified78.7%
Final simplification83.2%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* M D) (* d 2.0)) 2.0))))))
(t_2 (sqrt (/ d l))))
(if (<= t_1 -1e-244)
(*
t_2
(* t_0 (+ 1.0 (* (pow (/ (/ M d) (/ -2.0 D)) 2.0) (/ -0.5 (/ l h))))))
(if (or (<= t_1 5e-202) (not (<= t_1 1e+254)))
(fabs (/ d (sqrt (* h l))))
(*
t_2
(*
t_0
(+ 1.0 (* (/ (pow (* D (* M (/ 0.5 d))) 2.0) l) (* h -0.5)))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double t_1 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((M * D) / (d * 2.0)), 2.0))));
double t_2 = sqrt((d / l));
double tmp;
if (t_1 <= -1e-244) {
tmp = t_2 * (t_0 * (1.0 + (pow(((M / d) / (-2.0 / D)), 2.0) * (-0.5 / (l / h)))));
} else if ((t_1 <= 5e-202) || !(t_1 <= 1e+254)) {
tmp = fabs((d / sqrt((h * l))));
} else {
tmp = t_2 * (t_0 * (1.0 + ((pow((D * (M * (0.5 / d))), 2.0) / l) * (h * -0.5))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = sqrt((d / h))
t_1 = (((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((h / l) * (0.5d0 * (((m * d_1) / (d * 2.0d0)) ** 2.0d0))))
t_2 = sqrt((d / l))
if (t_1 <= (-1d-244)) then
tmp = t_2 * (t_0 * (1.0d0 + ((((m / d) / ((-2.0d0) / d_1)) ** 2.0d0) * ((-0.5d0) / (l / h)))))
else if ((t_1 <= 5d-202) .or. (.not. (t_1 <= 1d+254))) then
tmp = abs((d / sqrt((h * l))))
else
tmp = t_2 * (t_0 * (1.0d0 + ((((d_1 * (m * (0.5d0 / d))) ** 2.0d0) / l) * (h * (-0.5d0)))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
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.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((M * D) / (d * 2.0)), 2.0))));
double t_2 = Math.sqrt((d / l));
double tmp;
if (t_1 <= -1e-244) {
tmp = t_2 * (t_0 * (1.0 + (Math.pow(((M / d) / (-2.0 / D)), 2.0) * (-0.5 / (l / h)))));
} else if ((t_1 <= 5e-202) || !(t_1 <= 1e+254)) {
tmp = Math.abs((d / Math.sqrt((h * l))));
} else {
tmp = t_2 * (t_0 * (1.0 + ((Math.pow((D * (M * (0.5 / d))), 2.0) / l) * (h * -0.5))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) t_1 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((M * D) / (d * 2.0)), 2.0)))) t_2 = math.sqrt((d / l)) tmp = 0 if t_1 <= -1e-244: tmp = t_2 * (t_0 * (1.0 + (math.pow(((M / d) / (-2.0 / D)), 2.0) * (-0.5 / (l / h))))) elif (t_1 <= 5e-202) or not (t_1 <= 1e+254): tmp = math.fabs((d / math.sqrt((h * l)))) else: tmp = t_2 * (t_0 * (1.0 + ((math.pow((D * (M * (0.5 / d))), 2.0) / l) * (h * -0.5)))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) t_1 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0))))) t_2 = sqrt(Float64(d / l)) tmp = 0.0 if (t_1 <= -1e-244) tmp = Float64(t_2 * Float64(t_0 * Float64(1.0 + Float64((Float64(Float64(M / d) / Float64(-2.0 / D)) ^ 2.0) * Float64(-0.5 / Float64(l / h)))))); elseif ((t_1 <= 5e-202) || !(t_1 <= 1e+254)) tmp = abs(Float64(d / sqrt(Float64(h * l)))); else tmp = Float64(t_2 * Float64(t_0 * Float64(1.0 + Float64(Float64((Float64(D * Float64(M * Float64(0.5 / d))) ^ 2.0) / l) * Float64(h * -0.5))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / h));
t_1 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((M * D) / (d * 2.0)) ^ 2.0))));
t_2 = sqrt((d / l));
tmp = 0.0;
if (t_1 <= -1e-244)
tmp = t_2 * (t_0 * (1.0 + ((((M / d) / (-2.0 / D)) ^ 2.0) * (-0.5 / (l / h)))));
elseif ((t_1 <= 5e-202) || ~((t_1 <= 1e+254)))
tmp = abs((d / sqrt((h * l))));
else
tmp = t_2 * (t_0 * (1.0 + ((((D * (M * (0.5 / d))) ^ 2.0) / l) * (h * -0.5))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -1e-244], N[(t$95$2 * N[(t$95$0 * N[(1.0 + N[(N[Power[N[(N[(M / d), $MachinePrecision] / N[(-2.0 / D), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$1, 5e-202], N[Not[LessEqual[t$95$1, 1e+254]], $MachinePrecision]], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(t$95$2 * N[(t$95$0 * N[(1.0 + N[(N[(N[Power[N[(D * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision] * N[(h * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right)\\
t_2 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;t_1 \leq -1 \cdot 10^{-244}:\\
\;\;\;\;t_2 \cdot \left(t_0 \cdot \left(1 + {\left(\frac{\frac{M}{d}}{\frac{-2}{D}}\right)}^{2} \cdot \frac{-0.5}{\frac{\ell}{h}}\right)\right)\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{-202} \lor \neg \left(t_1 \leq 10^{+254}\right):\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \left(t_0 \cdot \left(1 + \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell} \cdot \left(h \cdot -0.5\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < -9.9999999999999993e-245Initial program 88.2%
Simplified87.8%
fma-udef87.8%
*-commutative87.8%
associate-/r*88.3%
associate-*r/88.3%
associate-/l*88.3%
Applied egg-rr88.3%
if -9.9999999999999993e-245 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 4.99999999999999973e-202 or 9.9999999999999994e253 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) Initial program 24.0%
Simplified22.6%
Taylor expanded in M around 0 29.7%
*-rgt-identity29.7%
pow1/229.7%
pow1/229.7%
pow-prod-down29.5%
Applied egg-rr29.5%
unpow1/229.5%
Simplified29.5%
sqrt-prod29.7%
frac-2neg29.7%
sqrt-undiv10.9%
*-commutative10.9%
add-sqr-sqrt10.9%
sqrt-prod9.6%
rem-sqrt-square10.9%
*-commutative10.9%
sqrt-undiv29.7%
frac-2neg29.7%
sqrt-prod29.5%
frac-times37.1%
sqrt-div40.0%
sqrt-unprod35.4%
add-sqr-sqrt57.7%
Applied egg-rr57.7%
if 4.99999999999999973e-202 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 9.9999999999999994e253Initial program 97.8%
Simplified99.0%
fma-udef99.0%
*-commutative99.0%
associate-/r*99.0%
associate-*r/99.0%
associate-/l*99.0%
Applied egg-rr99.0%
clear-num99.0%
un-div-inv99.0%
Applied egg-rr99.0%
associate-/r/99.0%
*-commutative99.0%
associate-*r*99.0%
*-commutative99.0%
*-commutative99.0%
Simplified99.0%
Final simplification79.0%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* M D) (* d 2.0)) 2.0))))))
(t_2 (sqrt (/ d h))))
(if (<= t_1 -1e-244)
(*
t_2
(*
t_0
(- 1.0 (* 0.5 (pow (* (sqrt (/ h l)) (* 0.5 (* D (/ M d)))) 2.0)))))
(if (or (<= t_1 5e-202) (not (<= t_1 1e+254)))
(fabs (/ d (sqrt (* h l))))
(*
t_0
(*
t_2
(+ 1.0 (* (/ (pow (* D (* M (/ 0.5 d))) 2.0) l) (* h -0.5)))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((M * D) / (d * 2.0)), 2.0))));
double t_2 = sqrt((d / h));
double tmp;
if (t_1 <= -1e-244) {
tmp = t_2 * (t_0 * (1.0 - (0.5 * pow((sqrt((h / l)) * (0.5 * (D * (M / d)))), 2.0))));
} else if ((t_1 <= 5e-202) || !(t_1 <= 1e+254)) {
tmp = fabs((d / sqrt((h * l))));
} else {
tmp = t_0 * (t_2 * (1.0 + ((pow((D * (M * (0.5 / d))), 2.0) / l) * (h * -0.5))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = (((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((h / l) * (0.5d0 * (((m * d_1) / (d * 2.0d0)) ** 2.0d0))))
t_2 = sqrt((d / h))
if (t_1 <= (-1d-244)) then
tmp = t_2 * (t_0 * (1.0d0 - (0.5d0 * ((sqrt((h / l)) * (0.5d0 * (d_1 * (m / d)))) ** 2.0d0))))
else if ((t_1 <= 5d-202) .or. (.not. (t_1 <= 1d+254))) then
tmp = abs((d / sqrt((h * l))))
else
tmp = t_0 * (t_2 * (1.0d0 + ((((d_1 * (m * (0.5d0 / d))) ** 2.0d0) / l) * (h * (-0.5d0)))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
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.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((M * D) / (d * 2.0)), 2.0))));
double t_2 = Math.sqrt((d / h));
double tmp;
if (t_1 <= -1e-244) {
tmp = t_2 * (t_0 * (1.0 - (0.5 * Math.pow((Math.sqrt((h / l)) * (0.5 * (D * (M / d)))), 2.0))));
} else if ((t_1 <= 5e-202) || !(t_1 <= 1e+254)) {
tmp = Math.abs((d / Math.sqrt((h * l))));
} else {
tmp = t_0 * (t_2 * (1.0 + ((Math.pow((D * (M * (0.5 / d))), 2.0) / l) * (h * -0.5))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) t_1 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((M * D) / (d * 2.0)), 2.0)))) t_2 = math.sqrt((d / h)) tmp = 0 if t_1 <= -1e-244: tmp = t_2 * (t_0 * (1.0 - (0.5 * math.pow((math.sqrt((h / l)) * (0.5 * (D * (M / d)))), 2.0)))) elif (t_1 <= 5e-202) or not (t_1 <= 1e+254): tmp = math.fabs((d / math.sqrt((h * l)))) else: tmp = t_0 * (t_2 * (1.0 + ((math.pow((D * (M * (0.5 / d))), 2.0) / l) * (h * -0.5)))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0))))) t_2 = sqrt(Float64(d / h)) tmp = 0.0 if (t_1 <= -1e-244) tmp = Float64(t_2 * Float64(t_0 * Float64(1.0 - Float64(0.5 * (Float64(sqrt(Float64(h / l)) * Float64(0.5 * Float64(D * Float64(M / d)))) ^ 2.0))))); elseif ((t_1 <= 5e-202) || !(t_1 <= 1e+254)) tmp = abs(Float64(d / sqrt(Float64(h * l)))); else tmp = Float64(t_0 * Float64(t_2 * Float64(1.0 + Float64(Float64((Float64(D * Float64(M * Float64(0.5 / d))) ^ 2.0) / l) * Float64(h * -0.5))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / l));
t_1 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((M * D) / (d * 2.0)) ^ 2.0))));
t_2 = sqrt((d / h));
tmp = 0.0;
if (t_1 <= -1e-244)
tmp = t_2 * (t_0 * (1.0 - (0.5 * ((sqrt((h / l)) * (0.5 * (D * (M / d)))) ^ 2.0))));
elseif ((t_1 <= 5e-202) || ~((t_1 <= 1e+254)))
tmp = abs((d / sqrt((h * l))));
else
tmp = t_0 * (t_2 * (1.0 + ((((D * (M * (0.5 / d))) ^ 2.0) / l) * (h * -0.5))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -1e-244], N[(t$95$2 * N[(t$95$0 * N[(1.0 - N[(0.5 * N[Power[N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * N[(0.5 * N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$1, 5e-202], N[Not[LessEqual[t$95$1, 1e+254]], $MachinePrecision]], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(t$95$0 * N[(t$95$2 * N[(1.0 + N[(N[(N[Power[N[(D * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision] * N[(h * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right)\\
t_2 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;t_1 \leq -1 \cdot 10^{-244}:\\
\;\;\;\;t_2 \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot {\left(\sqrt{\frac{h}{\ell}} \cdot \left(0.5 \cdot \left(D \cdot \frac{M}{d}\right)\right)\right)}^{2}\right)\right)\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{-202} \lor \neg \left(t_1 \leq 10^{+254}\right):\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(t_2 \cdot \left(1 + \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell} \cdot \left(h \cdot -0.5\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < -9.9999999999999993e-245Initial program 88.2%
Simplified87.2%
add-sqr-sqrt87.2%
pow287.2%
times-frac88.2%
sqrt-prod88.2%
sqrt-pow190.7%
metadata-eval90.7%
pow190.7%
div-inv90.6%
associate-*r*88.7%
associate-/r*88.7%
metadata-eval88.7%
Applied egg-rr88.7%
associate-*r*90.6%
*-commutative90.6%
associate-*r*89.2%
Simplified89.2%
Taylor expanded in D around 0 90.7%
*-commutative90.7%
associate-/l*89.2%
associate-/r/89.2%
Simplified89.2%
if -9.9999999999999993e-245 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 4.99999999999999973e-202 or 9.9999999999999994e253 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) Initial program 24.0%
Simplified22.6%
Taylor expanded in M around 0 29.7%
*-rgt-identity29.7%
pow1/229.7%
pow1/229.7%
pow-prod-down29.5%
Applied egg-rr29.5%
unpow1/229.5%
Simplified29.5%
sqrt-prod29.7%
frac-2neg29.7%
sqrt-undiv10.9%
*-commutative10.9%
add-sqr-sqrt10.9%
sqrt-prod9.6%
rem-sqrt-square10.9%
*-commutative10.9%
sqrt-undiv29.7%
frac-2neg29.7%
sqrt-prod29.5%
frac-times37.1%
sqrt-div40.0%
sqrt-unprod35.4%
add-sqr-sqrt57.7%
Applied egg-rr57.7%
if 4.99999999999999973e-202 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 9.9999999999999994e253Initial program 97.8%
Simplified99.0%
fma-udef99.0%
*-commutative99.0%
associate-/r*99.0%
associate-*r/99.0%
associate-/l*99.0%
Applied egg-rr99.0%
clear-num99.0%
un-div-inv99.0%
Applied egg-rr99.0%
associate-/r/99.0%
*-commutative99.0%
associate-*r*99.0%
*-commutative99.0%
*-commutative99.0%
Simplified99.0%
Final simplification79.3%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 (* M (/ 0.5 d))))
(t_1
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* M D) (* d 2.0)) 2.0))))))
(t_2 (sqrt (/ d l)))
(t_3 (sqrt (/ d h))))
(if (<= t_1 -1e-244)
(* t_3 (* (- 1.0 (* 0.5 (pow (* t_0 (sqrt (/ h l))) 2.0))) t_2))
(if (or (<= t_1 5e-202) (not (<= t_1 1e+254)))
(fabs (/ d (sqrt (* h l))))
(* t_2 (* t_3 (+ 1.0 (* (/ (pow t_0 2.0) l) (* h -0.5)))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = D * (M * (0.5 / d));
double t_1 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((M * D) / (d * 2.0)), 2.0))));
double t_2 = sqrt((d / l));
double t_3 = sqrt((d / h));
double tmp;
if (t_1 <= -1e-244) {
tmp = t_3 * ((1.0 - (0.5 * pow((t_0 * sqrt((h / l))), 2.0))) * t_2);
} else if ((t_1 <= 5e-202) || !(t_1 <= 1e+254)) {
tmp = fabs((d / sqrt((h * l))));
} else {
tmp = t_2 * (t_3 * (1.0 + ((pow(t_0, 2.0) / l) * (h * -0.5))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 = d_1 * (m * (0.5d0 / d))
t_1 = (((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((h / l) * (0.5d0 * (((m * d_1) / (d * 2.0d0)) ** 2.0d0))))
t_2 = sqrt((d / l))
t_3 = sqrt((d / h))
if (t_1 <= (-1d-244)) then
tmp = t_3 * ((1.0d0 - (0.5d0 * ((t_0 * sqrt((h / l))) ** 2.0d0))) * t_2)
else if ((t_1 <= 5d-202) .or. (.not. (t_1 <= 1d+254))) then
tmp = abs((d / sqrt((h * l))))
else
tmp = t_2 * (t_3 * (1.0d0 + (((t_0 ** 2.0d0) / l) * (h * (-0.5d0)))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = D * (M * (0.5 / d));
double t_1 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((M * D) / (d * 2.0)), 2.0))));
double t_2 = Math.sqrt((d / l));
double t_3 = Math.sqrt((d / h));
double tmp;
if (t_1 <= -1e-244) {
tmp = t_3 * ((1.0 - (0.5 * Math.pow((t_0 * Math.sqrt((h / l))), 2.0))) * t_2);
} else if ((t_1 <= 5e-202) || !(t_1 <= 1e+254)) {
tmp = Math.abs((d / Math.sqrt((h * l))));
} else {
tmp = t_2 * (t_3 * (1.0 + ((Math.pow(t_0, 2.0) / l) * (h * -0.5))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = D * (M * (0.5 / d)) t_1 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((M * D) / (d * 2.0)), 2.0)))) t_2 = math.sqrt((d / l)) t_3 = math.sqrt((d / h)) tmp = 0 if t_1 <= -1e-244: tmp = t_3 * ((1.0 - (0.5 * math.pow((t_0 * math.sqrt((h / l))), 2.0))) * t_2) elif (t_1 <= 5e-202) or not (t_1 <= 1e+254): tmp = math.fabs((d / math.sqrt((h * l)))) else: tmp = t_2 * (t_3 * (1.0 + ((math.pow(t_0, 2.0) / l) * (h * -0.5)))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(D * Float64(M * Float64(0.5 / d))) t_1 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0))))) t_2 = sqrt(Float64(d / l)) t_3 = sqrt(Float64(d / h)) tmp = 0.0 if (t_1 <= -1e-244) tmp = Float64(t_3 * Float64(Float64(1.0 - Float64(0.5 * (Float64(t_0 * sqrt(Float64(h / l))) ^ 2.0))) * t_2)); elseif ((t_1 <= 5e-202) || !(t_1 <= 1e+254)) tmp = abs(Float64(d / sqrt(Float64(h * l)))); else tmp = Float64(t_2 * Float64(t_3 * Float64(1.0 + Float64(Float64((t_0 ^ 2.0) / l) * Float64(h * -0.5))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = D * (M * (0.5 / d));
t_1 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((M * D) / (d * 2.0)) ^ 2.0))));
t_2 = sqrt((d / l));
t_3 = sqrt((d / h));
tmp = 0.0;
if (t_1 <= -1e-244)
tmp = t_3 * ((1.0 - (0.5 * ((t_0 * sqrt((h / l))) ^ 2.0))) * t_2);
elseif ((t_1 <= 5e-202) || ~((t_1 <= 1e+254)))
tmp = abs((d / sqrt((h * l))));
else
tmp = t_2 * (t_3 * (1.0 + (((t_0 ^ 2.0) / l) * (h * -0.5))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -1e-244], N[(t$95$3 * N[(N[(1.0 - N[(0.5 * N[Power[N[(t$95$0 * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$1, 5e-202], N[Not[LessEqual[t$95$1, 1e+254]], $MachinePrecision]], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(t$95$2 * N[(t$95$3 * N[(1.0 + N[(N[(N[Power[t$95$0, 2.0], $MachinePrecision] / l), $MachinePrecision] * N[(h * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := D \cdot \left(M \cdot \frac{0.5}{d}\right)\\
t_1 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right)\\
t_2 := \sqrt{\frac{d}{\ell}}\\
t_3 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;t_1 \leq -1 \cdot 10^{-244}:\\
\;\;\;\;t_3 \cdot \left(\left(1 - 0.5 \cdot {\left(t_0 \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \cdot t_2\right)\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{-202} \lor \neg \left(t_1 \leq 10^{+254}\right):\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \left(t_3 \cdot \left(1 + \frac{{t_0}^{2}}{\ell} \cdot \left(h \cdot -0.5\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < -9.9999999999999993e-245Initial program 88.2%
Simplified87.2%
add-sqr-sqrt87.2%
pow287.2%
times-frac88.2%
sqrt-prod88.2%
sqrt-pow190.7%
metadata-eval90.7%
pow190.7%
div-inv90.6%
associate-*r*88.7%
associate-/r*88.7%
metadata-eval88.7%
Applied egg-rr88.7%
associate-*r*90.6%
*-commutative90.6%
associate-*r*89.2%
Simplified89.2%
if -9.9999999999999993e-245 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 4.99999999999999973e-202 or 9.9999999999999994e253 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) Initial program 24.0%
Simplified22.6%
Taylor expanded in M around 0 29.7%
*-rgt-identity29.7%
pow1/229.7%
pow1/229.7%
pow-prod-down29.5%
Applied egg-rr29.5%
unpow1/229.5%
Simplified29.5%
sqrt-prod29.7%
frac-2neg29.7%
sqrt-undiv10.9%
*-commutative10.9%
add-sqr-sqrt10.9%
sqrt-prod9.6%
rem-sqrt-square10.9%
*-commutative10.9%
sqrt-undiv29.7%
frac-2neg29.7%
sqrt-prod29.5%
frac-times37.1%
sqrt-div40.0%
sqrt-unprod35.4%
add-sqr-sqrt57.7%
Applied egg-rr57.7%
if 4.99999999999999973e-202 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 9.9999999999999994e253Initial program 97.8%
Simplified99.0%
fma-udef99.0%
*-commutative99.0%
associate-/r*99.0%
associate-*r/99.0%
associate-/l*99.0%
Applied egg-rr99.0%
clear-num99.0%
un-div-inv99.0%
Applied egg-rr99.0%
associate-/r/99.0%
*-commutative99.0%
associate-*r*99.0%
*-commutative99.0%
*-commutative99.0%
Simplified99.0%
Final simplification79.3%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 (* 0.5 (* (pow (* (/ M 2.0) (/ D d)) 2.0) (/ h l))))
(sqrt (/ d l)))))
(if (<= d -2e-310)
(* (/ (sqrt (- d)) (sqrt (- h))) t_0)
(if (<= d 3.8e-204)
(* (/ (sqrt d) (sqrt h)) t_0)
(/
(/ d (sqrt h))
(/
(sqrt l)
(+ 1.0 (* -0.5 (/ (* h (pow (* D (/ M (* d 2.0))) 2.0)) l)))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (1.0 - (0.5 * (pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) * sqrt((d / l));
double tmp;
if (d <= -2e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
} else if (d <= 3.8e-204) {
tmp = (sqrt(d) / sqrt(h)) * t_0;
} else {
tmp = (d / sqrt(h)) / (sqrt(l) / (1.0 + (-0.5 * ((h * pow((D * (M / (d * 2.0))), 2.0)) / l))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 = (1.0d0 - (0.5d0 * ((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (h / l)))) * sqrt((d / l))
if (d <= (-2d-310)) then
tmp = (sqrt(-d) / sqrt(-h)) * t_0
else if (d <= 3.8d-204) then
tmp = (sqrt(d) / sqrt(h)) * t_0
else
tmp = (d / sqrt(h)) / (sqrt(l) / (1.0d0 + ((-0.5d0) * ((h * ((d_1 * (m / (d * 2.0d0))) ** 2.0d0)) / l))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (1.0 - (0.5 * (Math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) * Math.sqrt((d / l));
double tmp;
if (d <= -2e-310) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * t_0;
} else if (d <= 3.8e-204) {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * t_0;
} else {
tmp = (d / Math.sqrt(h)) / (Math.sqrt(l) / (1.0 + (-0.5 * ((h * Math.pow((D * (M / (d * 2.0))), 2.0)) / l))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = (1.0 - (0.5 * (math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) * math.sqrt((d / l)) tmp = 0 if d <= -2e-310: tmp = (math.sqrt(-d) / math.sqrt(-h)) * t_0 elif d <= 3.8e-204: tmp = (math.sqrt(d) / math.sqrt(h)) * t_0 else: tmp = (d / math.sqrt(h)) / (math.sqrt(l) / (1.0 + (-0.5 * ((h * math.pow((D * (M / (d * 2.0))), 2.0)) / l)))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(h / l)))) * sqrt(Float64(d / l))) tmp = 0.0 if (d <= -2e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0); elseif (d <= 3.8e-204) tmp = Float64(Float64(sqrt(d) / sqrt(h)) * t_0); else tmp = Float64(Float64(d / sqrt(h)) / Float64(sqrt(l) / Float64(1.0 + Float64(-0.5 * Float64(Float64(h * (Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0)) / l))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (1.0 - (0.5 * ((((M / 2.0) * (D / d)) ^ 2.0) * (h / l)))) * sqrt((d / l));
tmp = 0.0;
if (d <= -2e-310)
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
elseif (d <= 3.8e-204)
tmp = (sqrt(d) / sqrt(h)) * t_0;
else
tmp = (d / sqrt(h)) / (sqrt(l) / (1.0 + (-0.5 * ((h * ((D * (M / (d * 2.0))) ^ 2.0)) / l))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 - 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] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[d, 3.8e-204], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] / N[(1.0 + N[(-0.5 * N[(N[(h * N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t_0\\
\mathbf{elif}\;d \leq 3.8 \cdot 10^{-204}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\frac{\sqrt{\ell}}{1 + -0.5 \cdot \frac{h \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}}{\ell}}}\\
\end{array}
\end{array}
if d < -1.999999999999994e-310Initial program 67.2%
Simplified67.7%
frac-2neg67.7%
sqrt-div81.7%
Applied egg-rr81.7%
if -1.999999999999994e-310 < d < 3.79999999999999983e-204Initial program 43.8%
Simplified41.1%
sqrt-div62.8%
div-inv62.8%
Applied egg-rr62.8%
associate-*r/62.8%
*-rgt-identity62.8%
Simplified62.8%
if 3.79999999999999983e-204 < d Initial program 71.8%
Simplified70.4%
frac-2neg0.0%
sqrt-div0.0%
Applied egg-rr0.0%
Applied egg-rr80.1%
*-commutative80.1%
associate-/l*80.1%
*-commutative80.1%
associate-*r*82.9%
*-commutative82.9%
Simplified82.9%
Applied egg-rr87.8%
Final simplification81.4%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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))))
(if (<= d -2e-310)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(* t_0 (- 1.0 (* 0.5 (* (/ h l) (pow (/ (* 0.5 M) (/ d D)) 2.0))))))
(if (<= d 3.8e-204)
(*
(/ (sqrt d) (sqrt h))
(* (- 1.0 (* 0.5 (* (pow (* (/ M 2.0) (/ D d)) 2.0) (/ h l)))) t_0))
(/
(/ d (sqrt h))
(/
(sqrt l)
(+ 1.0 (* -0.5 (/ (* h (pow (* D (/ M (* d 2.0))) 2.0)) l)))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (d <= -2e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * (1.0 - (0.5 * ((h / l) * pow(((0.5 * M) / (d / D)), 2.0)))));
} else if (d <= 3.8e-204) {
tmp = (sqrt(d) / sqrt(h)) * ((1.0 - (0.5 * (pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) * t_0);
} else {
tmp = (d / sqrt(h)) / (sqrt(l) / (1.0 + (-0.5 * ((h * pow((D * (M / (d * 2.0))), 2.0)) / l))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 / l))
if (d <= (-2d-310)) then
tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * (1.0d0 - (0.5d0 * ((h / l) * (((0.5d0 * m) / (d / d_1)) ** 2.0d0)))))
else if (d <= 3.8d-204) then
tmp = (sqrt(d) / sqrt(h)) * ((1.0d0 - (0.5d0 * ((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (h / l)))) * t_0)
else
tmp = (d / sqrt(h)) / (sqrt(l) / (1.0d0 + ((-0.5d0) * ((h * ((d_1 * (m / (d * 2.0d0))) ** 2.0d0)) / l))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
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 tmp;
if (d <= -2e-310) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * (t_0 * (1.0 - (0.5 * ((h / l) * Math.pow(((0.5 * M) / (d / D)), 2.0)))));
} else if (d <= 3.8e-204) {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * ((1.0 - (0.5 * (Math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) * t_0);
} else {
tmp = (d / Math.sqrt(h)) / (Math.sqrt(l) / (1.0 + (-0.5 * ((h * Math.pow((D * (M / (d * 2.0))), 2.0)) / l))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) tmp = 0 if d <= -2e-310: tmp = (math.sqrt(-d) / math.sqrt(-h)) * (t_0 * (1.0 - (0.5 * ((h / l) * math.pow(((0.5 * M) / (d / D)), 2.0))))) elif d <= 3.8e-204: tmp = (math.sqrt(d) / math.sqrt(h)) * ((1.0 - (0.5 * (math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) * t_0) else: tmp = (d / math.sqrt(h)) / (math.sqrt(l) / (1.0 + (-0.5 * ((h * math.pow((D * (M / (d * 2.0))), 2.0)) / l)))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (d <= -2e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(0.5 * M) / Float64(d / D)) ^ 2.0)))))); elseif (d <= 3.8e-204) tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(h / l)))) * t_0)); else tmp = Float64(Float64(d / sqrt(h)) / Float64(sqrt(l) / Float64(1.0 + Float64(-0.5 * Float64(Float64(h * (Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0)) / l))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / l));
tmp = 0.0;
if (d <= -2e-310)
tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * (1.0 - (0.5 * ((h / l) * (((0.5 * M) / (d / D)) ^ 2.0)))));
elseif (d <= 3.8e-204)
tmp = (sqrt(d) / sqrt(h)) * ((1.0 - (0.5 * ((((M / 2.0) * (D / d)) ^ 2.0) * (h / l)))) * t_0);
else
tmp = (d / sqrt(h)) / (sqrt(l) / (1.0 + (-0.5 * ((h * ((D * (M / (d * 2.0))) ^ 2.0)) / l))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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]}, If[LessEqual[d, -2e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(0.5 * M), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.8e-204], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(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] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] / N[(1.0 + N[(-0.5 * N[(N[(h * N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{0.5 \cdot M}{\frac{d}{D}}\right)}^{2}\right)\right)\right)\\
\mathbf{elif}\;d \leq 3.8 \cdot 10^{-204}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot t_0\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\frac{\sqrt{\ell}}{1 + -0.5 \cdot \frac{h \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}}{\ell}}}\\
\end{array}
\end{array}
if d < -1.999999999999994e-310Initial program 67.2%
Simplified67.7%
frac-2neg67.7%
sqrt-div81.7%
Applied egg-rr81.7%
associate-*r/80.9%
associate-/l*81.7%
div-inv81.7%
metadata-eval81.7%
Applied egg-rr81.7%
if -1.999999999999994e-310 < d < 3.79999999999999983e-204Initial program 43.8%
Simplified41.1%
sqrt-div62.8%
div-inv62.8%
Applied egg-rr62.8%
associate-*r/62.8%
*-rgt-identity62.8%
Simplified62.8%
if 3.79999999999999983e-204 < d Initial program 71.8%
Simplified70.4%
frac-2neg0.0%
sqrt-div0.0%
Applied egg-rr0.0%
Applied egg-rr80.1%
*-commutative80.1%
associate-/l*80.1%
*-commutative80.1%
associate-*r*82.9%
*-commutative82.9%
Simplified82.9%
Applied egg-rr87.8%
Final simplification81.4%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (* D (/ M (* d 2.0))) 2.0)) (t_1 (/ (* h t_0) l)))
(if (<= h -5e-311)
(* (* (/ (sqrt (- d)) (sqrt (- l))) (sqrt (/ d h))) (- 1.0 (* 0.5 t_1)))
(if (<= h 1.22e+215)
(/ (/ d (sqrt h)) (/ (sqrt l) (+ 1.0 (* -0.5 t_1))))
(/ (/ d (/ (sqrt l) (+ (* t_0 (* (/ h l) -0.5)) -1.0))) (sqrt h))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((D * (M / (d * 2.0))), 2.0);
double t_1 = (h * t_0) / l;
double tmp;
if (h <= -5e-311) {
tmp = ((sqrt(-d) / sqrt(-l)) * sqrt((d / h))) * (1.0 - (0.5 * t_1));
} else if (h <= 1.22e+215) {
tmp = (d / sqrt(h)) / (sqrt(l) / (1.0 + (-0.5 * t_1)));
} else {
tmp = (d / (sqrt(l) / ((t_0 * ((h / l) * -0.5)) + -1.0))) / sqrt(h);
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 = (d_1 * (m / (d * 2.0d0))) ** 2.0d0
t_1 = (h * t_0) / l
if (h <= (-5d-311)) then
tmp = ((sqrt(-d) / sqrt(-l)) * sqrt((d / h))) * (1.0d0 - (0.5d0 * t_1))
else if (h <= 1.22d+215) then
tmp = (d / sqrt(h)) / (sqrt(l) / (1.0d0 + ((-0.5d0) * t_1)))
else
tmp = (d / (sqrt(l) / ((t_0 * ((h / l) * (-0.5d0))) + (-1.0d0)))) / sqrt(h)
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow((D * (M / (d * 2.0))), 2.0);
double t_1 = (h * t_0) / l;
double tmp;
if (h <= -5e-311) {
tmp = ((Math.sqrt(-d) / Math.sqrt(-l)) * Math.sqrt((d / h))) * (1.0 - (0.5 * t_1));
} else if (h <= 1.22e+215) {
tmp = (d / Math.sqrt(h)) / (Math.sqrt(l) / (1.0 + (-0.5 * t_1)));
} else {
tmp = (d / (Math.sqrt(l) / ((t_0 * ((h / l) * -0.5)) + -1.0))) / Math.sqrt(h);
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.pow((D * (M / (d * 2.0))), 2.0) t_1 = (h * t_0) / l tmp = 0 if h <= -5e-311: tmp = ((math.sqrt(-d) / math.sqrt(-l)) * math.sqrt((d / h))) * (1.0 - (0.5 * t_1)) elif h <= 1.22e+215: tmp = (d / math.sqrt(h)) / (math.sqrt(l) / (1.0 + (-0.5 * t_1))) else: tmp = (d / (math.sqrt(l) / ((t_0 * ((h / l) * -0.5)) + -1.0))) / math.sqrt(h) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0 t_1 = Float64(Float64(h * t_0) / l) tmp = 0.0 if (h <= -5e-311) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(0.5 * t_1))); elseif (h <= 1.22e+215) tmp = Float64(Float64(d / sqrt(h)) / Float64(sqrt(l) / Float64(1.0 + Float64(-0.5 * t_1)))); else tmp = Float64(Float64(d / Float64(sqrt(l) / Float64(Float64(t_0 * Float64(Float64(h / l) * -0.5)) + -1.0))) / sqrt(h)); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (D * (M / (d * 2.0))) ^ 2.0;
t_1 = (h * t_0) / l;
tmp = 0.0;
if (h <= -5e-311)
tmp = ((sqrt(-d) / sqrt(-l)) * sqrt((d / h))) * (1.0 - (0.5 * t_1));
elseif (h <= 1.22e+215)
tmp = (d / sqrt(h)) / (sqrt(l) / (1.0 + (-0.5 * t_1)));
else
tmp = (d / (sqrt(l) / ((t_0 * ((h / l) * -0.5)) + -1.0))) / sqrt(h);
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[(h * t$95$0), $MachinePrecision] / l), $MachinePrecision]}, If[LessEqual[h, -5e-311], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 1.22e+215], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] / N[(1.0 + N[(-0.5 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] / N[(N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\\
t_1 := \frac{h \cdot t_0}{\ell}\\
\mathbf{if}\;h \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot t_1\right)\\
\mathbf{elif}\;h \leq 1.22 \cdot 10^{+215}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\frac{\sqrt{\ell}}{1 + -0.5 \cdot t_1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\frac{\sqrt{\ell}}{t_0 \cdot \left(\frac{h}{\ell} \cdot -0.5\right) + -1}}}{\sqrt{h}}\\
\end{array}
\end{array}
if h < -5.00000000000023e-311Initial program 67.2%
Simplified67.7%
frac-2neg81.7%
sqrt-div85.3%
Applied egg-rr70.4%
associate-*r/73.8%
*-commutative73.8%
associate-*l/73.2%
times-frac73.8%
associate-*l/73.2%
associate-*r/73.9%
associate-/l/73.9%
Applied egg-rr73.9%
if -5.00000000000023e-311 < h < 1.22000000000000007e215Initial program 68.3%
Simplified66.4%
frac-2neg0.0%
sqrt-div0.0%
Applied egg-rr0.0%
Applied egg-rr75.9%
*-commutative75.9%
associate-/l*75.1%
*-commutative75.1%
associate-*r*78.3%
*-commutative78.3%
Simplified78.3%
Applied egg-rr82.2%
if 1.22000000000000007e215 < h Initial program 29.1%
Simplified29.1%
sqrt-div29.2%
div-inv29.2%
Applied egg-rr29.2%
associate-*r/29.2%
*-rgt-identity29.2%
Simplified29.2%
Applied egg-rr79.9%
Final simplification78.4%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (pow (* D (/ M (* d 2.0))) 2.0) (* (/ h l) -0.5))))
(if (<= l -1.4e-73)
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
(if (<= l -1.02e-302)
(* (+ t_0 -1.0) (/ (- d) (sqrt (* h l))))
(/ (+ 1.0 t_0) (/ (sqrt l) (/ d (sqrt h))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((D * (M / (d * 2.0))), 2.0) * ((h / l) * -0.5);
double tmp;
if (l <= -1.4e-73) {
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l));
} else if (l <= -1.02e-302) {
tmp = (t_0 + -1.0) * (-d / sqrt((h * l)));
} else {
tmp = (1.0 + t_0) / (sqrt(l) / (d / sqrt(h)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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_1 * (m / (d * 2.0d0))) ** 2.0d0) * ((h / l) * (-0.5d0))
if (l <= (-1.4d-73)) then
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l))
else if (l <= (-1.02d-302)) then
tmp = (t_0 + (-1.0d0)) * (-d / sqrt((h * l)))
else
tmp = (1.0d0 + t_0) / (sqrt(l) / (d / sqrt(h)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow((D * (M / (d * 2.0))), 2.0) * ((h / l) * -0.5);
double tmp;
if (l <= -1.4e-73) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * Math.sqrt((d / l));
} else if (l <= -1.02e-302) {
tmp = (t_0 + -1.0) * (-d / Math.sqrt((h * l)));
} else {
tmp = (1.0 + t_0) / (Math.sqrt(l) / (d / Math.sqrt(h)));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.pow((D * (M / (d * 2.0))), 2.0) * ((h / l) * -0.5) tmp = 0 if l <= -1.4e-73: tmp = (math.sqrt(-d) / math.sqrt(-h)) * math.sqrt((d / l)) elif l <= -1.02e-302: tmp = (t_0 + -1.0) * (-d / math.sqrt((h * l))) else: tmp = (1.0 + t_0) / (math.sqrt(l) / (d / math.sqrt(h))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64((Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0) * Float64(Float64(h / l) * -0.5)) tmp = 0.0 if (l <= -1.4e-73) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))); elseif (l <= -1.02e-302) tmp = Float64(Float64(t_0 + -1.0) * Float64(Float64(-d) / sqrt(Float64(h * l)))); else tmp = Float64(Float64(1.0 + t_0) / Float64(sqrt(l) / Float64(d / sqrt(h)))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = ((D * (M / (d * 2.0))) ^ 2.0) * ((h / l) * -0.5);
tmp = 0.0;
if (l <= -1.4e-73)
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l));
elseif (l <= -1.02e-302)
tmp = (t_0 + -1.0) * (-d / sqrt((h * l)));
else
tmp = (1.0 + t_0) / (sqrt(l) / (d / sqrt(h)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.4e-73], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1.02e-302], N[(N[(t$95$0 + -1.0), $MachinePrecision] * N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + t$95$0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] / N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\\
\mathbf{if}\;\ell \leq -1.4 \cdot 10^{-73}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq -1.02 \cdot 10^{-302}:\\
\;\;\;\;\left(t_0 + -1\right) \cdot \frac{-d}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + t_0}{\frac{\sqrt{\ell}}{\frac{d}{\sqrt{h}}}}\\
\end{array}
\end{array}
if l < -1.40000000000000006e-73Initial program 61.5%
Simplified61.5%
frac-2neg61.5%
sqrt-div79.1%
Applied egg-rr79.1%
Taylor expanded in M around 0 55.2%
if -1.40000000000000006e-73 < l < -1.02e-302Initial program 81.3%
Simplified83.2%
frac-2neg89.5%
sqrt-div92.0%
Applied egg-rr85.7%
Applied egg-rr0.0%
*-commutative0.0%
associate-/l*0.0%
*-commutative0.0%
associate-*r*0.0%
*-commutative0.0%
Simplified0.0%
Applied egg-rr78.3%
if -1.02e-302 < l Initial program 64.0%
Simplified62.3%
sqrt-div74.6%
div-inv74.6%
Applied egg-rr68.7%
associate-*r/74.6%
*-rgt-identity74.6%
Simplified68.7%
Applied egg-rr74.2%
associate-/l*73.8%
Simplified73.8%
Final simplification68.8%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (* D (/ M (* d 2.0))) 2.0)))
(if (<= l -1.5e-74)
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
(if (<= l -1.02e-302)
(* (+ (* t_0 (* (/ h l) -0.5)) -1.0) (/ (- d) (sqrt (* h l))))
(/ (/ d (sqrt h)) (/ (sqrt l) (+ 1.0 (* -0.5 (/ (* h t_0) l)))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((D * (M / (d * 2.0))), 2.0);
double tmp;
if (l <= -1.5e-74) {
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l));
} else if (l <= -1.02e-302) {
tmp = ((t_0 * ((h / l) * -0.5)) + -1.0) * (-d / sqrt((h * l)));
} else {
tmp = (d / sqrt(h)) / (sqrt(l) / (1.0 + (-0.5 * ((h * t_0) / l))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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_1 * (m / (d * 2.0d0))) ** 2.0d0
if (l <= (-1.5d-74)) then
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l))
else if (l <= (-1.02d-302)) then
tmp = ((t_0 * ((h / l) * (-0.5d0))) + (-1.0d0)) * (-d / sqrt((h * l)))
else
tmp = (d / sqrt(h)) / (sqrt(l) / (1.0d0 + ((-0.5d0) * ((h * t_0) / l))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow((D * (M / (d * 2.0))), 2.0);
double tmp;
if (l <= -1.5e-74) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * Math.sqrt((d / l));
} else if (l <= -1.02e-302) {
tmp = ((t_0 * ((h / l) * -0.5)) + -1.0) * (-d / Math.sqrt((h * l)));
} else {
tmp = (d / Math.sqrt(h)) / (Math.sqrt(l) / (1.0 + (-0.5 * ((h * t_0) / l))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.pow((D * (M / (d * 2.0))), 2.0) tmp = 0 if l <= -1.5e-74: tmp = (math.sqrt(-d) / math.sqrt(-h)) * math.sqrt((d / l)) elif l <= -1.02e-302: tmp = ((t_0 * ((h / l) * -0.5)) + -1.0) * (-d / math.sqrt((h * l))) else: tmp = (d / math.sqrt(h)) / (math.sqrt(l) / (1.0 + (-0.5 * ((h * t_0) / l)))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0 tmp = 0.0 if (l <= -1.5e-74) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))); elseif (l <= -1.02e-302) tmp = Float64(Float64(Float64(t_0 * Float64(Float64(h / l) * -0.5)) + -1.0) * Float64(Float64(-d) / sqrt(Float64(h * l)))); else tmp = Float64(Float64(d / sqrt(h)) / Float64(sqrt(l) / Float64(1.0 + Float64(-0.5 * Float64(Float64(h * t_0) / l))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (D * (M / (d * 2.0))) ^ 2.0;
tmp = 0.0;
if (l <= -1.5e-74)
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l));
elseif (l <= -1.02e-302)
tmp = ((t_0 * ((h / l) * -0.5)) + -1.0) * (-d / sqrt((h * l)));
else
tmp = (d / sqrt(h)) / (sqrt(l) / (1.0 + (-0.5 * ((h * t_0) / l))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[l, -1.5e-74], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1.02e-302], N[(N[(N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision] * N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] / N[(1.0 + N[(-0.5 * N[(N[(h * t$95$0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\\
\mathbf{if}\;\ell \leq -1.5 \cdot 10^{-74}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq -1.02 \cdot 10^{-302}:\\
\;\;\;\;\left(t_0 \cdot \left(\frac{h}{\ell} \cdot -0.5\right) + -1\right) \cdot \frac{-d}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\frac{\sqrt{\ell}}{1 + -0.5 \cdot \frac{h \cdot t_0}{\ell}}}\\
\end{array}
\end{array}
if l < -1.50000000000000003e-74Initial program 61.5%
Simplified61.5%
frac-2neg61.5%
sqrt-div79.1%
Applied egg-rr79.1%
Taylor expanded in M around 0 55.2%
if -1.50000000000000003e-74 < l < -1.02e-302Initial program 81.3%
Simplified83.2%
frac-2neg89.5%
sqrt-div92.0%
Applied egg-rr85.7%
Applied egg-rr0.0%
*-commutative0.0%
associate-/l*0.0%
*-commutative0.0%
associate-*r*0.0%
*-commutative0.0%
Simplified0.0%
Applied egg-rr78.3%
if -1.02e-302 < l Initial program 64.0%
Simplified62.3%
frac-2neg0.0%
sqrt-div0.0%
Applied egg-rr0.0%
Applied egg-rr71.4%
*-commutative71.4%
associate-/l*70.8%
*-commutative70.8%
associate-*r*73.6%
*-commutative73.6%
Simplified73.6%
Applied egg-rr77.1%
Final simplification70.6%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (* D (/ M (* d 2.0))) 2.0)))
(if (<= d -2e-310)
(*
(sqrt (/ d h))
(*
(- 1.0 (* 0.5 (* (pow (* (/ M 2.0) (/ D d)) 2.0) (/ h l))))
(sqrt (/ d l))))
(if (<= d 4e-204)
(/ (/ d (/ (sqrt l) (+ (* t_0 (* (/ h l) -0.5)) -1.0))) (sqrt h))
(/ (/ d (sqrt h)) (/ (sqrt l) (+ 1.0 (* -0.5 (/ (* h t_0) l)))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((D * (M / (d * 2.0))), 2.0);
double tmp;
if (d <= -2e-310) {
tmp = sqrt((d / h)) * ((1.0 - (0.5 * (pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) * sqrt((d / l)));
} else if (d <= 4e-204) {
tmp = (d / (sqrt(l) / ((t_0 * ((h / l) * -0.5)) + -1.0))) / sqrt(h);
} else {
tmp = (d / sqrt(h)) / (sqrt(l) / (1.0 + (-0.5 * ((h * t_0) / l))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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_1 * (m / (d * 2.0d0))) ** 2.0d0
if (d <= (-2d-310)) then
tmp = sqrt((d / h)) * ((1.0d0 - (0.5d0 * ((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (h / l)))) * sqrt((d / l)))
else if (d <= 4d-204) then
tmp = (d / (sqrt(l) / ((t_0 * ((h / l) * (-0.5d0))) + (-1.0d0)))) / sqrt(h)
else
tmp = (d / sqrt(h)) / (sqrt(l) / (1.0d0 + ((-0.5d0) * ((h * t_0) / l))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow((D * (M / (d * 2.0))), 2.0);
double tmp;
if (d <= -2e-310) {
tmp = Math.sqrt((d / h)) * ((1.0 - (0.5 * (Math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) * Math.sqrt((d / l)));
} else if (d <= 4e-204) {
tmp = (d / (Math.sqrt(l) / ((t_0 * ((h / l) * -0.5)) + -1.0))) / Math.sqrt(h);
} else {
tmp = (d / Math.sqrt(h)) / (Math.sqrt(l) / (1.0 + (-0.5 * ((h * t_0) / l))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.pow((D * (M / (d * 2.0))), 2.0) tmp = 0 if d <= -2e-310: tmp = math.sqrt((d / h)) * ((1.0 - (0.5 * (math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) * math.sqrt((d / l))) elif d <= 4e-204: tmp = (d / (math.sqrt(l) / ((t_0 * ((h / l) * -0.5)) + -1.0))) / math.sqrt(h) else: tmp = (d / math.sqrt(h)) / (math.sqrt(l) / (1.0 + (-0.5 * ((h * t_0) / l)))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0 tmp = 0.0 if (d <= -2e-310) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(h / l)))) * sqrt(Float64(d / l)))); elseif (d <= 4e-204) tmp = Float64(Float64(d / Float64(sqrt(l) / Float64(Float64(t_0 * Float64(Float64(h / l) * -0.5)) + -1.0))) / sqrt(h)); else tmp = Float64(Float64(d / sqrt(h)) / Float64(sqrt(l) / Float64(1.0 + Float64(-0.5 * Float64(Float64(h * t_0) / l))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (D * (M / (d * 2.0))) ^ 2.0;
tmp = 0.0;
if (d <= -2e-310)
tmp = sqrt((d / h)) * ((1.0 - (0.5 * ((((M / 2.0) * (D / d)) ^ 2.0) * (h / l)))) * sqrt((d / l)));
elseif (d <= 4e-204)
tmp = (d / (sqrt(l) / ((t_0 * ((h / l) * -0.5)) + -1.0))) / sqrt(h);
else
tmp = (d / sqrt(h)) / (sqrt(l) / (1.0 + (-0.5 * ((h * t_0) / l))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[d, -2e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(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] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4e-204], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] / N[(N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] / N[(1.0 + N[(-0.5 * N[(N[(h * t$95$0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\\
\mathbf{if}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{elif}\;d \leq 4 \cdot 10^{-204}:\\
\;\;\;\;\frac{\frac{d}{\frac{\sqrt{\ell}}{t_0 \cdot \left(\frac{h}{\ell} \cdot -0.5\right) + -1}}}{\sqrt{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\frac{\sqrt{\ell}}{1 + -0.5 \cdot \frac{h \cdot t_0}{\ell}}}\\
\end{array}
\end{array}
if d < -1.999999999999994e-310Initial program 67.2%
Simplified67.7%
if -1.999999999999994e-310 < d < 4e-204Initial program 43.8%
Simplified41.1%
sqrt-div54.3%
div-inv54.3%
Applied egg-rr48.7%
associate-*r/54.3%
*-rgt-identity54.3%
Simplified48.7%
Applied egg-rr62.3%
if 4e-204 < d Initial program 71.8%
Simplified70.4%
frac-2neg0.0%
sqrt-div0.0%
Applied egg-rr0.0%
Applied egg-rr80.1%
*-commutative80.1%
associate-/l*80.1%
*-commutative80.1%
associate-*r*82.9%
*-commutative82.9%
Simplified82.9%
Applied egg-rr87.8%
Final simplification75.1%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (* D (/ M (* d 2.0))) 2.0)))
(if (<= d -2e-310)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(- 1.0 (* 0.5 (/ (* h (pow (* M (* D (/ 0.5 d))) 2.0)) l)))))
(if (<= d 3.8e-204)
(/ (/ d (/ (sqrt l) (+ (* t_0 (* (/ h l) -0.5)) -1.0))) (sqrt h))
(/ (/ d (sqrt h)) (/ (sqrt l) (+ 1.0 (* -0.5 (/ (* h t_0) l)))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((D * (M / (d * 2.0))), 2.0);
double tmp;
if (d <= -2e-310) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((h * pow((M * (D * (0.5 / d))), 2.0)) / l))));
} else if (d <= 3.8e-204) {
tmp = (d / (sqrt(l) / ((t_0 * ((h / l) * -0.5)) + -1.0))) / sqrt(h);
} else {
tmp = (d / sqrt(h)) / (sqrt(l) / (1.0 + (-0.5 * ((h * t_0) / l))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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_1 * (m / (d * 2.0d0))) ** 2.0d0
if (d <= (-2d-310)) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * ((h * ((m * (d_1 * (0.5d0 / d))) ** 2.0d0)) / l))))
else if (d <= 3.8d-204) then
tmp = (d / (sqrt(l) / ((t_0 * ((h / l) * (-0.5d0))) + (-1.0d0)))) / sqrt(h)
else
tmp = (d / sqrt(h)) / (sqrt(l) / (1.0d0 + ((-0.5d0) * ((h * t_0) / l))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow((D * (M / (d * 2.0))), 2.0);
double tmp;
if (d <= -2e-310) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * ((h * Math.pow((M * (D * (0.5 / d))), 2.0)) / l))));
} else if (d <= 3.8e-204) {
tmp = (d / (Math.sqrt(l) / ((t_0 * ((h / l) * -0.5)) + -1.0))) / Math.sqrt(h);
} else {
tmp = (d / Math.sqrt(h)) / (Math.sqrt(l) / (1.0 + (-0.5 * ((h * t_0) / l))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.pow((D * (M / (d * 2.0))), 2.0) tmp = 0 if d <= -2e-310: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * ((h * math.pow((M * (D * (0.5 / d))), 2.0)) / l)))) elif d <= 3.8e-204: tmp = (d / (math.sqrt(l) / ((t_0 * ((h / l) * -0.5)) + -1.0))) / math.sqrt(h) else: tmp = (d / math.sqrt(h)) / (math.sqrt(l) / (1.0 + (-0.5 * ((h * t_0) / l)))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0 tmp = 0.0 if (d <= -2e-310) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M * Float64(D * Float64(0.5 / d))) ^ 2.0)) / l))))); elseif (d <= 3.8e-204) tmp = Float64(Float64(d / Float64(sqrt(l) / Float64(Float64(t_0 * Float64(Float64(h / l) * -0.5)) + -1.0))) / sqrt(h)); else tmp = Float64(Float64(d / sqrt(h)) / Float64(sqrt(l) / Float64(1.0 + Float64(-0.5 * Float64(Float64(h * t_0) / l))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (D * (M / (d * 2.0))) ^ 2.0;
tmp = 0.0;
if (d <= -2e-310)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((h * ((M * (D * (0.5 / d))) ^ 2.0)) / l))));
elseif (d <= 3.8e-204)
tmp = (d / (sqrt(l) / ((t_0 * ((h / l) * -0.5)) + -1.0))) / sqrt(h);
else
tmp = (d / sqrt(h)) / (sqrt(l) / (1.0 + (-0.5 * ((h * t_0) / l))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[d, -2e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.8e-204], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] / N[(N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] / N[(1.0 + N[(-0.5 * N[(N[(h * t$95$0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\\
\mathbf{if}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}\right)\right)\\
\mathbf{elif}\;d \leq 3.8 \cdot 10^{-204}:\\
\;\;\;\;\frac{\frac{d}{\frac{\sqrt{\ell}}{t_0 \cdot \left(\frac{h}{\ell} \cdot -0.5\right) + -1}}}{\sqrt{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\frac{\sqrt{\ell}}{1 + -0.5 \cdot \frac{h \cdot t_0}{\ell}}}\\
\end{array}
\end{array}
if d < -1.999999999999994e-310Initial program 67.2%
Simplified67.7%
times-frac67.2%
associate-*r/68.1%
*-commutative68.1%
times-frac68.6%
times-frac68.1%
div-inv68.0%
associate-*r*68.6%
associate-/r*68.6%
metadata-eval68.6%
Applied egg-rr68.6%
if -1.999999999999994e-310 < d < 3.79999999999999983e-204Initial program 43.8%
Simplified41.1%
sqrt-div54.3%
div-inv54.3%
Applied egg-rr48.7%
associate-*r/54.3%
*-rgt-identity54.3%
Simplified48.7%
Applied egg-rr62.3%
if 3.79999999999999983e-204 < d Initial program 71.8%
Simplified70.4%
frac-2neg0.0%
sqrt-div0.0%
Applied egg-rr0.0%
Applied egg-rr80.1%
*-commutative80.1%
associate-/l*80.1%
*-commutative80.1%
associate-*r*82.9%
*-commutative82.9%
Simplified82.9%
Applied egg-rr87.8%
Final simplification75.5%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (* D (/ M (* d 2.0))) 2.0)))
(if (<= d -2e-310)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (* (/ (pow (* D (* M (/ 0.5 d))) 2.0) l) (* h -0.5)))))
(if (<= d 3.8e-204)
(/ (/ d (/ (sqrt l) (+ (* t_0 (* (/ h l) -0.5)) -1.0))) (sqrt h))
(/ (/ d (sqrt h)) (/ (sqrt l) (+ 1.0 (* -0.5 (/ (* h t_0) l)))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((D * (M / (d * 2.0))), 2.0);
double tmp;
if (d <= -2e-310) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((pow((D * (M * (0.5 / d))), 2.0) / l) * (h * -0.5))));
} else if (d <= 3.8e-204) {
tmp = (d / (sqrt(l) / ((t_0 * ((h / l) * -0.5)) + -1.0))) / sqrt(h);
} else {
tmp = (d / sqrt(h)) / (sqrt(l) / (1.0 + (-0.5 * ((h * t_0) / l))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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_1 * (m / (d * 2.0d0))) ** 2.0d0
if (d <= (-2d-310)) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((((d_1 * (m * (0.5d0 / d))) ** 2.0d0) / l) * (h * (-0.5d0)))))
else if (d <= 3.8d-204) then
tmp = (d / (sqrt(l) / ((t_0 * ((h / l) * (-0.5d0))) + (-1.0d0)))) / sqrt(h)
else
tmp = (d / sqrt(h)) / (sqrt(l) / (1.0d0 + ((-0.5d0) * ((h * t_0) / l))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow((D * (M / (d * 2.0))), 2.0);
double tmp;
if (d <= -2e-310) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((Math.pow((D * (M * (0.5 / d))), 2.0) / l) * (h * -0.5))));
} else if (d <= 3.8e-204) {
tmp = (d / (Math.sqrt(l) / ((t_0 * ((h / l) * -0.5)) + -1.0))) / Math.sqrt(h);
} else {
tmp = (d / Math.sqrt(h)) / (Math.sqrt(l) / (1.0 + (-0.5 * ((h * t_0) / l))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.pow((D * (M / (d * 2.0))), 2.0) tmp = 0 if d <= -2e-310: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((math.pow((D * (M * (0.5 / d))), 2.0) / l) * (h * -0.5)))) elif d <= 3.8e-204: tmp = (d / (math.sqrt(l) / ((t_0 * ((h / l) * -0.5)) + -1.0))) / math.sqrt(h) else: tmp = (d / math.sqrt(h)) / (math.sqrt(l) / (1.0 + (-0.5 * ((h * t_0) / l)))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0 tmp = 0.0 if (d <= -2e-310) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64((Float64(D * Float64(M * Float64(0.5 / d))) ^ 2.0) / l) * Float64(h * -0.5))))); elseif (d <= 3.8e-204) tmp = Float64(Float64(d / Float64(sqrt(l) / Float64(Float64(t_0 * Float64(Float64(h / l) * -0.5)) + -1.0))) / sqrt(h)); else tmp = Float64(Float64(d / sqrt(h)) / Float64(sqrt(l) / Float64(1.0 + Float64(-0.5 * Float64(Float64(h * t_0) / l))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (D * (M / (d * 2.0))) ^ 2.0;
tmp = 0.0;
if (d <= -2e-310)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((((D * (M * (0.5 / d))) ^ 2.0) / l) * (h * -0.5))));
elseif (d <= 3.8e-204)
tmp = (d / (sqrt(l) / ((t_0 * ((h / l) * -0.5)) + -1.0))) / sqrt(h);
else
tmp = (d / sqrt(h)) / (sqrt(l) / (1.0 + (-0.5 * ((h * t_0) / l))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[d, -2e-310], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(N[Power[N[(D * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision] * N[(h * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.8e-204], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] / N[(N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] / N[(1.0 + N[(-0.5 * N[(N[(h * t$95$0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\\
\mathbf{if}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell} \cdot \left(h \cdot -0.5\right)\right)\right)\\
\mathbf{elif}\;d \leq 3.8 \cdot 10^{-204}:\\
\;\;\;\;\frac{\frac{d}{\frac{\sqrt{\ell}}{t_0 \cdot \left(\frac{h}{\ell} \cdot -0.5\right) + -1}}}{\sqrt{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\frac{\sqrt{\ell}}{1 + -0.5 \cdot \frac{h \cdot t_0}{\ell}}}\\
\end{array}
\end{array}
if d < -1.999999999999994e-310Initial program 67.2%
Simplified67.7%
fma-udef67.7%
*-commutative67.7%
associate-/r*66.9%
associate-*r/66.9%
associate-/l*67.0%
Applied egg-rr67.0%
clear-num67.0%
un-div-inv66.9%
Applied egg-rr67.7%
associate-/r/70.3%
*-commutative70.3%
associate-*r*69.6%
*-commutative69.6%
*-commutative69.6%
Simplified69.6%
if -1.999999999999994e-310 < d < 3.79999999999999983e-204Initial program 43.8%
Simplified41.1%
sqrt-div54.3%
div-inv54.3%
Applied egg-rr48.7%
associate-*r/54.3%
*-rgt-identity54.3%
Simplified48.7%
Applied egg-rr62.3%
if 3.79999999999999983e-204 < d Initial program 71.8%
Simplified70.4%
frac-2neg0.0%
sqrt-div0.0%
Applied egg-rr0.0%
Applied egg-rr80.1%
*-commutative80.1%
associate-/l*80.1%
*-commutative80.1%
associate-*r*82.9%
*-commutative82.9%
Simplified82.9%
Applied egg-rr87.8%
Final simplification75.9%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 (* h l))))
(if (<= l -9.2e-76)
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
(if (<= l -1.02e-302)
(*
(+ (* (pow (* D (/ M (* d 2.0))) 2.0) (* (/ h l) -0.5)) -1.0)
(/ (- d) t_0))
(if (<= l 1.25e+207)
(*
(/ d t_0)
(+ 1.0 (* -0.5 (* (/ h l) (pow (* D (* M (/ 0.5 d))) 2.0)))))
(/ d (* (sqrt l) (sqrt h))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h * l));
double tmp;
if (l <= -9.2e-76) {
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l));
} else if (l <= -1.02e-302) {
tmp = ((pow((D * (M / (d * 2.0))), 2.0) * ((h / l) * -0.5)) + -1.0) * (-d / t_0);
} else if (l <= 1.25e+207) {
tmp = (d / t_0) * (1.0 + (-0.5 * ((h / l) * pow((D * (M * (0.5 / d))), 2.0))));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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((h * l))
if (l <= (-9.2d-76)) then
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l))
else if (l <= (-1.02d-302)) then
tmp = ((((d_1 * (m / (d * 2.0d0))) ** 2.0d0) * ((h / l) * (-0.5d0))) + (-1.0d0)) * (-d / t_0)
else if (l <= 1.25d+207) then
tmp = (d / t_0) * (1.0d0 + ((-0.5d0) * ((h / l) * ((d_1 * (m * (0.5d0 / d))) ** 2.0d0))))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((h * l));
double tmp;
if (l <= -9.2e-76) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * Math.sqrt((d / l));
} else if (l <= -1.02e-302) {
tmp = ((Math.pow((D * (M / (d * 2.0))), 2.0) * ((h / l) * -0.5)) + -1.0) * (-d / t_0);
} else if (l <= 1.25e+207) {
tmp = (d / t_0) * (1.0 + (-0.5 * ((h / l) * Math.pow((D * (M * (0.5 / d))), 2.0))));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((h * l)) tmp = 0 if l <= -9.2e-76: tmp = (math.sqrt(-d) / math.sqrt(-h)) * math.sqrt((d / l)) elif l <= -1.02e-302: tmp = ((math.pow((D * (M / (d * 2.0))), 2.0) * ((h / l) * -0.5)) + -1.0) * (-d / t_0) elif l <= 1.25e+207: tmp = (d / t_0) * (1.0 + (-0.5 * ((h / l) * math.pow((D * (M * (0.5 / d))), 2.0)))) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(h * l)) tmp = 0.0 if (l <= -9.2e-76) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))); elseif (l <= -1.02e-302) tmp = Float64(Float64(Float64((Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0) * Float64(Float64(h / l) * -0.5)) + -1.0) * Float64(Float64(-d) / t_0)); elseif (l <= 1.25e+207) tmp = Float64(Float64(d / t_0) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(M * Float64(0.5 / d))) ^ 2.0))))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((h * l));
tmp = 0.0;
if (l <= -9.2e-76)
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l));
elseif (l <= -1.02e-302)
tmp = ((((D * (M / (d * 2.0))) ^ 2.0) * ((h / l) * -0.5)) + -1.0) * (-d / t_0);
elseif (l <= 1.25e+207)
tmp = (d / t_0) * (1.0 + (-0.5 * ((h / l) * ((D * (M * (0.5 / d))) ^ 2.0))));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -9.2e-76], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1.02e-302], N[(N[(N[(N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision] * N[((-d) / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.25e+207], N[(N[(d / t$95$0), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
\mathbf{if}\;\ell \leq -9.2 \cdot 10^{-76}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq -1.02 \cdot 10^{-302}:\\
\;\;\;\;\left({\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right) + -1\right) \cdot \frac{-d}{t_0}\\
\mathbf{elif}\;\ell \leq 1.25 \cdot 10^{+207}:\\
\;\;\;\;\frac{d}{t_0} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -9.20000000000000025e-76Initial program 61.5%
Simplified61.5%
frac-2neg61.5%
sqrt-div79.1%
Applied egg-rr79.1%
Taylor expanded in M around 0 55.2%
if -9.20000000000000025e-76 < l < -1.02e-302Initial program 81.3%
Simplified83.2%
frac-2neg89.5%
sqrt-div92.0%
Applied egg-rr85.7%
Applied egg-rr0.0%
*-commutative0.0%
associate-/l*0.0%
*-commutative0.0%
associate-*r*0.0%
*-commutative0.0%
Simplified0.0%
Applied egg-rr78.3%
if -1.02e-302 < l < 1.25e207Initial program 68.0%
Simplified66.4%
frac-2neg0.0%
sqrt-div0.0%
Applied egg-rr0.0%
Applied egg-rr59.1%
*-rgt-identity59.1%
distribute-lft-in72.9%
*-commutative72.9%
*-commutative72.9%
associate-*r*73.7%
*-commutative73.7%
Simplified73.7%
if 1.25e207 < l Initial program 43.4%
Simplified41.3%
Taylor expanded in M around 0 47.9%
*-rgt-identity47.9%
sqrt-div78.8%
sqrt-div78.6%
frac-times78.6%
add-sqr-sqrt78.8%
Applied egg-rr78.8%
Final simplification69.2%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 (* h l))))
(if (<= l -1.34e-79)
(* d (- (sqrt (/ (/ 1.0 h) l))))
(if (<= l -2e-310)
(/ d (cbrt (* h (* l t_0))))
(if (<= l 2.15e+207)
(*
(/ d t_0)
(+ 1.0 (* -0.5 (* (/ h l) (pow (* D (* M (/ 0.5 d))) 2.0)))))
(/ d (* (sqrt l) (sqrt h))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h * l));
double tmp;
if (l <= -1.34e-79) {
tmp = d * -sqrt(((1.0 / h) / l));
} else if (l <= -2e-310) {
tmp = d / cbrt((h * (l * t_0)));
} else if (l <= 2.15e+207) {
tmp = (d / t_0) * (1.0 + (-0.5 * ((h / l) * pow((D * (M * (0.5 / d))), 2.0))));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((h * l));
double tmp;
if (l <= -1.34e-79) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else if (l <= -2e-310) {
tmp = d / Math.cbrt((h * (l * t_0)));
} else if (l <= 2.15e+207) {
tmp = (d / t_0) * (1.0 + (-0.5 * ((h / l) * Math.pow((D * (M * (0.5 / d))), 2.0))));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(h * l)) tmp = 0.0 if (l <= -1.34e-79) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); elseif (l <= -2e-310) tmp = Float64(d / cbrt(Float64(h * Float64(l * t_0)))); elseif (l <= 2.15e+207) tmp = Float64(Float64(d / t_0) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(M * Float64(0.5 / d))) ^ 2.0))))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.34e-79], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, -2e-310], N[(d / N[Power[N[(h * N[(l * t$95$0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.15e+207], N[(N[(d / t$95$0), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
\mathbf{if}\;\ell \leq -1.34 \cdot 10^{-79}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt[3]{h \cdot \left(\ell \cdot t_0\right)}}\\
\mathbf{elif}\;\ell \leq 2.15 \cdot 10^{+207}:\\
\;\;\;\;\frac{d}{t_0} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -1.34e-79Initial program 61.5%
Simplified61.5%
Taylor expanded in M around 0 41.0%
*-rgt-identity41.0%
pow1/241.0%
pow1/241.0%
pow-prod-down35.1%
Applied egg-rr35.1%
unpow1/235.1%
Simplified35.1%
sqrt-prod41.0%
frac-2neg41.0%
sqrt-undiv41.4%
*-commutative41.4%
sqrt-div0.0%
frac-2neg0.0%
frac-times0.0%
Applied egg-rr0.0%
Taylor expanded in d around 0 45.5%
associate-*r*45.5%
neg-mul-145.5%
associate-/r*47.5%
Simplified47.5%
if -1.34e-79 < l < -1.999999999999994e-310Initial program 79.1%
Simplified81.0%
Taylor expanded in M around 0 16.9%
*-rgt-identity16.9%
pow1/216.9%
pow1/216.9%
pow-prod-down14.4%
Applied egg-rr14.4%
unpow1/214.4%
Simplified14.4%
frac-times11.8%
sqrt-div11.8%
sqrt-unprod0.0%
add-sqr-sqrt27.3%
Applied egg-rr27.3%
add-cbrt-cube34.9%
add-sqr-sqrt34.9%
*-commutative34.9%
associate-*l*40.1%
*-commutative40.1%
Applied egg-rr40.1%
if -1.999999999999994e-310 < l < 2.1499999999999999e207Initial program 68.5%
Simplified67.0%
frac-2neg0.0%
sqrt-div0.0%
Applied egg-rr0.0%
Applied egg-rr59.6%
*-rgt-identity59.6%
distribute-lft-in73.5%
*-commutative73.5%
*-commutative73.5%
associate-*r*74.4%
*-commutative74.4%
Simplified74.4%
if 2.1499999999999999e207 < l Initial program 43.4%
Simplified41.3%
Taylor expanded in M around 0 47.9%
*-rgt-identity47.9%
sqrt-div78.8%
sqrt-div78.6%
frac-times78.6%
add-sqr-sqrt78.8%
Applied egg-rr78.8%
Final simplification61.6%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 (* h l))))
(if (<= l -1.9e-73)
(* d (- (sqrt (/ (/ 1.0 h) l))))
(if (<= l -1.02e-302)
(*
(+ (* (pow (* D (/ M (* d 2.0))) 2.0) (* (/ h l) -0.5)) -1.0)
(/ (- d) t_0))
(if (<= l 6.2e+208)
(*
(/ d t_0)
(+ 1.0 (* -0.5 (* (/ h l) (pow (* D (* M (/ 0.5 d))) 2.0)))))
(/ d (* (sqrt l) (sqrt h))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h * l));
double tmp;
if (l <= -1.9e-73) {
tmp = d * -sqrt(((1.0 / h) / l));
} else if (l <= -1.02e-302) {
tmp = ((pow((D * (M / (d * 2.0))), 2.0) * ((h / l) * -0.5)) + -1.0) * (-d / t_0);
} else if (l <= 6.2e+208) {
tmp = (d / t_0) * (1.0 + (-0.5 * ((h / l) * pow((D * (M * (0.5 / d))), 2.0))));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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((h * l))
if (l <= (-1.9d-73)) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else if (l <= (-1.02d-302)) then
tmp = ((((d_1 * (m / (d * 2.0d0))) ** 2.0d0) * ((h / l) * (-0.5d0))) + (-1.0d0)) * (-d / t_0)
else if (l <= 6.2d+208) then
tmp = (d / t_0) * (1.0d0 + ((-0.5d0) * ((h / l) * ((d_1 * (m * (0.5d0 / d))) ** 2.0d0))))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((h * l));
double tmp;
if (l <= -1.9e-73) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else if (l <= -1.02e-302) {
tmp = ((Math.pow((D * (M / (d * 2.0))), 2.0) * ((h / l) * -0.5)) + -1.0) * (-d / t_0);
} else if (l <= 6.2e+208) {
tmp = (d / t_0) * (1.0 + (-0.5 * ((h / l) * Math.pow((D * (M * (0.5 / d))), 2.0))));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((h * l)) tmp = 0 if l <= -1.9e-73: tmp = d * -math.sqrt(((1.0 / h) / l)) elif l <= -1.02e-302: tmp = ((math.pow((D * (M / (d * 2.0))), 2.0) * ((h / l) * -0.5)) + -1.0) * (-d / t_0) elif l <= 6.2e+208: tmp = (d / t_0) * (1.0 + (-0.5 * ((h / l) * math.pow((D * (M * (0.5 / d))), 2.0)))) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(h * l)) tmp = 0.0 if (l <= -1.9e-73) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); elseif (l <= -1.02e-302) tmp = Float64(Float64(Float64((Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0) * Float64(Float64(h / l) * -0.5)) + -1.0) * Float64(Float64(-d) / t_0)); elseif (l <= 6.2e+208) tmp = Float64(Float64(d / t_0) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(M * Float64(0.5 / d))) ^ 2.0))))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((h * l));
tmp = 0.0;
if (l <= -1.9e-73)
tmp = d * -sqrt(((1.0 / h) / l));
elseif (l <= -1.02e-302)
tmp = ((((D * (M / (d * 2.0))) ^ 2.0) * ((h / l) * -0.5)) + -1.0) * (-d / t_0);
elseif (l <= 6.2e+208)
tmp = (d / t_0) * (1.0 + (-0.5 * ((h / l) * ((D * (M * (0.5 / d))) ^ 2.0))));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.9e-73], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, -1.02e-302], N[(N[(N[(N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision] * N[((-d) / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.2e+208], N[(N[(d / t$95$0), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
\mathbf{if}\;\ell \leq -1.9 \cdot 10^{-73}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{elif}\;\ell \leq -1.02 \cdot 10^{-302}:\\
\;\;\;\;\left({\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right) + -1\right) \cdot \frac{-d}{t_0}\\
\mathbf{elif}\;\ell \leq 6.2 \cdot 10^{+208}:\\
\;\;\;\;\frac{d}{t_0} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -1.9000000000000001e-73Initial program 61.5%
Simplified61.5%
Taylor expanded in M around 0 41.0%
*-rgt-identity41.0%
pow1/241.0%
pow1/241.0%
pow-prod-down35.1%
Applied egg-rr35.1%
unpow1/235.1%
Simplified35.1%
sqrt-prod41.0%
frac-2neg41.0%
sqrt-undiv41.4%
*-commutative41.4%
sqrt-div0.0%
frac-2neg0.0%
frac-times0.0%
Applied egg-rr0.0%
Taylor expanded in d around 0 45.5%
associate-*r*45.5%
neg-mul-145.5%
associate-/r*47.5%
Simplified47.5%
if -1.9000000000000001e-73 < l < -1.02e-302Initial program 81.3%
Simplified83.2%
frac-2neg89.5%
sqrt-div92.0%
Applied egg-rr85.7%
Applied egg-rr0.0%
*-commutative0.0%
associate-/l*0.0%
*-commutative0.0%
associate-*r*0.0%
*-commutative0.0%
Simplified0.0%
Applied egg-rr78.3%
if -1.02e-302 < l < 6.19999999999999961e208Initial program 68.0%
Simplified66.4%
frac-2neg0.0%
sqrt-div0.0%
Applied egg-rr0.0%
Applied egg-rr59.1%
*-rgt-identity59.1%
distribute-lft-in72.9%
*-commutative72.9%
*-commutative72.9%
associate-*r*73.7%
*-commutative73.7%
Simplified73.7%
if 6.19999999999999961e208 < l Initial program 43.4%
Simplified41.3%
Taylor expanded in M around 0 47.9%
*-rgt-identity47.9%
sqrt-div78.8%
sqrt-div78.6%
frac-times78.6%
add-sqr-sqrt78.8%
Applied egg-rr78.8%
Final simplification66.8%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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.2e-79)
(* d (- (sqrt (/ (/ 1.0 h) l))))
(if (<= l -2e-310)
(/ d (cbrt (* h (* l (sqrt (* h l))))))
(/ d (* (sqrt l) (sqrt h))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2.2e-79) {
tmp = d * -sqrt(((1.0 / h) / l));
} else if (l <= -2e-310) {
tmp = d / cbrt((h * (l * sqrt((h * l)))));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2.2e-79) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else if (l <= -2e-310) {
tmp = d / Math.cbrt((h * (l * Math.sqrt((h * l)))));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -2.2e-79) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); elseif (l <= -2e-310) tmp = Float64(d / cbrt(Float64(h * Float64(l * sqrt(Float64(h * l)))))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2.2e-79], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, -2e-310], N[(d / N[Power[N[(h * N[(l * N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.2 \cdot 10^{-79}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt[3]{h \cdot \left(\ell \cdot \sqrt{h \cdot \ell}\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -2.1999999999999999e-79Initial program 61.5%
Simplified61.5%
Taylor expanded in M around 0 41.0%
*-rgt-identity41.0%
pow1/241.0%
pow1/241.0%
pow-prod-down35.1%
Applied egg-rr35.1%
unpow1/235.1%
Simplified35.1%
sqrt-prod41.0%
frac-2neg41.0%
sqrt-undiv41.4%
*-commutative41.4%
sqrt-div0.0%
frac-2neg0.0%
frac-times0.0%
Applied egg-rr0.0%
Taylor expanded in d around 0 45.5%
associate-*r*45.5%
neg-mul-145.5%
associate-/r*47.5%
Simplified47.5%
if -2.1999999999999999e-79 < l < -1.999999999999994e-310Initial program 79.1%
Simplified81.0%
Taylor expanded in M around 0 16.9%
*-rgt-identity16.9%
pow1/216.9%
pow1/216.9%
pow-prod-down14.4%
Applied egg-rr14.4%
unpow1/214.4%
Simplified14.4%
frac-times11.8%
sqrt-div11.8%
sqrt-unprod0.0%
add-sqr-sqrt27.3%
Applied egg-rr27.3%
add-cbrt-cube34.9%
add-sqr-sqrt34.9%
*-commutative34.9%
associate-*l*40.1%
*-commutative40.1%
Applied egg-rr40.1%
if -1.999999999999994e-310 < l Initial program 64.4%
Simplified63.1%
Taylor expanded in M around 0 35.8%
*-rgt-identity35.8%
sqrt-div44.5%
sqrt-div47.0%
frac-times47.0%
add-sqr-sqrt47.2%
Applied egg-rr47.2%
Final simplification46.3%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= h -5.6e+85)
(sqrt (/ d (* l (/ h d))))
(if (<= h 3.2e-308)
(* d (/ -1.0 (sqrt (* h l))))
(/ d (* (sqrt l) (sqrt h))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -5.6e+85) {
tmp = sqrt((d / (l * (h / d))));
} else if (h <= 3.2e-308) {
tmp = d * (-1.0 / sqrt((h * l)));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 <= (-5.6d+85)) then
tmp = sqrt((d / (l * (h / d))))
else if (h <= 3.2d-308) then
tmp = d * ((-1.0d0) / sqrt((h * l)))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -5.6e+85) {
tmp = Math.sqrt((d / (l * (h / d))));
} else if (h <= 3.2e-308) {
tmp = d * (-1.0 / Math.sqrt((h * l)));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if h <= -5.6e+85: tmp = math.sqrt((d / (l * (h / d)))) elif h <= 3.2e-308: tmp = d * (-1.0 / math.sqrt((h * l))) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= -5.6e+85) tmp = sqrt(Float64(d / Float64(l * Float64(h / d)))); elseif (h <= 3.2e-308) tmp = Float64(d * Float64(-1.0 / sqrt(Float64(h * l)))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (h <= -5.6e+85)
tmp = sqrt((d / (l * (h / d))));
elseif (h <= 3.2e-308)
tmp = d * (-1.0 / sqrt((h * l)));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, -5.6e+85], N[Sqrt[N[(d / N[(l * N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[h, 3.2e-308], N[(d * N[(-1.0 / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -5.6 \cdot 10^{+85}:\\
\;\;\;\;\sqrt{\frac{d}{\ell \cdot \frac{h}{d}}}\\
\mathbf{elif}\;h \leq 3.2 \cdot 10^{-308}:\\
\;\;\;\;d \cdot \frac{-1}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if h < -5.5999999999999998e85Initial program 63.8%
Simplified61.2%
Taylor expanded in M around 0 35.9%
*-rgt-identity35.9%
pow1/235.9%
pow1/235.9%
pow-prod-down33.5%
Applied egg-rr33.5%
unpow1/233.5%
Simplified33.5%
*-commutative33.5%
clear-num33.5%
frac-times33.5%
*-un-lft-identity33.5%
Applied egg-rr33.5%
if -5.5999999999999998e85 < h < 3.2000000000000001e-308Initial program 69.2%
Simplified71.3%
Taylor expanded in M around 0 31.6%
*-rgt-identity31.6%
pow1/231.6%
pow1/231.6%
pow-prod-down25.7%
Applied egg-rr25.7%
unpow1/225.7%
Simplified25.7%
frac-times21.4%
sqrt-div21.3%
sqrt-unprod0.0%
add-sqr-sqrt17.4%
Applied egg-rr17.4%
frac-2neg17.4%
sqrt-prod0.0%
distribute-lft-neg-in0.0%
*-commutative0.0%
div-inv0.0%
add-sqr-sqrt0.0%
sqrt-unprod0.2%
sqr-neg0.2%
add-sqr-sqrt0.2%
sqrt-prod44.5%
Applied egg-rr44.5%
if 3.2000000000000001e-308 < h Initial program 64.2%
Simplified62.9%
Taylor expanded in M around 0 36.0%
*-rgt-identity36.0%
sqrt-div44.8%
sqrt-div47.3%
frac-times47.4%
add-sqr-sqrt47.5%
Applied egg-rr47.5%
Final simplification44.5%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= h -3.1e+86)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= h 3.2e-308)
(* d (/ -1.0 (sqrt (* h l))))
(/ d (* (sqrt l) (sqrt h))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -3.1e+86) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (h <= 3.2e-308) {
tmp = d * (-1.0 / sqrt((h * l)));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 <= (-3.1d+86)) then
tmp = sqrt((d / h)) * sqrt((d / l))
else if (h <= 3.2d-308) then
tmp = d * ((-1.0d0) / sqrt((h * l)))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -3.1e+86) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (h <= 3.2e-308) {
tmp = d * (-1.0 / Math.sqrt((h * l)));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if h <= -3.1e+86: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) elif h <= 3.2e-308: tmp = d * (-1.0 / math.sqrt((h * l))) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= -3.1e+86) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (h <= 3.2e-308) tmp = Float64(d * Float64(-1.0 / sqrt(Float64(h * l)))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (h <= -3.1e+86)
tmp = sqrt((d / h)) * sqrt((d / l));
elseif (h <= 3.2e-308)
tmp = d * (-1.0 / sqrt((h * l)));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, -3.1e+86], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 3.2e-308], N[(d * N[(-1.0 / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -3.1 \cdot 10^{+86}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;h \leq 3.2 \cdot 10^{-308}:\\
\;\;\;\;d \cdot \frac{-1}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if h < -3.1000000000000002e86Initial program 63.8%
Simplified61.2%
Taylor expanded in M around 0 35.9%
*-rgt-identity35.9%
pow1/235.9%
pow1/235.9%
pow-prod-down33.5%
Applied egg-rr33.5%
unpow1/233.5%
Simplified33.5%
sqrt-prod35.9%
Applied egg-rr35.9%
if -3.1000000000000002e86 < h < 3.2000000000000001e-308Initial program 69.2%
Simplified71.3%
Taylor expanded in M around 0 31.6%
*-rgt-identity31.6%
pow1/231.6%
pow1/231.6%
pow-prod-down25.7%
Applied egg-rr25.7%
unpow1/225.7%
Simplified25.7%
frac-times21.4%
sqrt-div21.3%
sqrt-unprod0.0%
add-sqr-sqrt17.4%
Applied egg-rr17.4%
frac-2neg17.4%
sqrt-prod0.0%
distribute-lft-neg-in0.0%
*-commutative0.0%
div-inv0.0%
add-sqr-sqrt0.0%
sqrt-unprod0.2%
sqr-neg0.2%
add-sqr-sqrt0.2%
sqrt-prod44.5%
Applied egg-rr44.5%
if 3.2000000000000001e-308 < h Initial program 64.2%
Simplified62.9%
Taylor expanded in M around 0 36.0%
*-rgt-identity36.0%
sqrt-div44.8%
sqrt-div47.3%
frac-times47.4%
add-sqr-sqrt47.5%
Applied egg-rr47.5%
Final simplification44.9%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= h -6e+91) (sqrt (/ d (* l (/ h d)))) (fabs (/ d (sqrt (* h l))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -6e+91) {
tmp = sqrt((d / (l * (h / d))));
} else {
tmp = fabs((d / sqrt((h * l))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 <= (-6d+91)) then
tmp = sqrt((d / (l * (h / d))))
else
tmp = abs((d / sqrt((h * l))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -6e+91) {
tmp = Math.sqrt((d / (l * (h / d))));
} else {
tmp = Math.abs((d / Math.sqrt((h * l))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if h <= -6e+91: tmp = math.sqrt((d / (l * (h / d)))) else: tmp = math.fabs((d / math.sqrt((h * l)))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= -6e+91) tmp = sqrt(Float64(d / Float64(l * Float64(h / d)))); else tmp = abs(Float64(d / sqrt(Float64(h * l)))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (h <= -6e+91)
tmp = sqrt((d / (l * (h / d))));
else
tmp = abs((d / sqrt((h * l))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, -6e+91], N[Sqrt[N[(d / N[(l * N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -6 \cdot 10^{+91}:\\
\;\;\;\;\sqrt{\frac{d}{\ell \cdot \frac{h}{d}}}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
\end{array}
\end{array}
if h < -6.00000000000000012e91Initial program 62.8%
Simplified60.2%
Taylor expanded in M around 0 34.2%
*-rgt-identity34.2%
pow1/234.2%
pow1/234.2%
pow-prod-down31.7%
Applied egg-rr31.7%
unpow1/231.7%
Simplified31.7%
*-commutative31.7%
clear-num31.7%
frac-times31.7%
*-un-lft-identity31.7%
Applied egg-rr31.7%
if -6.00000000000000012e91 < h Initial program 66.1%
Simplified66.0%
Taylor expanded in M around 0 34.7%
*-rgt-identity34.7%
pow1/234.7%
pow1/234.7%
pow-prod-down30.4%
Applied egg-rr30.4%
unpow1/230.4%
Simplified30.4%
sqrt-prod34.7%
frac-2neg34.7%
sqrt-undiv12.3%
*-commutative12.3%
add-sqr-sqrt12.3%
sqrt-prod9.5%
rem-sqrt-square12.3%
*-commutative12.3%
sqrt-undiv34.7%
frac-2neg34.7%
sqrt-prod30.4%
frac-times26.4%
sqrt-div29.0%
sqrt-unprod26.8%
add-sqr-sqrt43.2%
Applied egg-rr43.2%
Final simplification41.6%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 (* h l))))
(if (<= h -7.2e+88)
(sqrt (* (/ d h) (/ d l)))
(if (<= h -7.8e-243) (/ (- d) t_0) (/ d t_0)))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h * l));
double tmp;
if (h <= -7.2e+88) {
tmp = sqrt(((d / h) * (d / l)));
} else if (h <= -7.8e-243) {
tmp = -d / t_0;
} else {
tmp = d / t_0;
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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((h * l))
if (h <= (-7.2d+88)) then
tmp = sqrt(((d / h) * (d / l)))
else if (h <= (-7.8d-243)) then
tmp = -d / t_0
else
tmp = d / t_0
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((h * l));
double tmp;
if (h <= -7.2e+88) {
tmp = Math.sqrt(((d / h) * (d / l)));
} else if (h <= -7.8e-243) {
tmp = -d / t_0;
} else {
tmp = d / t_0;
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((h * l)) tmp = 0 if h <= -7.2e+88: tmp = math.sqrt(((d / h) * (d / l))) elif h <= -7.8e-243: tmp = -d / t_0 else: tmp = d / t_0 return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(h * l)) tmp = 0.0 if (h <= -7.2e+88) tmp = sqrt(Float64(Float64(d / h) * Float64(d / l))); elseif (h <= -7.8e-243) tmp = Float64(Float64(-d) / t_0); else tmp = Float64(d / t_0); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((h * l));
tmp = 0.0;
if (h <= -7.2e+88)
tmp = sqrt(((d / h) * (d / l)));
elseif (h <= -7.8e-243)
tmp = -d / t_0;
else
tmp = d / t_0;
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -7.2e+88], N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[h, -7.8e-243], N[((-d) / t$95$0), $MachinePrecision], N[(d / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
\mathbf{if}\;h \leq -7.2 \cdot 10^{+88}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{elif}\;h \leq -7.8 \cdot 10^{-243}:\\
\;\;\;\;\frac{-d}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t_0}\\
\end{array}
\end{array}
if h < -7.2000000000000004e88Initial program 62.8%
Simplified60.2%
Taylor expanded in M around 0 34.2%
*-rgt-identity34.2%
pow1/234.2%
pow1/234.2%
pow-prod-down31.7%
Applied egg-rr31.7%
unpow1/231.7%
Simplified31.7%
if -7.2000000000000004e88 < h < -7.8000000000000003e-243Initial program 68.9%
Simplified71.3%
Taylor expanded in M around 0 33.8%
*-rgt-identity33.8%
pow1/233.8%
pow1/233.8%
pow-prod-down27.0%
Applied egg-rr27.0%
unpow1/227.0%
Simplified27.0%
frac-times22.8%
sqrt-div22.7%
sqrt-unprod0.0%
add-sqr-sqrt14.0%
Applied egg-rr14.0%
sqrt-prod0.0%
associate-/l/0.0%
*-un-lft-identity0.0%
add-sqr-sqrt0.0%
sqr-neg0.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
neg-mul-10.0%
times-frac0.0%
metadata-eval0.0%
associate-/l/0.0%
sqrt-prod47.9%
*-commutative47.9%
Applied egg-rr47.9%
mul-1-neg47.9%
distribute-neg-frac47.9%
Simplified47.9%
if -7.8000000000000003e-243 < h Initial program 64.9%
Simplified63.7%
Taylor expanded in M around 0 35.1%
*-rgt-identity35.1%
pow1/235.1%
pow1/235.1%
pow-prod-down31.9%
Applied egg-rr31.9%
unpow1/231.9%
Simplified31.9%
frac-times28.0%
sqrt-div31.8%
sqrt-unprod38.9%
add-sqr-sqrt41.8%
Applied egg-rr41.8%
Final simplification41.9%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 (* h l))))
(if (<= h -2.55e+92)
(sqrt (/ d (* l (/ h d))))
(if (<= h -7.8e-243) (/ (- d) t_0) (/ d t_0)))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h * l));
double tmp;
if (h <= -2.55e+92) {
tmp = sqrt((d / (l * (h / d))));
} else if (h <= -7.8e-243) {
tmp = -d / t_0;
} else {
tmp = d / t_0;
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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((h * l))
if (h <= (-2.55d+92)) then
tmp = sqrt((d / (l * (h / d))))
else if (h <= (-7.8d-243)) then
tmp = -d / t_0
else
tmp = d / t_0
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((h * l));
double tmp;
if (h <= -2.55e+92) {
tmp = Math.sqrt((d / (l * (h / d))));
} else if (h <= -7.8e-243) {
tmp = -d / t_0;
} else {
tmp = d / t_0;
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((h * l)) tmp = 0 if h <= -2.55e+92: tmp = math.sqrt((d / (l * (h / d)))) elif h <= -7.8e-243: tmp = -d / t_0 else: tmp = d / t_0 return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(h * l)) tmp = 0.0 if (h <= -2.55e+92) tmp = sqrt(Float64(d / Float64(l * Float64(h / d)))); elseif (h <= -7.8e-243) tmp = Float64(Float64(-d) / t_0); else tmp = Float64(d / t_0); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((h * l));
tmp = 0.0;
if (h <= -2.55e+92)
tmp = sqrt((d / (l * (h / d))));
elseif (h <= -7.8e-243)
tmp = -d / t_0;
else
tmp = d / t_0;
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -2.55e+92], N[Sqrt[N[(d / N[(l * N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[h, -7.8e-243], N[((-d) / t$95$0), $MachinePrecision], N[(d / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
\mathbf{if}\;h \leq -2.55 \cdot 10^{+92}:\\
\;\;\;\;\sqrt{\frac{d}{\ell \cdot \frac{h}{d}}}\\
\mathbf{elif}\;h \leq -7.8 \cdot 10^{-243}:\\
\;\;\;\;\frac{-d}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t_0}\\
\end{array}
\end{array}
if h < -2.5500000000000001e92Initial program 62.8%
Simplified60.2%
Taylor expanded in M around 0 34.2%
*-rgt-identity34.2%
pow1/234.2%
pow1/234.2%
pow-prod-down31.7%
Applied egg-rr31.7%
unpow1/231.7%
Simplified31.7%
*-commutative31.7%
clear-num31.7%
frac-times31.7%
*-un-lft-identity31.7%
Applied egg-rr31.7%
if -2.5500000000000001e92 < h < -7.8000000000000003e-243Initial program 68.9%
Simplified71.3%
Taylor expanded in M around 0 33.8%
*-rgt-identity33.8%
pow1/233.8%
pow1/233.8%
pow-prod-down27.0%
Applied egg-rr27.0%
unpow1/227.0%
Simplified27.0%
frac-times22.8%
sqrt-div22.7%
sqrt-unprod0.0%
add-sqr-sqrt14.0%
Applied egg-rr14.0%
sqrt-prod0.0%
associate-/l/0.0%
*-un-lft-identity0.0%
add-sqr-sqrt0.0%
sqr-neg0.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
neg-mul-10.0%
times-frac0.0%
metadata-eval0.0%
associate-/l/0.0%
sqrt-prod47.9%
*-commutative47.9%
Applied egg-rr47.9%
mul-1-neg47.9%
distribute-neg-frac47.9%
Simplified47.9%
if -7.8000000000000003e-243 < h Initial program 64.9%
Simplified63.7%
Taylor expanded in M around 0 35.1%
*-rgt-identity35.1%
pow1/235.1%
pow1/235.1%
pow-prod-down31.9%
Applied egg-rr31.9%
unpow1/231.9%
Simplified31.9%
frac-times28.0%
sqrt-div31.8%
sqrt-unprod38.9%
add-sqr-sqrt41.8%
Applied egg-rr41.8%
Final simplification42.0%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= d 8.2e-222) (* d (- (sqrt (/ (/ 1.0 h) l)))) (/ d (sqrt (* h l)))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 8.2e-222) {
tmp = d * -sqrt(((1.0 / h) / l));
} else {
tmp = d / sqrt((h * l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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 <= 8.2d-222) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else
tmp = d / sqrt((h * l))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 8.2e-222) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else {
tmp = d / Math.sqrt((h * l));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= 8.2e-222: tmp = d * -math.sqrt(((1.0 / h) / l)) else: tmp = d / math.sqrt((h * l)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= 8.2e-222) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); else tmp = Float64(d / sqrt(Float64(h * l))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= 8.2e-222)
tmp = d * -sqrt(((1.0 / h) / l));
else
tmp = d / sqrt((h * l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, 8.2e-222], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 8.2 \cdot 10^{-222}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if d < 8.2000000000000006e-222Initial program 63.2%
Simplified63.0%
Taylor expanded in M around 0 29.9%
*-rgt-identity29.9%
pow1/229.9%
pow1/229.9%
pow-prod-down26.1%
Applied egg-rr26.1%
unpow1/226.1%
Simplified26.1%
sqrt-prod29.9%
frac-2neg29.9%
sqrt-undiv27.6%
*-commutative27.6%
sqrt-div0.0%
frac-2neg0.0%
frac-times0.0%
Applied egg-rr2.7%
Taylor expanded in d around 0 33.1%
associate-*r*33.1%
neg-mul-133.1%
associate-/r*34.3%
Simplified34.3%
if 8.2000000000000006e-222 < d Initial program 68.8%
Simplified68.0%
Taylor expanded in M around 0 40.6%
*-rgt-identity40.6%
pow1/240.6%
pow1/240.6%
pow-prod-down36.3%
Applied egg-rr36.3%
unpow1/236.3%
Simplified36.3%
frac-times32.4%
sqrt-div37.5%
sqrt-unprod48.1%
add-sqr-sqrt48.3%
Applied egg-rr48.3%
Final simplification40.5%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function 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 (* h l)))) (if (<= d 2.55e-224) (/ (- d) t_0) (/ d t_0))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h * l));
double tmp;
if (d <= 2.55e-224) {
tmp = -d / t_0;
} else {
tmp = d / t_0;
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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((h * l))
if (d <= 2.55d-224) then
tmp = -d / t_0
else
tmp = d / t_0
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((h * l));
double tmp;
if (d <= 2.55e-224) {
tmp = -d / t_0;
} else {
tmp = d / t_0;
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((h * l)) tmp = 0 if d <= 2.55e-224: tmp = -d / t_0 else: tmp = d / t_0 return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(h * l)) tmp = 0.0 if (d <= 2.55e-224) tmp = Float64(Float64(-d) / t_0); else tmp = Float64(d / t_0); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((h * l));
tmp = 0.0;
if (d <= 2.55e-224)
tmp = -d / t_0;
else
tmp = d / t_0;
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, 2.55e-224], N[((-d) / t$95$0), $MachinePrecision], N[(d / t$95$0), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
\mathbf{if}\;d \leq 2.55 \cdot 10^{-224}:\\
\;\;\;\;\frac{-d}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t_0}\\
\end{array}
\end{array}
if d < 2.5500000000000001e-224Initial program 63.2%
Simplified63.0%
Taylor expanded in M around 0 29.9%
*-rgt-identity29.9%
pow1/229.9%
pow1/229.9%
pow-prod-down26.1%
Applied egg-rr26.1%
unpow1/226.1%
Simplified26.1%
frac-times17.6%
sqrt-div18.2%
sqrt-unprod3.1%
add-sqr-sqrt13.6%
Applied egg-rr13.6%
sqrt-prod3.8%
associate-/l/3.8%
*-un-lft-identity3.8%
add-sqr-sqrt3.8%
sqr-neg3.8%
sqrt-unprod0.0%
add-sqr-sqrt2.7%
neg-mul-12.7%
times-frac2.7%
metadata-eval2.7%
associate-/l/2.7%
sqrt-prod33.7%
*-commutative33.7%
Applied egg-rr33.7%
mul-1-neg33.7%
distribute-neg-frac33.7%
Simplified33.7%
if 2.5500000000000001e-224 < d Initial program 68.8%
Simplified68.0%
Taylor expanded in M around 0 40.6%
*-rgt-identity40.6%
pow1/240.6%
pow1/240.6%
pow-prod-down36.3%
Applied egg-rr36.3%
unpow1/236.3%
Simplified36.3%
frac-times32.4%
sqrt-div37.5%
sqrt-unprod48.1%
add-sqr-sqrt48.3%
Applied egg-rr48.3%
Final simplification40.2%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function 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))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d / sqrt((h * l));
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
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
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d / Math.sqrt((h * l));
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d / math.sqrt((h * l))
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d / sqrt(Float64(h * l))) end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d / sqrt((h * l));
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function 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 = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Initial program 65.7%
Simplified65.2%
Taylor expanded in M around 0 34.6%
*-rgt-identity34.6%
pow1/234.6%
pow1/234.6%
pow-prod-down30.6%
Applied egg-rr30.6%
unpow1/230.6%
Simplified30.6%
frac-times24.1%
sqrt-div26.7%
sqrt-unprod22.9%
add-sqr-sqrt28.9%
Applied egg-rr28.9%
Final simplification28.9%
herbie shell --seed 2023301
(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)))))