
(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 22 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
(if (<= l -5e-311)
(*
(* (sqrt (/ d h)) (pow (* (pow (- d) 0.25) (pow (/ -1.0 l) 0.25)) 2.0))
(- 1.0 (* 0.5 (/ (* h (pow (* (* 0.5 M) (/ D d)) 2.0)) l))))
(*
(/ (sqrt d) (sqrt l))
(*
(/ (sqrt d) (sqrt h))
(fma (pow (* 0.5 (/ M (/ d D))) 2.0) (* -0.5 (/ h l)) 1.0)))))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 <= -5e-311) {
tmp = (sqrt((d / h)) * pow((pow(-d, 0.25) * pow((-1.0 / l), 0.25)), 2.0)) * (1.0 - (0.5 * ((h * pow(((0.5 * M) * (D / d)), 2.0)) / l)));
} else {
tmp = (sqrt(d) / sqrt(l)) * ((sqrt(d) / sqrt(h)) * fma(pow((0.5 * (M / (d / D))), 2.0), (-0.5 * (h / l)), 1.0));
}
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 <= -5e-311) tmp = Float64(Float64(sqrt(Float64(d / h)) * (Float64((Float64(-d) ^ 0.25) * (Float64(-1.0 / l) ^ 0.25)) ^ 2.0)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0)) / l)))); else tmp = Float64(Float64(sqrt(d) / sqrt(l)) * Float64(Float64(sqrt(d) / sqrt(h)) * fma((Float64(0.5 * Float64(M / Float64(d / D))) ^ 2.0), Float64(-0.5 * Float64(h / l)), 1.0))); 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, -5e-311], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Power[N[(N[Power[(-d), 0.25], $MachinePrecision] * N[Power[N[(-1.0 / l), $MachinePrecision], 0.25], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(0.5 * N[(M / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot {\left({\left(-d\right)}^{0.25} \cdot {\left(\frac{-1}{\ell}\right)}^{0.25}\right)}^{2}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \frac{M}{\frac{d}{D}}\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)\\
\end{array}
\end{array}
if l < -5.00000000000023e-311Initial program 70.9%
Simplified69.2%
associate-*r/72.5%
div-inv72.5%
metadata-eval72.5%
Applied egg-rr72.5%
pow1/272.5%
sqr-pow72.3%
pow272.3%
metadata-eval72.3%
Applied egg-rr72.3%
Taylor expanded in l around -inf 73.7%
distribute-lft-in73.7%
exp-sum73.9%
*-commutative73.9%
rem-square-sqrt0.0%
unpow20.0%
*-commutative0.0%
exp-to-pow0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt74.2%
mul-1-neg74.2%
*-commutative74.2%
exp-to-pow76.7%
Simplified76.7%
if -5.00000000000023e-311 < l Initial program 67.2%
Simplified67.3%
sqrt-div80.0%
Applied egg-rr80.0%
sqrt-div87.8%
Applied egg-rr87.8%
Final simplification82.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 (- 1.0 (* 0.5 (/ (* h (pow (* (* 0.5 M) (/ D d)) 2.0)) l)))))
(if (<= d -1.95e-296)
(*
(* (sqrt (/ d h)) (pow (* (pow (- d) 0.25) (pow (/ -1.0 l) 0.25)) 2.0))
t_0)
(if (<= d 3.4e-184)
(* -0.125 (/ (* (* (* M D) (* M D)) (/ (sqrt h) (pow l 1.5))) d))
(* t_0 (* (/ (sqrt d) (sqrt h)) (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 * ((h * pow(((0.5 * M) * (D / d)), 2.0)) / l));
double tmp;
if (d <= -1.95e-296) {
tmp = (sqrt((d / h)) * pow((pow(-d, 0.25) * pow((-1.0 / l), 0.25)), 2.0)) * t_0;
} else if (d <= 3.4e-184) {
tmp = -0.125 * ((((M * D) * (M * D)) * (sqrt(h) / pow(l, 1.5))) / d);
} else {
tmp = t_0 * ((sqrt(d) / sqrt(h)) * 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) :: tmp
t_0 = 1.0d0 - (0.5d0 * ((h * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0)) / l))
if (d <= (-1.95d-296)) then
tmp = (sqrt((d / h)) * (((-d ** 0.25d0) * (((-1.0d0) / l) ** 0.25d0)) ** 2.0d0)) * t_0
else if (d <= 3.4d-184) then
tmp = (-0.125d0) * ((((m * d_1) * (m * d_1)) * (sqrt(h) / (l ** 1.5d0))) / d)
else
tmp = t_0 * ((sqrt(d) / sqrt(h)) * 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 * ((h * Math.pow(((0.5 * M) * (D / d)), 2.0)) / l));
double tmp;
if (d <= -1.95e-296) {
tmp = (Math.sqrt((d / h)) * Math.pow((Math.pow(-d, 0.25) * Math.pow((-1.0 / l), 0.25)), 2.0)) * t_0;
} else if (d <= 3.4e-184) {
tmp = -0.125 * ((((M * D) * (M * D)) * (Math.sqrt(h) / Math.pow(l, 1.5))) / d);
} else {
tmp = t_0 * ((Math.sqrt(d) / Math.sqrt(h)) * 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 * ((h * math.pow(((0.5 * M) * (D / d)), 2.0)) / l)) tmp = 0 if d <= -1.95e-296: tmp = (math.sqrt((d / h)) * math.pow((math.pow(-d, 0.25) * math.pow((-1.0 / l), 0.25)), 2.0)) * t_0 elif d <= 3.4e-184: tmp = -0.125 * ((((M * D) * (M * D)) * (math.sqrt(h) / math.pow(l, 1.5))) / d) else: tmp = t_0 * ((math.sqrt(d) / math.sqrt(h)) * 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(h * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0)) / l))) tmp = 0.0 if (d <= -1.95e-296) tmp = Float64(Float64(sqrt(Float64(d / h)) * (Float64((Float64(-d) ^ 0.25) * (Float64(-1.0 / l) ^ 0.25)) ^ 2.0)) * t_0); elseif (d <= 3.4e-184) tmp = Float64(-0.125 * Float64(Float64(Float64(Float64(M * D) * Float64(M * D)) * Float64(sqrt(h) / (l ^ 1.5))) / d)); else tmp = Float64(t_0 * Float64(Float64(sqrt(d) / sqrt(h)) * 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 * ((h * (((0.5 * M) * (D / d)) ^ 2.0)) / l));
tmp = 0.0;
if (d <= -1.95e-296)
tmp = (sqrt((d / h)) * (((-d ^ 0.25) * ((-1.0 / l) ^ 0.25)) ^ 2.0)) * t_0;
elseif (d <= 3.4e-184)
tmp = -0.125 * ((((M * D) * (M * D)) * (sqrt(h) / (l ^ 1.5))) / d);
else
tmp = t_0 * ((sqrt(d) / sqrt(h)) * 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[(h * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.95e-296], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Power[N[(N[Power[(-d), 0.25], $MachinePrecision] * N[Power[N[(-1.0 / l), $MachinePrecision], 0.25], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[d, 3.4e-184], N[(-0.125 * N[(N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * 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 \frac{h \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}}{\ell}\\
\mathbf{if}\;d \leq -1.95 \cdot 10^{-296}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot {\left({\left(-d\right)}^{0.25} \cdot {\left(\frac{-1}{\ell}\right)}^{0.25}\right)}^{2}\right) \cdot t_0\\
\mathbf{elif}\;d \leq 3.4 \cdot 10^{-184}:\\
\;\;\;\;-0.125 \cdot \frac{\left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right) \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}}{d}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\end{array}
\end{array}
if d < -1.95000000000000005e-296Initial program 72.1%
Simplified70.4%
associate-*r/73.7%
div-inv73.7%
metadata-eval73.7%
Applied egg-rr73.7%
pow1/273.7%
sqr-pow73.6%
pow273.6%
metadata-eval73.6%
Applied egg-rr73.6%
Taylor expanded in l around -inf 74.9%
distribute-lft-in74.9%
exp-sum75.1%
*-commutative75.1%
rem-square-sqrt0.0%
unpow20.0%
*-commutative0.0%
exp-to-pow0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt75.4%
mul-1-neg75.4%
*-commutative75.4%
exp-to-pow78.0%
Simplified78.0%
if -1.95000000000000005e-296 < d < 3.40000000000000004e-184Initial program 35.0%
Simplified34.8%
associate-*r/34.9%
div-inv34.9%
metadata-eval34.9%
Applied egg-rr34.9%
Taylor expanded in d around 0 43.2%
associate-*l/43.3%
unpow243.3%
unpow243.3%
unswap-sqr55.9%
Simplified55.9%
sqrt-div55.9%
Applied egg-rr55.9%
sqr-pow55.9%
rem-sqrt-square63.6%
sqr-pow63.6%
fabs-sqr63.6%
sqr-pow63.6%
metadata-eval63.6%
Simplified63.6%
if 3.40000000000000004e-184 < d Initial program 75.8%
Simplified75.8%
associate-*r/77.9%
div-inv77.9%
metadata-eval77.9%
Applied egg-rr77.9%
sqrt-div86.4%
Applied egg-rr88.4%
Final simplification80.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 (/ d l))))
(if (<= d -1.95e-296)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* (* 0.5 M) (/ D d)) 2.0)) l)))
(* (sqrt (/ d h)) t_0))
(if (<= d 1.3e-185)
(* -0.125 (/ (* (* (* M D) (* M D)) (/ (sqrt h) (pow l 1.5))) d))
(*
(* (/ (sqrt d) (sqrt h)) t_0)
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D d) (/ M 2.0)) 2.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((d / l));
double tmp;
if (d <= -1.95e-296) {
tmp = (1.0 - (0.5 * ((h * pow(((0.5 * M) * (D / d)), 2.0)) / l))) * (sqrt((d / h)) * t_0);
} else if (d <= 1.3e-185) {
tmp = -0.125 * ((((M * D) * (M * D)) * (sqrt(h) / pow(l, 1.5))) / d);
} else {
tmp = ((sqrt(d) / sqrt(h)) * t_0) * (1.0 - (0.5 * ((h / l) * pow(((D / d) * (M / 2.0)), 2.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((d / l))
if (d <= (-1.95d-296)) then
tmp = (1.0d0 - (0.5d0 * ((h * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0)) / l))) * (sqrt((d / h)) * t_0)
else if (d <= 1.3d-185) then
tmp = (-0.125d0) * ((((m * d_1) * (m * d_1)) * (sqrt(h) / (l ** 1.5d0))) / d)
else
tmp = ((sqrt(d) / sqrt(h)) * t_0) * (1.0d0 - (0.5d0 * ((h / l) * (((d_1 / d) * (m / 2.0d0)) ** 2.0d0))))
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 <= -1.95e-296) {
tmp = (1.0 - (0.5 * ((h * Math.pow(((0.5 * M) * (D / d)), 2.0)) / l))) * (Math.sqrt((d / h)) * t_0);
} else if (d <= 1.3e-185) {
tmp = -0.125 * ((((M * D) * (M * D)) * (Math.sqrt(h) / Math.pow(l, 1.5))) / d);
} else {
tmp = ((Math.sqrt(d) / Math.sqrt(h)) * t_0) * (1.0 - (0.5 * ((h / l) * Math.pow(((D / d) * (M / 2.0)), 2.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((d / l)) tmp = 0 if d <= -1.95e-296: tmp = (1.0 - (0.5 * ((h * math.pow(((0.5 * M) * (D / d)), 2.0)) / l))) * (math.sqrt((d / h)) * t_0) elif d <= 1.3e-185: tmp = -0.125 * ((((M * D) * (M * D)) * (math.sqrt(h) / math.pow(l, 1.5))) / d) else: tmp = ((math.sqrt(d) / math.sqrt(h)) * t_0) * (1.0 - (0.5 * ((h / l) * math.pow(((D / d) * (M / 2.0)), 2.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(d / l)) tmp = 0.0 if (d <= -1.95e-296) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0)) / l))) * Float64(sqrt(Float64(d / h)) * t_0)); elseif (d <= 1.3e-185) tmp = Float64(-0.125 * Float64(Float64(Float64(Float64(M * D) * Float64(M * D)) * Float64(sqrt(h) / (l ^ 1.5))) / d)); else tmp = Float64(Float64(Float64(sqrt(d) / sqrt(h)) * t_0) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.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((d / l));
tmp = 0.0;
if (d <= -1.95e-296)
tmp = (1.0 - (0.5 * ((h * (((0.5 * M) * (D / d)) ^ 2.0)) / l))) * (sqrt((d / h)) * t_0);
elseif (d <= 1.3e-185)
tmp = -0.125 * ((((M * D) * (M * D)) * (sqrt(h) / (l ^ 1.5))) / d);
else
tmp = ((sqrt(d) / sqrt(h)) * t_0) * (1.0 - (0.5 * ((h / l) * (((D / d) * (M / 2.0)) ^ 2.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[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.95e-296], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.3e-185], N[(-0.125 * N[(N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $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 -1.95 \cdot 10^{-296}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot t_0\right)\\
\mathbf{elif}\;d \leq 1.3 \cdot 10^{-185}:\\
\;\;\;\;-0.125 \cdot \frac{\left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right) \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}}{d}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot t_0\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if d < -1.95000000000000005e-296Initial program 72.1%
Simplified70.4%
associate-*r/73.7%
div-inv73.7%
metadata-eval73.7%
Applied egg-rr73.7%
if -1.95000000000000005e-296 < d < 1.29999999999999992e-185Initial program 35.0%
Simplified34.8%
associate-*r/34.9%
div-inv34.9%
metadata-eval34.9%
Applied egg-rr34.9%
Taylor expanded in d around 0 43.2%
associate-*l/43.3%
unpow243.3%
unpow243.3%
unswap-sqr55.9%
Simplified55.9%
sqrt-div55.9%
Applied egg-rr55.9%
sqr-pow55.9%
rem-sqrt-square63.6%
sqr-pow63.6%
fabs-sqr63.6%
sqr-pow63.6%
metadata-eval63.6%
Simplified63.6%
if 1.29999999999999992e-185 < d Initial program 75.8%
Simplified75.8%
sqrt-div86.4%
Applied egg-rr86.4%
Final simplification77.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 (- 1.0 (* 0.5 (/ (* h (pow (* (* 0.5 M) (/ D d)) 2.0)) l))))
(t_1 (sqrt (/ d l))))
(if (<= d -1.95e-296)
(* t_0 (* (sqrt (/ d h)) t_1))
(if (<= d 3.2e-187)
(* -0.125 (/ (* (* (* M D) (* M D)) (/ (sqrt h) (pow l 1.5))) d))
(* t_0 (* (/ (sqrt d) (sqrt h)) t_1))))))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 * ((h * pow(((0.5 * M) * (D / d)), 2.0)) / l));
double t_1 = sqrt((d / l));
double tmp;
if (d <= -1.95e-296) {
tmp = t_0 * (sqrt((d / h)) * t_1);
} else if (d <= 3.2e-187) {
tmp = -0.125 * ((((M * D) * (M * D)) * (sqrt(h) / pow(l, 1.5))) / d);
} else {
tmp = t_0 * ((sqrt(d) / sqrt(h)) * t_1);
}
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 * ((h * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0)) / l))
t_1 = sqrt((d / l))
if (d <= (-1.95d-296)) then
tmp = t_0 * (sqrt((d / h)) * t_1)
else if (d <= 3.2d-187) then
tmp = (-0.125d0) * ((((m * d_1) * (m * d_1)) * (sqrt(h) / (l ** 1.5d0))) / d)
else
tmp = t_0 * ((sqrt(d) / sqrt(h)) * t_1)
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 * ((h * Math.pow(((0.5 * M) * (D / d)), 2.0)) / l));
double t_1 = Math.sqrt((d / l));
double tmp;
if (d <= -1.95e-296) {
tmp = t_0 * (Math.sqrt((d / h)) * t_1);
} else if (d <= 3.2e-187) {
tmp = -0.125 * ((((M * D) * (M * D)) * (Math.sqrt(h) / Math.pow(l, 1.5))) / d);
} else {
tmp = t_0 * ((Math.sqrt(d) / Math.sqrt(h)) * t_1);
}
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 * ((h * math.pow(((0.5 * M) * (D / d)), 2.0)) / l)) t_1 = math.sqrt((d / l)) tmp = 0 if d <= -1.95e-296: tmp = t_0 * (math.sqrt((d / h)) * t_1) elif d <= 3.2e-187: tmp = -0.125 * ((((M * D) * (M * D)) * (math.sqrt(h) / math.pow(l, 1.5))) / d) else: tmp = t_0 * ((math.sqrt(d) / math.sqrt(h)) * t_1) 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(h * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0)) / l))) t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (d <= -1.95e-296) tmp = Float64(t_0 * Float64(sqrt(Float64(d / h)) * t_1)); elseif (d <= 3.2e-187) tmp = Float64(-0.125 * Float64(Float64(Float64(Float64(M * D) * Float64(M * D)) * Float64(sqrt(h) / (l ^ 1.5))) / d)); else tmp = Float64(t_0 * Float64(Float64(sqrt(d) / sqrt(h)) * t_1)); 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 * ((h * (((0.5 * M) * (D / d)) ^ 2.0)) / l));
t_1 = sqrt((d / l));
tmp = 0.0;
if (d <= -1.95e-296)
tmp = t_0 * (sqrt((d / h)) * t_1);
elseif (d <= 3.2e-187)
tmp = -0.125 * ((((M * D) * (M * D)) * (sqrt(h) / (l ^ 1.5))) / d);
else
tmp = t_0 * ((sqrt(d) / sqrt(h)) * t_1);
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[(h * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.95e-296], N[(t$95$0 * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.2e-187], N[(-0.125 * N[(N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 1 - 0.5 \cdot \frac{h \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}}{\ell}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -1.95 \cdot 10^{-296}:\\
\;\;\;\;t_0 \cdot \left(\sqrt{\frac{d}{h}} \cdot t_1\right)\\
\mathbf{elif}\;d \leq 3.2 \cdot 10^{-187}:\\
\;\;\;\;-0.125 \cdot \frac{\left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right) \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}}{d}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot t_1\right)\\
\end{array}
\end{array}
if d < -1.95000000000000005e-296Initial program 72.1%
Simplified70.4%
associate-*r/73.7%
div-inv73.7%
metadata-eval73.7%
Applied egg-rr73.7%
if -1.95000000000000005e-296 < d < 3.1999999999999998e-187Initial program 35.0%
Simplified34.8%
associate-*r/34.9%
div-inv34.9%
metadata-eval34.9%
Applied egg-rr34.9%
Taylor expanded in d around 0 43.2%
associate-*l/43.3%
unpow243.3%
unpow243.3%
unswap-sqr55.9%
Simplified55.9%
sqrt-div55.9%
Applied egg-rr55.9%
sqr-pow55.9%
rem-sqrt-square63.6%
sqr-pow63.6%
fabs-sqr63.6%
sqr-pow63.6%
metadata-eval63.6%
Simplified63.6%
if 3.1999999999999998e-187 < d Initial program 75.8%
Simplified75.8%
associate-*r/77.9%
div-inv77.9%
metadata-eval77.9%
Applied egg-rr77.9%
sqrt-div86.4%
Applied egg-rr88.4%
Final simplification78.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 (<= l 5.5e+118)
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D d) (/ M 2.0)) 2.0))))
(* (sqrt (/ d h)) (sqrt (/ d l))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt 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 (l <= 5.5e+118) {
tmp = (1.0 - (0.5 * ((h / l) * pow(((D / d) * (M / 2.0)), 2.0)))) * (sqrt((d / h)) * sqrt((d / l)));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(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 (l <= 5.5d+118) then
tmp = (1.0d0 - (0.5d0 * ((h / l) * (((d_1 / d) * (m / 2.0d0)) ** 2.0d0)))) * (sqrt((d / h)) * sqrt((d / l)))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(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 (l <= 5.5e+118) {
tmp = (1.0 - (0.5 * ((h / l) * Math.pow(((D / d) * (M / 2.0)), 2.0)))) * (Math.sqrt((d / h)) * Math.sqrt((d / l)));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 5.5e+118: tmp = (1.0 - (0.5 * ((h / l) * math.pow(((D / d) * (M / 2.0)), 2.0)))) * (math.sqrt((d / h)) * math.sqrt((d / l))) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(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 (l <= 5.5e+118) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0)))) * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(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 (l <= 5.5e+118)
tmp = (1.0 - (0.5 * ((h / l) * (((D / d) * (M / 2.0)) ^ 2.0)))) * (sqrt((d / h)) * sqrt((d / l)));
else
tmp = d * (sqrt((1.0 / h)) / sqrt(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[l, 5.5e+118], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 5.5 \cdot 10^{+118}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < 5.5000000000000003e118Initial program 72.0%
Simplified71.1%
if 5.5000000000000003e118 < l Initial program 56.0%
Simplified56.0%
Taylor expanded in d around inf 50.2%
associate-/r*52.1%
Simplified52.1%
sqrt-div75.5%
Applied egg-rr75.5%
Final simplification71.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 (<= l 2.5e+120)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* (* 0.5 M) (/ D d)) 2.0)) l)))
(* (sqrt (/ d h)) (sqrt (/ d l))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt 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 (l <= 2.5e+120) {
tmp = (1.0 - (0.5 * ((h * pow(((0.5 * M) * (D / d)), 2.0)) / l))) * (sqrt((d / h)) * sqrt((d / l)));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(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 (l <= 2.5d+120) then
tmp = (1.0d0 - (0.5d0 * ((h * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0)) / l))) * (sqrt((d / h)) * sqrt((d / l)))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(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 (l <= 2.5e+120) {
tmp = (1.0 - (0.5 * ((h * Math.pow(((0.5 * M) * (D / d)), 2.0)) / l))) * (Math.sqrt((d / h)) * Math.sqrt((d / l)));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 2.5e+120: tmp = (1.0 - (0.5 * ((h * math.pow(((0.5 * M) * (D / d)), 2.0)) / l))) * (math.sqrt((d / h)) * math.sqrt((d / l))) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(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 (l <= 2.5e+120) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0)) / l))) * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(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 (l <= 2.5e+120)
tmp = (1.0 - (0.5 * ((h * (((0.5 * M) * (D / d)) ^ 2.0)) / l))) * (sqrt((d / h)) * sqrt((d / l)));
else
tmp = d * (sqrt((1.0 / h)) / sqrt(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[l, 2.5e+120], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.5 \cdot 10^{+120}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < 2.50000000000000009e120Initial program 72.0%
Simplified71.1%
associate-*r/73.9%
div-inv73.9%
metadata-eval73.9%
Applied egg-rr73.9%
if 2.50000000000000009e120 < l Initial program 56.0%
Simplified56.0%
Taylor expanded in d around inf 50.2%
associate-/r*52.1%
Simplified52.1%
sqrt-div75.5%
Applied egg-rr75.5%
Final simplification74.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
(if (<= d -3.8e-196)
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (* -0.5 (* (/ h l) (pow (* 0.5 (* M (/ D d))) 2.0)))))
(if (<= d 4.5e-305)
(* d (log (exp (pow (* l h) -0.5))))
(if (<= d 6e-58)
(* -0.125 (/ (* (* (* M D) (* M D)) (/ (sqrt h) (pow l 1.5))) d))
(if (<= d 4.5e+87)
(*
(sqrt (/ (* d (/ d h)) l))
(+ 1.0 (* -0.5 (* (/ h l) (pow (* (* 0.5 M) (/ D d)) 2.0)))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt 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 <= -3.8e-196) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * pow((0.5 * (M * (D / d))), 2.0))));
} else if (d <= 4.5e-305) {
tmp = d * log(exp(pow((l * h), -0.5)));
} else if (d <= 6e-58) {
tmp = -0.125 * ((((M * D) * (M * D)) * (sqrt(h) / pow(l, 1.5))) / d);
} else if (d <= 4.5e+87) {
tmp = sqrt(((d * (d / h)) / l)) * (1.0 + (-0.5 * ((h / l) * pow(((0.5 * M) * (D / d)), 2.0))));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(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 <= (-3.8d-196)) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) * ((h / l) * ((0.5d0 * (m * (d_1 / d))) ** 2.0d0))))
else if (d <= 4.5d-305) then
tmp = d * log(exp(((l * h) ** (-0.5d0))))
else if (d <= 6d-58) then
tmp = (-0.125d0) * ((((m * d_1) * (m * d_1)) * (sqrt(h) / (l ** 1.5d0))) / d)
else if (d <= 4.5d+87) then
tmp = sqrt(((d * (d / h)) / l)) * (1.0d0 + ((-0.5d0) * ((h / l) * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0))))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(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 <= -3.8e-196) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * Math.pow((0.5 * (M * (D / d))), 2.0))));
} else if (d <= 4.5e-305) {
tmp = d * Math.log(Math.exp(Math.pow((l * h), -0.5)));
} else if (d <= 6e-58) {
tmp = -0.125 * ((((M * D) * (M * D)) * (Math.sqrt(h) / Math.pow(l, 1.5))) / d);
} else if (d <= 4.5e+87) {
tmp = Math.sqrt(((d * (d / h)) / l)) * (1.0 + (-0.5 * ((h / l) * Math.pow(((0.5 * M) * (D / d)), 2.0))));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(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 <= -3.8e-196: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * math.pow((0.5 * (M * (D / d))), 2.0)))) elif d <= 4.5e-305: tmp = d * math.log(math.exp(math.pow((l * h), -0.5))) elif d <= 6e-58: tmp = -0.125 * ((((M * D) * (M * D)) * (math.sqrt(h) / math.pow(l, 1.5))) / d) elif d <= 4.5e+87: tmp = math.sqrt(((d * (d / h)) / l)) * (1.0 + (-0.5 * ((h / l) * math.pow(((0.5 * M) * (D / d)), 2.0)))) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(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 <= -3.8e-196) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(0.5 * Float64(M * Float64(D / d))) ^ 2.0))))); elseif (d <= 4.5e-305) tmp = Float64(d * log(exp((Float64(l * h) ^ -0.5)))); elseif (d <= 6e-58) tmp = Float64(-0.125 * Float64(Float64(Float64(Float64(M * D) * Float64(M * D)) * Float64(sqrt(h) / (l ^ 1.5))) / d)); elseif (d <= 4.5e+87) tmp = Float64(sqrt(Float64(Float64(d * Float64(d / h)) / l)) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0))))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(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 <= -3.8e-196)
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * ((0.5 * (M * (D / d))) ^ 2.0))));
elseif (d <= 4.5e-305)
tmp = d * log(exp(((l * h) ^ -0.5)));
elseif (d <= 6e-58)
tmp = -0.125 * ((((M * D) * (M * D)) * (sqrt(h) / (l ^ 1.5))) / d);
elseif (d <= 4.5e+87)
tmp = sqrt(((d * (d / h)) / l)) * (1.0 + (-0.5 * ((h / l) * (((0.5 * M) * (D / d)) ^ 2.0))));
else
tmp = d * (sqrt((1.0 / h)) / sqrt(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, -3.8e-196], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(0.5 * N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4.5e-305], N[(d * N[Log[N[Exp[N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6e-58], N[(-0.125 * N[(N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4.5e+87], N[(N[Sqrt[N[(N[(d * N[(d / h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -3.8 \cdot 10^{-196}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\mathbf{elif}\;d \leq 4.5 \cdot 10^{-305}:\\
\;\;\;\;d \cdot \log \left(e^{{\left(\ell \cdot h\right)}^{-0.5}}\right)\\
\mathbf{elif}\;d \leq 6 \cdot 10^{-58}:\\
\;\;\;\;-0.125 \cdot \frac{\left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right) \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}}{d}\\
\mathbf{elif}\;d \leq 4.5 \cdot 10^{+87}:\\
\;\;\;\;\sqrt{\frac{d \cdot \frac{d}{h}}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -3.8000000000000001e-196Initial program 76.7%
Simplified74.4%
associate-*r/78.8%
div-inv78.8%
metadata-eval78.8%
Applied egg-rr78.8%
Applied egg-rr65.4%
unpow165.4%
*-commutative65.4%
associate-*r*65.4%
Simplified65.4%
if -3.8000000000000001e-196 < d < 4.5000000000000002e-305Initial program 51.6%
Simplified51.6%
associate-*r/51.6%
div-inv51.6%
metadata-eval51.6%
Applied egg-rr51.6%
Taylor expanded in d around inf 24.3%
unpow-124.3%
sqr-pow24.3%
rem-sqrt-square21.2%
metadata-eval21.2%
sqr-pow21.2%
fabs-sqr21.2%
sqr-pow21.2%
Simplified21.2%
add-log-exp49.6%
*-commutative49.6%
Applied egg-rr49.6%
if 4.5000000000000002e-305 < d < 6.00000000000000015e-58Initial program 48.6%
Simplified48.4%
associate-*r/46.7%
div-inv46.7%
metadata-eval46.7%
Applied egg-rr46.7%
Taylor expanded in d around 0 40.1%
associate-*l/40.1%
unpow240.1%
unpow240.1%
unswap-sqr54.1%
Simplified54.1%
sqrt-div56.1%
Applied egg-rr56.1%
sqr-pow56.1%
rem-sqrt-square64.9%
sqr-pow64.9%
fabs-sqr64.9%
sqr-pow64.9%
metadata-eval64.9%
Simplified64.9%
if 6.00000000000000015e-58 < d < 4.5000000000000003e87Initial program 80.4%
Simplified80.4%
Applied egg-rr15.7%
expm1-def33.6%
expm1-log1p70.0%
associate-*r/70.1%
*-commutative70.1%
Simplified70.1%
if 4.5000000000000003e87 < d Initial program 78.4%
Simplified78.6%
Taylor expanded in d around inf 68.9%
associate-/r*68.9%
Simplified68.9%
sqrt-div86.6%
Applied egg-rr86.6%
Final simplification68.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
(if (<= d -6.5e-196)
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (* -0.5 (* (/ h l) (pow (* 0.5 (* M (/ D d))) 2.0)))))
(if (<= d -1.95e-296)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(* -0.125 (* (* D (/ D d)) (* (/ M d) (* M (/ h l)))))))
(if (<= d 8.5e-60)
(* -0.125 (/ (* (* (* M D) (* M D)) (/ (sqrt h) (pow l 1.5))) d))
(if (<= d 2.5e+87)
(*
(sqrt (/ (* d (/ d h)) l))
(+ 1.0 (* -0.5 (* (/ h l) (pow (* (* 0.5 M) (/ D d)) 2.0)))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt 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 <= -6.5e-196) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * pow((0.5 * (M * (D / d))), 2.0))));
} else if (d <= -1.95e-296) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (-0.125 * ((D * (D / d)) * ((M / d) * (M * (h / l))))));
} else if (d <= 8.5e-60) {
tmp = -0.125 * ((((M * D) * (M * D)) * (sqrt(h) / pow(l, 1.5))) / d);
} else if (d <= 2.5e+87) {
tmp = sqrt(((d * (d / h)) / l)) * (1.0 + (-0.5 * ((h / l) * pow(((0.5 * M) * (D / d)), 2.0))));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(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 <= (-6.5d-196)) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) * ((h / l) * ((0.5d0 * (m * (d_1 / d))) ** 2.0d0))))
else if (d <= (-1.95d-296)) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * ((-0.125d0) * ((d_1 * (d_1 / d)) * ((m / d) * (m * (h / l))))))
else if (d <= 8.5d-60) then
tmp = (-0.125d0) * ((((m * d_1) * (m * d_1)) * (sqrt(h) / (l ** 1.5d0))) / d)
else if (d <= 2.5d+87) then
tmp = sqrt(((d * (d / h)) / l)) * (1.0d0 + ((-0.5d0) * ((h / l) * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0))))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(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 <= -6.5e-196) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * Math.pow((0.5 * (M * (D / d))), 2.0))));
} else if (d <= -1.95e-296) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (-0.125 * ((D * (D / d)) * ((M / d) * (M * (h / l))))));
} else if (d <= 8.5e-60) {
tmp = -0.125 * ((((M * D) * (M * D)) * (Math.sqrt(h) / Math.pow(l, 1.5))) / d);
} else if (d <= 2.5e+87) {
tmp = Math.sqrt(((d * (d / h)) / l)) * (1.0 + (-0.5 * ((h / l) * Math.pow(((0.5 * M) * (D / d)), 2.0))));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(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 <= -6.5e-196: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * math.pow((0.5 * (M * (D / d))), 2.0)))) elif d <= -1.95e-296: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (-0.125 * ((D * (D / d)) * ((M / d) * (M * (h / l)))))) elif d <= 8.5e-60: tmp = -0.125 * ((((M * D) * (M * D)) * (math.sqrt(h) / math.pow(l, 1.5))) / d) elif d <= 2.5e+87: tmp = math.sqrt(((d * (d / h)) / l)) * (1.0 + (-0.5 * ((h / l) * math.pow(((0.5 * M) * (D / d)), 2.0)))) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(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 <= -6.5e-196) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(0.5 * Float64(M * Float64(D / d))) ^ 2.0))))); elseif (d <= -1.95e-296) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(-0.125 * Float64(Float64(D * Float64(D / d)) * Float64(Float64(M / d) * Float64(M * Float64(h / l))))))); elseif (d <= 8.5e-60) tmp = Float64(-0.125 * Float64(Float64(Float64(Float64(M * D) * Float64(M * D)) * Float64(sqrt(h) / (l ^ 1.5))) / d)); elseif (d <= 2.5e+87) tmp = Float64(sqrt(Float64(Float64(d * Float64(d / h)) / l)) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0))))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(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 <= -6.5e-196)
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * ((0.5 * (M * (D / d))) ^ 2.0))));
elseif (d <= -1.95e-296)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (-0.125 * ((D * (D / d)) * ((M / d) * (M * (h / l))))));
elseif (d <= 8.5e-60)
tmp = -0.125 * ((((M * D) * (M * D)) * (sqrt(h) / (l ^ 1.5))) / d);
elseif (d <= 2.5e+87)
tmp = sqrt(((d * (d / h)) / l)) * (1.0 + (-0.5 * ((h / l) * (((0.5 * M) * (D / d)) ^ 2.0))));
else
tmp = d * (sqrt((1.0 / h)) / sqrt(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, -6.5e-196], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(0.5 * N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.95e-296], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(N[(D * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(M * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 8.5e-60], N[(-0.125 * N[(N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.5e+87], N[(N[Sqrt[N[(N[(d * N[(d / h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -6.5 \cdot 10^{-196}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\mathbf{elif}\;d \leq -1.95 \cdot 10^{-296}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(-0.125 \cdot \left(\left(D \cdot \frac{D}{d}\right) \cdot \left(\frac{M}{d} \cdot \left(M \cdot \frac{h}{\ell}\right)\right)\right)\right)\right)\\
\mathbf{elif}\;d \leq 8.5 \cdot 10^{-60}:\\
\;\;\;\;-0.125 \cdot \frac{\left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right) \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}}{d}\\
\mathbf{elif}\;d \leq 2.5 \cdot 10^{+87}:\\
\;\;\;\;\sqrt{\frac{d \cdot \frac{d}{h}}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -6.5000000000000004e-196Initial program 76.7%
Simplified74.4%
associate-*r/78.8%
div-inv78.8%
metadata-eval78.8%
Applied egg-rr78.8%
Applied egg-rr65.4%
unpow165.4%
*-commutative65.4%
associate-*r*65.4%
Simplified65.4%
if -6.5000000000000004e-196 < d < -1.95000000000000005e-296Initial program 57.1%
Simplified57.1%
Taylor expanded in M around inf 32.1%
times-frac28.6%
unpow228.6%
unpow228.6%
unpow228.6%
Simplified28.6%
Taylor expanded in D around 0 32.1%
*-commutative32.1%
unpow232.1%
unpow232.1%
associate-*l*32.3%
times-frac39.5%
unpow239.5%
associate-*r/46.6%
associate-*r*46.6%
*-commutative46.6%
*-commutative46.6%
Simplified46.6%
Taylor expanded in M around 0 46.6%
unpow246.6%
associate-*r*46.6%
*-commutative46.6%
times-frac50.3%
associate-/l*53.9%
associate-/r/53.9%
Simplified53.9%
if -1.95000000000000005e-296 < d < 8.50000000000000044e-60Initial program 45.9%
Simplified45.7%
associate-*r/44.1%
div-inv44.1%
metadata-eval44.1%
Applied egg-rr44.1%
Taylor expanded in d around 0 37.8%
associate-*l/37.8%
unpow237.8%
unpow237.8%
unswap-sqr51.0%
Simplified51.0%
sqrt-div52.9%
Applied egg-rr52.9%
sqr-pow52.9%
rem-sqrt-square61.3%
sqr-pow61.2%
fabs-sqr61.2%
sqr-pow61.3%
metadata-eval61.3%
Simplified61.3%
if 8.50000000000000044e-60 < d < 2.4999999999999999e87Initial program 80.4%
Simplified80.4%
Applied egg-rr15.7%
expm1-def33.6%
expm1-log1p70.0%
associate-*r/70.1%
*-commutative70.1%
Simplified70.1%
if 2.4999999999999999e87 < d Initial program 78.4%
Simplified78.6%
Taylor expanded in d around inf 68.9%
associate-/r*68.9%
Simplified68.9%
sqrt-div86.6%
Applied egg-rr86.6%
Final simplification68.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
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (* -0.5 (* (/ h l) (pow (* 0.5 (* M (/ D d))) 2.0)))))))
(if (<= d -2.05e-280)
t_0
(if (<= d 8.5e-60)
(* -0.125 (/ (* (* (* M D) (* M D)) (/ (sqrt h) (pow l 1.5))) d))
(if (<= d 3.6e+87) t_0 (* d (/ (sqrt (/ 1.0 h)) (sqrt 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 / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * pow((0.5 * (M * (D / d))), 2.0))));
double tmp;
if (d <= -2.05e-280) {
tmp = t_0;
} else if (d <= 8.5e-60) {
tmp = -0.125 * ((((M * D) * (M * D)) * (sqrt(h) / pow(l, 1.5))) / d);
} else if (d <= 3.6e+87) {
tmp = t_0;
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(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 / h) * (d / l))) * (1.0d0 + ((-0.5d0) * ((h / l) * ((0.5d0 * (m * (d_1 / d))) ** 2.0d0))))
if (d <= (-2.05d-280)) then
tmp = t_0
else if (d <= 8.5d-60) then
tmp = (-0.125d0) * ((((m * d_1) * (m * d_1)) * (sqrt(h) / (l ** 1.5d0))) / d)
else if (d <= 3.6d+87) then
tmp = t_0
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(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 / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * Math.pow((0.5 * (M * (D / d))), 2.0))));
double tmp;
if (d <= -2.05e-280) {
tmp = t_0;
} else if (d <= 8.5e-60) {
tmp = -0.125 * ((((M * D) * (M * D)) * (Math.sqrt(h) / Math.pow(l, 1.5))) / d);
} else if (d <= 3.6e+87) {
tmp = t_0;
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(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 / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * math.pow((0.5 * (M * (D / d))), 2.0)))) tmp = 0 if d <= -2.05e-280: tmp = t_0 elif d <= 8.5e-60: tmp = -0.125 * ((((M * D) * (M * D)) * (math.sqrt(h) / math.pow(l, 1.5))) / d) elif d <= 3.6e+87: tmp = t_0 else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(0.5 * Float64(M * Float64(D / d))) ^ 2.0))))) tmp = 0.0 if (d <= -2.05e-280) tmp = t_0; elseif (d <= 8.5e-60) tmp = Float64(-0.125 * Float64(Float64(Float64(Float64(M * D) * Float64(M * D)) * Float64(sqrt(h) / (l ^ 1.5))) / d)); elseif (d <= 3.6e+87) tmp = t_0; else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(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 / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * ((0.5 * (M * (D / d))) ^ 2.0))));
tmp = 0.0;
if (d <= -2.05e-280)
tmp = t_0;
elseif (d <= 8.5e-60)
tmp = -0.125 * ((((M * D) * (M * D)) * (sqrt(h) / (l ^ 1.5))) / d);
elseif (d <= 3.6e+87)
tmp = t_0;
else
tmp = d * (sqrt((1.0 / h)) / sqrt(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[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(0.5 * N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.05e-280], t$95$0, If[LessEqual[d, 8.5e-60], N[(-0.125 * N[(N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.6e+87], t$95$0, N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $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} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\mathbf{if}\;d \leq -2.05 \cdot 10^{-280}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 8.5 \cdot 10^{-60}:\\
\;\;\;\;-0.125 \cdot \frac{\left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right) \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}}{d}\\
\mathbf{elif}\;d \leq 3.6 \cdot 10^{+87}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -2.0500000000000001e-280 or 8.50000000000000044e-60 < d < 3.59999999999999994e87Initial program 75.6%
Simplified74.2%
associate-*r/77.6%
div-inv77.6%
metadata-eval77.6%
Applied egg-rr77.6%
Applied egg-rr63.5%
unpow163.5%
*-commutative63.5%
associate-*r*63.5%
Simplified63.5%
if -2.0500000000000001e-280 < d < 8.50000000000000044e-60Initial program 43.6%
Simplified43.5%
associate-*r/42.0%
div-inv42.0%
metadata-eval42.0%
Applied egg-rr42.0%
Taylor expanded in d around 0 34.6%
associate-*l/34.7%
unpow234.7%
unpow234.7%
unswap-sqr46.7%
Simplified46.7%
sqrt-div48.4%
Applied egg-rr48.4%
sqr-pow48.3%
rem-sqrt-square56.0%
sqr-pow55.9%
fabs-sqr55.9%
sqr-pow56.0%
metadata-eval56.0%
Simplified56.0%
if 3.59999999999999994e87 < d Initial program 78.4%
Simplified78.6%
Taylor expanded in d around inf 68.9%
associate-/r*68.9%
Simplified68.9%
sqrt-div86.6%
Applied egg-rr86.6%
Final simplification66.7%
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 -2.05e-280)
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (* -0.5 (* (/ h l) (pow (* 0.5 (* M (/ D d))) 2.0)))))
(if (<= d 6.2e-60)
(* -0.125 (/ (* (* (* M D) (* M D)) (/ (sqrt h) (pow l 1.5))) d))
(if (<= d 2.2e+87)
(*
(sqrt (/ (* d (/ d h)) l))
(+ 1.0 (* -0.5 (* (/ h l) (pow (* (* 0.5 M) (/ D d)) 2.0)))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt 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 <= -2.05e-280) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * pow((0.5 * (M * (D / d))), 2.0))));
} else if (d <= 6.2e-60) {
tmp = -0.125 * ((((M * D) * (M * D)) * (sqrt(h) / pow(l, 1.5))) / d);
} else if (d <= 2.2e+87) {
tmp = sqrt(((d * (d / h)) / l)) * (1.0 + (-0.5 * ((h / l) * pow(((0.5 * M) * (D / d)), 2.0))));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(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 <= (-2.05d-280)) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) * ((h / l) * ((0.5d0 * (m * (d_1 / d))) ** 2.0d0))))
else if (d <= 6.2d-60) then
tmp = (-0.125d0) * ((((m * d_1) * (m * d_1)) * (sqrt(h) / (l ** 1.5d0))) / d)
else if (d <= 2.2d+87) then
tmp = sqrt(((d * (d / h)) / l)) * (1.0d0 + ((-0.5d0) * ((h / l) * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0))))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(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 <= -2.05e-280) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * Math.pow((0.5 * (M * (D / d))), 2.0))));
} else if (d <= 6.2e-60) {
tmp = -0.125 * ((((M * D) * (M * D)) * (Math.sqrt(h) / Math.pow(l, 1.5))) / d);
} else if (d <= 2.2e+87) {
tmp = Math.sqrt(((d * (d / h)) / l)) * (1.0 + (-0.5 * ((h / l) * Math.pow(((0.5 * M) * (D / d)), 2.0))));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(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 <= -2.05e-280: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * math.pow((0.5 * (M * (D / d))), 2.0)))) elif d <= 6.2e-60: tmp = -0.125 * ((((M * D) * (M * D)) * (math.sqrt(h) / math.pow(l, 1.5))) / d) elif d <= 2.2e+87: tmp = math.sqrt(((d * (d / h)) / l)) * (1.0 + (-0.5 * ((h / l) * math.pow(((0.5 * M) * (D / d)), 2.0)))) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(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 <= -2.05e-280) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(0.5 * Float64(M * Float64(D / d))) ^ 2.0))))); elseif (d <= 6.2e-60) tmp = Float64(-0.125 * Float64(Float64(Float64(Float64(M * D) * Float64(M * D)) * Float64(sqrt(h) / (l ^ 1.5))) / d)); elseif (d <= 2.2e+87) tmp = Float64(sqrt(Float64(Float64(d * Float64(d / h)) / l)) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0))))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(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 <= -2.05e-280)
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * ((0.5 * (M * (D / d))) ^ 2.0))));
elseif (d <= 6.2e-60)
tmp = -0.125 * ((((M * D) * (M * D)) * (sqrt(h) / (l ^ 1.5))) / d);
elseif (d <= 2.2e+87)
tmp = sqrt(((d * (d / h)) / l)) * (1.0 + (-0.5 * ((h / l) * (((0.5 * M) * (D / d)) ^ 2.0))));
else
tmp = d * (sqrt((1.0 / h)) / sqrt(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, -2.05e-280], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(0.5 * N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6.2e-60], N[(-0.125 * N[(N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.2e+87], N[(N[Sqrt[N[(N[(d * N[(d / h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.05 \cdot 10^{-280}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\mathbf{elif}\;d \leq 6.2 \cdot 10^{-60}:\\
\;\;\;\;-0.125 \cdot \frac{\left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right) \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}}{d}\\
\mathbf{elif}\;d \leq 2.2 \cdot 10^{+87}:\\
\;\;\;\;\sqrt{\frac{d \cdot \frac{d}{h}}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -2.0500000000000001e-280Initial program 74.3%
Simplified72.6%
associate-*r/76.0%
div-inv76.0%
metadata-eval76.0%
Applied egg-rr76.0%
Applied egg-rr61.8%
unpow161.8%
*-commutative61.8%
associate-*r*61.8%
Simplified61.8%
if -2.0500000000000001e-280 < d < 6.19999999999999976e-60Initial program 43.6%
Simplified43.5%
associate-*r/42.0%
div-inv42.0%
metadata-eval42.0%
Applied egg-rr42.0%
Taylor expanded in d around 0 34.6%
associate-*l/34.7%
unpow234.7%
unpow234.7%
unswap-sqr46.7%
Simplified46.7%
sqrt-div48.4%
Applied egg-rr48.4%
sqr-pow48.3%
rem-sqrt-square56.0%
sqr-pow55.9%
fabs-sqr55.9%
sqr-pow56.0%
metadata-eval56.0%
Simplified56.0%
if 6.19999999999999976e-60 < d < 2.2000000000000001e87Initial program 80.4%
Simplified80.4%
Applied egg-rr15.7%
expm1-def33.6%
expm1-log1p70.0%
associate-*r/70.1%
*-commutative70.1%
Simplified70.1%
if 2.2000000000000001e87 < d Initial program 78.4%
Simplified78.6%
Taylor expanded in d around inf 68.9%
associate-/r*68.9%
Simplified68.9%
sqrt-div86.6%
Applied egg-rr86.6%
Final simplification66.7%
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 (* l h))))
(if (<= d -5.4e-161)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= d 4.5e-305)
(* d (sqrt (cbrt (* t_0 (* t_0 t_0)))))
(if (<= d 7.8e-56)
(* -0.125 (/ (* (* (* M D) (* M D)) (/ (sqrt h) (pow l 1.5))) d))
(* d (/ (sqrt (/ 1.0 h)) (sqrt 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 / (l * h);
double tmp;
if (d <= -5.4e-161) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (d <= 4.5e-305) {
tmp = d * sqrt(cbrt((t_0 * (t_0 * t_0))));
} else if (d <= 7.8e-56) {
tmp = -0.125 * ((((M * D) * (M * D)) * (sqrt(h) / pow(l, 1.5))) / d);
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
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 = 1.0 / (l * h);
double tmp;
if (d <= -5.4e-161) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (d <= 4.5e-305) {
tmp = d * Math.sqrt(Math.cbrt((t_0 * (t_0 * t_0))));
} else if (d <= 7.8e-56) {
tmp = -0.125 * ((((M * D) * (M * D)) * (Math.sqrt(h) / Math.pow(l, 1.5))) / d);
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(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(l * h)) tmp = 0.0 if (d <= -5.4e-161) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (d <= 4.5e-305) tmp = Float64(d * sqrt(cbrt(Float64(t_0 * Float64(t_0 * t_0))))); elseif (d <= 7.8e-56) tmp = Float64(-0.125 * Float64(Float64(Float64(Float64(M * D) * Float64(M * D)) * Float64(sqrt(h) / (l ^ 1.5))) / d)); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); 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[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -5.4e-161], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4.5e-305], N[(d * N[Sqrt[N[Power[N[(t$95$0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7.8e-56], N[(-0.125 * N[(N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \frac{1}{\ell \cdot h}\\
\mathbf{if}\;d \leq -5.4 \cdot 10^{-161}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;d \leq 4.5 \cdot 10^{-305}:\\
\;\;\;\;d \cdot \sqrt{\sqrt[3]{t_0 \cdot \left(t_0 \cdot t_0\right)}}\\
\mathbf{elif}\;d \leq 7.8 \cdot 10^{-56}:\\
\;\;\;\;-0.125 \cdot \frac{\left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right) \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}}{d}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -5.3999999999999999e-161Initial program 76.9%
Simplified74.7%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in M around 0 55.7%
if -5.3999999999999999e-161 < d < 4.5000000000000002e-305Initial program 55.0%
Simplified55.0%
Taylor expanded in d around inf 24.4%
add-cbrt-cube45.4%
Applied egg-rr45.4%
if 4.5000000000000002e-305 < d < 7.8e-56Initial program 48.6%
Simplified48.4%
associate-*r/46.7%
div-inv46.7%
metadata-eval46.7%
Applied egg-rr46.7%
Taylor expanded in d around 0 40.1%
associate-*l/40.1%
unpow240.1%
unpow240.1%
unswap-sqr54.1%
Simplified54.1%
sqrt-div56.1%
Applied egg-rr56.1%
sqr-pow56.1%
rem-sqrt-square64.9%
sqr-pow64.9%
fabs-sqr64.9%
sqr-pow64.9%
metadata-eval64.9%
Simplified64.9%
if 7.8e-56 < d Initial program 79.1%
Simplified79.2%
Taylor expanded in d around inf 60.0%
associate-/r*61.1%
Simplified61.1%
sqrt-div75.9%
Applied egg-rr75.9%
Final simplification62.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 (/ 1.0 (* l h))))
(if (<= d -1e-162)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= d 9.5e-304)
(* d (cbrt (* t_0 (sqrt t_0))))
(if (<= d 4.5e-65)
(* -0.125 (/ (* (sqrt (/ h (pow l 3.0))) (* M (* M (* D D)))) d))
(* d (/ (sqrt (/ 1.0 h)) (sqrt 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 / (l * h);
double tmp;
if (d <= -1e-162) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (d <= 9.5e-304) {
tmp = d * cbrt((t_0 * sqrt(t_0)));
} else if (d <= 4.5e-65) {
tmp = -0.125 * ((sqrt((h / pow(l, 3.0))) * (M * (M * (D * D)))) / d);
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
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 = 1.0 / (l * h);
double tmp;
if (d <= -1e-162) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (d <= 9.5e-304) {
tmp = d * Math.cbrt((t_0 * Math.sqrt(t_0)));
} else if (d <= 4.5e-65) {
tmp = -0.125 * ((Math.sqrt((h / Math.pow(l, 3.0))) * (M * (M * (D * D)))) / d);
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(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(l * h)) tmp = 0.0 if (d <= -1e-162) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (d <= 9.5e-304) tmp = Float64(d * cbrt(Float64(t_0 * sqrt(t_0)))); elseif (d <= 4.5e-65) tmp = Float64(-0.125 * Float64(Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(M * Float64(M * Float64(D * D)))) / d)); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); 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[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1e-162], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 9.5e-304], N[(d * N[Power[N[(t$95$0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4.5e-65], N[(-0.125 * N[(N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(M * N[(M * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \frac{1}{\ell \cdot h}\\
\mathbf{if}\;d \leq -1 \cdot 10^{-162}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;d \leq 9.5 \cdot 10^{-304}:\\
\;\;\;\;d \cdot \sqrt[3]{t_0 \cdot \sqrt{t_0}}\\
\mathbf{elif}\;d \leq 4.5 \cdot 10^{-65}:\\
\;\;\;\;-0.125 \cdot \frac{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(M \cdot \left(M \cdot \left(D \cdot D\right)\right)\right)}{d}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -9.99999999999999954e-163Initial program 76.9%
Simplified74.7%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in M around 0 55.7%
if -9.99999999999999954e-163 < d < 9.50000000000000023e-304Initial program 51.0%
Simplified51.0%
Taylor expanded in d around inf 22.8%
add-cbrt-cube30.1%
add-sqr-sqrt30.1%
Applied egg-rr30.1%
if 9.50000000000000023e-304 < d < 4.4999999999999998e-65Initial program 50.6%
Simplified50.4%
Taylor expanded in d around 0 43.5%
associate-*l/43.5%
*-commutative43.5%
unpow243.5%
associate-*l*48.1%
unpow248.1%
Simplified48.1%
if 4.4999999999999998e-65 < d Initial program 79.4%
Simplified79.5%
Taylor expanded in d around inf 59.3%
associate-/r*60.4%
Simplified60.4%
sqrt-div75.0%
Applied egg-rr75.0%
Final simplification56.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 (/ 1.0 (* l h))))
(if (<= d -1.25e-163)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= d 9.5e-304)
(* d (cbrt (* t_0 (sqrt t_0))))
(if (<= d 2.1e-66)
(* -0.125 (/ (* (* (* M D) (* M D)) (sqrt (/ h (pow l 3.0)))) d))
(* d (/ (sqrt (/ 1.0 h)) (sqrt 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 / (l * h);
double tmp;
if (d <= -1.25e-163) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (d <= 9.5e-304) {
tmp = d * cbrt((t_0 * sqrt(t_0)));
} else if (d <= 2.1e-66) {
tmp = -0.125 * ((((M * D) * (M * D)) * sqrt((h / pow(l, 3.0)))) / d);
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
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 = 1.0 / (l * h);
double tmp;
if (d <= -1.25e-163) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (d <= 9.5e-304) {
tmp = d * Math.cbrt((t_0 * Math.sqrt(t_0)));
} else if (d <= 2.1e-66) {
tmp = -0.125 * ((((M * D) * (M * D)) * Math.sqrt((h / Math.pow(l, 3.0)))) / d);
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(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(l * h)) tmp = 0.0 if (d <= -1.25e-163) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (d <= 9.5e-304) tmp = Float64(d * cbrt(Float64(t_0 * sqrt(t_0)))); elseif (d <= 2.1e-66) tmp = Float64(-0.125 * Float64(Float64(Float64(Float64(M * D) * Float64(M * D)) * sqrt(Float64(h / (l ^ 3.0)))) / d)); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); 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[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.25e-163], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 9.5e-304], N[(d * N[Power[N[(t$95$0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.1e-66], N[(-0.125 * N[(N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \frac{1}{\ell \cdot h}\\
\mathbf{if}\;d \leq -1.25 \cdot 10^{-163}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;d \leq 9.5 \cdot 10^{-304}:\\
\;\;\;\;d \cdot \sqrt[3]{t_0 \cdot \sqrt{t_0}}\\
\mathbf{elif}\;d \leq 2.1 \cdot 10^{-66}:\\
\;\;\;\;-0.125 \cdot \frac{\left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}}{d}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.24999999999999994e-163Initial program 76.9%
Simplified74.7%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in M around 0 55.7%
if -1.24999999999999994e-163 < d < 9.50000000000000023e-304Initial program 51.0%
Simplified51.0%
Taylor expanded in d around inf 22.8%
add-cbrt-cube30.1%
add-sqr-sqrt30.1%
Applied egg-rr30.1%
if 9.50000000000000023e-304 < d < 2.1e-66Initial program 50.6%
Simplified50.4%
associate-*r/48.5%
div-inv48.5%
metadata-eval48.5%
Applied egg-rr48.5%
Taylor expanded in d around 0 43.5%
associate-*l/43.5%
unpow243.5%
unpow243.5%
unswap-sqr58.6%
Simplified58.6%
if 2.1e-66 < d Initial program 79.4%
Simplified79.5%
Taylor expanded in d around inf 59.3%
associate-/r*60.4%
Simplified60.4%
sqrt-div75.0%
Applied egg-rr75.0%
Final simplification58.7%
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 (* l h))))
(if (<= d -4.8e-161)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= d 4.5e-305)
(* d (cbrt (* t_0 (sqrt t_0))))
(if (<= d 1.3e-57)
(* -0.125 (/ (* (* (* M D) (* M D)) (/ (sqrt h) (pow l 1.5))) d))
(* d (/ (sqrt (/ 1.0 h)) (sqrt 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 / (l * h);
double tmp;
if (d <= -4.8e-161) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (d <= 4.5e-305) {
tmp = d * cbrt((t_0 * sqrt(t_0)));
} else if (d <= 1.3e-57) {
tmp = -0.125 * ((((M * D) * (M * D)) * (sqrt(h) / pow(l, 1.5))) / d);
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
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 = 1.0 / (l * h);
double tmp;
if (d <= -4.8e-161) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (d <= 4.5e-305) {
tmp = d * Math.cbrt((t_0 * Math.sqrt(t_0)));
} else if (d <= 1.3e-57) {
tmp = -0.125 * ((((M * D) * (M * D)) * (Math.sqrt(h) / Math.pow(l, 1.5))) / d);
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(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(l * h)) tmp = 0.0 if (d <= -4.8e-161) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (d <= 4.5e-305) tmp = Float64(d * cbrt(Float64(t_0 * sqrt(t_0)))); elseif (d <= 1.3e-57) tmp = Float64(-0.125 * Float64(Float64(Float64(Float64(M * D) * Float64(M * D)) * Float64(sqrt(h) / (l ^ 1.5))) / d)); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); 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[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -4.8e-161], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4.5e-305], N[(d * N[Power[N[(t$95$0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.3e-57], N[(-0.125 * N[(N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \frac{1}{\ell \cdot h}\\
\mathbf{if}\;d \leq -4.8 \cdot 10^{-161}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;d \leq 4.5 \cdot 10^{-305}:\\
\;\;\;\;d \cdot \sqrt[3]{t_0 \cdot \sqrt{t_0}}\\
\mathbf{elif}\;d \leq 1.3 \cdot 10^{-57}:\\
\;\;\;\;-0.125 \cdot \frac{\left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right) \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}}{d}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -4.79999999999999998e-161Initial program 76.9%
Simplified74.7%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in M around 0 55.7%
if -4.79999999999999998e-161 < d < 4.5000000000000002e-305Initial program 55.0%
Simplified55.0%
Taylor expanded in d around inf 24.4%
add-cbrt-cube32.4%
add-sqr-sqrt32.4%
Applied egg-rr32.4%
if 4.5000000000000002e-305 < d < 1.29999999999999993e-57Initial program 48.6%
Simplified48.4%
associate-*r/46.7%
div-inv46.7%
metadata-eval46.7%
Applied egg-rr46.7%
Taylor expanded in d around 0 40.1%
associate-*l/40.1%
unpow240.1%
unpow240.1%
unswap-sqr54.1%
Simplified54.1%
sqrt-div56.1%
Applied egg-rr56.1%
sqr-pow56.1%
rem-sqrt-square64.9%
sqr-pow64.9%
fabs-sqr64.9%
sqr-pow64.9%
metadata-eval64.9%
Simplified64.9%
if 1.29999999999999993e-57 < d Initial program 79.1%
Simplified79.2%
Taylor expanded in d around inf 60.0%
associate-/r*61.1%
Simplified61.1%
sqrt-div75.9%
Applied egg-rr75.9%
Final simplification60.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 (/ 1.0 (* l h))))
(if (<= d -1.85e-162)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= d 1.96e-230)
(* d (cbrt (* t_0 (sqrt t_0))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt 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 / (l * h);
double tmp;
if (d <= -1.85e-162) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (d <= 1.96e-230) {
tmp = d * cbrt((t_0 * sqrt(t_0)));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
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 = 1.0 / (l * h);
double tmp;
if (d <= -1.85e-162) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (d <= 1.96e-230) {
tmp = d * Math.cbrt((t_0 * Math.sqrt(t_0)));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(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(l * h)) tmp = 0.0 if (d <= -1.85e-162) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (d <= 1.96e-230) tmp = Float64(d * cbrt(Float64(t_0 * sqrt(t_0)))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); 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[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.85e-162], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.96e-230], N[(d * N[Power[N[(t$95$0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \frac{1}{\ell \cdot h}\\
\mathbf{if}\;d \leq -1.85 \cdot 10^{-162}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;d \leq 1.96 \cdot 10^{-230}:\\
\;\;\;\;d \cdot \sqrt[3]{t_0 \cdot \sqrt{t_0}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.8500000000000001e-162Initial program 76.9%
Simplified74.7%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in M around 0 55.7%
if -1.8500000000000001e-162 < d < 1.96000000000000001e-230Initial program 47.0%
Simplified46.9%
Taylor expanded in d around inf 27.2%
add-cbrt-cube32.8%
add-sqr-sqrt32.9%
Applied egg-rr32.9%
if 1.96000000000000001e-230 < d Initial program 72.8%
Simplified72.9%
Taylor expanded in d around inf 47.0%
associate-/r*47.8%
Simplified47.8%
sqrt-div59.0%
Applied egg-rr59.0%
Final simplification52.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 (/ 1.0 (* l h)))))
(if (<= d -8e-170)
(* (- d) t_0)
(if (<= d 4e-282) (* d t_0) (* d (* (pow h -0.5) (pow l -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((1.0 / (l * h)));
double tmp;
if (d <= -8e-170) {
tmp = -d * t_0;
} else if (d <= 4e-282) {
tmp = d * t_0;
} else {
tmp = d * (pow(h, -0.5) * pow(l, -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) :: tmp
t_0 = sqrt((1.0d0 / (l * h)))
if (d <= (-8d-170)) then
tmp = -d * t_0
else if (d <= 4d-282) then
tmp = d * t_0
else
tmp = d * ((h ** (-0.5d0)) * (l ** (-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((1.0 / (l * h)));
double tmp;
if (d <= -8e-170) {
tmp = -d * t_0;
} else if (d <= 4e-282) {
tmp = d * t_0;
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -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((1.0 / (l * h))) tmp = 0 if d <= -8e-170: tmp = -d * t_0 elif d <= 4e-282: tmp = d * t_0 else: tmp = d * (math.pow(h, -0.5) * math.pow(l, -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(1.0 / Float64(l * h))) tmp = 0.0 if (d <= -8e-170) tmp = Float64(Float64(-d) * t_0); elseif (d <= 4e-282) tmp = Float64(d * t_0); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -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((1.0 / (l * h)));
tmp = 0.0;
if (d <= -8e-170)
tmp = -d * t_0;
elseif (d <= 4e-282)
tmp = d * t_0;
else
tmp = d * ((h ^ -0.5) * (l ^ -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[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -8e-170], N[((-d) * t$95$0), $MachinePrecision], If[LessEqual[d, 4e-282], N[(d * t$95$0), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{if}\;d \leq -8 \cdot 10^{-170}:\\
\;\;\;\;\left(-d\right) \cdot t_0\\
\mathbf{elif}\;d \leq 4 \cdot 10^{-282}:\\
\;\;\;\;d \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -7.99999999999999987e-170Initial program 76.4%
Simplified74.0%
add-cbrt-cube55.0%
pow355.0%
Applied egg-rr55.1%
Taylor expanded in d around -inf 54.2%
associate-*r*54.2%
mul-1-neg54.2%
*-commutative54.2%
Simplified54.2%
if -7.99999999999999987e-170 < d < 4.0000000000000001e-282Initial program 48.1%
Simplified47.9%
Taylor expanded in d around inf 23.5%
if 4.0000000000000001e-282 < d Initial program 70.8%
Simplified70.9%
associate-*r/72.6%
div-inv72.6%
metadata-eval72.6%
Applied egg-rr72.6%
Taylor expanded in d around inf 46.8%
unpow-146.8%
sqr-pow46.8%
rem-sqrt-square46.8%
metadata-eval46.8%
sqr-pow46.7%
fabs-sqr46.7%
sqr-pow46.8%
Simplified46.8%
unpow-prod-down57.9%
Applied egg-rr57.9%
Final simplification51.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 (/ 1.0 (* l h)))))
(if (<= d -8e-170)
(* (- d) t_0)
(if (<= d 4e-284) (* d t_0) (* d (/ (sqrt (/ 1.0 h)) (sqrt 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((1.0 / (l * h)));
double tmp;
if (d <= -8e-170) {
tmp = -d * t_0;
} else if (d <= 4e-284) {
tmp = d * t_0;
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(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((1.0d0 / (l * h)))
if (d <= (-8d-170)) then
tmp = -d * t_0
else if (d <= 4d-284) then
tmp = d * t_0
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(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((1.0 / (l * h)));
double tmp;
if (d <= -8e-170) {
tmp = -d * t_0;
} else if (d <= 4e-284) {
tmp = d * t_0;
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(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((1.0 / (l * h))) tmp = 0 if d <= -8e-170: tmp = -d * t_0 elif d <= 4e-284: tmp = d * t_0 else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(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(1.0 / Float64(l * h))) tmp = 0.0 if (d <= -8e-170) tmp = Float64(Float64(-d) * t_0); elseif (d <= 4e-284) tmp = Float64(d * t_0); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(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((1.0 / (l * h)));
tmp = 0.0;
if (d <= -8e-170)
tmp = -d * t_0;
elseif (d <= 4e-284)
tmp = d * t_0;
else
tmp = d * (sqrt((1.0 / h)) / sqrt(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[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -8e-170], N[((-d) * t$95$0), $MachinePrecision], If[LessEqual[d, 4e-284], N[(d * t$95$0), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{if}\;d \leq -8 \cdot 10^{-170}:\\
\;\;\;\;\left(-d\right) \cdot t_0\\
\mathbf{elif}\;d \leq 4 \cdot 10^{-284}:\\
\;\;\;\;d \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -7.99999999999999987e-170Initial program 76.4%
Simplified74.0%
add-cbrt-cube55.0%
pow355.0%
Applied egg-rr55.1%
Taylor expanded in d around -inf 54.2%
associate-*r*54.2%
mul-1-neg54.2%
*-commutative54.2%
Simplified54.2%
if -7.99999999999999987e-170 < d < 4.00000000000000015e-284Initial program 48.1%
Simplified47.9%
Taylor expanded in d around inf 23.5%
if 4.00000000000000015e-284 < d Initial program 70.8%
Simplified70.9%
Taylor expanded in d around inf 46.8%
associate-/r*47.5%
Simplified47.5%
sqrt-div58.0%
Applied egg-rr58.0%
Final simplification51.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 -8e-170)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= d 5e-282)
(* d (sqrt (/ 1.0 (* l h))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt 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 <= -8e-170) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (d <= 5e-282) {
tmp = d * sqrt((1.0 / (l * h)));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(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 <= (-8d-170)) then
tmp = sqrt((d / h)) * sqrt((d / l))
else if (d <= 5d-282) then
tmp = d * sqrt((1.0d0 / (l * h)))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(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 <= -8e-170) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (d <= 5e-282) {
tmp = d * Math.sqrt((1.0 / (l * h)));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(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 <= -8e-170: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) elif d <= 5e-282: tmp = d * math.sqrt((1.0 / (l * h))) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(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 <= -8e-170) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (d <= 5e-282) tmp = Float64(d * sqrt(Float64(1.0 / Float64(l * h)))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(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 <= -8e-170)
tmp = sqrt((d / h)) * sqrt((d / l));
elseif (d <= 5e-282)
tmp = d * sqrt((1.0 / (l * h)));
else
tmp = d * (sqrt((1.0 / h)) / sqrt(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, -8e-170], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5e-282], N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[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 \cdot 10^{-170}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;d \leq 5 \cdot 10^{-282}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -7.99999999999999987e-170Initial program 76.4%
Simplified74.1%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in M around 0 55.4%
if -7.99999999999999987e-170 < d < 5.0000000000000001e-282Initial program 48.1%
Simplified47.9%
Taylor expanded in d around inf 23.5%
if 5.0000000000000001e-282 < d Initial program 70.8%
Simplified70.9%
Taylor expanded in d around inf 46.8%
associate-/r*47.5%
Simplified47.5%
sqrt-div58.0%
Applied egg-rr58.0%
Final simplification51.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 (<= d -8.5e-170) (* (- d) (sqrt (/ 1.0 (* l h)))) (* d (sqrt (/ (/ 1.0 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.5e-170) {
tmp = -d * sqrt((1.0 / (l * h)));
} else {
tmp = d * sqrt(((1.0 / 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.5d-170)) then
tmp = -d * sqrt((1.0d0 / (l * h)))
else
tmp = d * sqrt(((1.0d0 / 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.5e-170) {
tmp = -d * Math.sqrt((1.0 / (l * h)));
} else {
tmp = d * Math.sqrt(((1.0 / 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.5e-170: tmp = -d * math.sqrt((1.0 / (l * h))) else: tmp = d * math.sqrt(((1.0 / 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.5e-170) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / 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.5e-170)
tmp = -d * sqrt((1.0 / (l * h)));
else
tmp = d * sqrt(((1.0 / 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.5e-170], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / 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.5 \cdot 10^{-170}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if d < -8.5e-170Initial program 76.4%
Simplified74.0%
add-cbrt-cube55.0%
pow355.0%
Applied egg-rr55.1%
Taylor expanded in d around -inf 54.2%
associate-*r*54.2%
mul-1-neg54.2%
*-commutative54.2%
Simplified54.2%
if -8.5e-170 < d Initial program 65.2%
Simplified65.2%
Taylor expanded in d around inf 41.0%
associate-/r*41.6%
Simplified41.6%
Final simplification45.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 (* d (sqrt (/ 1.0 (* l h)))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * sqrt((1.0 / (l * h)));
}
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((1.0d0 / (l * h)))
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((1.0 / (l * h)));
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.sqrt((1.0 / (l * h)))
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * sqrt((1.0 / (l * h)));
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[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot \sqrt{\frac{1}{\ell \cdot h}}
\end{array}
Initial program 69.0%
Simplified68.2%
Taylor expanded in d around inf 30.5%
Final simplification30.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 (* d (sqrt (/ (/ 1.0 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(((1.0 / 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(((1.0d0 / 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(((1.0 / h) / l));
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.sqrt(((1.0 / 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(Float64(1.0 / 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(((1.0 / 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[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}
\end{array}
Initial program 69.0%
Simplified68.2%
Taylor expanded in d around inf 30.5%
associate-/r*30.9%
Simplified30.9%
Final simplification30.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 (* d (pow (* 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) {
return d * pow((l * h), -0.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.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = d * ((l * h) ** (-0.5d0))
end function
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.pow((l * h), -0.5);
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.pow((l * h), -0.5)
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * (Float64(l * h) ^ -0.5)) end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * ((l * h) ^ -0.5);
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[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot {\left(\ell \cdot h\right)}^{-0.5}
\end{array}
Initial program 69.0%
Simplified68.2%
associate-*r/70.5%
div-inv70.5%
metadata-eval70.5%
Applied egg-rr70.5%
Taylor expanded in d around inf 30.5%
unpow-130.5%
sqr-pow30.5%
rem-sqrt-square30.1%
metadata-eval30.1%
sqr-pow30.1%
fabs-sqr30.1%
sqr-pow30.1%
Simplified30.1%
Final simplification30.1%
herbie shell --seed 2023271
(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)))))