
(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 26 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))) (t_1 (sqrt (- d))))
(if (<= l -8.4e+37)
(*
(/ t_1 (sqrt (- h)))
(*
(/ t_1 (sqrt (- l)))
(- 1.0 (* 0.5 (* 0.25 (* (/ D (/ (/ (/ d M) M) D)) (/ h (* l d))))))))
(if (<= l 2.6e-266)
(*
(* t_0 (sqrt (/ d h)))
(- 1.0 (/ (* h (* 0.5 (pow (* (* 0.5 M) (/ D d)) 2.0))) l)))
(if (<= l 4.6e+116)
(*
(/ (sqrt d) (sqrt h))
(* (- 1.0 (* 0.5 (* (pow (/ (/ (* M D) 2.0) d) 2.0) (/ h l)))) t_0))
(* d (* (pow l -0.5) (pow h -0.5))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = sqrt(-d);
double tmp;
if (l <= -8.4e+37) {
tmp = (t_1 / sqrt(-h)) * ((t_1 / sqrt(-l)) * (1.0 - (0.5 * (0.25 * ((D / (((d / M) / M) / D)) * (h / (l * d)))))));
} else if (l <= 2.6e-266) {
tmp = (t_0 * sqrt((d / h))) * (1.0 - ((h * (0.5 * pow(((0.5 * M) * (D / d)), 2.0))) / l));
} else if (l <= 4.6e+116) {
tmp = (sqrt(d) / sqrt(h)) * ((1.0 - (0.5 * (pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * t_0);
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = sqrt(-d)
if (l <= (-8.4d+37)) then
tmp = (t_1 / sqrt(-h)) * ((t_1 / sqrt(-l)) * (1.0d0 - (0.5d0 * (0.25d0 * ((d_1 / (((d / m) / m) / d_1)) * (h / (l * d)))))))
else if (l <= 2.6d-266) then
tmp = (t_0 * sqrt((d / h))) * (1.0d0 - ((h * (0.5d0 * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0))) / l))
else if (l <= 4.6d+116) then
tmp = (sqrt(d) / sqrt(h)) * ((1.0d0 - (0.5d0 * (((((m * d_1) / 2.0d0) / d) ** 2.0d0) * (h / l)))) * t_0)
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double t_1 = Math.sqrt(-d);
double tmp;
if (l <= -8.4e+37) {
tmp = (t_1 / Math.sqrt(-h)) * ((t_1 / Math.sqrt(-l)) * (1.0 - (0.5 * (0.25 * ((D / (((d / M) / M) / D)) * (h / (l * d)))))));
} else if (l <= 2.6e-266) {
tmp = (t_0 * Math.sqrt((d / h))) * (1.0 - ((h * (0.5 * Math.pow(((0.5 * M) * (D / d)), 2.0))) / l));
} else if (l <= 4.6e+116) {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * ((1.0 - (0.5 * (Math.pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * t_0);
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) t_1 = math.sqrt(-d) tmp = 0 if l <= -8.4e+37: tmp = (t_1 / math.sqrt(-h)) * ((t_1 / math.sqrt(-l)) * (1.0 - (0.5 * (0.25 * ((D / (((d / M) / M) / D)) * (h / (l * d))))))) elif l <= 2.6e-266: tmp = (t_0 * math.sqrt((d / h))) * (1.0 - ((h * (0.5 * math.pow(((0.5 * M) * (D / d)), 2.0))) / l)) elif l <= 4.6e+116: tmp = (math.sqrt(d) / math.sqrt(h)) * ((1.0 - (0.5 * (math.pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * t_0) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -8.4e+37) tmp = Float64(Float64(t_1 / sqrt(Float64(-h))) * Float64(Float64(t_1 / sqrt(Float64(-l))) * Float64(1.0 - Float64(0.5 * Float64(0.25 * Float64(Float64(D / Float64(Float64(Float64(d / M) / M) / D)) * Float64(h / Float64(l * d)))))))); elseif (l <= 2.6e-266) tmp = Float64(Float64(t_0 * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0))) / l))); elseif (l <= 4.6e+116) tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(Float64(M * D) / 2.0) / d) ^ 2.0) * Float64(h / l)))) * t_0)); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / l));
t_1 = sqrt(-d);
tmp = 0.0;
if (l <= -8.4e+37)
tmp = (t_1 / sqrt(-h)) * ((t_1 / sqrt(-l)) * (1.0 - (0.5 * (0.25 * ((D / (((d / M) / M) / D)) * (h / (l * d)))))));
elseif (l <= 2.6e-266)
tmp = (t_0 * sqrt((d / h))) * (1.0 - ((h * (0.5 * (((0.5 * M) * (D / d)) ^ 2.0))) / l));
elseif (l <= 4.6e+116)
tmp = (sqrt(d) / sqrt(h)) * ((1.0 - (0.5 * (((((M * D) / 2.0) / d) ^ 2.0) * (h / l)))) * t_0);
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -8.4e+37], N[(N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(0.25 * N[(N[(D / N[(N[(N[(d / M), $MachinePrecision] / M), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision] * N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.6e-266], N[(N[(t$95$0 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.6e+116], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(N[(M * D), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -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{d}{\ell}}\\
t_1 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -8.4 \cdot 10^{+37}:\\
\;\;\;\;\frac{t_1}{\sqrt{-h}} \cdot \left(\frac{t_1}{\sqrt{-\ell}} \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right)\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 2.6 \cdot 10^{-266}:\\
\;\;\;\;\left(t_0 \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right)\\
\mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\left(1 - 0.5 \cdot \left({\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot t_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -8.4000000000000004e37Initial program 51.6%
associate-*l*51.5%
metadata-eval51.5%
unpow1/251.5%
metadata-eval51.5%
unpow1/251.5%
associate-*l*51.5%
metadata-eval51.5%
times-frac51.6%
Simplified51.6%
frac-2neg51.6%
sqrt-div63.3%
Applied egg-rr63.3%
frac-times63.3%
associate-/r*63.3%
Applied egg-rr63.3%
Taylor expanded in M around 0 33.3%
associate-*r/33.3%
*-commutative33.3%
associate-*r/33.3%
associate-*r*33.4%
unpow233.4%
associate-*l*37.7%
times-frac41.1%
associate-/l*41.8%
unpow241.8%
associate-/l*50.1%
unpow250.1%
associate-/r*55.6%
Simplified55.6%
frac-2neg55.6%
sqrt-div63.7%
Applied egg-rr63.7%
if -8.4000000000000004e37 < l < 2.6e-266Initial program 81.4%
metadata-eval81.4%
unpow1/281.4%
metadata-eval81.4%
unpow1/281.4%
*-commutative81.4%
associate-*l*81.4%
times-frac78.4%
metadata-eval78.4%
Simplified78.4%
associate-*r*78.4%
frac-times81.4%
*-commutative81.4%
metadata-eval81.4%
associate-*r/85.1%
metadata-eval85.1%
*-commutative85.1%
frac-times82.2%
div-inv82.2%
metadata-eval82.2%
Applied egg-rr82.2%
if 2.6e-266 < l < 4.5999999999999999e116Initial program 75.0%
associate-*l*75.1%
metadata-eval75.1%
unpow1/275.1%
metadata-eval75.1%
unpow1/275.1%
associate-*l*75.1%
metadata-eval75.1%
times-frac72.9%
Simplified72.9%
frac-times0.0%
associate-/r*0.0%
Applied egg-rr75.1%
sqrt-div86.0%
Applied egg-rr86.0%
if 4.5999999999999999e116 < l Initial program 53.5%
Taylor expanded in d around inf 60.0%
*-un-lft-identity60.0%
*-commutative60.0%
Applied egg-rr60.0%
*-lft-identity60.0%
unpow-160.0%
sqr-pow60.1%
rem-sqrt-square60.1%
metadata-eval60.1%
sqr-pow59.9%
fabs-sqr59.9%
sqr-pow60.1%
Simplified60.1%
*-commutative60.1%
unpow-prod-down75.1%
Applied egg-rr75.1%
Final simplification78.9%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* M D) (* d 2.0)) 2.0)))))))
(if (<= t_0 -1e-107)
t_0
(if (<= t_0 5e-273)
(*
(- 1.0 (* (pow (/ (* D (* 0.5 M)) d) 2.0) (* 0.5 (/ h l))))
(* d (pow (* l h) -0.5)))
(if (<= t_0 2e+234)
(*
(*
(- 1.0 (* 0.5 (* (pow (/ (/ (* M D) 2.0) d) 2.0) (/ h l))))
(sqrt (/ d l)))
(sqrt (/ d h)))
(* d (* (pow l -0.5) (pow h -0.5))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((M * D) / (d * 2.0)), 2.0))));
double tmp;
if (t_0 <= -1e-107) {
tmp = t_0;
} else if (t_0 <= 5e-273) {
tmp = (1.0 - (pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)))) * (d * pow((l * h), -0.5));
} else if (t_0 <= 2e+234) {
tmp = ((1.0 - (0.5 * (pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * sqrt((d / l))) * sqrt((d / h));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = (((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((h / l) * (0.5d0 * (((m * d_1) / (d * 2.0d0)) ** 2.0d0))))
if (t_0 <= (-1d-107)) then
tmp = t_0
else if (t_0 <= 5d-273) then
tmp = (1.0d0 - ((((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * (0.5d0 * (h / l)))) * (d * ((l * h) ** (-0.5d0)))
else if (t_0 <= 2d+234) then
tmp = ((1.0d0 - (0.5d0 * (((((m * d_1) / 2.0d0) / d) ** 2.0d0) * (h / l)))) * sqrt((d / l))) * sqrt((d / h))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((M * D) / (d * 2.0)), 2.0))));
double tmp;
if (t_0 <= -1e-107) {
tmp = t_0;
} else if (t_0 <= 5e-273) {
tmp = (1.0 - (Math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)))) * (d * Math.pow((l * h), -0.5));
} else if (t_0 <= 2e+234) {
tmp = ((1.0 - (0.5 * (Math.pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * Math.sqrt((d / l))) * Math.sqrt((d / h));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((M * D) / (d * 2.0)), 2.0)))) tmp = 0 if t_0 <= -1e-107: tmp = t_0 elif t_0 <= 5e-273: tmp = (1.0 - (math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)))) * (d * math.pow((l * h), -0.5)) elif t_0 <= 2e+234: tmp = ((1.0 - (0.5 * (math.pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * math.sqrt((d / l))) * math.sqrt((d / h)) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0))))) tmp = 0.0 if (t_0 <= -1e-107) tmp = t_0; elseif (t_0 <= 5e-273) tmp = Float64(Float64(1.0 - Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * Float64(0.5 * Float64(h / l)))) * Float64(d * (Float64(l * h) ^ -0.5))); elseif (t_0 <= 2e+234) tmp = Float64(Float64(Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(Float64(M * D) / 2.0) / d) ^ 2.0) * Float64(h / l)))) * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((M * D) / (d * 2.0)) ^ 2.0))));
tmp = 0.0;
if (t_0 <= -1e-107)
tmp = t_0;
elseif (t_0 <= 5e-273)
tmp = (1.0 - ((((D * (0.5 * M)) / d) ^ 2.0) * (0.5 * (h / l)))) * (d * ((l * h) ^ -0.5));
elseif (t_0 <= 2e+234)
tmp = ((1.0 - (0.5 * (((((M * D) / 2.0) / d) ^ 2.0) * (h / l)))) * sqrt((d / l))) * sqrt((d / h));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-107], t$95$0, If[LessEqual[t$95$0, 5e-273], N[(N[(1.0 - N[(N[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+234], N[(N[(N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(N[(M * D), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right)\\
\mathbf{if}\;t_0 \leq -1 \cdot 10^{-107}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{-273}:\\
\;\;\;\;\left(1 - {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+234}:\\
\;\;\;\;\left(\left(1 - 0.5 \cdot \left({\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < -1e-107Initial program 87.1%
if -1e-107 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 4.99999999999999965e-273Initial program 28.1%
expm1-log1p-u28.1%
expm1-udef25.7%
Applied egg-rr25.5%
expm1-def25.5%
expm1-log1p25.5%
*-commutative25.5%
associate-*r/25.7%
*-commutative25.7%
*-commutative25.7%
Simplified25.7%
Taylor expanded in d around 0 58.2%
*-commutative58.2%
*-commutative58.2%
unpow-158.2%
sqr-pow58.2%
rem-sqrt-square58.2%
metadata-eval58.2%
sqr-pow58.1%
fabs-sqr58.1%
sqr-pow58.2%
Simplified58.2%
if 4.99999999999999965e-273 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 2.00000000000000004e234Initial program 99.1%
associate-*l*99.1%
metadata-eval99.1%
unpow1/299.1%
metadata-eval99.1%
unpow1/299.1%
associate-*l*99.1%
metadata-eval99.1%
times-frac98.0%
Simplified98.0%
frac-times46.3%
associate-/r*46.3%
Applied egg-rr99.1%
if 2.00000000000000004e234 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) Initial program 18.5%
Taylor expanded in d around inf 37.5%
*-un-lft-identity37.5%
*-commutative37.5%
Applied egg-rr37.5%
*-lft-identity37.5%
unpow-137.5%
sqr-pow37.5%
rem-sqrt-square37.5%
metadata-eval37.5%
sqr-pow37.4%
fabs-sqr37.4%
sqr-pow37.5%
Simplified37.5%
*-commutative37.5%
unpow-prod-down39.4%
Applied egg-rr39.4%
Final simplification76.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 (* 0.5 (* (pow (/ (/ (* M D) 2.0) d) 2.0) (/ h l)))))
(t_1 (sqrt (- d))))
(if (<= l -1.2e-301)
(* (/ t_1 (sqrt (- h))) (* (/ t_1 (sqrt (- l))) t_0))
(if (<= l 4.2e+116)
(* (/ (sqrt d) (sqrt h)) (* t_0 (sqrt (/ d l))))
(* d (* (pow l -0.5) (pow h -0.5)))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 - (0.5 * (pow((((M * D) / 2.0) / d), 2.0) * (h / l)));
double t_1 = sqrt(-d);
double tmp;
if (l <= -1.2e-301) {
tmp = (t_1 / sqrt(-h)) * ((t_1 / sqrt(-l)) * t_0);
} else if (l <= 4.2e+116) {
tmp = (sqrt(d) / sqrt(h)) * (t_0 * sqrt((d / l)));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - (0.5d0 * (((((m * d_1) / 2.0d0) / d) ** 2.0d0) * (h / l)))
t_1 = sqrt(-d)
if (l <= (-1.2d-301)) then
tmp = (t_1 / sqrt(-h)) * ((t_1 / sqrt(-l)) * t_0)
else if (l <= 4.2d+116) then
tmp = (sqrt(d) / sqrt(h)) * (t_0 * sqrt((d / l)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 - (0.5 * (Math.pow((((M * D) / 2.0) / d), 2.0) * (h / l)));
double t_1 = Math.sqrt(-d);
double tmp;
if (l <= -1.2e-301) {
tmp = (t_1 / Math.sqrt(-h)) * ((t_1 / Math.sqrt(-l)) * t_0);
} else if (l <= 4.2e+116) {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (t_0 * Math.sqrt((d / l)));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 1.0 - (0.5 * (math.pow((((M * D) / 2.0) / d), 2.0) * (h / l))) t_1 = math.sqrt(-d) tmp = 0 if l <= -1.2e-301: tmp = (t_1 / math.sqrt(-h)) * ((t_1 / math.sqrt(-l)) * t_0) elif l <= 4.2e+116: tmp = (math.sqrt(d) / math.sqrt(h)) * (t_0 * math.sqrt((d / l))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(Float64(M * D) / 2.0) / d) ^ 2.0) * Float64(h / l)))) t_1 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -1.2e-301) tmp = Float64(Float64(t_1 / sqrt(Float64(-h))) * Float64(Float64(t_1 / sqrt(Float64(-l))) * t_0)); elseif (l <= 4.2e+116) tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_0 * sqrt(Float64(d / l)))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 1.0 - (0.5 * (((((M * D) / 2.0) / d) ^ 2.0) * (h / l)));
t_1 = sqrt(-d);
tmp = 0.0;
if (l <= -1.2e-301)
tmp = (t_1 / sqrt(-h)) * ((t_1 / sqrt(-l)) * t_0);
elseif (l <= 4.2e+116)
tmp = (sqrt(d) / sqrt(h)) * (t_0 * sqrt((d / l)));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(N[(M * D), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -1.2e-301], N[(N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.2e+116], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 1 - 0.5 \cdot \left({\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\\
t_1 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -1.2 \cdot 10^{-301}:\\
\;\;\;\;\frac{t_1}{\sqrt{-h}} \cdot \left(\frac{t_1}{\sqrt{-\ell}} \cdot t_0\right)\\
\mathbf{elif}\;\ell \leq 4.2 \cdot 10^{+116}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t_0 \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -1.19999999999999996e-301Initial program 72.1%
associate-*l*71.3%
metadata-eval71.3%
unpow1/271.3%
metadata-eval71.3%
unpow1/271.3%
associate-*l*70.5%
metadata-eval70.5%
times-frac68.5%
Simplified68.5%
frac-2neg68.5%
sqrt-div73.3%
Applied egg-rr73.3%
frac-times75.4%
associate-/r*75.4%
Applied egg-rr75.4%
frac-2neg61.9%
sqrt-div66.2%
Applied egg-rr81.5%
if -1.19999999999999996e-301 < l < 4.2000000000000002e116Initial program 72.1%
associate-*l*72.1%
metadata-eval72.1%
unpow1/272.1%
metadata-eval72.1%
unpow1/272.1%
associate-*l*72.1%
metadata-eval72.1%
times-frac70.2%
Simplified70.2%
frac-times0.0%
associate-/r*0.0%
Applied egg-rr72.1%
sqrt-div81.7%
Applied egg-rr81.7%
if 4.2000000000000002e116 < l Initial program 53.5%
Taylor expanded in d around inf 60.0%
*-un-lft-identity60.0%
*-commutative60.0%
Applied egg-rr60.0%
*-lft-identity60.0%
unpow-160.0%
sqr-pow60.1%
rem-sqrt-square60.1%
metadata-eval60.1%
sqr-pow59.9%
fabs-sqr59.9%
sqr-pow60.1%
Simplified60.1%
*-commutative60.1%
unpow-prod-down75.1%
Applied egg-rr75.1%
Final simplification80.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 (* (pow (/ (/ (* M D) 2.0) d) 2.0) (/ h l)))))
(t_1 (/ (cbrt h) l))
(t_2 (sqrt (/ d h))))
(if (<= d -4e-311)
(* (* (/ (sqrt (- d)) (sqrt (- l))) t_0) t_2)
(if (<= d 3.9e-224)
(* (* (fabs t_1) (sqrt t_1)) (/ -0.125 (/ d (* (* M D) (* M D)))))
(if (<= d 1.15e+95)
(* t_2 (* t_0 (/ (sqrt d) (sqrt l))))
(if (or (<= d 1.7e+147) (not (<= d 5.2e+202)))
(* d (* (pow l -0.5) (pow h -0.5)))
(*
t_2
(*
(sqrt (/ d l))
(-
1.0
(*
0.5
(pow (* (* (* 0.5 M) (/ D d)) (sqrt (/ h l))) 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 = 1.0 - (0.5 * (pow((((M * D) / 2.0) / d), 2.0) * (h / l)));
double t_1 = cbrt(h) / l;
double t_2 = sqrt((d / h));
double tmp;
if (d <= -4e-311) {
tmp = ((sqrt(-d) / sqrt(-l)) * t_0) * t_2;
} else if (d <= 3.9e-224) {
tmp = (fabs(t_1) * sqrt(t_1)) * (-0.125 / (d / ((M * D) * (M * D))));
} else if (d <= 1.15e+95) {
tmp = t_2 * (t_0 * (sqrt(d) / sqrt(l)));
} else if ((d <= 1.7e+147) || !(d <= 5.2e+202)) {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
} else {
tmp = t_2 * (sqrt((d / l)) * (1.0 - (0.5 * pow((((0.5 * M) * (D / d)) * sqrt((h / l))), 2.0))));
}
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 - (0.5 * (Math.pow((((M * D) / 2.0) / d), 2.0) * (h / l)));
double t_1 = Math.cbrt(h) / l;
double t_2 = Math.sqrt((d / h));
double tmp;
if (d <= -4e-311) {
tmp = ((Math.sqrt(-d) / Math.sqrt(-l)) * t_0) * t_2;
} else if (d <= 3.9e-224) {
tmp = (Math.abs(t_1) * Math.sqrt(t_1)) * (-0.125 / (d / ((M * D) * (M * D))));
} else if (d <= 1.15e+95) {
tmp = t_2 * (t_0 * (Math.sqrt(d) / Math.sqrt(l)));
} else if ((d <= 1.7e+147) || !(d <= 5.2e+202)) {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
} else {
tmp = t_2 * (Math.sqrt((d / l)) * (1.0 - (0.5 * Math.pow((((0.5 * M) * (D / d)) * Math.sqrt((h / l))), 2.0))));
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(Float64(M * D) / 2.0) / d) ^ 2.0) * Float64(h / l)))) t_1 = Float64(cbrt(h) / l) t_2 = sqrt(Float64(d / h)) tmp = 0.0 if (d <= -4e-311) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * t_0) * t_2); elseif (d <= 3.9e-224) tmp = Float64(Float64(abs(t_1) * sqrt(t_1)) * Float64(-0.125 / Float64(d / Float64(Float64(M * D) * Float64(M * D))))); elseif (d <= 1.15e+95) tmp = Float64(t_2 * Float64(t_0 * Float64(sqrt(d) / sqrt(l)))); elseif ((d <= 1.7e+147) || !(d <= 5.2e+202)) tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); else tmp = Float64(t_2 * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * (Float64(Float64(Float64(0.5 * M) * Float64(D / d)) * sqrt(Float64(h / l))) ^ 2.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_] := Block[{t$95$0 = N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(N[(M * D), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[h, 1/3], $MachinePrecision] / l), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -4e-311], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[d, 3.9e-224], N[(N[(N[Abs[t$95$1], $MachinePrecision] * N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision] * N[(-0.125 / N[(d / N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.15e+95], N[(t$95$2 * N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d, 1.7e+147], N[Not[LessEqual[d, 5.2e+202]], $MachinePrecision]], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $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 := 1 - 0.5 \cdot \left({\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\\
t_1 := \frac{\sqrt[3]{h}}{\ell}\\
t_2 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;d \leq -4 \cdot 10^{-311}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot t_0\right) \cdot t_2\\
\mathbf{elif}\;d \leq 3.9 \cdot 10^{-224}:\\
\;\;\;\;\left(\left|t_1\right| \cdot \sqrt{t_1}\right) \cdot \frac{-0.125}{\frac{d}{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}}\\
\mathbf{elif}\;d \leq 1.15 \cdot 10^{+95}:\\
\;\;\;\;t_2 \cdot \left(t_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
\mathbf{elif}\;d \leq 1.7 \cdot 10^{+147} \lor \neg \left(d \leq 5.2 \cdot 10^{+202}\right):\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot {\left(\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if d < -3.99999999999979e-311Initial program 71.5%
associate-*l*70.7%
metadata-eval70.7%
unpow1/270.7%
metadata-eval70.7%
unpow1/270.7%
associate-*l*70.0%
metadata-eval70.0%
times-frac67.9%
Simplified67.9%
frac-2neg67.9%
sqrt-div72.7%
Applied egg-rr72.7%
frac-times74.8%
associate-/r*74.8%
Applied egg-rr74.8%
if -3.99999999999979e-311 < d < 3.8999999999999998e-224Initial program 29.9%
metadata-eval29.9%
unpow1/229.9%
metadata-eval29.9%
unpow1/229.9%
*-commutative29.9%
associate-*l*29.9%
times-frac29.9%
metadata-eval29.9%
Simplified29.9%
associate-*r*29.9%
frac-times29.9%
*-commutative29.9%
metadata-eval29.9%
add-sqr-sqrt29.8%
pow229.8%
Applied egg-rr31.3%
pow131.3%
sqrt-unprod16.3%
*-commutative16.3%
metadata-eval16.3%
div-inv16.3%
*-commutative16.3%
div-inv16.3%
metadata-eval16.3%
*-commutative16.3%
Applied egg-rr16.3%
unpow116.3%
*-commutative16.3%
Simplified16.3%
Taylor expanded in d around 0 36.4%
associate-*r*36.4%
*-commutative36.4%
associate-/l*36.3%
unpow236.3%
rem-square-sqrt36.4%
associate-*r/36.4%
metadata-eval36.4%
unpow236.4%
unpow236.4%
unswap-sqr47.0%
Simplified47.0%
pow1/247.0%
add-cube-cbrt47.0%
metadata-eval47.0%
unpow-prod-down46.9%
pow246.9%
cbrt-div46.9%
unpow346.9%
add-cbrt-cube47.0%
metadata-eval47.0%
cbrt-div51.2%
unpow351.2%
add-cbrt-cube57.7%
metadata-eval57.7%
Applied egg-rr57.7%
unpow1/257.7%
unpow257.7%
rem-sqrt-square62.1%
unpow1/262.1%
Simplified62.1%
if 3.8999999999999998e-224 < d < 1.14999999999999999e95Initial program 80.1%
associate-*l*80.1%
metadata-eval80.1%
unpow1/280.1%
metadata-eval80.1%
unpow1/280.1%
associate-*l*80.1%
metadata-eval80.1%
times-frac76.1%
Simplified76.1%
frac-times0.0%
associate-/r*0.0%
Applied egg-rr80.1%
sqrt-div88.2%
Applied egg-rr88.2%
if 1.14999999999999999e95 < d < 1.7e147 or 5.2000000000000004e202 < d Initial program 57.8%
Taylor expanded in d around inf 87.5%
*-un-lft-identity87.5%
*-commutative87.5%
Applied egg-rr87.5%
*-lft-identity87.5%
unpow-187.5%
sqr-pow87.5%
rem-sqrt-square87.5%
metadata-eval87.5%
sqr-pow87.2%
fabs-sqr87.2%
sqr-pow87.5%
Simplified87.5%
*-commutative87.5%
unpow-prod-down96.4%
Applied egg-rr96.4%
if 1.7e147 < d < 5.2000000000000004e202Initial program 91.7%
associate-*l*91.7%
metadata-eval91.7%
unpow1/291.7%
metadata-eval91.7%
unpow1/291.7%
associate-*l*91.7%
metadata-eval91.7%
times-frac91.7%
Simplified91.7%
add-sqr-sqrt91.7%
pow291.7%
sqrt-prod91.7%
sqrt-pow1100.0%
metadata-eval100.0%
pow1100.0%
div-inv100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Final simplification81.2%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1 (sqrt (/ d l)))
(t_2 (/ D (/ (/ (/ d M) M) D)))
(t_3 (/ (sqrt (- d)) (sqrt (- l)))))
(if (<= l -2.6e+270)
(* (* t_3 (- 1.0 (* 0.5 (* 0.25 (* t_2 (/ h (* l d))))))) t_0)
(if (<= l -9.5e+172)
(*
(* d (sqrt (/ (/ 1.0 l) h)))
(+ (* (pow (/ (* D (* 0.5 M)) d) 2.0) (* 0.5 (/ h l))) -1.0))
(if (<= l -6.5e+38)
(* t_0 (* t_3 (- 1.0 (* 0.5 (* 0.25 (* t_2 (/ (/ h l) d)))))))
(if (<= l 2.7e-265)
(*
(* t_1 t_0)
(- 1.0 (/ (* h (* 0.5 (pow (* (* 0.5 M) (/ D d)) 2.0))) l)))
(if (<= l 4.6e+116)
(*
(/ (sqrt d) (sqrt h))
(*
(- 1.0 (* 0.5 (* (pow (/ (/ (* M D) 2.0) d) 2.0) (/ h l))))
t_1))
(* d (* (pow l -0.5) (pow h -0.5))))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double t_1 = sqrt((d / l));
double t_2 = D / (((d / M) / M) / D);
double t_3 = sqrt(-d) / sqrt(-l);
double tmp;
if (l <= -2.6e+270) {
tmp = (t_3 * (1.0 - (0.5 * (0.25 * (t_2 * (h / (l * d))))))) * t_0;
} else if (l <= -9.5e+172) {
tmp = (d * sqrt(((1.0 / l) / h))) * ((pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l))) + -1.0);
} else if (l <= -6.5e+38) {
tmp = t_0 * (t_3 * (1.0 - (0.5 * (0.25 * (t_2 * ((h / l) / d))))));
} else if (l <= 2.7e-265) {
tmp = (t_1 * t_0) * (1.0 - ((h * (0.5 * pow(((0.5 * M) * (D / d)), 2.0))) / l));
} else if (l <= 4.6e+116) {
tmp = (sqrt(d) / sqrt(h)) * ((1.0 - (0.5 * (pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * t_1);
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = sqrt((d / h))
t_1 = sqrt((d / l))
t_2 = d_1 / (((d / m) / m) / d_1)
t_3 = sqrt(-d) / sqrt(-l)
if (l <= (-2.6d+270)) then
tmp = (t_3 * (1.0d0 - (0.5d0 * (0.25d0 * (t_2 * (h / (l * d))))))) * t_0
else if (l <= (-9.5d+172)) then
tmp = (d * sqrt(((1.0d0 / l) / h))) * (((((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * (0.5d0 * (h / l))) + (-1.0d0))
else if (l <= (-6.5d+38)) then
tmp = t_0 * (t_3 * (1.0d0 - (0.5d0 * (0.25d0 * (t_2 * ((h / l) / d))))))
else if (l <= 2.7d-265) then
tmp = (t_1 * t_0) * (1.0d0 - ((h * (0.5d0 * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0))) / l))
else if (l <= 4.6d+116) then
tmp = (sqrt(d) / sqrt(h)) * ((1.0d0 - (0.5d0 * (((((m * d_1) / 2.0d0) / d) ** 2.0d0) * (h / l)))) * t_1)
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h));
double t_1 = Math.sqrt((d / l));
double t_2 = D / (((d / M) / M) / D);
double t_3 = Math.sqrt(-d) / Math.sqrt(-l);
double tmp;
if (l <= -2.6e+270) {
tmp = (t_3 * (1.0 - (0.5 * (0.25 * (t_2 * (h / (l * d))))))) * t_0;
} else if (l <= -9.5e+172) {
tmp = (d * Math.sqrt(((1.0 / l) / h))) * ((Math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l))) + -1.0);
} else if (l <= -6.5e+38) {
tmp = t_0 * (t_3 * (1.0 - (0.5 * (0.25 * (t_2 * ((h / l) / d))))));
} else if (l <= 2.7e-265) {
tmp = (t_1 * t_0) * (1.0 - ((h * (0.5 * Math.pow(((0.5 * M) * (D / d)), 2.0))) / l));
} else if (l <= 4.6e+116) {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * ((1.0 - (0.5 * (Math.pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * t_1);
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) t_1 = math.sqrt((d / l)) t_2 = D / (((d / M) / M) / D) t_3 = math.sqrt(-d) / math.sqrt(-l) tmp = 0 if l <= -2.6e+270: tmp = (t_3 * (1.0 - (0.5 * (0.25 * (t_2 * (h / (l * d))))))) * t_0 elif l <= -9.5e+172: tmp = (d * math.sqrt(((1.0 / l) / h))) * ((math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l))) + -1.0) elif l <= -6.5e+38: tmp = t_0 * (t_3 * (1.0 - (0.5 * (0.25 * (t_2 * ((h / l) / d)))))) elif l <= 2.7e-265: tmp = (t_1 * t_0) * (1.0 - ((h * (0.5 * math.pow(((0.5 * M) * (D / d)), 2.0))) / l)) elif l <= 4.6e+116: tmp = (math.sqrt(d) / math.sqrt(h)) * ((1.0 - (0.5 * (math.pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * t_1) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) t_1 = sqrt(Float64(d / l)) t_2 = Float64(D / Float64(Float64(Float64(d / M) / M) / D)) t_3 = Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) tmp = 0.0 if (l <= -2.6e+270) tmp = Float64(Float64(t_3 * Float64(1.0 - Float64(0.5 * Float64(0.25 * Float64(t_2 * Float64(h / Float64(l * d))))))) * t_0); elseif (l <= -9.5e+172) tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * Float64(0.5 * Float64(h / l))) + -1.0)); elseif (l <= -6.5e+38) tmp = Float64(t_0 * Float64(t_3 * Float64(1.0 - Float64(0.5 * Float64(0.25 * Float64(t_2 * Float64(Float64(h / l) / d))))))); elseif (l <= 2.7e-265) tmp = Float64(Float64(t_1 * t_0) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0))) / l))); elseif (l <= 4.6e+116) tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(Float64(M * D) / 2.0) / d) ^ 2.0) * Float64(h / l)))) * t_1)); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / h));
t_1 = sqrt((d / l));
t_2 = D / (((d / M) / M) / D);
t_3 = sqrt(-d) / sqrt(-l);
tmp = 0.0;
if (l <= -2.6e+270)
tmp = (t_3 * (1.0 - (0.5 * (0.25 * (t_2 * (h / (l * d))))))) * t_0;
elseif (l <= -9.5e+172)
tmp = (d * sqrt(((1.0 / l) / h))) * (((((D * (0.5 * M)) / d) ^ 2.0) * (0.5 * (h / l))) + -1.0);
elseif (l <= -6.5e+38)
tmp = t_0 * (t_3 * (1.0 - (0.5 * (0.25 * (t_2 * ((h / l) / d))))));
elseif (l <= 2.7e-265)
tmp = (t_1 * t_0) * (1.0 - ((h * (0.5 * (((0.5 * M) * (D / d)) ^ 2.0))) / l));
elseif (l <= 4.6e+116)
tmp = (sqrt(d) / sqrt(h)) * ((1.0 - (0.5 * (((((M * D) / 2.0) / d) ^ 2.0) * (h / l)))) * t_1);
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(D / N[(N[(N[(d / M), $MachinePrecision] / M), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.6e+270], N[(N[(t$95$3 * N[(1.0 - N[(0.5 * N[(0.25 * N[(t$95$2 * N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[l, -9.5e+172], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -6.5e+38], N[(t$95$0 * N[(t$95$3 * N[(1.0 - N[(0.5 * N[(0.25 * N[(t$95$2 * N[(N[(h / l), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.7e-265], N[(N[(t$95$1 * t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.6e+116], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(N[(M * D), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -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{d}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}}\\
t_3 := \frac{\sqrt{-d}}{\sqrt{-\ell}}\\
\mathbf{if}\;\ell \leq -2.6 \cdot 10^{+270}:\\
\;\;\;\;\left(t_3 \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(t_2 \cdot \frac{h}{\ell \cdot d}\right)\right)\right)\right) \cdot t_0\\
\mathbf{elif}\;\ell \leq -9.5 \cdot 10^{+172}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left({\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right) + -1\right)\\
\mathbf{elif}\;\ell \leq -6.5 \cdot 10^{+38}:\\
\;\;\;\;t_0 \cdot \left(t_3 \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(t_2 \cdot \frac{\frac{h}{\ell}}{d}\right)\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 2.7 \cdot 10^{-265}:\\
\;\;\;\;\left(t_1 \cdot t_0\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right)\\
\mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\left(1 - 0.5 \cdot \left({\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot t_1\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -2.60000000000000012e270Initial program 38.0%
associate-*l*38.0%
metadata-eval38.0%
unpow1/238.0%
metadata-eval38.0%
unpow1/238.0%
associate-*l*38.0%
metadata-eval38.0%
times-frac38.0%
Simplified38.0%
frac-2neg38.0%
sqrt-div50.7%
Applied egg-rr50.7%
frac-times50.7%
associate-/r*50.7%
Applied egg-rr50.7%
Taylor expanded in M around 0 26.6%
associate-*r/26.6%
*-commutative26.6%
associate-*r/26.6%
associate-*r*26.6%
unpow226.6%
associate-*l*39.1%
times-frac39.1%
associate-/l*39.1%
unpow239.1%
associate-/l*39.9%
unpow239.9%
associate-/r*51.6%
Simplified51.6%
if -2.60000000000000012e270 < l < -9.50000000000000027e172Initial program 40.0%
expm1-log1p-u33.6%
expm1-udef28.9%
Applied egg-rr28.9%
expm1-def33.7%
expm1-log1p40.2%
*-commutative40.2%
associate-*r/40.2%
*-commutative40.2%
*-commutative40.2%
Simplified40.2%
Taylor expanded in d around -inf 63.4%
mul-1-neg63.4%
*-commutative63.4%
distribute-rgt-neg-in63.4%
*-commutative63.4%
associate-/r*67.1%
Simplified67.1%
if -9.50000000000000027e172 < l < -6.5e38Initial program 67.8%
associate-*l*67.6%
metadata-eval67.6%
unpow1/267.6%
metadata-eval67.6%
unpow1/267.6%
associate-*l*67.6%
metadata-eval67.6%
times-frac67.7%
Simplified67.7%
frac-2neg67.7%
sqrt-div75.6%
Applied egg-rr75.6%
frac-times75.6%
associate-/r*75.6%
Applied egg-rr75.6%
Taylor expanded in M around 0 38.2%
associate-*r/38.2%
*-commutative38.2%
associate-*r/38.2%
associate-*r*38.4%
unpow238.4%
associate-*l*38.7%
times-frac48.7%
associate-/l*53.1%
unpow253.1%
associate-/l*67.5%
unpow267.5%
associate-/r*71.0%
Simplified71.0%
Taylor expanded in l around 0 71.0%
associate-/r*71.0%
Simplified71.0%
if -6.5e38 < l < 2.7000000000000002e-265Initial program 81.4%
metadata-eval81.4%
unpow1/281.4%
metadata-eval81.4%
unpow1/281.4%
*-commutative81.4%
associate-*l*81.4%
times-frac78.4%
metadata-eval78.4%
Simplified78.4%
associate-*r*78.4%
frac-times81.4%
*-commutative81.4%
metadata-eval81.4%
associate-*r/85.1%
metadata-eval85.1%
*-commutative85.1%
frac-times82.2%
div-inv82.2%
metadata-eval82.2%
Applied egg-rr82.2%
if 2.7000000000000002e-265 < l < 4.5999999999999999e116Initial program 75.0%
associate-*l*75.1%
metadata-eval75.1%
unpow1/275.1%
metadata-eval75.1%
unpow1/275.1%
associate-*l*75.1%
metadata-eval75.1%
times-frac72.9%
Simplified72.9%
frac-times0.0%
associate-/r*0.0%
Applied egg-rr75.1%
sqrt-div86.0%
Applied egg-rr86.0%
if 4.5999999999999999e116 < l Initial program 53.5%
Taylor expanded in d around inf 60.0%
*-un-lft-identity60.0%
*-commutative60.0%
Applied egg-rr60.0%
*-lft-identity60.0%
unpow-160.0%
sqr-pow60.1%
rem-sqrt-square60.1%
metadata-eval60.1%
sqr-pow59.9%
fabs-sqr59.9%
sqr-pow60.1%
Simplified60.1%
*-commutative60.1%
unpow-prod-down75.1%
Applied egg-rr75.1%
Final simplification79.4%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1
(*
(*
(/ (sqrt (- d)) (sqrt (- l)))
(-
1.0
(* 0.5 (* 0.25 (* (/ D (/ (/ (/ d M) M) D)) (/ h (* l d)))))))
t_0))
(t_2 (* (pow (/ (* D (* 0.5 M)) d) 2.0) (* 0.5 (/ h l)))))
(if (<= l -6.3e+268)
t_1
(if (<= l -3.2e+172)
(* (* d (sqrt (/ (/ 1.0 l) h))) (+ t_2 -1.0))
(if (<= l -5.5e+37)
t_1
(if (<= l 1.65e-125)
(*
(* (sqrt (/ d l)) t_0)
(- 1.0 (/ (* h (* 0.5 (pow (* (* 0.5 M) (/ D d)) 2.0))) l)))
(if (<= l 2.7e+116)
(* (- 1.0 t_2) (* d (pow (* l h) -0.5)))
(* d (* (pow l -0.5) (pow h -0.5))))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double t_1 = ((sqrt(-d) / sqrt(-l)) * (1.0 - (0.5 * (0.25 * ((D / (((d / M) / M) / D)) * (h / (l * d))))))) * t_0;
double t_2 = pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l));
double tmp;
if (l <= -6.3e+268) {
tmp = t_1;
} else if (l <= -3.2e+172) {
tmp = (d * sqrt(((1.0 / l) / h))) * (t_2 + -1.0);
} else if (l <= -5.5e+37) {
tmp = t_1;
} else if (l <= 1.65e-125) {
tmp = (sqrt((d / l)) * t_0) * (1.0 - ((h * (0.5 * pow(((0.5 * M) * (D / d)), 2.0))) / l));
} else if (l <= 2.7e+116) {
tmp = (1.0 - t_2) * (d * pow((l * h), -0.5));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = sqrt((d / h))
t_1 = ((sqrt(-d) / sqrt(-l)) * (1.0d0 - (0.5d0 * (0.25d0 * ((d_1 / (((d / m) / m) / d_1)) * (h / (l * d))))))) * t_0
t_2 = (((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * (0.5d0 * (h / l))
if (l <= (-6.3d+268)) then
tmp = t_1
else if (l <= (-3.2d+172)) then
tmp = (d * sqrt(((1.0d0 / l) / h))) * (t_2 + (-1.0d0))
else if (l <= (-5.5d+37)) then
tmp = t_1
else if (l <= 1.65d-125) then
tmp = (sqrt((d / l)) * t_0) * (1.0d0 - ((h * (0.5d0 * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0))) / l))
else if (l <= 2.7d+116) then
tmp = (1.0d0 - t_2) * (d * ((l * h) ** (-0.5d0)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h));
double t_1 = ((Math.sqrt(-d) / Math.sqrt(-l)) * (1.0 - (0.5 * (0.25 * ((D / (((d / M) / M) / D)) * (h / (l * d))))))) * t_0;
double t_2 = Math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l));
double tmp;
if (l <= -6.3e+268) {
tmp = t_1;
} else if (l <= -3.2e+172) {
tmp = (d * Math.sqrt(((1.0 / l) / h))) * (t_2 + -1.0);
} else if (l <= -5.5e+37) {
tmp = t_1;
} else if (l <= 1.65e-125) {
tmp = (Math.sqrt((d / l)) * t_0) * (1.0 - ((h * (0.5 * Math.pow(((0.5 * M) * (D / d)), 2.0))) / l));
} else if (l <= 2.7e+116) {
tmp = (1.0 - t_2) * (d * Math.pow((l * h), -0.5));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) t_1 = ((math.sqrt(-d) / math.sqrt(-l)) * (1.0 - (0.5 * (0.25 * ((D / (((d / M) / M) / D)) * (h / (l * d))))))) * t_0 t_2 = math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)) tmp = 0 if l <= -6.3e+268: tmp = t_1 elif l <= -3.2e+172: tmp = (d * math.sqrt(((1.0 / l) / h))) * (t_2 + -1.0) elif l <= -5.5e+37: tmp = t_1 elif l <= 1.65e-125: tmp = (math.sqrt((d / l)) * t_0) * (1.0 - ((h * (0.5 * math.pow(((0.5 * M) * (D / d)), 2.0))) / l)) elif l <= 2.7e+116: tmp = (1.0 - t_2) * (d * math.pow((l * h), -0.5)) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) t_1 = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * Float64(1.0 - Float64(0.5 * Float64(0.25 * Float64(Float64(D / Float64(Float64(Float64(d / M) / M) / D)) * Float64(h / Float64(l * d))))))) * t_0) t_2 = Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * Float64(0.5 * Float64(h / l))) tmp = 0.0 if (l <= -6.3e+268) tmp = t_1; elseif (l <= -3.2e+172) tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(t_2 + -1.0)); elseif (l <= -5.5e+37) tmp = t_1; elseif (l <= 1.65e-125) tmp = Float64(Float64(sqrt(Float64(d / l)) * t_0) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0))) / l))); elseif (l <= 2.7e+116) tmp = Float64(Float64(1.0 - t_2) * Float64(d * (Float64(l * h) ^ -0.5))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / h));
t_1 = ((sqrt(-d) / sqrt(-l)) * (1.0 - (0.5 * (0.25 * ((D / (((d / M) / M) / D)) * (h / (l * d))))))) * t_0;
t_2 = (((D * (0.5 * M)) / d) ^ 2.0) * (0.5 * (h / l));
tmp = 0.0;
if (l <= -6.3e+268)
tmp = t_1;
elseif (l <= -3.2e+172)
tmp = (d * sqrt(((1.0 / l) / h))) * (t_2 + -1.0);
elseif (l <= -5.5e+37)
tmp = t_1;
elseif (l <= 1.65e-125)
tmp = (sqrt((d / l)) * t_0) * (1.0 - ((h * (0.5 * (((0.5 * M) * (D / d)) ^ 2.0))) / l));
elseif (l <= 2.7e+116)
tmp = (1.0 - t_2) * (d * ((l * h) ^ -0.5));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(0.25 * N[(N[(D / N[(N[(N[(d / M), $MachinePrecision] / M), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision] * N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -6.3e+268], t$95$1, If[LessEqual[l, -3.2e+172], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$2 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5.5e+37], t$95$1, If[LessEqual[l, 1.65e-125], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.7e+116], N[(N[(1.0 - t$95$2), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -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{d}{h}}\\
t_1 := \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right)\right)\right)\right) \cdot t_0\\
t_2 := {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;\ell \leq -6.3 \cdot 10^{+268}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -3.2 \cdot 10^{+172}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(t_2 + -1\right)\\
\mathbf{elif}\;\ell \leq -5.5 \cdot 10^{+37}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 1.65 \cdot 10^{-125}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot t_0\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right)\\
\mathbf{elif}\;\ell \leq 2.7 \cdot 10^{+116}:\\
\;\;\;\;\left(1 - t_2\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -6.2999999999999996e268 or -3.19999999999999985e172 < l < -5.50000000000000016e37Initial program 59.6%
associate-*l*59.5%
metadata-eval59.5%
unpow1/259.5%
metadata-eval59.5%
unpow1/259.5%
associate-*l*59.5%
metadata-eval59.5%
times-frac59.5%
Simplified59.5%
frac-2neg59.5%
sqrt-div68.8%
Applied egg-rr68.8%
frac-times68.7%
associate-/r*68.7%
Applied egg-rr68.7%
Taylor expanded in M around 0 35.0%
associate-*r/35.0%
*-commutative35.0%
associate-*r/35.0%
associate-*r*35.2%
unpow235.2%
associate-*l*38.8%
times-frac46.0%
associate-/l*49.2%
unpow249.2%
associate-/l*59.9%
unpow259.9%
associate-/r*65.7%
Simplified65.7%
if -6.2999999999999996e268 < l < -3.19999999999999985e172Initial program 40.0%
expm1-log1p-u33.6%
expm1-udef28.9%
Applied egg-rr28.9%
expm1-def33.7%
expm1-log1p40.2%
*-commutative40.2%
associate-*r/40.2%
*-commutative40.2%
*-commutative40.2%
Simplified40.2%
Taylor expanded in d around -inf 63.4%
mul-1-neg63.4%
*-commutative63.4%
distribute-rgt-neg-in63.4%
*-commutative63.4%
associate-/r*67.1%
Simplified67.1%
if -5.50000000000000016e37 < l < 1.65e-125Initial program 79.9%
metadata-eval79.9%
unpow1/279.9%
metadata-eval79.9%
unpow1/279.9%
*-commutative79.9%
associate-*l*79.9%
times-frac77.0%
metadata-eval77.0%
Simplified77.0%
associate-*r*77.0%
frac-times79.9%
*-commutative79.9%
metadata-eval79.9%
associate-*r/83.6%
metadata-eval83.6%
*-commutative83.6%
frac-times80.7%
div-inv80.7%
metadata-eval80.7%
Applied egg-rr80.7%
if 1.65e-125 < l < 2.7e116Initial program 74.1%
expm1-log1p-u43.7%
expm1-udef26.4%
Applied egg-rr17.1%
expm1-def28.4%
expm1-log1p52.0%
*-commutative52.0%
associate-*r/52.1%
*-commutative52.1%
*-commutative52.1%
Simplified52.1%
Taylor expanded in d around 0 85.5%
*-commutative85.5%
*-commutative85.5%
unpow-185.5%
sqr-pow85.4%
rem-sqrt-square85.4%
metadata-eval85.4%
sqr-pow85.1%
fabs-sqr85.1%
sqr-pow85.4%
Simplified85.4%
if 2.7e116 < l Initial program 53.5%
Taylor expanded in d around inf 60.0%
*-un-lft-identity60.0%
*-commutative60.0%
Applied egg-rr60.0%
*-lft-identity60.0%
unpow-160.0%
sqr-pow60.1%
rem-sqrt-square60.1%
metadata-eval60.1%
sqr-pow59.9%
fabs-sqr59.9%
sqr-pow60.1%
Simplified60.1%
*-commutative60.1%
unpow-prod-down75.1%
Applied egg-rr75.1%
Final simplification78.1%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1 (/ D (/ (/ (/ d M) M) D)))
(t_2 (/ (sqrt (- d)) (sqrt (- l))))
(t_3 (* (pow (/ (* D (* 0.5 M)) d) 2.0) (* 0.5 (/ h l)))))
(if (<= l -6.3e+268)
(* (* t_2 (- 1.0 (* 0.5 (* 0.25 (* t_1 (/ h (* l d))))))) t_0)
(if (<= l -2.75e+172)
(* (* d (sqrt (/ (/ 1.0 l) h))) (+ t_3 -1.0))
(if (<= l -2e+38)
(* t_0 (* t_2 (- 1.0 (* 0.5 (* 0.25 (* t_1 (/ (/ h l) d)))))))
(if (<= l 2.2e-129)
(*
(* (sqrt (/ d l)) t_0)
(- 1.0 (/ (* h (* 0.5 (pow (* (* 0.5 M) (/ D d)) 2.0))) l)))
(if (<= l 4.6e+116)
(* (- 1.0 t_3) (* d (pow (* l h) -0.5)))
(* d (* (pow l -0.5) (pow h -0.5))))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double t_1 = D / (((d / M) / M) / D);
double t_2 = sqrt(-d) / sqrt(-l);
double t_3 = pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l));
double tmp;
if (l <= -6.3e+268) {
tmp = (t_2 * (1.0 - (0.5 * (0.25 * (t_1 * (h / (l * d))))))) * t_0;
} else if (l <= -2.75e+172) {
tmp = (d * sqrt(((1.0 / l) / h))) * (t_3 + -1.0);
} else if (l <= -2e+38) {
tmp = t_0 * (t_2 * (1.0 - (0.5 * (0.25 * (t_1 * ((h / l) / d))))));
} else if (l <= 2.2e-129) {
tmp = (sqrt((d / l)) * t_0) * (1.0 - ((h * (0.5 * pow(((0.5 * M) * (D / d)), 2.0))) / l));
} else if (l <= 4.6e+116) {
tmp = (1.0 - t_3) * (d * pow((l * h), -0.5));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = sqrt((d / h))
t_1 = d_1 / (((d / m) / m) / d_1)
t_2 = sqrt(-d) / sqrt(-l)
t_3 = (((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * (0.5d0 * (h / l))
if (l <= (-6.3d+268)) then
tmp = (t_2 * (1.0d0 - (0.5d0 * (0.25d0 * (t_1 * (h / (l * d))))))) * t_0
else if (l <= (-2.75d+172)) then
tmp = (d * sqrt(((1.0d0 / l) / h))) * (t_3 + (-1.0d0))
else if (l <= (-2d+38)) then
tmp = t_0 * (t_2 * (1.0d0 - (0.5d0 * (0.25d0 * (t_1 * ((h / l) / d))))))
else if (l <= 2.2d-129) then
tmp = (sqrt((d / l)) * t_0) * (1.0d0 - ((h * (0.5d0 * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0))) / l))
else if (l <= 4.6d+116) then
tmp = (1.0d0 - t_3) * (d * ((l * h) ** (-0.5d0)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h));
double t_1 = D / (((d / M) / M) / D);
double t_2 = Math.sqrt(-d) / Math.sqrt(-l);
double t_3 = Math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l));
double tmp;
if (l <= -6.3e+268) {
tmp = (t_2 * (1.0 - (0.5 * (0.25 * (t_1 * (h / (l * d))))))) * t_0;
} else if (l <= -2.75e+172) {
tmp = (d * Math.sqrt(((1.0 / l) / h))) * (t_3 + -1.0);
} else if (l <= -2e+38) {
tmp = t_0 * (t_2 * (1.0 - (0.5 * (0.25 * (t_1 * ((h / l) / d))))));
} else if (l <= 2.2e-129) {
tmp = (Math.sqrt((d / l)) * t_0) * (1.0 - ((h * (0.5 * Math.pow(((0.5 * M) * (D / d)), 2.0))) / l));
} else if (l <= 4.6e+116) {
tmp = (1.0 - t_3) * (d * Math.pow((l * h), -0.5));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) t_1 = D / (((d / M) / M) / D) t_2 = math.sqrt(-d) / math.sqrt(-l) t_3 = math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)) tmp = 0 if l <= -6.3e+268: tmp = (t_2 * (1.0 - (0.5 * (0.25 * (t_1 * (h / (l * d))))))) * t_0 elif l <= -2.75e+172: tmp = (d * math.sqrt(((1.0 / l) / h))) * (t_3 + -1.0) elif l <= -2e+38: tmp = t_0 * (t_2 * (1.0 - (0.5 * (0.25 * (t_1 * ((h / l) / d)))))) elif l <= 2.2e-129: tmp = (math.sqrt((d / l)) * t_0) * (1.0 - ((h * (0.5 * math.pow(((0.5 * M) * (D / d)), 2.0))) / l)) elif l <= 4.6e+116: tmp = (1.0 - t_3) * (d * math.pow((l * h), -0.5)) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) t_1 = Float64(D / Float64(Float64(Float64(d / M) / M) / D)) t_2 = Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) t_3 = Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * Float64(0.5 * Float64(h / l))) tmp = 0.0 if (l <= -6.3e+268) tmp = Float64(Float64(t_2 * Float64(1.0 - Float64(0.5 * Float64(0.25 * Float64(t_1 * Float64(h / Float64(l * d))))))) * t_0); elseif (l <= -2.75e+172) tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(t_3 + -1.0)); elseif (l <= -2e+38) tmp = Float64(t_0 * Float64(t_2 * Float64(1.0 - Float64(0.5 * Float64(0.25 * Float64(t_1 * Float64(Float64(h / l) / d))))))); elseif (l <= 2.2e-129) tmp = Float64(Float64(sqrt(Float64(d / l)) * t_0) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0))) / l))); elseif (l <= 4.6e+116) tmp = Float64(Float64(1.0 - t_3) * Float64(d * (Float64(l * h) ^ -0.5))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / h));
t_1 = D / (((d / M) / M) / D);
t_2 = sqrt(-d) / sqrt(-l);
t_3 = (((D * (0.5 * M)) / d) ^ 2.0) * (0.5 * (h / l));
tmp = 0.0;
if (l <= -6.3e+268)
tmp = (t_2 * (1.0 - (0.5 * (0.25 * (t_1 * (h / (l * d))))))) * t_0;
elseif (l <= -2.75e+172)
tmp = (d * sqrt(((1.0 / l) / h))) * (t_3 + -1.0);
elseif (l <= -2e+38)
tmp = t_0 * (t_2 * (1.0 - (0.5 * (0.25 * (t_1 * ((h / l) / d))))));
elseif (l <= 2.2e-129)
tmp = (sqrt((d / l)) * t_0) * (1.0 - ((h * (0.5 * (((0.5 * M) * (D / d)) ^ 2.0))) / l));
elseif (l <= 4.6e+116)
tmp = (1.0 - t_3) * (d * ((l * h) ^ -0.5));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(D / N[(N[(N[(d / M), $MachinePrecision] / M), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -6.3e+268], N[(N[(t$95$2 * N[(1.0 - N[(0.5 * N[(0.25 * N[(t$95$1 * N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[l, -2.75e+172], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$3 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e+38], N[(t$95$0 * N[(t$95$2 * N[(1.0 - N[(0.5 * N[(0.25 * N[(t$95$1 * N[(N[(h / l), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.2e-129], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.6e+116], N[(N[(1.0 - t$95$3), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -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{d}{h}}\\
t_1 := \frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}}\\
t_2 := \frac{\sqrt{-d}}{\sqrt{-\ell}}\\
t_3 := {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;\ell \leq -6.3 \cdot 10^{+268}:\\
\;\;\;\;\left(t_2 \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(t_1 \cdot \frac{h}{\ell \cdot d}\right)\right)\right)\right) \cdot t_0\\
\mathbf{elif}\;\ell \leq -2.75 \cdot 10^{+172}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(t_3 + -1\right)\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{+38}:\\
\;\;\;\;t_0 \cdot \left(t_2 \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(t_1 \cdot \frac{\frac{h}{\ell}}{d}\right)\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 2.2 \cdot 10^{-129}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot t_0\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right)\\
\mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\
\;\;\;\;\left(1 - t_3\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -6.2999999999999996e268Initial program 38.0%
associate-*l*38.0%
metadata-eval38.0%
unpow1/238.0%
metadata-eval38.0%
unpow1/238.0%
associate-*l*38.0%
metadata-eval38.0%
times-frac38.0%
Simplified38.0%
frac-2neg38.0%
sqrt-div50.7%
Applied egg-rr50.7%
frac-times50.7%
associate-/r*50.7%
Applied egg-rr50.7%
Taylor expanded in M around 0 26.6%
associate-*r/26.6%
*-commutative26.6%
associate-*r/26.6%
associate-*r*26.6%
unpow226.6%
associate-*l*39.1%
times-frac39.1%
associate-/l*39.1%
unpow239.1%
associate-/l*39.9%
unpow239.9%
associate-/r*51.6%
Simplified51.6%
if -6.2999999999999996e268 < l < -2.75e172Initial program 40.0%
expm1-log1p-u33.6%
expm1-udef28.9%
Applied egg-rr28.9%
expm1-def33.7%
expm1-log1p40.2%
*-commutative40.2%
associate-*r/40.2%
*-commutative40.2%
*-commutative40.2%
Simplified40.2%
Taylor expanded in d around -inf 63.4%
mul-1-neg63.4%
*-commutative63.4%
distribute-rgt-neg-in63.4%
*-commutative63.4%
associate-/r*67.1%
Simplified67.1%
if -2.75e172 < l < -1.99999999999999995e38Initial program 67.8%
associate-*l*67.6%
metadata-eval67.6%
unpow1/267.6%
metadata-eval67.6%
unpow1/267.6%
associate-*l*67.6%
metadata-eval67.6%
times-frac67.7%
Simplified67.7%
frac-2neg67.7%
sqrt-div75.6%
Applied egg-rr75.6%
frac-times75.6%
associate-/r*75.6%
Applied egg-rr75.6%
Taylor expanded in M around 0 38.2%
associate-*r/38.2%
*-commutative38.2%
associate-*r/38.2%
associate-*r*38.4%
unpow238.4%
associate-*l*38.7%
times-frac48.7%
associate-/l*53.1%
unpow253.1%
associate-/l*67.5%
unpow267.5%
associate-/r*71.0%
Simplified71.0%
Taylor expanded in l around 0 71.0%
associate-/r*71.0%
Simplified71.0%
if -1.99999999999999995e38 < l < 2.20000000000000003e-129Initial program 79.9%
metadata-eval79.9%
unpow1/279.9%
metadata-eval79.9%
unpow1/279.9%
*-commutative79.9%
associate-*l*79.9%
times-frac77.0%
metadata-eval77.0%
Simplified77.0%
associate-*r*77.0%
frac-times79.9%
*-commutative79.9%
metadata-eval79.9%
associate-*r/83.6%
metadata-eval83.6%
*-commutative83.6%
frac-times80.7%
div-inv80.7%
metadata-eval80.7%
Applied egg-rr80.7%
if 2.20000000000000003e-129 < l < 4.5999999999999999e116Initial program 74.1%
expm1-log1p-u43.7%
expm1-udef26.4%
Applied egg-rr17.1%
expm1-def28.4%
expm1-log1p52.0%
*-commutative52.0%
associate-*r/52.1%
*-commutative52.1%
*-commutative52.1%
Simplified52.1%
Taylor expanded in d around 0 85.5%
*-commutative85.5%
*-commutative85.5%
unpow-185.5%
sqr-pow85.4%
rem-sqrt-square85.4%
metadata-eval85.4%
sqr-pow85.1%
fabs-sqr85.1%
sqr-pow85.4%
Simplified85.4%
if 4.5999999999999999e116 < l Initial program 53.5%
Taylor expanded in d around inf 60.0%
*-un-lft-identity60.0%
*-commutative60.0%
Applied egg-rr60.0%
*-lft-identity60.0%
unpow-160.0%
sqr-pow60.1%
rem-sqrt-square60.1%
metadata-eval60.1%
sqr-pow59.9%
fabs-sqr59.9%
sqr-pow60.1%
Simplified60.1%
*-commutative60.1%
unpow-prod-down75.1%
Applied egg-rr75.1%
Final simplification78.1%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* 0.5 (/ h l))) (t_1 (* (pow (/ (* D (* 0.5 M)) d) 2.0) t_0)))
(if (<= l -2.55e-117)
(* (* d (sqrt (/ (/ 1.0 l) h))) (+ t_1 -1.0))
(if (<= l 6e-201)
(*
(- 1.0 (pow (* (sqrt t_0) (/ D (/ d (* 0.5 M)))) 2.0))
(sqrt (* (/ d l) (/ d h))))
(if (<= l 4.6e+116)
(* (- 1.0 t_1) (* d (pow (* l h) -0.5)))
(* d (* (pow l -0.5) (pow h -0.5))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 0.5 * (h / l);
double t_1 = pow(((D * (0.5 * M)) / d), 2.0) * t_0;
double tmp;
if (l <= -2.55e-117) {
tmp = (d * sqrt(((1.0 / l) / h))) * (t_1 + -1.0);
} else if (l <= 6e-201) {
tmp = (1.0 - pow((sqrt(t_0) * (D / (d / (0.5 * M)))), 2.0)) * sqrt(((d / l) * (d / h)));
} else if (l <= 4.6e+116) {
tmp = (1.0 - t_1) * (d * pow((l * h), -0.5));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * (h / l)
t_1 = (((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * t_0
if (l <= (-2.55d-117)) then
tmp = (d * sqrt(((1.0d0 / l) / h))) * (t_1 + (-1.0d0))
else if (l <= 6d-201) then
tmp = (1.0d0 - ((sqrt(t_0) * (d_1 / (d / (0.5d0 * m)))) ** 2.0d0)) * sqrt(((d / l) * (d / h)))
else if (l <= 4.6d+116) then
tmp = (1.0d0 - t_1) * (d * ((l * h) ** (-0.5d0)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 0.5 * (h / l);
double t_1 = Math.pow(((D * (0.5 * M)) / d), 2.0) * t_0;
double tmp;
if (l <= -2.55e-117) {
tmp = (d * Math.sqrt(((1.0 / l) / h))) * (t_1 + -1.0);
} else if (l <= 6e-201) {
tmp = (1.0 - Math.pow((Math.sqrt(t_0) * (D / (d / (0.5 * M)))), 2.0)) * Math.sqrt(((d / l) * (d / h)));
} else if (l <= 4.6e+116) {
tmp = (1.0 - t_1) * (d * Math.pow((l * h), -0.5));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 0.5 * (h / l) t_1 = math.pow(((D * (0.5 * M)) / d), 2.0) * t_0 tmp = 0 if l <= -2.55e-117: tmp = (d * math.sqrt(((1.0 / l) / h))) * (t_1 + -1.0) elif l <= 6e-201: tmp = (1.0 - math.pow((math.sqrt(t_0) * (D / (d / (0.5 * M)))), 2.0)) * math.sqrt(((d / l) * (d / h))) elif l <= 4.6e+116: tmp = (1.0 - t_1) * (d * math.pow((l * h), -0.5)) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(0.5 * Float64(h / l)) t_1 = Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * t_0) tmp = 0.0 if (l <= -2.55e-117) tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(t_1 + -1.0)); elseif (l <= 6e-201) tmp = Float64(Float64(1.0 - (Float64(sqrt(t_0) * Float64(D / Float64(d / Float64(0.5 * M)))) ^ 2.0)) * sqrt(Float64(Float64(d / l) * Float64(d / h)))); elseif (l <= 4.6e+116) tmp = Float64(Float64(1.0 - t_1) * Float64(d * (Float64(l * h) ^ -0.5))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 0.5 * (h / l);
t_1 = (((D * (0.5 * M)) / d) ^ 2.0) * t_0;
tmp = 0.0;
if (l <= -2.55e-117)
tmp = (d * sqrt(((1.0 / l) / h))) * (t_1 + -1.0);
elseif (l <= 6e-201)
tmp = (1.0 - ((sqrt(t_0) * (D / (d / (0.5 * M)))) ^ 2.0)) * sqrt(((d / l) * (d / h)));
elseif (l <= 4.6e+116)
tmp = (1.0 - t_1) * (d * ((l * h) ^ -0.5));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[l, -2.55e-117], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6e-201], N[(N[(1.0 - N[Power[N[(N[Sqrt[t$95$0], $MachinePrecision] * N[(D / N[(d / N[(0.5 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.6e+116], N[(N[(1.0 - t$95$1), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{h}{\ell}\\
t_1 := {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot t_0\\
\mathbf{if}\;\ell \leq -2.55 \cdot 10^{-117}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(t_1 + -1\right)\\
\mathbf{elif}\;\ell \leq 6 \cdot 10^{-201}:\\
\;\;\;\;\left(1 - {\left(\sqrt{t_0} \cdot \frac{D}{\frac{d}{0.5 \cdot M}}\right)}^{2}\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\
\;\;\;\;\left(1 - t_1\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -2.5500000000000001e-117Initial program 66.4%
expm1-log1p-u40.8%
expm1-udef25.8%
Applied egg-rr22.8%
expm1-def35.7%
expm1-log1p53.3%
*-commutative53.3%
associate-*r/54.0%
*-commutative54.0%
*-commutative54.0%
Simplified54.0%
Taylor expanded in d around -inf 69.9%
mul-1-neg69.9%
*-commutative69.9%
distribute-rgt-neg-in69.9%
*-commutative69.9%
associate-/r*70.8%
Simplified70.8%
if -2.5500000000000001e-117 < l < 6.00000000000000004e-201Initial program 75.5%
metadata-eval75.5%
unpow1/275.5%
metadata-eval75.5%
unpow1/275.5%
*-commutative75.5%
associate-*l*75.5%
times-frac72.6%
metadata-eval72.6%
Simplified72.6%
associate-*r*72.6%
frac-times75.5%
*-commutative75.5%
metadata-eval75.5%
add-sqr-sqrt75.5%
pow275.5%
Applied egg-rr74.2%
pow174.2%
sqrt-unprod69.8%
*-commutative69.8%
metadata-eval69.8%
div-inv69.8%
*-commutative69.8%
div-inv69.8%
metadata-eval69.8%
*-commutative69.8%
Applied egg-rr69.8%
unpow169.8%
*-commutative69.8%
Simplified69.8%
associate-*l/72.8%
*-commutative72.8%
associate-/l*69.8%
Applied egg-rr69.8%
if 6.00000000000000004e-201 < l < 4.5999999999999999e116Initial program 75.7%
expm1-log1p-u40.3%
expm1-udef27.0%
Applied egg-rr19.8%
expm1-def28.5%
expm1-log1p55.9%
*-commutative55.9%
associate-*r/57.3%
*-commutative57.3%
*-commutative57.3%
Simplified57.3%
Taylor expanded in d around 0 83.3%
*-commutative83.3%
*-commutative83.3%
unpow-183.3%
sqr-pow83.2%
rem-sqrt-square83.2%
metadata-eval83.2%
sqr-pow83.0%
fabs-sqr83.0%
sqr-pow83.2%
Simplified83.2%
if 4.5999999999999999e116 < l Initial program 53.5%
Taylor expanded in d around inf 60.0%
*-un-lft-identity60.0%
*-commutative60.0%
Applied egg-rr60.0%
*-lft-identity60.0%
unpow-160.0%
sqr-pow60.1%
rem-sqrt-square60.1%
metadata-eval60.1%
sqr-pow59.9%
fabs-sqr59.9%
sqr-pow60.1%
Simplified60.1%
*-commutative60.1%
unpow-prod-down75.1%
Applied egg-rr75.1%
Final simplification74.6%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (pow (/ (* D (* 0.5 M)) d) 2.0) (* 0.5 (/ h l)))))
(if (<= l -3e-117)
(* (* d (sqrt (/ (/ 1.0 l) h))) (+ t_0 -1.0))
(if (<= l 8.5e-128)
(*
(*
(- 1.0 (* 0.5 (* (pow (/ (/ (* M D) 2.0) d) 2.0) (/ h l))))
(sqrt (/ d l)))
(sqrt (/ d h)))
(if (<= l 4.6e+116)
(* (- 1.0 t_0) (* d (pow (* l h) -0.5)))
(* d (* (pow l -0.5) (pow h -0.5))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l));
double tmp;
if (l <= -3e-117) {
tmp = (d * sqrt(((1.0 / l) / h))) * (t_0 + -1.0);
} else if (l <= 8.5e-128) {
tmp = ((1.0 - (0.5 * (pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * sqrt((d / l))) * sqrt((d / h));
} else if (l <= 4.6e+116) {
tmp = (1.0 - t_0) * (d * pow((l * h), -0.5));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = (((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * (0.5d0 * (h / l))
if (l <= (-3d-117)) then
tmp = (d * sqrt(((1.0d0 / l) / h))) * (t_0 + (-1.0d0))
else if (l <= 8.5d-128) then
tmp = ((1.0d0 - (0.5d0 * (((((m * d_1) / 2.0d0) / d) ** 2.0d0) * (h / l)))) * sqrt((d / l))) * sqrt((d / h))
else if (l <= 4.6d+116) then
tmp = (1.0d0 - t_0) * (d * ((l * h) ** (-0.5d0)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l));
double tmp;
if (l <= -3e-117) {
tmp = (d * Math.sqrt(((1.0 / l) / h))) * (t_0 + -1.0);
} else if (l <= 8.5e-128) {
tmp = ((1.0 - (0.5 * (Math.pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * Math.sqrt((d / l))) * Math.sqrt((d / h));
} else if (l <= 4.6e+116) {
tmp = (1.0 - t_0) * (d * Math.pow((l * h), -0.5));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)) tmp = 0 if l <= -3e-117: tmp = (d * math.sqrt(((1.0 / l) / h))) * (t_0 + -1.0) elif l <= 8.5e-128: tmp = ((1.0 - (0.5 * (math.pow((((M * D) / 2.0) / d), 2.0) * (h / l)))) * math.sqrt((d / l))) * math.sqrt((d / h)) elif l <= 4.6e+116: tmp = (1.0 - t_0) * (d * math.pow((l * h), -0.5)) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * Float64(0.5 * Float64(h / l))) tmp = 0.0 if (l <= -3e-117) tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(t_0 + -1.0)); elseif (l <= 8.5e-128) tmp = Float64(Float64(Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(Float64(M * D) / 2.0) / d) ^ 2.0) * Float64(h / l)))) * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); elseif (l <= 4.6e+116) tmp = Float64(Float64(1.0 - t_0) * Float64(d * (Float64(l * h) ^ -0.5))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (((D * (0.5 * M)) / d) ^ 2.0) * (0.5 * (h / l));
tmp = 0.0;
if (l <= -3e-117)
tmp = (d * sqrt(((1.0 / l) / h))) * (t_0 + -1.0);
elseif (l <= 8.5e-128)
tmp = ((1.0 - (0.5 * (((((M * D) / 2.0) / d) ^ 2.0) * (h / l)))) * sqrt((d / l))) * sqrt((d / h));
elseif (l <= 4.6e+116)
tmp = (1.0 - t_0) * (d * ((l * h) ^ -0.5));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3e-117], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8.5e-128], N[(N[(N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(N[(M * D), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.6e+116], N[(N[(1.0 - t$95$0), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;\ell \leq -3 \cdot 10^{-117}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(t_0 + -1\right)\\
\mathbf{elif}\;\ell \leq 8.5 \cdot 10^{-128}:\\
\;\;\;\;\left(\left(1 - 0.5 \cdot \left({\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\
\;\;\;\;\left(1 - t_0\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -2.99999999999999991e-117Initial program 66.4%
expm1-log1p-u40.8%
expm1-udef25.8%
Applied egg-rr22.8%
expm1-def35.7%
expm1-log1p53.3%
*-commutative53.3%
associate-*r/54.0%
*-commutative54.0%
*-commutative54.0%
Simplified54.0%
Taylor expanded in d around -inf 69.9%
mul-1-neg69.9%
*-commutative69.9%
distribute-rgt-neg-in69.9%
*-commutative69.9%
associate-/r*70.8%
Simplified70.8%
if -2.99999999999999991e-117 < l < 8.4999999999999996e-128Initial program 76.6%
associate-*l*76.6%
metadata-eval76.6%
unpow1/276.6%
metadata-eval76.6%
unpow1/276.6%
associate-*l*76.6%
metadata-eval76.6%
times-frac73.1%
Simplified73.1%
frac-times37.0%
associate-/r*37.0%
Applied egg-rr76.6%
if 8.4999999999999996e-128 < l < 4.5999999999999999e116Initial program 74.1%
expm1-log1p-u43.7%
expm1-udef26.4%
Applied egg-rr17.1%
expm1-def28.4%
expm1-log1p52.0%
*-commutative52.0%
associate-*r/52.1%
*-commutative52.1%
*-commutative52.1%
Simplified52.1%
Taylor expanded in d around 0 85.5%
*-commutative85.5%
*-commutative85.5%
unpow-185.5%
sqr-pow85.4%
rem-sqrt-square85.4%
metadata-eval85.4%
sqr-pow85.1%
fabs-sqr85.1%
sqr-pow85.4%
Simplified85.4%
if 4.5999999999999999e116 < l Initial program 53.5%
Taylor expanded in d around inf 60.0%
*-un-lft-identity60.0%
*-commutative60.0%
Applied egg-rr60.0%
*-lft-identity60.0%
unpow-160.0%
sqr-pow60.1%
rem-sqrt-square60.1%
metadata-eval60.1%
sqr-pow59.9%
fabs-sqr59.9%
sqr-pow60.1%
Simplified60.1%
*-commutative60.1%
unpow-prod-down75.1%
Applied egg-rr75.1%
Final simplification76.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 (* (pow (/ (* D (* 0.5 M)) d) 2.0) (* 0.5 (/ h l)))))
(if (<= l -5.1e-117)
(* (* d (sqrt (/ (/ 1.0 l) h))) (+ t_0 -1.0))
(if (<= l 6.8e-127)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (/ (* h (* 0.5 (pow (* (* 0.5 M) (/ D d)) 2.0))) l)))
(if (<= l 3.4e+116)
(* (- 1.0 t_0) (* d (pow (* l h) -0.5)))
(* d (* (pow l -0.5) (pow h -0.5))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l));
double tmp;
if (l <= -5.1e-117) {
tmp = (d * sqrt(((1.0 / l) / h))) * (t_0 + -1.0);
} else if (l <= 6.8e-127) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((h * (0.5 * pow(((0.5 * M) * (D / d)), 2.0))) / l));
} else if (l <= 3.4e+116) {
tmp = (1.0 - t_0) * (d * pow((l * h), -0.5));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = (((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * (0.5d0 * (h / l))
if (l <= (-5.1d-117)) then
tmp = (d * sqrt(((1.0d0 / l) / h))) * (t_0 + (-1.0d0))
else if (l <= 6.8d-127) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - ((h * (0.5d0 * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0))) / l))
else if (l <= 3.4d+116) then
tmp = (1.0d0 - t_0) * (d * ((l * h) ** (-0.5d0)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l));
double tmp;
if (l <= -5.1e-117) {
tmp = (d * Math.sqrt(((1.0 / l) / h))) * (t_0 + -1.0);
} else if (l <= 6.8e-127) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - ((h * (0.5 * Math.pow(((0.5 * M) * (D / d)), 2.0))) / l));
} else if (l <= 3.4e+116) {
tmp = (1.0 - t_0) * (d * Math.pow((l * h), -0.5));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)) tmp = 0 if l <= -5.1e-117: tmp = (d * math.sqrt(((1.0 / l) / h))) * (t_0 + -1.0) elif l <= 6.8e-127: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - ((h * (0.5 * math.pow(((0.5 * M) * (D / d)), 2.0))) / l)) elif l <= 3.4e+116: tmp = (1.0 - t_0) * (d * math.pow((l * h), -0.5)) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * Float64(0.5 * Float64(h / l))) tmp = 0.0 if (l <= -5.1e-117) tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(t_0 + -1.0)); elseif (l <= 6.8e-127) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0))) / l))); elseif (l <= 3.4e+116) tmp = Float64(Float64(1.0 - t_0) * Float64(d * (Float64(l * h) ^ -0.5))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (((D * (0.5 * M)) / d) ^ 2.0) * (0.5 * (h / l));
tmp = 0.0;
if (l <= -5.1e-117)
tmp = (d * sqrt(((1.0 / l) / h))) * (t_0 + -1.0);
elseif (l <= 6.8e-127)
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((h * (0.5 * (((0.5 * M) * (D / d)) ^ 2.0))) / l));
elseif (l <= 3.4e+116)
tmp = (1.0 - t_0) * (d * ((l * h) ^ -0.5));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5.1e-117], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.8e-127], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.4e+116], N[(N[(1.0 - t$95$0), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;\ell \leq -5.1 \cdot 10^{-117}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(t_0 + -1\right)\\
\mathbf{elif}\;\ell \leq 6.8 \cdot 10^{-127}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right)\\
\mathbf{elif}\;\ell \leq 3.4 \cdot 10^{+116}:\\
\;\;\;\;\left(1 - t_0\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -5.1000000000000002e-117Initial program 66.4%
expm1-log1p-u40.8%
expm1-udef25.8%
Applied egg-rr22.8%
expm1-def35.7%
expm1-log1p53.3%
*-commutative53.3%
associate-*r/54.0%
*-commutative54.0%
*-commutative54.0%
Simplified54.0%
Taylor expanded in d around -inf 69.9%
mul-1-neg69.9%
*-commutative69.9%
distribute-rgt-neg-in69.9%
*-commutative69.9%
associate-/r*70.8%
Simplified70.8%
if -5.1000000000000002e-117 < l < 6.7999999999999997e-127Initial program 76.6%
metadata-eval76.6%
unpow1/276.6%
metadata-eval76.6%
unpow1/276.6%
*-commutative76.6%
associate-*l*76.6%
times-frac73.2%
metadata-eval73.2%
Simplified73.2%
associate-*r*73.2%
frac-times76.6%
*-commutative76.6%
metadata-eval76.6%
associate-*r/81.8%
metadata-eval81.8%
*-commutative81.8%
frac-times78.3%
div-inv78.3%
metadata-eval78.3%
Applied egg-rr78.3%
if 6.7999999999999997e-127 < l < 3.40000000000000023e116Initial program 74.1%
expm1-log1p-u43.7%
expm1-udef26.4%
Applied egg-rr17.1%
expm1-def28.4%
expm1-log1p52.0%
*-commutative52.0%
associate-*r/52.1%
*-commutative52.1%
*-commutative52.1%
Simplified52.1%
Taylor expanded in d around 0 85.5%
*-commutative85.5%
*-commutative85.5%
unpow-185.5%
sqr-pow85.4%
rem-sqrt-square85.4%
metadata-eval85.4%
sqr-pow85.1%
fabs-sqr85.1%
sqr-pow85.4%
Simplified85.4%
if 3.40000000000000023e116 < l Initial program 53.5%
Taylor expanded in d around inf 60.0%
*-un-lft-identity60.0%
*-commutative60.0%
Applied egg-rr60.0%
*-lft-identity60.0%
unpow-160.0%
sqr-pow60.1%
rem-sqrt-square60.1%
metadata-eval60.1%
sqr-pow59.9%
fabs-sqr59.9%
sqr-pow60.1%
Simplified60.1%
*-commutative60.1%
unpow-prod-down75.1%
Applied egg-rr75.1%
Final simplification76.9%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (* (/ d l) (/ d h)))) (t_1 (* 0.5 (/ h l))))
(if (<= l -1.04e+68)
(* (- d) (sqrt (/ 1.0 (* l h))))
(if (<= l -1e-104)
(* t_0 (- 1.0 (* (/ h (/ l 0.5)) (pow (* (* 0.5 M) (/ D d)) 2.0))))
(if (<= l 8.5e-197)
(* t_0 (- 1.0 (* t_1 (pow (* 0.5 (/ D (/ d M))) 2.0))))
(if (<= l 4e+116)
(*
(- 1.0 (* (pow (/ (* D (* 0.5 M)) d) 2.0) t_1))
(* d (pow (* l h) -0.5)))
(* d (* (pow l -0.5) (pow h -0.5)))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(((d / l) * (d / h)));
double t_1 = 0.5 * (h / l);
double tmp;
if (l <= -1.04e+68) {
tmp = -d * sqrt((1.0 / (l * h)));
} else if (l <= -1e-104) {
tmp = t_0 * (1.0 - ((h / (l / 0.5)) * pow(((0.5 * M) * (D / d)), 2.0)));
} else if (l <= 8.5e-197) {
tmp = t_0 * (1.0 - (t_1 * pow((0.5 * (D / (d / M))), 2.0)));
} else if (l <= 4e+116) {
tmp = (1.0 - (pow(((D * (0.5 * M)) / d), 2.0) * t_1)) * (d * pow((l * h), -0.5));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt(((d / l) * (d / h)))
t_1 = 0.5d0 * (h / l)
if (l <= (-1.04d+68)) then
tmp = -d * sqrt((1.0d0 / (l * h)))
else if (l <= (-1d-104)) then
tmp = t_0 * (1.0d0 - ((h / (l / 0.5d0)) * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0)))
else if (l <= 8.5d-197) then
tmp = t_0 * (1.0d0 - (t_1 * ((0.5d0 * (d_1 / (d / m))) ** 2.0d0)))
else if (l <= 4d+116) then
tmp = (1.0d0 - ((((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * t_1)) * (d * ((l * h) ** (-0.5d0)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt(((d / l) * (d / h)));
double t_1 = 0.5 * (h / l);
double tmp;
if (l <= -1.04e+68) {
tmp = -d * Math.sqrt((1.0 / (l * h)));
} else if (l <= -1e-104) {
tmp = t_0 * (1.0 - ((h / (l / 0.5)) * Math.pow(((0.5 * M) * (D / d)), 2.0)));
} else if (l <= 8.5e-197) {
tmp = t_0 * (1.0 - (t_1 * Math.pow((0.5 * (D / (d / M))), 2.0)));
} else if (l <= 4e+116) {
tmp = (1.0 - (Math.pow(((D * (0.5 * M)) / d), 2.0) * t_1)) * (d * Math.pow((l * h), -0.5));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt(((d / l) * (d / h))) t_1 = 0.5 * (h / l) tmp = 0 if l <= -1.04e+68: tmp = -d * math.sqrt((1.0 / (l * h))) elif l <= -1e-104: tmp = t_0 * (1.0 - ((h / (l / 0.5)) * math.pow(((0.5 * M) * (D / d)), 2.0))) elif l <= 8.5e-197: tmp = t_0 * (1.0 - (t_1 * math.pow((0.5 * (D / (d / M))), 2.0))) elif l <= 4e+116: tmp = (1.0 - (math.pow(((D * (0.5 * M)) / d), 2.0) * t_1)) * (d * math.pow((l * h), -0.5)) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(Float64(d / l) * Float64(d / h))) t_1 = Float64(0.5 * Float64(h / l)) tmp = 0.0 if (l <= -1.04e+68) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); elseif (l <= -1e-104) tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(h / Float64(l / 0.5)) * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0)))); elseif (l <= 8.5e-197) tmp = Float64(t_0 * Float64(1.0 - Float64(t_1 * (Float64(0.5 * Float64(D / Float64(d / M))) ^ 2.0)))); elseif (l <= 4e+116) tmp = Float64(Float64(1.0 - Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * t_1)) * Float64(d * (Float64(l * h) ^ -0.5))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt(((d / l) * (d / h)));
t_1 = 0.5 * (h / l);
tmp = 0.0;
if (l <= -1.04e+68)
tmp = -d * sqrt((1.0 / (l * h)));
elseif (l <= -1e-104)
tmp = t_0 * (1.0 - ((h / (l / 0.5)) * (((0.5 * M) * (D / d)) ^ 2.0)));
elseif (l <= 8.5e-197)
tmp = t_0 * (1.0 - (t_1 * ((0.5 * (D / (d / M))) ^ 2.0)));
elseif (l <= 4e+116)
tmp = (1.0 - ((((D * (0.5 * M)) / d) ^ 2.0) * t_1)) * (d * ((l * h) ^ -0.5));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.04e+68], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-104], N[(t$95$0 * N[(1.0 - N[(N[(h / N[(l / 0.5), $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8.5e-197], N[(t$95$0 * N[(1.0 - N[(t$95$1 * N[Power[N[(0.5 * N[(D / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4e+116], N[(N[(1.0 - N[(N[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -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{d}{\ell} \cdot \frac{d}{h}}\\
t_1 := 0.5 \cdot \frac{h}{\ell}\\
\mathbf{if}\;\ell \leq -1.04 \cdot 10^{+68}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-104}:\\
\;\;\;\;t_0 \cdot \left(1 - \frac{h}{\frac{\ell}{0.5}} \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)\\
\mathbf{elif}\;\ell \leq 8.5 \cdot 10^{-197}:\\
\;\;\;\;t_0 \cdot \left(1 - t_1 \cdot {\left(0.5 \cdot \frac{D}{\frac{d}{M}}\right)}^{2}\right)\\
\mathbf{elif}\;\ell \leq 4 \cdot 10^{+116}:\\
\;\;\;\;\left(1 - {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot t_1\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -1.04e68Initial program 50.6%
associate-*l*50.5%
metadata-eval50.5%
unpow1/250.5%
metadata-eval50.5%
unpow1/250.5%
associate-*l*50.5%
metadata-eval50.5%
times-frac50.5%
Simplified50.5%
frac-2neg50.5%
sqrt-div63.6%
Applied egg-rr63.6%
Taylor expanded in d around -inf 54.8%
mul-1-neg54.8%
*-commutative54.8%
distribute-rgt-neg-in54.8%
Simplified54.8%
if -1.04e68 < l < -9.99999999999999927e-105Initial program 82.7%
metadata-eval82.7%
unpow1/282.7%
metadata-eval82.7%
unpow1/282.7%
*-commutative82.7%
associate-*l*82.7%
times-frac81.1%
metadata-eval81.1%
Simplified81.1%
associate-*r*81.1%
frac-times82.7%
*-commutative82.7%
metadata-eval82.7%
add-sqr-sqrt82.4%
pow282.4%
Applied egg-rr81.0%
pow181.0%
sqrt-unprod59.6%
*-commutative59.6%
metadata-eval59.6%
div-inv59.6%
*-commutative59.6%
div-inv59.6%
metadata-eval59.6%
*-commutative59.6%
Applied egg-rr59.6%
unpow159.6%
unpow259.6%
swap-sqr59.6%
rem-square-sqrt59.6%
associate-*l/59.6%
associate-/l*59.6%
unpow259.6%
Simplified59.6%
if -9.99999999999999927e-105 < l < 8.5e-197Initial program 76.9%
expm1-log1p-u22.4%
expm1-udef19.4%
Applied egg-rr16.8%
expm1-def19.8%
expm1-log1p68.6%
*-commutative68.6%
associate-*r/71.4%
*-commutative71.4%
*-commutative71.4%
Simplified71.4%
pow171.4%
associate-/l*70.1%
*-commutative70.1%
Applied egg-rr70.1%
unpow170.1%
*-commutative70.1%
associate-/r/68.6%
associate-*r*68.6%
*-commutative68.6%
associate-*l/71.4%
associate-/l*70.1%
Simplified70.1%
if 8.5e-197 < l < 4.00000000000000006e116Initial program 75.7%
expm1-log1p-u40.3%
expm1-udef27.0%
Applied egg-rr19.8%
expm1-def28.5%
expm1-log1p55.9%
*-commutative55.9%
associate-*r/57.3%
*-commutative57.3%
*-commutative57.3%
Simplified57.3%
Taylor expanded in d around 0 83.3%
*-commutative83.3%
*-commutative83.3%
unpow-183.3%
sqr-pow83.2%
rem-sqrt-square83.2%
metadata-eval83.2%
sqr-pow83.0%
fabs-sqr83.0%
sqr-pow83.2%
Simplified83.2%
if 4.00000000000000006e116 < l Initial program 53.5%
Taylor expanded in d around inf 60.0%
*-un-lft-identity60.0%
*-commutative60.0%
Applied egg-rr60.0%
*-lft-identity60.0%
unpow-160.0%
sqr-pow60.1%
rem-sqrt-square60.1%
metadata-eval60.1%
sqr-pow59.9%
fabs-sqr59.9%
sqr-pow60.1%
Simplified60.1%
*-commutative60.1%
unpow-prod-down75.1%
Applied egg-rr75.1%
Final simplification70.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 (<= l -8.2e+67)
(* (- d) (sqrt (/ 1.0 (* l h))))
(if (<= l 3.5e-296)
(*
(sqrt (* (/ d l) (/ d h)))
(- 1.0 (* (* (/ D (/ (/ (/ d M) M) D)) (/ h (* l d))) 0.125)))
(if (<= l 4.6e+116)
(*
(- 1.0 (* (pow (/ (* D (* 0.5 M)) d) 2.0) (* 0.5 (/ h l))))
(* d (pow (* l h) -0.5)))
(* d (* (pow l -0.5) (pow h -0.5)))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -8.2e+67) {
tmp = -d * sqrt((1.0 / (l * h)));
} else if (l <= 3.5e-296) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
} else if (l <= 4.6e+116) {
tmp = (1.0 - (pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)))) * (d * pow((l * h), -0.5));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-8.2d+67)) then
tmp = -d * sqrt((1.0d0 / (l * h)))
else if (l <= 3.5d-296) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - (((d_1 / (((d / m) / m) / d_1)) * (h / (l * d))) * 0.125d0))
else if (l <= 4.6d+116) then
tmp = (1.0d0 - ((((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * (0.5d0 * (h / l)))) * (d * ((l * h) ** (-0.5d0)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -8.2e+67) {
tmp = -d * Math.sqrt((1.0 / (l * h)));
} else if (l <= 3.5e-296) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
} else if (l <= 4.6e+116) {
tmp = (1.0 - (Math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)))) * (d * Math.pow((l * h), -0.5));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -8.2e+67: tmp = -d * math.sqrt((1.0 / (l * h))) elif l <= 3.5e-296: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125)) elif l <= 4.6e+116: tmp = (1.0 - (math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)))) * (d * math.pow((l * h), -0.5)) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) 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 <= -8.2e+67) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); elseif (l <= 3.5e-296) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(Float64(Float64(D / Float64(Float64(Float64(d / M) / M) / D)) * Float64(h / Float64(l * d))) * 0.125))); elseif (l <= 4.6e+116) tmp = Float64(Float64(1.0 - Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * Float64(0.5 * Float64(h / l)))) * Float64(d * (Float64(l * h) ^ -0.5))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -8.2e+67)
tmp = -d * sqrt((1.0 / (l * h)));
elseif (l <= 3.5e-296)
tmp = sqrt(((d / l) * (d / h))) * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
elseif (l <= 4.6e+116)
tmp = (1.0 - ((((D * (0.5 * M)) / d) ^ 2.0) * (0.5 * (h / l)))) * (d * ((l * h) ^ -0.5));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -8.2e+67], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.5e-296], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(N[(D / N[(N[(N[(d / M), $MachinePrecision] / M), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision] * N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.6e+116], N[(N[(1.0 - N[(N[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -8.2 \cdot 10^{+67}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{elif}\;\ell \leq 3.5 \cdot 10^{-296}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right) \cdot 0.125\right)\\
\mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\
\;\;\;\;\left(1 - {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -8.19999999999999959e67Initial program 50.6%
associate-*l*50.5%
metadata-eval50.5%
unpow1/250.5%
metadata-eval50.5%
unpow1/250.5%
associate-*l*50.5%
metadata-eval50.5%
times-frac50.5%
Simplified50.5%
frac-2neg50.5%
sqrt-div63.6%
Applied egg-rr63.6%
Taylor expanded in d around -inf 54.8%
mul-1-neg54.8%
*-commutative54.8%
distribute-rgt-neg-in54.8%
Simplified54.8%
if -8.19999999999999959e67 < l < 3.4999999999999999e-296Initial program 82.7%
expm1-log1p-u31.4%
expm1-udef22.6%
Applied egg-rr19.3%
expm1-def25.7%
expm1-log1p65.8%
*-commutative65.8%
associate-*r/69.1%
*-commutative69.1%
*-commutative69.1%
Simplified69.1%
Taylor expanded in D around 0 33.6%
associate-*r/33.6%
*-commutative33.6%
associate-*r/33.6%
*-commutative33.6%
associate-*r*37.6%
unpow237.6%
associate-*l*40.2%
times-frac46.9%
associate-/l*48.0%
unpow248.0%
associate-/l*52.8%
unpow252.8%
associate-/r*56.9%
Simplified56.9%
if 3.4999999999999999e-296 < l < 4.5999999999999999e116Initial program 73.6%
expm1-log1p-u32.9%
expm1-udef22.5%
Applied egg-rr17.3%
expm1-def24.5%
expm1-log1p58.5%
*-commutative58.5%
associate-*r/59.5%
*-commutative59.5%
*-commutative59.5%
Simplified59.5%
Taylor expanded in d around 0 76.1%
*-commutative76.1%
*-commutative76.1%
unpow-176.1%
sqr-pow76.1%
rem-sqrt-square76.1%
metadata-eval76.1%
sqr-pow75.9%
fabs-sqr75.9%
sqr-pow76.1%
Simplified76.1%
if 4.5999999999999999e116 < l Initial program 53.5%
Taylor expanded in d around inf 60.0%
*-un-lft-identity60.0%
*-commutative60.0%
Applied egg-rr60.0%
*-lft-identity60.0%
unpow-160.0%
sqr-pow60.1%
rem-sqrt-square60.1%
metadata-eval60.1%
sqr-pow59.9%
fabs-sqr59.9%
sqr-pow60.1%
Simplified60.1%
*-commutative60.1%
unpow-prod-down75.1%
Applied egg-rr75.1%
Final simplification66.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
(if (<= l -9e+67)
(* (- d) (sqrt (/ 1.0 (* l h))))
(if (<= l 1.52e-291)
(*
(sqrt (* (/ d l) (/ d h)))
(- 1.0 (* (/ h (/ l 0.5)) (pow (* (* 0.5 M) (/ D d)) 2.0))))
(if (<= l 4.6e+116)
(*
(- 1.0 (* (pow (/ (* D (* 0.5 M)) d) 2.0) (* 0.5 (/ h l))))
(* d (pow (* l h) -0.5)))
(* d (* (pow l -0.5) (pow h -0.5)))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -9e+67) {
tmp = -d * sqrt((1.0 / (l * h)));
} else if (l <= 1.52e-291) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 - ((h / (l / 0.5)) * pow(((0.5 * M) * (D / d)), 2.0)));
} else if (l <= 4.6e+116) {
tmp = (1.0 - (pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)))) * (d * pow((l * h), -0.5));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-9d+67)) then
tmp = -d * sqrt((1.0d0 / (l * h)))
else if (l <= 1.52d-291) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - ((h / (l / 0.5d0)) * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0)))
else if (l <= 4.6d+116) then
tmp = (1.0d0 - ((((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * (0.5d0 * (h / l)))) * (d * ((l * h) ** (-0.5d0)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -9e+67) {
tmp = -d * Math.sqrt((1.0 / (l * h)));
} else if (l <= 1.52e-291) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - ((h / (l / 0.5)) * Math.pow(((0.5 * M) * (D / d)), 2.0)));
} else if (l <= 4.6e+116) {
tmp = (1.0 - (Math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)))) * (d * Math.pow((l * h), -0.5));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -9e+67: tmp = -d * math.sqrt((1.0 / (l * h))) elif l <= 1.52e-291: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - ((h / (l / 0.5)) * math.pow(((0.5 * M) * (D / d)), 2.0))) elif l <= 4.6e+116: tmp = (1.0 - (math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)))) * (d * math.pow((l * h), -0.5)) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) 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 <= -9e+67) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); elseif (l <= 1.52e-291) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(Float64(h / Float64(l / 0.5)) * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0)))); elseif (l <= 4.6e+116) tmp = Float64(Float64(1.0 - Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * Float64(0.5 * Float64(h / l)))) * Float64(d * (Float64(l * h) ^ -0.5))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -9e+67)
tmp = -d * sqrt((1.0 / (l * h)));
elseif (l <= 1.52e-291)
tmp = sqrt(((d / l) * (d / h))) * (1.0 - ((h / (l / 0.5)) * (((0.5 * M) * (D / d)) ^ 2.0)));
elseif (l <= 4.6e+116)
tmp = (1.0 - ((((D * (0.5 * M)) / d) ^ 2.0) * (0.5 * (h / l)))) * (d * ((l * h) ^ -0.5));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -9e+67], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.52e-291], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(h / N[(l / 0.5), $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.6e+116], N[(N[(1.0 - N[(N[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -9 \cdot 10^{+67}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{elif}\;\ell \leq 1.52 \cdot 10^{-291}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{h}{\frac{\ell}{0.5}} \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)\\
\mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\
\;\;\;\;\left(1 - {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -8.9999999999999997e67Initial program 50.6%
associate-*l*50.5%
metadata-eval50.5%
unpow1/250.5%
metadata-eval50.5%
unpow1/250.5%
associate-*l*50.5%
metadata-eval50.5%
times-frac50.5%
Simplified50.5%
frac-2neg50.5%
sqrt-div63.6%
Applied egg-rr63.6%
Taylor expanded in d around -inf 54.8%
mul-1-neg54.8%
*-commutative54.8%
distribute-rgt-neg-in54.8%
Simplified54.8%
if -8.9999999999999997e67 < l < 1.52000000000000008e-291Initial program 82.9%
metadata-eval82.9%
unpow1/282.9%
metadata-eval82.9%
unpow1/282.9%
*-commutative82.9%
associate-*l*82.9%
times-frac79.8%
metadata-eval79.8%
Simplified79.8%
associate-*r*79.8%
frac-times82.9%
*-commutative82.9%
metadata-eval82.9%
add-sqr-sqrt82.8%
pow282.8%
Applied egg-rr79.7%
pow179.7%
sqrt-unprod66.2%
*-commutative66.2%
metadata-eval66.2%
div-inv66.2%
*-commutative66.2%
div-inv66.2%
metadata-eval66.2%
*-commutative66.2%
Applied egg-rr66.2%
unpow166.2%
unpow266.2%
swap-sqr66.3%
rem-square-sqrt66.2%
associate-*l/66.2%
associate-/l*66.2%
unpow266.2%
Simplified66.2%
if 1.52000000000000008e-291 < l < 4.5999999999999999e116Initial program 73.3%
expm1-log1p-u33.3%
expm1-udef22.7%
Applied egg-rr17.5%
expm1-def24.8%
expm1-log1p58.1%
*-commutative58.1%
associate-*r/59.1%
*-commutative59.1%
*-commutative59.1%
Simplified59.1%
Taylor expanded in d around 0 76.9%
*-commutative76.9%
*-commutative76.9%
unpow-176.9%
sqr-pow76.9%
rem-sqrt-square76.9%
metadata-eval76.9%
sqr-pow76.7%
fabs-sqr76.7%
sqr-pow76.9%
Simplified76.9%
if 4.5999999999999999e116 < l Initial program 53.5%
Taylor expanded in d around inf 60.0%
*-un-lft-identity60.0%
*-commutative60.0%
Applied egg-rr60.0%
*-lft-identity60.0%
unpow-160.0%
sqr-pow60.1%
rem-sqrt-square60.1%
metadata-eval60.1%
sqr-pow59.9%
fabs-sqr59.9%
sqr-pow60.1%
Simplified60.1%
*-commutative60.1%
unpow-prod-down75.1%
Applied egg-rr75.1%
Final simplification69.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 (* d (pow (* l h) -0.5)))
(t_1 (* 0.5 (/ h l)))
(t_2 (* (pow (/ (* D (* 0.5 M)) d) 2.0) t_1)))
(if (<= l -2.55e-117)
(* t_0 (+ t_2 -1.0))
(if (<= l 5.4e-205)
(*
(sqrt (* (/ d l) (/ d h)))
(- 1.0 (* t_1 (pow (* 0.5 (/ D (/ d M))) 2.0))))
(if (<= l 4.6e+116)
(* (- 1.0 t_2) t_0)
(* d (* (pow l -0.5) (pow h -0.5))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = d * pow((l * h), -0.5);
double t_1 = 0.5 * (h / l);
double t_2 = pow(((D * (0.5 * M)) / d), 2.0) * t_1;
double tmp;
if (l <= -2.55e-117) {
tmp = t_0 * (t_2 + -1.0);
} else if (l <= 5.4e-205) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 - (t_1 * pow((0.5 * (D / (d / M))), 2.0)));
} else if (l <= 4.6e+116) {
tmp = (1.0 - t_2) * t_0;
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = d * ((l * h) ** (-0.5d0))
t_1 = 0.5d0 * (h / l)
t_2 = (((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * t_1
if (l <= (-2.55d-117)) then
tmp = t_0 * (t_2 + (-1.0d0))
else if (l <= 5.4d-205) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - (t_1 * ((0.5d0 * (d_1 / (d / m))) ** 2.0d0)))
else if (l <= 4.6d+116) then
tmp = (1.0d0 - t_2) * t_0
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = d * Math.pow((l * h), -0.5);
double t_1 = 0.5 * (h / l);
double t_2 = Math.pow(((D * (0.5 * M)) / d), 2.0) * t_1;
double tmp;
if (l <= -2.55e-117) {
tmp = t_0 * (t_2 + -1.0);
} else if (l <= 5.4e-205) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - (t_1 * Math.pow((0.5 * (D / (d / M))), 2.0)));
} else if (l <= 4.6e+116) {
tmp = (1.0 - t_2) * t_0;
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = d * math.pow((l * h), -0.5) t_1 = 0.5 * (h / l) t_2 = math.pow(((D * (0.5 * M)) / d), 2.0) * t_1 tmp = 0 if l <= -2.55e-117: tmp = t_0 * (t_2 + -1.0) elif l <= 5.4e-205: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - (t_1 * math.pow((0.5 * (D / (d / M))), 2.0))) elif l <= 4.6e+116: tmp = (1.0 - t_2) * t_0 else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(d * (Float64(l * h) ^ -0.5)) t_1 = Float64(0.5 * Float64(h / l)) t_2 = Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * t_1) tmp = 0.0 if (l <= -2.55e-117) tmp = Float64(t_0 * Float64(t_2 + -1.0)); elseif (l <= 5.4e-205) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(t_1 * (Float64(0.5 * Float64(D / Float64(d / M))) ^ 2.0)))); elseif (l <= 4.6e+116) tmp = Float64(Float64(1.0 - t_2) * t_0); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = d * ((l * h) ^ -0.5);
t_1 = 0.5 * (h / l);
t_2 = (((D * (0.5 * M)) / d) ^ 2.0) * t_1;
tmp = 0.0;
if (l <= -2.55e-117)
tmp = t_0 * (t_2 + -1.0);
elseif (l <= 5.4e-205)
tmp = sqrt(((d / l) * (d / h))) * (1.0 - (t_1 * ((0.5 * (D / (d / M))) ^ 2.0)));
elseif (l <= 4.6e+116)
tmp = (1.0 - t_2) * t_0;
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[l, -2.55e-117], N[(t$95$0 * N[(t$95$2 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.4e-205], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(t$95$1 * N[Power[N[(0.5 * N[(D / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.6e+116], N[(N[(1.0 - t$95$2), $MachinePrecision] * t$95$0), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
t_1 := 0.5 \cdot \frac{h}{\ell}\\
t_2 := {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot t_1\\
\mathbf{if}\;\ell \leq -2.55 \cdot 10^{-117}:\\
\;\;\;\;t_0 \cdot \left(t_2 + -1\right)\\
\mathbf{elif}\;\ell \leq 5.4 \cdot 10^{-205}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - t_1 \cdot {\left(0.5 \cdot \frac{D}{\frac{d}{M}}\right)}^{2}\right)\\
\mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+116}:\\
\;\;\;\;\left(1 - t_2\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -2.5500000000000001e-117Initial program 66.4%
expm1-log1p-u40.8%
expm1-udef25.8%
Applied egg-rr22.8%
expm1-def35.7%
expm1-log1p53.3%
*-commutative53.3%
associate-*r/54.0%
*-commutative54.0%
*-commutative54.0%
Simplified54.0%
Taylor expanded in d around -inf 69.9%
mul-1-neg69.9%
*-commutative69.9%
distribute-rgt-neg-in69.9%
unpow-169.9%
sqr-pow69.9%
rem-sqrt-square69.9%
metadata-eval69.9%
sqr-pow69.9%
fabs-sqr69.9%
sqr-pow69.9%
Simplified69.9%
if -2.5500000000000001e-117 < l < 5.4000000000000002e-205Initial program 75.5%
expm1-log1p-u19.2%
expm1-udef17.7%
Applied egg-rr15.0%
expm1-def16.5%
expm1-log1p68.3%
*-commutative68.3%
associate-*r/71.2%
*-commutative71.2%
*-commutative71.2%
Simplified71.2%
pow171.2%
associate-/l*69.8%
*-commutative69.8%
Applied egg-rr69.8%
unpow169.8%
*-commutative69.8%
associate-/r/68.3%
associate-*r*68.3%
*-commutative68.3%
associate-*l/71.2%
associate-/l*69.8%
Simplified69.8%
if 5.4000000000000002e-205 < l < 4.5999999999999999e116Initial program 75.7%
expm1-log1p-u40.3%
expm1-udef27.0%
Applied egg-rr19.8%
expm1-def28.5%
expm1-log1p55.9%
*-commutative55.9%
associate-*r/57.3%
*-commutative57.3%
*-commutative57.3%
Simplified57.3%
Taylor expanded in d around 0 83.3%
*-commutative83.3%
*-commutative83.3%
unpow-183.3%
sqr-pow83.2%
rem-sqrt-square83.2%
metadata-eval83.2%
sqr-pow83.0%
fabs-sqr83.0%
sqr-pow83.2%
Simplified83.2%
if 4.5999999999999999e116 < l Initial program 53.5%
Taylor expanded in d around inf 60.0%
*-un-lft-identity60.0%
*-commutative60.0%
Applied egg-rr60.0%
*-lft-identity60.0%
unpow-160.0%
sqr-pow60.1%
rem-sqrt-square60.1%
metadata-eval60.1%
sqr-pow59.9%
fabs-sqr59.9%
sqr-pow60.1%
Simplified60.1%
*-commutative60.1%
unpow-prod-down75.1%
Applied egg-rr75.1%
Final simplification74.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 (* 0.5 (/ h l))) (t_1 (* (pow (/ (* D (* 0.5 M)) d) 2.0) t_0)))
(if (<= l -2.7e-117)
(* (* d (sqrt (/ (/ 1.0 l) h))) (+ t_1 -1.0))
(if (<= l 5.2e-203)
(*
(sqrt (* (/ d l) (/ d h)))
(- 1.0 (* t_0 (pow (* 0.5 (/ D (/ d M))) 2.0))))
(if (<= l 5.4e+115)
(* (- 1.0 t_1) (* d (pow (* l h) -0.5)))
(* d (* (pow l -0.5) (pow h -0.5))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 0.5 * (h / l);
double t_1 = pow(((D * (0.5 * M)) / d), 2.0) * t_0;
double tmp;
if (l <= -2.7e-117) {
tmp = (d * sqrt(((1.0 / l) / h))) * (t_1 + -1.0);
} else if (l <= 5.2e-203) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 - (t_0 * pow((0.5 * (D / (d / M))), 2.0)));
} else if (l <= 5.4e+115) {
tmp = (1.0 - t_1) * (d * pow((l * h), -0.5));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * (h / l)
t_1 = (((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * t_0
if (l <= (-2.7d-117)) then
tmp = (d * sqrt(((1.0d0 / l) / h))) * (t_1 + (-1.0d0))
else if (l <= 5.2d-203) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - (t_0 * ((0.5d0 * (d_1 / (d / m))) ** 2.0d0)))
else if (l <= 5.4d+115) then
tmp = (1.0d0 - t_1) * (d * ((l * h) ** (-0.5d0)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 0.5 * (h / l);
double t_1 = Math.pow(((D * (0.5 * M)) / d), 2.0) * t_0;
double tmp;
if (l <= -2.7e-117) {
tmp = (d * Math.sqrt(((1.0 / l) / h))) * (t_1 + -1.0);
} else if (l <= 5.2e-203) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - (t_0 * Math.pow((0.5 * (D / (d / M))), 2.0)));
} else if (l <= 5.4e+115) {
tmp = (1.0 - t_1) * (d * Math.pow((l * h), -0.5));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 0.5 * (h / l) t_1 = math.pow(((D * (0.5 * M)) / d), 2.0) * t_0 tmp = 0 if l <= -2.7e-117: tmp = (d * math.sqrt(((1.0 / l) / h))) * (t_1 + -1.0) elif l <= 5.2e-203: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - (t_0 * math.pow((0.5 * (D / (d / M))), 2.0))) elif l <= 5.4e+115: tmp = (1.0 - t_1) * (d * math.pow((l * h), -0.5)) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(0.5 * Float64(h / l)) t_1 = Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * t_0) tmp = 0.0 if (l <= -2.7e-117) tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(t_1 + -1.0)); elseif (l <= 5.2e-203) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(t_0 * (Float64(0.5 * Float64(D / Float64(d / M))) ^ 2.0)))); elseif (l <= 5.4e+115) tmp = Float64(Float64(1.0 - t_1) * Float64(d * (Float64(l * h) ^ -0.5))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 0.5 * (h / l);
t_1 = (((D * (0.5 * M)) / d) ^ 2.0) * t_0;
tmp = 0.0;
if (l <= -2.7e-117)
tmp = (d * sqrt(((1.0 / l) / h))) * (t_1 + -1.0);
elseif (l <= 5.2e-203)
tmp = sqrt(((d / l) * (d / h))) * (1.0 - (t_0 * ((0.5 * (D / (d / M))) ^ 2.0)));
elseif (l <= 5.4e+115)
tmp = (1.0 - t_1) * (d * ((l * h) ^ -0.5));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[l, -2.7e-117], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.2e-203], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(t$95$0 * N[Power[N[(0.5 * N[(D / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.4e+115], N[(N[(1.0 - t$95$1), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{h}{\ell}\\
t_1 := {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot t_0\\
\mathbf{if}\;\ell \leq -2.7 \cdot 10^{-117}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(t_1 + -1\right)\\
\mathbf{elif}\;\ell \leq 5.2 \cdot 10^{-203}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - t_0 \cdot {\left(0.5 \cdot \frac{D}{\frac{d}{M}}\right)}^{2}\right)\\
\mathbf{elif}\;\ell \leq 5.4 \cdot 10^{+115}:\\
\;\;\;\;\left(1 - t_1\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -2.70000000000000003e-117Initial program 66.4%
expm1-log1p-u40.8%
expm1-udef25.8%
Applied egg-rr22.8%
expm1-def35.7%
expm1-log1p53.3%
*-commutative53.3%
associate-*r/54.0%
*-commutative54.0%
*-commutative54.0%
Simplified54.0%
Taylor expanded in d around -inf 69.9%
mul-1-neg69.9%
*-commutative69.9%
distribute-rgt-neg-in69.9%
*-commutative69.9%
associate-/r*70.8%
Simplified70.8%
if -2.70000000000000003e-117 < l < 5.19999999999999951e-203Initial program 75.5%
expm1-log1p-u19.2%
expm1-udef17.7%
Applied egg-rr15.0%
expm1-def16.5%
expm1-log1p68.3%
*-commutative68.3%
associate-*r/71.2%
*-commutative71.2%
*-commutative71.2%
Simplified71.2%
pow171.2%
associate-/l*69.8%
*-commutative69.8%
Applied egg-rr69.8%
unpow169.8%
*-commutative69.8%
associate-/r/68.3%
associate-*r*68.3%
*-commutative68.3%
associate-*l/71.2%
associate-/l*69.8%
Simplified69.8%
if 5.19999999999999951e-203 < l < 5.40000000000000008e115Initial program 75.7%
expm1-log1p-u40.3%
expm1-udef27.0%
Applied egg-rr19.8%
expm1-def28.5%
expm1-log1p55.9%
*-commutative55.9%
associate-*r/57.3%
*-commutative57.3%
*-commutative57.3%
Simplified57.3%
Taylor expanded in d around 0 83.3%
*-commutative83.3%
*-commutative83.3%
unpow-183.3%
sqr-pow83.2%
rem-sqrt-square83.2%
metadata-eval83.2%
sqr-pow83.0%
fabs-sqr83.0%
sqr-pow83.2%
Simplified83.2%
if 5.40000000000000008e115 < l Initial program 53.5%
Taylor expanded in d around inf 60.0%
*-un-lft-identity60.0%
*-commutative60.0%
Applied egg-rr60.0%
*-lft-identity60.0%
unpow-160.0%
sqr-pow60.1%
rem-sqrt-square60.1%
metadata-eval60.1%
sqr-pow59.9%
fabs-sqr59.9%
sqr-pow60.1%
Simplified60.1%
*-commutative60.1%
unpow-prod-down75.1%
Applied egg-rr75.1%
Final simplification74.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 (* (pow (/ (* D (* 0.5 M)) d) 2.0) (* 0.5 (/ h l))))))
(if (<= l 7e-203)
(* t_0 (sqrt (* (/ d l) (/ d h))))
(if (<= l 2.7e+116)
(* t_0 (* d (pow (* l h) -0.5)))
(* d (* (pow l -0.5) (pow h -0.5)))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 - (pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)));
double tmp;
if (l <= 7e-203) {
tmp = t_0 * sqrt(((d / l) * (d / h)));
} else if (l <= 2.7e+116) {
tmp = t_0 * (d * pow((l * h), -0.5));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - ((((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * (0.5d0 * (h / l)))
if (l <= 7d-203) then
tmp = t_0 * sqrt(((d / l) * (d / h)))
else if (l <= 2.7d+116) then
tmp = t_0 * (d * ((l * h) ** (-0.5d0)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 - (Math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)));
double tmp;
if (l <= 7e-203) {
tmp = t_0 * Math.sqrt(((d / l) * (d / h)));
} else if (l <= 2.7e+116) {
tmp = t_0 * (d * Math.pow((l * h), -0.5));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 1.0 - (math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l))) tmp = 0 if l <= 7e-203: tmp = t_0 * math.sqrt(((d / l) * (d / h))) elif l <= 2.7e+116: tmp = t_0 * (d * math.pow((l * h), -0.5)) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(1.0 - Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * Float64(0.5 * Float64(h / l)))) tmp = 0.0 if (l <= 7e-203) tmp = Float64(t_0 * sqrt(Float64(Float64(d / l) * Float64(d / h)))); elseif (l <= 2.7e+116) tmp = Float64(t_0 * Float64(d * (Float64(l * h) ^ -0.5))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 1.0 - ((((D * (0.5 * M)) / d) ^ 2.0) * (0.5 * (h / l)));
tmp = 0.0;
if (l <= 7e-203)
tmp = t_0 * sqrt(((d / l) * (d / h)));
elseif (l <= 2.7e+116)
tmp = t_0 * (d * ((l * h) ^ -0.5));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(1.0 - N[(N[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 7e-203], N[(t$95$0 * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.7e+116], N[(t$95$0 * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 1 - {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;\ell \leq 7 \cdot 10^{-203}:\\
\;\;\;\;t_0 \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{elif}\;\ell \leq 2.7 \cdot 10^{+116}:\\
\;\;\;\;t_0 \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < 7.0000000000000003e-203Initial program 70.4%
expm1-log1p-u31.3%
expm1-udef22.3%
Applied egg-rr19.4%
expm1-def27.2%
expm1-log1p59.9%
*-commutative59.9%
associate-*r/61.5%
*-commutative61.5%
*-commutative61.5%
Simplified61.5%
if 7.0000000000000003e-203 < l < 2.7e116Initial program 75.7%
expm1-log1p-u40.3%
expm1-udef27.0%
Applied egg-rr19.8%
expm1-def28.5%
expm1-log1p55.9%
*-commutative55.9%
associate-*r/57.3%
*-commutative57.3%
*-commutative57.3%
Simplified57.3%
Taylor expanded in d around 0 83.3%
*-commutative83.3%
*-commutative83.3%
unpow-183.3%
sqr-pow83.2%
rem-sqrt-square83.2%
metadata-eval83.2%
sqr-pow83.0%
fabs-sqr83.0%
sqr-pow83.2%
Simplified83.2%
if 2.7e116 < l Initial program 53.5%
Taylor expanded in d around inf 60.0%
*-un-lft-identity60.0%
*-commutative60.0%
Applied egg-rr60.0%
*-lft-identity60.0%
unpow-160.0%
sqr-pow60.1%
rem-sqrt-square60.1%
metadata-eval60.1%
sqr-pow59.9%
fabs-sqr59.9%
sqr-pow60.1%
Simplified60.1%
*-commutative60.1%
unpow-prod-down75.1%
Applied egg-rr75.1%
Final simplification69.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 (- 1.0 (* (pow (/ (* D (* 0.5 M)) d) 2.0) (* 0.5 (/ h l))))))
(if (<= l 4e-205)
(* t_0 (sqrt (/ (/ d h) (/ l d))))
(if (<= l 5.8e+114)
(* t_0 (* d (pow (* l h) -0.5)))
(* d (* (pow l -0.5) (pow h -0.5)))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 - (pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)));
double tmp;
if (l <= 4e-205) {
tmp = t_0 * sqrt(((d / h) / (l / d)));
} else if (l <= 5.8e+114) {
tmp = t_0 * (d * pow((l * h), -0.5));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - ((((d_1 * (0.5d0 * m)) / d) ** 2.0d0) * (0.5d0 * (h / l)))
if (l <= 4d-205) then
tmp = t_0 * sqrt(((d / h) / (l / d)))
else if (l <= 5.8d+114) then
tmp = t_0 * (d * ((l * h) ** (-0.5d0)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 - (Math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l)));
double tmp;
if (l <= 4e-205) {
tmp = t_0 * Math.sqrt(((d / h) / (l / d)));
} else if (l <= 5.8e+114) {
tmp = t_0 * (d * Math.pow((l * h), -0.5));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 1.0 - (math.pow(((D * (0.5 * M)) / d), 2.0) * (0.5 * (h / l))) tmp = 0 if l <= 4e-205: tmp = t_0 * math.sqrt(((d / h) / (l / d))) elif l <= 5.8e+114: tmp = t_0 * (d * math.pow((l * h), -0.5)) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(1.0 - Float64((Float64(Float64(D * Float64(0.5 * M)) / d) ^ 2.0) * Float64(0.5 * Float64(h / l)))) tmp = 0.0 if (l <= 4e-205) tmp = Float64(t_0 * sqrt(Float64(Float64(d / h) / Float64(l / d)))); elseif (l <= 5.8e+114) tmp = Float64(t_0 * Float64(d * (Float64(l * h) ^ -0.5))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 1.0 - ((((D * (0.5 * M)) / d) ^ 2.0) * (0.5 * (h / l)));
tmp = 0.0;
if (l <= 4e-205)
tmp = t_0 * sqrt(((d / h) / (l / d)));
elseif (l <= 5.8e+114)
tmp = t_0 * (d * ((l * h) ^ -0.5));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(1.0 - N[(N[Power[N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 4e-205], N[(t$95$0 * N[Sqrt[N[(N[(d / h), $MachinePrecision] / N[(l / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.8e+114], N[(t$95$0 * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 1 - {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;\ell \leq 4 \cdot 10^{-205}:\\
\;\;\;\;t_0 \cdot \sqrt{\frac{\frac{d}{h}}{\frac{\ell}{d}}}\\
\mathbf{elif}\;\ell \leq 5.8 \cdot 10^{+114}:\\
\;\;\;\;t_0 \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < 4e-205Initial program 70.4%
expm1-log1p-u31.3%
expm1-udef22.3%
Applied egg-rr19.4%
expm1-def27.2%
expm1-log1p59.9%
*-commutative59.9%
associate-*r/61.5%
*-commutative61.5%
*-commutative61.5%
Simplified61.5%
*-commutative61.5%
*-un-lft-identity61.5%
associate-*r/54.6%
Applied egg-rr54.6%
*-lft-identity54.6%
associate-/l*61.6%
Simplified61.6%
if 4e-205 < l < 5.8000000000000001e114Initial program 75.7%
expm1-log1p-u40.3%
expm1-udef27.0%
Applied egg-rr19.8%
expm1-def28.5%
expm1-log1p55.9%
*-commutative55.9%
associate-*r/57.3%
*-commutative57.3%
*-commutative57.3%
Simplified57.3%
Taylor expanded in d around 0 83.3%
*-commutative83.3%
*-commutative83.3%
unpow-183.3%
sqr-pow83.2%
rem-sqrt-square83.2%
metadata-eval83.2%
sqr-pow83.0%
fabs-sqr83.0%
sqr-pow83.2%
Simplified83.2%
if 5.8000000000000001e114 < l Initial program 53.5%
Taylor expanded in d around inf 60.0%
*-un-lft-identity60.0%
*-commutative60.0%
Applied egg-rr60.0%
*-lft-identity60.0%
unpow-160.0%
sqr-pow60.1%
rem-sqrt-square60.1%
metadata-eval60.1%
sqr-pow59.9%
fabs-sqr59.9%
sqr-pow60.1%
Simplified60.1%
*-commutative60.1%
unpow-prod-down75.1%
Applied egg-rr75.1%
Final simplification69.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) (/ d h)))))
(if (<= d 6.8e-304)
(* t_0 (- 1.0 (* (* (/ D (/ (/ (/ d M) M) D)) (/ h (* l d))) 0.125)))
(if (<= d 3.8e-147)
(* -0.125 (/ (* M (* D (* M D))) (/ d (sqrt (/ h (pow l 3.0))))))
(if (<= d 3.7e+82)
(* t_0 (- 1.0 (* 0.125 (* (/ D (/ l D)) (/ (* M M) (/ d (/ h d)))))))
(* d (* (pow l -0.5) (pow h -0.5))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(((d / l) * (d / h)));
double tmp;
if (d <= 6.8e-304) {
tmp = t_0 * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
} else if (d <= 3.8e-147) {
tmp = -0.125 * ((M * (D * (M * D))) / (d / sqrt((h / pow(l, 3.0)))));
} else if (d <= 3.7e+82) {
tmp = t_0 * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((d / l) * (d / h)))
if (d <= 6.8d-304) then
tmp = t_0 * (1.0d0 - (((d_1 / (((d / m) / m) / d_1)) * (h / (l * d))) * 0.125d0))
else if (d <= 3.8d-147) then
tmp = (-0.125d0) * ((m * (d_1 * (m * d_1))) / (d / sqrt((h / (l ** 3.0d0)))))
else if (d <= 3.7d+82) then
tmp = t_0 * (1.0d0 - (0.125d0 * ((d_1 / (l / d_1)) * ((m * m) / (d / (h / d))))))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt(((d / l) * (d / h)));
double tmp;
if (d <= 6.8e-304) {
tmp = t_0 * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
} else if (d <= 3.8e-147) {
tmp = -0.125 * ((M * (D * (M * D))) / (d / Math.sqrt((h / Math.pow(l, 3.0)))));
} else if (d <= 3.7e+82) {
tmp = t_0 * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt(((d / l) * (d / h))) tmp = 0 if d <= 6.8e-304: tmp = t_0 * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125)) elif d <= 3.8e-147: tmp = -0.125 * ((M * (D * (M * D))) / (d / math.sqrt((h / math.pow(l, 3.0))))) elif d <= 3.7e+82: tmp = t_0 * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d)))))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(Float64(d / l) * Float64(d / h))) tmp = 0.0 if (d <= 6.8e-304) tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(D / Float64(Float64(Float64(d / M) / M) / D)) * Float64(h / Float64(l * d))) * 0.125))); elseif (d <= 3.8e-147) tmp = Float64(-0.125 * Float64(Float64(M * Float64(D * Float64(M * D))) / Float64(d / sqrt(Float64(h / (l ^ 3.0)))))); elseif (d <= 3.7e+82) tmp = Float64(t_0 * Float64(1.0 - Float64(0.125 * Float64(Float64(D / Float64(l / D)) * Float64(Float64(M * M) / Float64(d / Float64(h / d))))))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt(((d / l) * (d / h)));
tmp = 0.0;
if (d <= 6.8e-304)
tmp = t_0 * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
elseif (d <= 3.8e-147)
tmp = -0.125 * ((M * (D * (M * D))) / (d / sqrt((h / (l ^ 3.0)))));
elseif (d <= 3.7e+82)
tmp = t_0 * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, 6.8e-304], N[(t$95$0 * N[(1.0 - N[(N[(N[(D / N[(N[(N[(d / M), $MachinePrecision] / M), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision] * N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.8e-147], N[(-0.125 * N[(N[(M * N[(D * N[(M * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d / N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.7e+82], N[(t$95$0 * N[(1.0 - N[(0.125 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(d / N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -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{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{if}\;d \leq 6.8 \cdot 10^{-304}:\\
\;\;\;\;t_0 \cdot \left(1 - \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right) \cdot 0.125\right)\\
\mathbf{elif}\;d \leq 3.8 \cdot 10^{-147}:\\
\;\;\;\;-0.125 \cdot \frac{M \cdot \left(D \cdot \left(M \cdot D\right)\right)}{\frac{d}{\sqrt{\frac{h}{{\ell}^{3}}}}}\\
\mathbf{elif}\;d \leq 3.7 \cdot 10^{+82}:\\
\;\;\;\;t_0 \cdot \left(1 - 0.125 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{d}{\frac{h}{d}}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < 6.7999999999999997e-304Initial program 71.0%
expm1-log1p-u35.3%
expm1-udef24.9%
Applied egg-rr21.4%
expm1-def30.3%
expm1-log1p58.7%
*-commutative58.7%
associate-*r/60.8%
*-commutative60.8%
*-commutative60.8%
Simplified60.8%
Taylor expanded in D around 0 29.1%
associate-*r/29.1%
*-commutative29.1%
associate-*r/29.1%
*-commutative29.1%
associate-*r*31.6%
unpow231.6%
associate-*l*33.5%
times-frac38.4%
associate-/l*38.6%
unpow238.6%
associate-/l*44.2%
unpow244.2%
associate-/r*47.6%
Simplified47.6%
if 6.7999999999999997e-304 < d < 3.80000000000000028e-147Initial program 38.7%
Taylor expanded in d around 0 34.7%
associate-*l/37.3%
*-commutative37.3%
unpow237.3%
unpow237.3%
swap-sqr52.3%
associate-/l*48.6%
associate-*l*48.6%
*-commutative48.6%
Simplified48.6%
if 3.80000000000000028e-147 < d < 3.7000000000000002e82Initial program 88.6%
expm1-log1p-u41.1%
expm1-udef17.6%
Applied egg-rr17.5%
expm1-def36.0%
expm1-log1p76.4%
*-commutative76.4%
associate-*r/78.2%
*-commutative78.2%
*-commutative78.2%
Simplified78.2%
Taylor expanded in D around 0 61.7%
*-commutative61.7%
times-frac67.0%
unpow267.0%
associate-/l*70.9%
associate-/l*70.8%
unpow270.8%
unpow270.8%
associate-/l*70.8%
Simplified70.8%
if 3.7000000000000002e82 < d Initial program 66.4%
Taylor expanded in d around inf 72.0%
*-un-lft-identity72.0%
*-commutative72.0%
Applied egg-rr72.0%
*-lft-identity72.0%
unpow-172.0%
sqr-pow72.0%
rem-sqrt-square72.0%
metadata-eval72.0%
sqr-pow71.7%
fabs-sqr71.7%
sqr-pow72.0%
Simplified72.0%
*-commutative72.0%
unpow-prod-down84.3%
Applied egg-rr84.3%
Final simplification59.2%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (* (/ d l) (/ d h)))))
(if (<= d 6.8e-304)
(* t_0 (- 1.0 (* (* (/ D (/ (/ (/ d M) M) D)) (/ h (* l d))) 0.125)))
(if (<= d 2.9e-147)
(* (/ -0.125 (/ d (* (* M D) (* M D)))) (sqrt (/ h (pow l 3.0))))
(if (<= d 3.2e+82)
(* t_0 (- 1.0 (* 0.125 (* (/ D (/ l D)) (/ (* M M) (/ d (/ h d)))))))
(* d (* (pow l -0.5) (pow h -0.5))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(((d / l) * (d / h)));
double tmp;
if (d <= 6.8e-304) {
tmp = t_0 * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
} else if (d <= 2.9e-147) {
tmp = (-0.125 / (d / ((M * D) * (M * D)))) * sqrt((h / pow(l, 3.0)));
} else if (d <= 3.2e+82) {
tmp = t_0 * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((d / l) * (d / h)))
if (d <= 6.8d-304) then
tmp = t_0 * (1.0d0 - (((d_1 / (((d / m) / m) / d_1)) * (h / (l * d))) * 0.125d0))
else if (d <= 2.9d-147) then
tmp = ((-0.125d0) / (d / ((m * d_1) * (m * d_1)))) * sqrt((h / (l ** 3.0d0)))
else if (d <= 3.2d+82) then
tmp = t_0 * (1.0d0 - (0.125d0 * ((d_1 / (l / d_1)) * ((m * m) / (d / (h / d))))))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt(((d / l) * (d / h)));
double tmp;
if (d <= 6.8e-304) {
tmp = t_0 * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
} else if (d <= 2.9e-147) {
tmp = (-0.125 / (d / ((M * D) * (M * D)))) * Math.sqrt((h / Math.pow(l, 3.0)));
} else if (d <= 3.2e+82) {
tmp = t_0 * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt(((d / l) * (d / h))) tmp = 0 if d <= 6.8e-304: tmp = t_0 * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125)) elif d <= 2.9e-147: tmp = (-0.125 / (d / ((M * D) * (M * D)))) * math.sqrt((h / math.pow(l, 3.0))) elif d <= 3.2e+82: tmp = t_0 * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d)))))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(Float64(d / l) * Float64(d / h))) tmp = 0.0 if (d <= 6.8e-304) tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(D / Float64(Float64(Float64(d / M) / M) / D)) * Float64(h / Float64(l * d))) * 0.125))); elseif (d <= 2.9e-147) tmp = Float64(Float64(-0.125 / Float64(d / Float64(Float64(M * D) * Float64(M * D)))) * sqrt(Float64(h / (l ^ 3.0)))); elseif (d <= 3.2e+82) tmp = Float64(t_0 * Float64(1.0 - Float64(0.125 * Float64(Float64(D / Float64(l / D)) * Float64(Float64(M * M) / Float64(d / Float64(h / d))))))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt(((d / l) * (d / h)));
tmp = 0.0;
if (d <= 6.8e-304)
tmp = t_0 * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
elseif (d <= 2.9e-147)
tmp = (-0.125 / (d / ((M * D) * (M * D)))) * sqrt((h / (l ^ 3.0)));
elseif (d <= 3.2e+82)
tmp = t_0 * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, 6.8e-304], N[(t$95$0 * N[(1.0 - N[(N[(N[(D / N[(N[(N[(d / M), $MachinePrecision] / M), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision] * N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.9e-147], N[(N[(-0.125 / N[(d / N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.2e+82], N[(t$95$0 * N[(1.0 - N[(0.125 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(d / N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -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{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{if}\;d \leq 6.8 \cdot 10^{-304}:\\
\;\;\;\;t_0 \cdot \left(1 - \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right) \cdot 0.125\right)\\
\mathbf{elif}\;d \leq 2.9 \cdot 10^{-147}:\\
\;\;\;\;\frac{-0.125}{\frac{d}{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\\
\mathbf{elif}\;d \leq 3.2 \cdot 10^{+82}:\\
\;\;\;\;t_0 \cdot \left(1 - 0.125 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{d}{\frac{h}{d}}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < 6.7999999999999997e-304Initial program 71.0%
expm1-log1p-u35.3%
expm1-udef24.9%
Applied egg-rr21.4%
expm1-def30.3%
expm1-log1p58.7%
*-commutative58.7%
associate-*r/60.8%
*-commutative60.8%
*-commutative60.8%
Simplified60.8%
Taylor expanded in D around 0 29.1%
associate-*r/29.1%
*-commutative29.1%
associate-*r/29.1%
*-commutative29.1%
associate-*r*31.6%
unpow231.6%
associate-*l*33.5%
times-frac38.4%
associate-/l*38.6%
unpow238.6%
associate-/l*44.2%
unpow244.2%
associate-/r*47.6%
Simplified47.6%
if 6.7999999999999997e-304 < d < 2.9000000000000001e-147Initial program 38.7%
metadata-eval38.7%
unpow1/238.7%
metadata-eval38.7%
unpow1/238.7%
*-commutative38.7%
associate-*l*38.7%
times-frac36.0%
metadata-eval36.0%
Simplified36.0%
associate-*r*36.0%
frac-times38.7%
*-commutative38.7%
metadata-eval38.7%
add-sqr-sqrt38.7%
pow238.7%
Applied egg-rr39.5%
pow139.5%
sqrt-unprod27.3%
*-commutative27.3%
metadata-eval27.3%
div-inv27.3%
*-commutative27.3%
div-inv27.3%
metadata-eval27.3%
*-commutative27.3%
Applied egg-rr27.3%
unpow127.3%
*-commutative27.3%
Simplified27.3%
Taylor expanded in d around 0 34.6%
associate-*r*34.6%
*-commutative34.6%
associate-/l*34.6%
unpow234.6%
rem-square-sqrt34.7%
associate-*r/34.7%
metadata-eval34.7%
unpow234.7%
unpow234.7%
unswap-sqr49.7%
Simplified49.7%
if 2.9000000000000001e-147 < d < 3.19999999999999975e82Initial program 88.6%
expm1-log1p-u41.1%
expm1-udef17.6%
Applied egg-rr17.5%
expm1-def36.0%
expm1-log1p76.4%
*-commutative76.4%
associate-*r/78.2%
*-commutative78.2%
*-commutative78.2%
Simplified78.2%
Taylor expanded in D around 0 61.7%
*-commutative61.7%
times-frac67.0%
unpow267.0%
associate-/l*70.9%
associate-/l*70.8%
unpow270.8%
unpow270.8%
associate-/l*70.8%
Simplified70.8%
if 3.19999999999999975e82 < d Initial program 66.4%
Taylor expanded in d around inf 72.0%
*-un-lft-identity72.0%
*-commutative72.0%
Applied egg-rr72.0%
*-lft-identity72.0%
unpow-172.0%
sqr-pow72.0%
rem-sqrt-square72.0%
metadata-eval72.0%
sqr-pow71.7%
fabs-sqr71.7%
sqr-pow72.0%
Simplified72.0%
*-commutative72.0%
unpow-prod-down84.3%
Applied egg-rr84.3%
Final simplification59.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 (<= M 6.4e-88)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= M 1.8e-62)
(* d (* (pow l -0.5) (pow h -0.5)))
(*
(sqrt (* (/ d l) (/ d h)))
(- 1.0 (* 0.125 (* (/ D (/ l D)) (/ (* M M) (/ d (/ h d))))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (M <= 6.4e-88) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (M <= 1.8e-62) {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
} else {
tmp = sqrt(((d / l) * (d / h))) * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
}
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 (m <= 6.4d-88) then
tmp = sqrt((d / l)) * sqrt((d / h))
else if (m <= 1.8d-62) then
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
else
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - (0.125d0 * ((d_1 / (l / d_1)) * ((m * m) / (d / (h / d))))))
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 (M <= 6.4e-88) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (M <= 1.8e-62) {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
} else {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if M <= 6.4e-88: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif M <= 1.8e-62: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) else: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d)))))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (M <= 6.4e-88) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (M <= 1.8e-62) tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); else tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(0.125 * Float64(Float64(D / Float64(l / D)) * Float64(Float64(M * M) / Float64(d / Float64(h / d))))))); 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 (M <= 6.4e-88)
tmp = sqrt((d / l)) * sqrt((d / h));
elseif (M <= 1.8e-62)
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
else
tmp = sqrt(((d / l) * (d / h))) * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
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[M, 6.4e-88], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 1.8e-62], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.125 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(d / N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 6.4 \cdot 10^{-88}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;M \leq 1.8 \cdot 10^{-62}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.125 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{d}{\frac{h}{d}}}\right)\right)\\
\end{array}
\end{array}
if M < 6.40000000000000025e-88Initial program 67.8%
associate-*l*67.8%
metadata-eval67.8%
unpow1/267.8%
metadata-eval67.8%
unpow1/267.8%
sub-neg67.8%
+-commutative67.8%
*-commutative67.8%
distribute-rgt-neg-in67.8%
fma-def67.8%
Simplified66.2%
Taylor expanded in h around 0 44.6%
if 6.40000000000000025e-88 < M < 1.8e-62Initial program 40.0%
Taylor expanded in d around inf 79.7%
*-un-lft-identity79.7%
*-commutative79.7%
Applied egg-rr79.7%
*-lft-identity79.7%
unpow-179.7%
sqr-pow79.7%
rem-sqrt-square79.7%
metadata-eval79.7%
sqr-pow79.4%
fabs-sqr79.4%
sqr-pow79.7%
Simplified79.7%
*-commutative79.7%
unpow-prod-down80.0%
Applied egg-rr80.0%
if 1.8e-62 < M Initial program 75.6%
expm1-log1p-u19.0%
expm1-udef12.0%
Applied egg-rr10.8%
expm1-def17.8%
expm1-log1p62.8%
*-commutative62.8%
associate-*r/62.7%
*-commutative62.7%
*-commutative62.7%
Simplified62.7%
Taylor expanded in D around 0 31.5%
*-commutative31.5%
times-frac34.4%
unpow234.4%
associate-/l*37.4%
associate-/l*40.2%
unpow240.2%
unpow240.2%
associate-/l*49.0%
Simplified49.0%
Final simplification46.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 4.5e+84)
(*
(sqrt (* (/ d l) (/ d h)))
(- 1.0 (* (* (/ D (/ (/ (/ d M) M) D)) (/ h (* l d))) 0.125)))
(* d (/ (sqrt (/ 1.0 l)) (sqrt h)))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 4.5e+84) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= 4.5d+84) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - (((d_1 / (((d / m) / m) / d_1)) * (h / (l * d))) * 0.125d0))
else
tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 4.5e+84) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= 4.5e+84: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125)) else: tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= 4.5e+84) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(Float64(Float64(D / Float64(Float64(Float64(d / M) / M) / D)) * Float64(h / Float64(l * d))) * 0.125))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= 4.5e+84)
tmp = sqrt(((d / l) * (d / h))) * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
else
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, 4.5e+84], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(N[(D / N[(N[(N[(d / M), $MachinePrecision] / M), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision] * N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 4.5 \cdot 10^{+84}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right) \cdot 0.125\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < 4.4999999999999997e84Initial program 70.0%
expm1-log1p-u33.0%
expm1-udef19.9%
Applied egg-rr17.9%
expm1-def27.7%
expm1-log1p57.3%
*-commutative57.3%
associate-*r/59.0%
*-commutative59.0%
*-commutative59.0%
Simplified59.0%
Taylor expanded in D around 0 33.9%
associate-*r/33.9%
*-commutative33.9%
associate-*r/33.9%
*-commutative33.9%
associate-*r*35.4%
unpow235.4%
associate-*l*37.5%
times-frac42.0%
associate-/l*41.6%
unpow241.6%
associate-/l*45.9%
unpow245.9%
associate-/r*48.4%
Simplified48.4%
if 4.4999999999999997e84 < d Initial program 66.4%
Taylor expanded in d around inf 72.0%
*-commutative72.0%
associate-/r*71.8%
Simplified71.8%
sqrt-div84.0%
Applied egg-rr84.0%
Final simplification54.8%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d 5.1e+84)
(*
(sqrt (* (/ d l) (/ d h)))
(- 1.0 (* (* (/ D (/ (/ (/ d M) M) D)) (/ h (* l d))) 0.125)))
(* d (* (pow l -0.5) (pow h -0.5)))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 5.1e+84) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= 5.1d+84) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - (((d_1 / (((d / m) / m) / d_1)) * (h / (l * d))) * 0.125d0))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 5.1e+84) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= 5.1e+84: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125)) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) 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 <= 5.1e+84) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(Float64(Float64(D / Float64(Float64(Float64(d / M) / M) / D)) * Float64(h / Float64(l * d))) * 0.125))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= 5.1e+84)
tmp = sqrt(((d / l) * (d / h))) * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, 5.1e+84], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(N[(D / N[(N[(N[(d / M), $MachinePrecision] / M), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision] * N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 5.1 \cdot 10^{+84}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right) \cdot 0.125\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < 5.1000000000000001e84Initial program 70.0%
expm1-log1p-u33.0%
expm1-udef19.9%
Applied egg-rr17.9%
expm1-def27.7%
expm1-log1p57.3%
*-commutative57.3%
associate-*r/59.0%
*-commutative59.0%
*-commutative59.0%
Simplified59.0%
Taylor expanded in D around 0 33.9%
associate-*r/33.9%
*-commutative33.9%
associate-*r/33.9%
*-commutative33.9%
associate-*r*35.4%
unpow235.4%
associate-*l*37.5%
times-frac42.0%
associate-/l*41.6%
unpow241.6%
associate-/l*45.9%
unpow245.9%
associate-/r*48.4%
Simplified48.4%
if 5.1000000000000001e84 < d Initial program 66.4%
Taylor expanded in d around inf 72.0%
*-un-lft-identity72.0%
*-commutative72.0%
Applied egg-rr72.0%
*-lft-identity72.0%
unpow-172.0%
sqr-pow72.0%
rem-sqrt-square72.0%
metadata-eval72.0%
sqr-pow71.7%
fabs-sqr71.7%
sqr-pow72.0%
Simplified72.0%
*-commutative72.0%
unpow-prod-down84.3%
Applied egg-rr84.3%
Final simplification54.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 (sqrt (* (/ d l) (/ d h)))))
(if (<= d 6.6e+91)
(* t_0 (- 1.0 (* (* (/ D (/ (/ (/ d M) M) D)) (/ h (* l d))) 0.125)))
(if (or (<= d 1.8e+159) (not (<= d 4.1e+197)))
(* d (pow (* l h) -0.5))
(*
t_0
(- 1.0 (* 0.125 (* (/ D (/ l D)) (/ (* M M) (/ d (/ h d)))))))))))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) * (d / h)));
double tmp;
if (d <= 6.6e+91) {
tmp = t_0 * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
} else if ((d <= 1.8e+159) || !(d <= 4.1e+197)) {
tmp = d * pow((l * h), -0.5);
} else {
tmp = t_0 * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
}
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) * (d / h)))
if (d <= 6.6d+91) then
tmp = t_0 * (1.0d0 - (((d_1 / (((d / m) / m) / d_1)) * (h / (l * d))) * 0.125d0))
else if ((d <= 1.8d+159) .or. (.not. (d <= 4.1d+197))) then
tmp = d * ((l * h) ** (-0.5d0))
else
tmp = t_0 * (1.0d0 - (0.125d0 * ((d_1 / (l / d_1)) * ((m * m) / (d / (h / d))))))
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) * (d / h)));
double tmp;
if (d <= 6.6e+91) {
tmp = t_0 * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
} else if ((d <= 1.8e+159) || !(d <= 4.1e+197)) {
tmp = d * Math.pow((l * h), -0.5);
} else {
tmp = t_0 * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
}
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) * (d / h))) tmp = 0 if d <= 6.6e+91: tmp = t_0 * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125)) elif (d <= 1.8e+159) or not (d <= 4.1e+197): tmp = d * math.pow((l * h), -0.5) else: tmp = t_0 * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d)))))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(Float64(d / l) * Float64(d / h))) tmp = 0.0 if (d <= 6.6e+91) tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(D / Float64(Float64(Float64(d / M) / M) / D)) * Float64(h / Float64(l * d))) * 0.125))); elseif ((d <= 1.8e+159) || !(d <= 4.1e+197)) tmp = Float64(d * (Float64(l * h) ^ -0.5)); else tmp = Float64(t_0 * Float64(1.0 - Float64(0.125 * Float64(Float64(D / Float64(l / D)) * Float64(Float64(M * M) / Float64(d / Float64(h / d))))))); 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) * (d / h)));
tmp = 0.0;
if (d <= 6.6e+91)
tmp = t_0 * (1.0 - (((D / (((d / M) / M) / D)) * (h / (l * d))) * 0.125));
elseif ((d <= 1.8e+159) || ~((d <= 4.1e+197)))
tmp = d * ((l * h) ^ -0.5);
else
tmp = t_0 * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
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[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, 6.6e+91], N[(t$95$0 * N[(1.0 - N[(N[(N[(D / N[(N[(N[(d / M), $MachinePrecision] / M), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision] * N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d, 1.8e+159], N[Not[LessEqual[d, 4.1e+197]], $MachinePrecision]], N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(1.0 - N[(0.125 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(d / N[(h / d), $MachinePrecision]), $MachinePrecision]), $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} \cdot \frac{d}{h}}\\
\mathbf{if}\;d \leq 6.6 \cdot 10^{+91}:\\
\;\;\;\;t_0 \cdot \left(1 - \left(\frac{D}{\frac{\frac{\frac{d}{M}}{M}}{D}} \cdot \frac{h}{\ell \cdot d}\right) \cdot 0.125\right)\\
\mathbf{elif}\;d \leq 1.8 \cdot 10^{+159} \lor \neg \left(d \leq 4.1 \cdot 10^{+197}\right):\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(1 - 0.125 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{d}{\frac{h}{d}}}\right)\right)\\
\end{array}
\end{array}
if d < 6.60000000000000034e91Initial program 69.9%
expm1-log1p-u33.1%
expm1-udef20.2%
Applied egg-rr18.2%
expm1-def27.9%
expm1-log1p57.3%
*-commutative57.3%
associate-*r/58.9%
*-commutative58.9%
*-commutative58.9%
Simplified58.9%
Taylor expanded in D around 0 33.6%
associate-*r/33.6%
*-commutative33.6%
associate-*r/33.6%
*-commutative33.6%
associate-*r*35.1%
unpow235.1%
associate-*l*37.2%
times-frac41.6%
associate-/l*41.3%
unpow241.3%
associate-/l*46.0%
unpow246.0%
associate-/r*48.4%
Simplified48.4%
if 6.60000000000000034e91 < d < 1.80000000000000018e159 or 4.1000000000000003e197 < d Initial program 58.5%
Taylor expanded in d around inf 85.7%
*-un-lft-identity85.7%
*-commutative85.7%
Applied egg-rr85.7%
*-lft-identity85.7%
unpow-185.7%
sqr-pow85.7%
rem-sqrt-square85.7%
metadata-eval85.7%
sqr-pow85.3%
fabs-sqr85.3%
sqr-pow85.7%
Simplified85.7%
if 1.80000000000000018e159 < d < 4.1000000000000003e197Initial program 100.0%
expm1-log1p-u41.3%
expm1-udef36.6%
Applied egg-rr27.6%
expm1-def32.1%
expm1-log1p89.3%
*-commutative89.3%
associate-*r/89.3%
*-commutative89.3%
*-commutative89.3%
Simplified89.3%
Taylor expanded in D around 0 21.9%
*-commutative21.9%
times-frac21.9%
unpow221.9%
associate-/l*21.9%
associate-/l*21.9%
unpow221.9%
unpow221.9%
associate-/l*77.5%
Simplified77.5%
Final simplification54.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 -2.7e+67)
(* (- d) (sqrt (/ 1.0 (* l h))))
(if (<= l 4.8e-80)
(*
(sqrt (* (/ d l) (/ d h)))
(- 1.0 (* 0.125 (* (/ D (/ l D)) (/ (* M M) (/ d (/ h d)))))))
(* 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) {
double tmp;
if (l <= -2.7e+67) {
tmp = -d * sqrt((1.0 / (l * h)));
} else if (l <= 4.8e-80) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
} else {
tmp = d * pow((l * h), -0.5);
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-2.7d+67)) then
tmp = -d * sqrt((1.0d0 / (l * h)))
else if (l <= 4.8d-80) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - (0.125d0 * ((d_1 / (l / d_1)) * ((m * m) / (d / (h / d))))))
else
tmp = d * ((l * h) ** (-0.5d0))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2.7e+67) {
tmp = -d * Math.sqrt((1.0 / (l * h)));
} else if (l <= 4.8e-80) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
} else {
tmp = d * Math.pow((l * h), -0.5);
}
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.7e+67: tmp = -d * math.sqrt((1.0 / (l * h))) elif l <= 4.8e-80: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d)))))) else: tmp = d * math.pow((l * h), -0.5) 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.7e+67) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); elseif (l <= 4.8e-80) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(0.125 * Float64(Float64(D / Float64(l / D)) * Float64(Float64(M * M) / Float64(d / Float64(h / d))))))); else tmp = Float64(d * (Float64(l * h) ^ -0.5)); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -2.7e+67)
tmp = -d * sqrt((1.0 / (l * h)));
elseif (l <= 4.8e-80)
tmp = sqrt(((d / l) * (d / h))) * (1.0 - (0.125 * ((D / (l / D)) * ((M * M) / (d / (h / d))))));
else
tmp = d * ((l * h) ^ -0.5);
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2.7e+67], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.8e-80], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.125 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(d / N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.7 \cdot 10^{+67}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{elif}\;\ell \leq 4.8 \cdot 10^{-80}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.125 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{M \cdot M}{\frac{d}{\frac{h}{d}}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\end{array}
\end{array}
if l < -2.6999999999999999e67Initial program 50.6%
associate-*l*50.5%
metadata-eval50.5%
unpow1/250.5%
metadata-eval50.5%
unpow1/250.5%
associate-*l*50.5%
metadata-eval50.5%
times-frac50.5%
Simplified50.5%
frac-2neg50.5%
sqrt-div63.6%
Applied egg-rr63.6%
Taylor expanded in d around -inf 54.8%
mul-1-neg54.8%
*-commutative54.8%
distribute-rgt-neg-in54.8%
Simplified54.8%
if -2.6999999999999999e67 < l < 4.7999999999999998e-80Initial program 79.1%
expm1-log1p-u26.7%
expm1-udef20.8%
Applied egg-rr18.2%
expm1-def22.7%
expm1-log1p65.5%
*-commutative65.5%
associate-*r/68.1%
*-commutative68.1%
*-commutative68.1%
Simplified68.1%
Taylor expanded in D around 0 35.6%
*-commutative35.6%
times-frac39.5%
unpow239.5%
associate-/l*41.9%
associate-/l*42.5%
unpow242.5%
unpow242.5%
associate-/l*48.0%
Simplified48.0%
if 4.7999999999999998e-80 < l Initial program 64.1%
Taylor expanded in d around inf 57.8%
*-un-lft-identity57.8%
*-commutative57.8%
Applied egg-rr57.8%
*-lft-identity57.8%
unpow-157.8%
sqr-pow57.8%
rem-sqrt-square57.8%
metadata-eval57.8%
sqr-pow57.6%
fabs-sqr57.6%
sqr-pow57.8%
Simplified57.8%
Final simplification52.3%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= l -1.45e-157) (* (- d) (sqrt (/ 1.0 (* l h)))) (* 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) {
double tmp;
if (l <= -1.45e-157) {
tmp = -d * sqrt((1.0 / (l * h)));
} else {
tmp = d * pow((l * h), -0.5);
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-1.45d-157)) then
tmp = -d * sqrt((1.0d0 / (l * h)))
else
tmp = d * ((l * h) ** (-0.5d0))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1.45e-157) {
tmp = -d * Math.sqrt((1.0 / (l * h)));
} else {
tmp = d * Math.pow((l * h), -0.5);
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -1.45e-157: tmp = -d * math.sqrt((1.0 / (l * h))) else: tmp = d * math.pow((l * h), -0.5) 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 <= -1.45e-157) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); else tmp = Float64(d * (Float64(l * h) ^ -0.5)); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -1.45e-157)
tmp = -d * sqrt((1.0 / (l * h)));
else
tmp = d * ((l * h) ^ -0.5);
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -1.45e-157], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.45 \cdot 10^{-157}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\end{array}
\end{array}
if l < -1.44999999999999994e-157Initial program 68.3%
associate-*l*67.2%
metadata-eval67.2%
unpow1/267.2%
metadata-eval67.2%
unpow1/267.2%
associate-*l*66.2%
metadata-eval66.2%
times-frac64.5%
Simplified64.5%
frac-2neg64.5%
sqrt-div71.0%
Applied egg-rr71.0%
Taylor expanded in d around -inf 46.5%
mul-1-neg46.5%
*-commutative46.5%
distribute-rgt-neg-in46.5%
Simplified46.5%
if -1.44999999999999994e-157 < l Initial program 69.9%
Taylor expanded in d around inf 43.5%
*-un-lft-identity43.5%
*-commutative43.5%
Applied egg-rr43.5%
*-lft-identity43.5%
unpow-143.5%
sqr-pow43.5%
rem-sqrt-square43.5%
metadata-eval43.5%
sqr-pow43.4%
fabs-sqr43.4%
sqr-pow43.5%
Simplified43.5%
Final simplification44.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 (* 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.4%
Taylor expanded in d around inf 30.1%
*-un-lft-identity30.1%
*-commutative30.1%
Applied egg-rr30.1%
*-lft-identity30.1%
unpow-130.1%
sqr-pow30.1%
rem-sqrt-square30.1%
metadata-eval30.1%
sqr-pow30.0%
fabs-sqr30.0%
sqr-pow30.1%
Simplified30.1%
Final simplification30.1%
herbie shell --seed 2023200
(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)))))