
(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 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= d -1e-191)
(*
(sqrt (/ d h))
(* t_0 (fma (pow (* M (/ (/ D d) 2.0)) 2.0) (/ -0.5 (/ l h)) 1.0)))
(if (<= d 2.6e-295)
(*
-0.125
(pow
(pow (* (/ (pow (* M D) 2.0) d) (sqrt (* h (pow l -3.0)))) 3.0)
0.3333333333333333))
(*
(/ (sqrt d) (sqrt h))
(*
t_0
(- 1.0 (* 0.5 (* (pow (* (/ D d) (/ M 2.0)) 2.0) (/ h l))))))))))D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (d <= -1e-191) {
tmp = sqrt((d / h)) * (t_0 * fma(pow((M * ((D / d) / 2.0)), 2.0), (-0.5 / (l / h)), 1.0));
} else if (d <= 2.6e-295) {
tmp = -0.125 * pow(pow(((pow((M * D), 2.0) / d) * sqrt((h * pow(l, -3.0)))), 3.0), 0.3333333333333333);
} else {
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 - (0.5 * (pow(((D / d) * (M / 2.0)), 2.0) * (h / l)))));
}
return tmp;
}
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (d <= -1e-191) tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * fma((Float64(M * Float64(Float64(D / d) / 2.0)) ^ 2.0), Float64(-0.5 / Float64(l / h)), 1.0))); elseif (d <= 2.6e-295) tmp = Float64(-0.125 * ((Float64(Float64((Float64(M * D) ^ 2.0) / d) * sqrt(Float64(h * (l ^ -3.0)))) ^ 3.0) ^ 0.3333333333333333)); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0) * Float64(h / l)))))); end return tmp end
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1e-191], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(N[Power[N[(M * N[(N[(D / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 / N[(l / h), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.6e-295], N[(-0.125 * N[Power[N[Power[N[(N[(N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision] * N[Sqrt[N[(h * N[Power[l, -3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -1 \cdot 10^{-191}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t_0 \cdot \mathsf{fma}\left({\left(M \cdot \frac{\frac{D}{d}}{2}\right)}^{2}, \frac{-0.5}{\frac{\ell}{h}}, 1\right)\right)\\
\mathbf{elif}\;d \leq 2.6 \cdot 10^{-295}:\\
\;\;\;\;-0.125 \cdot {\left({\left(\frac{{\left(M \cdot D\right)}^{2}}{d} \cdot \sqrt{h \cdot {\ell}^{-3}}\right)}^{3}\right)}^{0.3333333333333333}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot \left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\
\end{array}
\end{array}
if d < -1e-191Initial program 74.8%
associate-*l*74.8%
metadata-eval74.8%
unpow1/274.8%
metadata-eval74.8%
unpow1/274.8%
sub-neg74.8%
+-commutative74.8%
*-commutative74.8%
associate-*l*74.8%
distribute-rgt-neg-in74.8%
*-commutative74.8%
Simplified75.8%
if -1e-191 < d < 2.59999999999999985e-295Initial program 23.5%
associate-*l*23.5%
metadata-eval23.5%
unpow1/223.5%
metadata-eval23.5%
unpow1/223.5%
associate-*l*23.5%
metadata-eval23.5%
times-frac23.5%
Simplified23.5%
Taylor expanded in d around 0 6.5%
unpow26.5%
unpow26.5%
unswap-sqr6.5%
Simplified6.5%
add-cbrt-cube6.5%
pow1/351.9%
pow351.9%
pow251.9%
div-inv51.9%
pow-flip51.9%
metadata-eval51.9%
Applied egg-rr51.9%
if 2.59999999999999985e-295 < d Initial program 65.5%
associate-*l*64.8%
metadata-eval64.8%
unpow1/264.8%
metadata-eval64.8%
unpow1/264.8%
associate-*l*64.8%
metadata-eval64.8%
times-frac63.3%
Simplified63.3%
sqrt-div78.5%
Applied egg-rr78.5%
Final simplification75.5%
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 2e+278)
t_0
(*
(* (sqrt (/ d l)) (/ (sqrt d) (sqrt h)))
(- 1.0 (* 0.125 (/ (/ (* D (* h (* M (/ M d)))) (/ d D)) l)))))))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 <= 2e+278) {
tmp = t_0;
} else {
tmp = (sqrt((d / l)) * (sqrt(d) / sqrt(h))) * (1.0 - (0.125 * (((D * (h * (M * (M / d)))) / (d / D)) / l)));
}
return tmp;
}
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 <= 2d+278) then
tmp = t_0
else
tmp = (sqrt((d / l)) * (sqrt(d) / sqrt(h))) * (1.0d0 - (0.125d0 * (((d_1 * (h * (m * (m / d)))) / (d / d_1)) / l)))
end if
code = tmp
end function
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 <= 2e+278) {
tmp = t_0;
} else {
tmp = (Math.sqrt((d / l)) * (Math.sqrt(d) / Math.sqrt(h))) * (1.0 - (0.125 * (((D * (h * (M * (M / d)))) / (d / D)) / l)));
}
return tmp;
}
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 <= 2e+278: tmp = t_0 else: tmp = (math.sqrt((d / l)) * (math.sqrt(d) / math.sqrt(h))) * (1.0 - (0.125 * (((D * (h * (M * (M / d)))) / (d / D)) / l))) return tmp
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 <= 2e+278) tmp = t_0; else tmp = Float64(Float64(sqrt(Float64(d / l)) * Float64(sqrt(d) / sqrt(h))) * Float64(1.0 - Float64(0.125 * Float64(Float64(Float64(D * Float64(h * Float64(M * Float64(M / d)))) / Float64(d / D)) / l)))); end return tmp end
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 <= 2e+278)
tmp = t_0;
else
tmp = (sqrt((d / l)) * (sqrt(d) / sqrt(h))) * (1.0 - (0.125 * (((D * (h * (M * (M / d)))) / (d / D)) / l)));
end
tmp_2 = tmp;
end
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, 2e+278], t$95$0, N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.125 * N[(N[(N[(D * N[(h * N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
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 2 \cdot 10^{+278}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{d}}{\sqrt{h}}\right) \cdot \left(1 - 0.125 \cdot \frac{\frac{D \cdot \left(h \cdot \left(M \cdot \frac{M}{d}\right)\right)}{\frac{d}{D}}}{\ell}\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)))) < 1.99999999999999993e278Initial program 87.1%
if 1.99999999999999993e278 < (*.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%
metadata-eval18.5%
unpow1/218.5%
metadata-eval18.5%
unpow1/218.5%
*-commutative18.5%
associate-*l*18.5%
times-frac19.9%
metadata-eval19.9%
Simplified19.9%
associate-*r*19.9%
frac-times18.5%
*-commutative18.5%
metadata-eval18.5%
expm1-log1p-u18.5%
expm1-udef18.5%
Applied egg-rr18.6%
Taylor expanded in M around 0 18.2%
unpow218.2%
*-commutative18.2%
times-frac19.4%
unpow219.4%
associate-*r*20.8%
times-frac19.6%
*-commutative19.6%
times-frac18.2%
associate-*l/20.9%
associate-*r/20.9%
times-frac22.2%
unpow222.2%
associate-/l*23.7%
associate-*r*22.2%
associate-*l/23.6%
*-commutative23.6%
associate-/l*26.6%
associate-/r/26.6%
Simplified26.6%
associate-*l/26.8%
*-commutative26.8%
Applied egg-rr26.8%
sqrt-div35.0%
Applied egg-rr37.8%
Final simplification72.3%
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= d -3e-300)
(*
(sqrt (/ d h))
(* t_0 (fma (pow (* M (/ (/ D d) 2.0)) 2.0) (/ -0.5 (/ l h)) 1.0)))
(*
(/ (sqrt d) (sqrt h))
(* t_0 (- 1.0 (* 0.5 (* (pow (* (/ D d) (/ M 2.0)) 2.0) (/ h l)))))))))D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (d <= -3e-300) {
tmp = sqrt((d / h)) * (t_0 * fma(pow((M * ((D / d) / 2.0)), 2.0), (-0.5 / (l / h)), 1.0));
} else {
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 - (0.5 * (pow(((D / d) * (M / 2.0)), 2.0) * (h / l)))));
}
return tmp;
}
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (d <= -3e-300) tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * fma((Float64(M * Float64(Float64(D / d) / 2.0)) ^ 2.0), Float64(-0.5 / Float64(l / h)), 1.0))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0) * Float64(h / l)))))); end return tmp end
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -3e-300], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(N[Power[N[(M * N[(N[(D / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 / N[(l / h), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -3 \cdot 10^{-300}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t_0 \cdot \mathsf{fma}\left({\left(M \cdot \frac{\frac{D}{d}}{2}\right)}^{2}, \frac{-0.5}{\frac{\ell}{h}}, 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot \left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\
\end{array}
\end{array}
if d < -3.00000000000000024e-300Initial program 68.4%
associate-*l*68.4%
metadata-eval68.4%
unpow1/268.4%
metadata-eval68.4%
unpow1/268.4%
sub-neg68.4%
+-commutative68.4%
*-commutative68.4%
associate-*l*68.4%
distribute-rgt-neg-in68.4%
*-commutative68.4%
Simplified69.2%
if -3.00000000000000024e-300 < d Initial program 64.7%
associate-*l*64.1%
metadata-eval64.1%
unpow1/264.1%
metadata-eval64.1%
unpow1/264.1%
associate-*l*64.1%
metadata-eval64.1%
times-frac62.6%
Simplified62.6%
sqrt-div77.5%
Applied egg-rr77.5%
Final simplification73.5%
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= l 9e-283)
(*
(* (sqrt (/ d h)) t_0)
(- 1.0 (* (pow (* (/ D d) (/ M 2.0)) 2.0) (* 0.5 (/ h l)))))
(if (<= l 4.8e+85)
(*
(* t_0 (/ (sqrt d) (sqrt h)))
(- 1.0 (* 0.125 (/ (* (/ D (/ d D)) (* h (* M (/ M d)))) l))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))))D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (l <= 9e-283) {
tmp = (sqrt((d / h)) * t_0) * (1.0 - (pow(((D / d) * (M / 2.0)), 2.0) * (0.5 * (h / l))));
} else if (l <= 4.8e+85) {
tmp = (t_0 * (sqrt(d) / sqrt(h))) * (1.0 - (0.125 * (((D / (d / D)) * (h * (M * (M / d)))) / l)));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / l))
if (l <= 9d-283) then
tmp = (sqrt((d / h)) * t_0) * (1.0d0 - ((((d_1 / d) * (m / 2.0d0)) ** 2.0d0) * (0.5d0 * (h / l))))
else if (l <= 4.8d+85) then
tmp = (t_0 * (sqrt(d) / sqrt(h))) * (1.0d0 - (0.125d0 * (((d_1 / (d / d_1)) * (h * (m * (m / d)))) / l)))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double tmp;
if (l <= 9e-283) {
tmp = (Math.sqrt((d / h)) * t_0) * (1.0 - (Math.pow(((D / d) * (M / 2.0)), 2.0) * (0.5 * (h / l))));
} else if (l <= 4.8e+85) {
tmp = (t_0 * (Math.sqrt(d) / Math.sqrt(h))) * (1.0 - (0.125 * (((D / (d / D)) * (h * (M * (M / d)))) / l)));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) tmp = 0 if l <= 9e-283: tmp = (math.sqrt((d / h)) * t_0) * (1.0 - (math.pow(((D / d) * (M / 2.0)), 2.0) * (0.5 * (h / l)))) elif l <= 4.8e+85: tmp = (t_0 * (math.sqrt(d) / math.sqrt(h))) * (1.0 - (0.125 * (((D / (d / D)) * (h * (M * (M / d)))) / l))) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= 9e-283) tmp = Float64(Float64(sqrt(Float64(d / h)) * t_0) * Float64(1.0 - Float64((Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0) * Float64(0.5 * Float64(h / l))))); elseif (l <= 4.8e+85) tmp = Float64(Float64(t_0 * Float64(sqrt(d) / sqrt(h))) * Float64(1.0 - Float64(0.125 * Float64(Float64(Float64(D / Float64(d / D)) * Float64(h * Float64(M * Float64(M / d)))) / l)))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / l));
tmp = 0.0;
if (l <= 9e-283)
tmp = (sqrt((d / h)) * t_0) * (1.0 - ((((D / d) * (M / 2.0)) ^ 2.0) * (0.5 * (h / l))));
elseif (l <= 4.8e+85)
tmp = (t_0 * (sqrt(d) / sqrt(h))) * (1.0 - (0.125 * (((D / (d / D)) * (h * (M * (M / d)))) / l)));
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, 9e-283], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 - N[(N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.8e+85], N[(N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.125 * N[(N[(N[(D / N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(h * N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq 9 \cdot 10^{-283}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot t_0\right) \cdot \left(1 - {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)\\
\mathbf{elif}\;\ell \leq 4.8 \cdot 10^{+85}:\\
\;\;\;\;\left(t_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right) \cdot \left(1 - 0.125 \cdot \frac{\frac{D}{\frac{d}{D}} \cdot \left(h \cdot \left(M \cdot \frac{M}{d}\right)\right)}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < 8.9999999999999994e-283Initial program 68.8%
metadata-eval68.8%
unpow1/268.8%
metadata-eval68.8%
unpow1/268.8%
*-commutative68.8%
associate-*l*68.8%
times-frac68.8%
metadata-eval68.8%
Simplified68.8%
if 8.9999999999999994e-283 < l < 4.79999999999999993e85Initial program 72.1%
metadata-eval72.1%
unpow1/272.1%
metadata-eval72.1%
unpow1/272.1%
*-commutative72.1%
associate-*l*72.1%
times-frac70.7%
metadata-eval70.7%
Simplified70.7%
associate-*r*70.7%
frac-times72.1%
*-commutative72.1%
metadata-eval72.1%
expm1-log1p-u71.2%
expm1-udef71.2%
Applied egg-rr70.7%
Taylor expanded in M around 0 47.7%
unpow247.7%
*-commutative47.7%
times-frac50.5%
unpow250.5%
associate-*r*54.7%
times-frac51.8%
*-commutative51.8%
times-frac50.5%
associate-*l/51.9%
associate-*r/54.6%
times-frac66.4%
unpow266.4%
associate-/l*67.9%
associate-*r*63.7%
associate-*l/63.6%
*-commutative63.6%
associate-/l*67.0%
associate-/r/67.0%
Simplified67.0%
sqrt-div83.4%
Applied egg-rr83.5%
if 4.79999999999999993e85 < l Initial program 52.8%
associate-*l*52.8%
metadata-eval52.8%
unpow1/252.8%
metadata-eval52.8%
unpow1/252.8%
associate-*l*52.8%
metadata-eval52.8%
times-frac52.9%
Simplified52.9%
Taylor expanded in d around inf 58.6%
*-commutative58.6%
*-commutative58.6%
associate-/r*58.9%
Simplified58.9%
sqrt-div66.0%
Applied egg-rr66.0%
Final simplification72.3%
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= h 5.5e-184)
(*
(* (sqrt (/ d h)) t_0)
(- 1.0 (* (pow (* (/ D d) (/ M 2.0)) 2.0) (* 0.5 (/ h l)))))
(*
(* t_0 (/ (sqrt d) (sqrt h)))
(- 1.0 (* 0.125 (/ (/ (* D (* h (* M (/ M d)))) (/ d D)) l)))))))D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (h <= 5.5e-184) {
tmp = (sqrt((d / h)) * t_0) * (1.0 - (pow(((D / d) * (M / 2.0)), 2.0) * (0.5 * (h / l))));
} else {
tmp = (t_0 * (sqrt(d) / sqrt(h))) * (1.0 - (0.125 * (((D * (h * (M * (M / d)))) / (d / D)) / l)));
}
return tmp;
}
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / l))
if (h <= 5.5d-184) then
tmp = (sqrt((d / h)) * t_0) * (1.0d0 - ((((d_1 / d) * (m / 2.0d0)) ** 2.0d0) * (0.5d0 * (h / l))))
else
tmp = (t_0 * (sqrt(d) / sqrt(h))) * (1.0d0 - (0.125d0 * (((d_1 * (h * (m * (m / d)))) / (d / d_1)) / l)))
end if
code = tmp
end function
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double tmp;
if (h <= 5.5e-184) {
tmp = (Math.sqrt((d / h)) * t_0) * (1.0 - (Math.pow(((D / d) * (M / 2.0)), 2.0) * (0.5 * (h / l))));
} else {
tmp = (t_0 * (Math.sqrt(d) / Math.sqrt(h))) * (1.0 - (0.125 * (((D * (h * (M * (M / d)))) / (d / D)) / l)));
}
return tmp;
}
D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) tmp = 0 if h <= 5.5e-184: tmp = (math.sqrt((d / h)) * t_0) * (1.0 - (math.pow(((D / d) * (M / 2.0)), 2.0) * (0.5 * (h / l)))) else: tmp = (t_0 * (math.sqrt(d) / math.sqrt(h))) * (1.0 - (0.125 * (((D * (h * (M * (M / d)))) / (d / D)) / l))) return tmp
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (h <= 5.5e-184) tmp = Float64(Float64(sqrt(Float64(d / h)) * t_0) * Float64(1.0 - Float64((Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0) * Float64(0.5 * Float64(h / l))))); else tmp = Float64(Float64(t_0 * Float64(sqrt(d) / sqrt(h))) * Float64(1.0 - Float64(0.125 * Float64(Float64(Float64(D * Float64(h * Float64(M * Float64(M / d)))) / Float64(d / D)) / l)))); end return tmp end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / l));
tmp = 0.0;
if (h <= 5.5e-184)
tmp = (sqrt((d / h)) * t_0) * (1.0 - ((((D / d) * (M / 2.0)) ^ 2.0) * (0.5 * (h / l))));
else
tmp = (t_0 * (sqrt(d) / sqrt(h))) * (1.0 - (0.125 * (((D * (h * (M * (M / d)))) / (d / D)) / l)));
end
tmp_2 = tmp;
end
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, 5.5e-184], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 - N[(N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.125 * N[(N[(N[(D * N[(h * N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;h \leq 5.5 \cdot 10^{-184}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot t_0\right) \cdot \left(1 - {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right) \cdot \left(1 - 0.125 \cdot \frac{\frac{D \cdot \left(h \cdot \left(M \cdot \frac{M}{d}\right)\right)}{\frac{d}{D}}}{\ell}\right)\\
\end{array}
\end{array}
if h < 5.4999999999999999e-184Initial program 70.1%
metadata-eval70.1%
unpow1/270.1%
metadata-eval70.1%
unpow1/270.1%
*-commutative70.1%
associate-*l*70.1%
times-frac70.8%
metadata-eval70.8%
Simplified70.8%
if 5.4999999999999999e-184 < h Initial program 61.6%
metadata-eval61.6%
unpow1/261.6%
metadata-eval61.6%
unpow1/261.6%
*-commutative61.6%
associate-*l*61.6%
times-frac59.8%
metadata-eval59.8%
Simplified59.8%
associate-*r*59.8%
frac-times61.6%
*-commutative61.6%
metadata-eval61.6%
expm1-log1p-u60.9%
expm1-udef60.9%
Applied egg-rr59.8%
Taylor expanded in M around 0 36.9%
unpow236.9%
*-commutative36.9%
times-frac36.8%
unpow236.8%
associate-*r*37.8%
times-frac37.8%
*-commutative37.8%
times-frac35.9%
associate-*l/37.0%
associate-*r/38.8%
times-frac47.3%
unpow247.3%
associate-/l*48.3%
associate-*r*48.2%
associate-*l/49.1%
*-commutative49.1%
associate-/l*49.6%
associate-/r/49.6%
Simplified49.6%
associate-*l/49.7%
*-commutative49.7%
Applied egg-rr49.7%
sqrt-div76.3%
Applied egg-rr67.3%
Final simplification69.3%
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -5e-158)
(*
(- 1.0 (* 0.125 (/ (/ (* D (* h (* M (/ M d)))) (/ d D)) l)))
(* (sqrt (/ d h)) (sqrt (/ d l))))
(if (<= l 1.8e-92)
(*
(sqrt (* (/ d h) (/ d l)))
(fma h (* (pow (* M (/ D (* d 2.0))) 2.0) (/ -0.5 l)) 1.0))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -5e-158) {
tmp = (1.0 - (0.125 * (((D * (h * (M * (M / d)))) / (d / D)) / l))) * (sqrt((d / h)) * sqrt((d / l)));
} else if (l <= 1.8e-92) {
tmp = sqrt(((d / h) * (d / l))) * fma(h, (pow((M * (D / (d * 2.0))), 2.0) * (-0.5 / l)), 1.0);
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -5e-158) tmp = Float64(Float64(1.0 - Float64(0.125 * Float64(Float64(Float64(D * Float64(h * Float64(M * Float64(M / d)))) / Float64(d / D)) / l))) * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))); elseif (l <= 1.8e-92) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * fma(h, Float64((Float64(M * Float64(D / Float64(d * 2.0))) ^ 2.0) * Float64(-0.5 / l)), 1.0)); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -5e-158], N[(N[(1.0 - N[(0.125 * N[(N[(N[(D * N[(h * N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.8e-92], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(h * N[(N[Power[N[(M * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-158}:\\
\;\;\;\;\left(1 - 0.125 \cdot \frac{\frac{D \cdot \left(h \cdot \left(M \cdot \frac{M}{d}\right)\right)}{\frac{d}{D}}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{elif}\;\ell \leq 1.8 \cdot 10^{-92}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \mathsf{fma}\left(h, {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2} \cdot \frac{-0.5}{\ell}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.99999999999999972e-158Initial program 70.8%
metadata-eval70.8%
unpow1/270.8%
metadata-eval70.8%
unpow1/270.8%
*-commutative70.8%
associate-*l*70.8%
times-frac71.9%
metadata-eval71.9%
Simplified71.9%
associate-*r*71.9%
frac-times70.8%
*-commutative70.8%
metadata-eval70.8%
expm1-log1p-u70.4%
expm1-udef70.4%
Applied egg-rr70.8%
Taylor expanded in M around 0 51.3%
unpow251.3%
*-commutative51.3%
times-frac49.5%
unpow249.5%
associate-*r*51.7%
times-frac52.5%
*-commutative52.5%
times-frac50.6%
associate-*l/51.7%
associate-*r/52.6%
times-frac57.0%
unpow257.0%
associate-/l*60.9%
associate-*r*58.7%
associate-*l/60.9%
*-commutative60.9%
associate-/l*63.1%
associate-/r/63.0%
Simplified63.0%
associate-*l/64.7%
*-commutative64.7%
Applied egg-rr64.7%
if -4.99999999999999972e-158 < l < 1.80000000000000008e-92Initial program 68.0%
associate-*l*66.9%
metadata-eval66.9%
unpow1/266.9%
metadata-eval66.9%
unpow1/266.9%
associate-*l*66.9%
metadata-eval66.9%
times-frac65.6%
Simplified65.6%
Applied egg-rr14.1%
expm1-def14.1%
expm1-log1p61.8%
sub-neg61.8%
distribute-rgt-in30.0%
distribute-rgt-neg-in30.0%
associate-/l*30.0%
distribute-neg-frac30.0%
metadata-eval30.0%
associate-/l*30.0%
associate-*l/30.0%
Simplified67.3%
if 1.80000000000000008e-92 < l Initial program 60.3%
associate-*l*60.3%
metadata-eval60.3%
unpow1/260.3%
metadata-eval60.3%
unpow1/260.3%
associate-*l*60.3%
metadata-eval60.3%
times-frac59.3%
Simplified59.3%
Taylor expanded in d around inf 61.1%
*-commutative61.1%
*-commutative61.1%
associate-/r*61.4%
Simplified61.4%
sqrt-div66.6%
Applied egg-rr66.6%
Final simplification66.1%
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.8e+122)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(- 1.0 (* 0.5 (* (pow (* (/ D d) (/ M 2.0)) 2.0) (/ h l))))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 2.8e+122) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * (pow(((D / d) * (M / 2.0)), 2.0) * (h / l)))));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
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.8d+122) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * ((((d_1 / d) * (m / 2.0d0)) ** 2.0d0) * (h / l)))))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
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.8e+122) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * (Math.pow(((D / d) * (M / 2.0)), 2.0) * (h / l)))));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 2.8e+122: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * (math.pow(((D / d) * (M / 2.0)), 2.0) * (h / l))))) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 2.8e+122) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0) * Float64(h / l)))))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 2.8e+122)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((((D / d) * (M / 2.0)) ^ 2.0) * (h / l)))));
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
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.8e+122], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.8 \cdot 10^{+122}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < 2.8e122Initial program 69.7%
associate-*l*69.3%
metadata-eval69.3%
unpow1/269.3%
metadata-eval69.3%
unpow1/269.3%
associate-*l*69.3%
metadata-eval69.3%
times-frac68.8%
Simplified68.8%
if 2.8e122 < l Initial program 50.8%
associate-*l*50.8%
metadata-eval50.8%
unpow1/250.8%
metadata-eval50.8%
unpow1/250.8%
associate-*l*50.8%
metadata-eval50.8%
times-frac50.9%
Simplified50.9%
Taylor expanded in d around inf 62.3%
*-commutative62.3%
*-commutative62.3%
associate-/r*62.8%
Simplified62.8%
sqrt-div71.1%
Applied egg-rr71.1%
Final simplification69.2%
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 3e+122)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(- 1.0 (* (pow (* (/ D d) (/ M 2.0)) 2.0) (* 0.5 (/ h l)))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3e+122) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (pow(((D / d) * (M / 2.0)), 2.0) * (0.5 * (h / l))));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
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 <= 3d+122) then
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0d0 - ((((d_1 / d) * (m / 2.0d0)) ** 2.0d0) * (0.5d0 * (h / l))))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
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 <= 3e+122) {
tmp = (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - (Math.pow(((D / d) * (M / 2.0)), 2.0) * (0.5 * (h / l))));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 3e+122: tmp = (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - (math.pow(((D / d) * (M / 2.0)), 2.0) * (0.5 * (h / l)))) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 3e+122) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64((Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0) * Float64(0.5 * Float64(h / l))))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 3e+122)
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - ((((D / d) * (M / 2.0)) ^ 2.0) * (0.5 * (h / l))));
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
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, 3e+122], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 3 \cdot 10^{+122}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < 2.99999999999999986e122Initial program 69.7%
metadata-eval69.7%
unpow1/269.7%
metadata-eval69.7%
unpow1/269.7%
*-commutative69.7%
associate-*l*69.7%
times-frac69.2%
metadata-eval69.2%
Simplified69.2%
if 2.99999999999999986e122 < l Initial program 50.8%
associate-*l*50.8%
metadata-eval50.8%
unpow1/250.8%
metadata-eval50.8%
unpow1/250.8%
associate-*l*50.8%
metadata-eval50.8%
times-frac50.9%
Simplified50.9%
Taylor expanded in d around inf 62.3%
*-commutative62.3%
*-commutative62.3%
associate-/r*62.8%
Simplified62.8%
sqrt-div71.1%
Applied egg-rr71.1%
Final simplification69.5%
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= D 3.2e+100)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(- 1.0 (* 0.125 (/ (* (/ D (/ d D)) (* M (* h (/ M d)))) l))))
(*
(sqrt (* (/ d h) (/ d l)))
(- 1.0 (* (pow (* M (/ D (* d 2.0))) 2.0) (/ 0.5 (/ l h)))))))D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (D <= 3.2e+100) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.125 * (((D / (d / D)) * (M * (h * (M / d)))) / l)));
} else {
tmp = sqrt(((d / h) * (d / l))) * (1.0 - (pow((M * (D / (d * 2.0))), 2.0) * (0.5 / (l / h))));
}
return tmp;
}
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_1 <= 3.2d+100) then
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0d0 - (0.125d0 * (((d_1 / (d / d_1)) * (m * (h * (m / d)))) / l)))
else
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 - (((m * (d_1 / (d * 2.0d0))) ** 2.0d0) * (0.5d0 / (l / h))))
end if
code = tmp
end function
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (D <= 3.2e+100) {
tmp = (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - (0.125 * (((D / (d / D)) * (M * (h * (M / d)))) / l)));
} else {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 - (Math.pow((M * (D / (d * 2.0))), 2.0) * (0.5 / (l / h))));
}
return tmp;
}
D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if D <= 3.2e+100: tmp = (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - (0.125 * (((D / (d / D)) * (M * (h * (M / d)))) / l))) else: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 - (math.pow((M * (D / (d * 2.0))), 2.0) * (0.5 / (l / h)))) return tmp
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (D <= 3.2e+100) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.125 * Float64(Float64(Float64(D / Float64(d / D)) * Float64(M * Float64(h * Float64(M / d)))) / l)))); else tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 - Float64((Float64(M * Float64(D / Float64(d * 2.0))) ^ 2.0) * Float64(0.5 / Float64(l / h))))); end return tmp end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (D <= 3.2e+100)
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.125 * (((D / (d / D)) * (M * (h * (M / d)))) / l)));
else
tmp = sqrt(((d / h) * (d / l))) * (1.0 - (((M * (D / (d * 2.0))) ^ 2.0) * (0.5 / (l / h))));
end
tmp_2 = tmp;
end
NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[D, 3.2e+100], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.125 * N[(N[(N[(D / N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(M * N[(h * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[Power[N[(M * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;D \leq 3.2 \cdot 10^{+100}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.125 \cdot \frac{\frac{D}{\frac{d}{D}} \cdot \left(M \cdot \left(h \cdot \frac{M}{d}\right)\right)}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2} \cdot \frac{0.5}{\frac{\ell}{h}}\right)\\
\end{array}
\end{array}
if D < 3.1999999999999999e100Initial program 65.1%
metadata-eval65.1%
unpow1/265.1%
metadata-eval65.1%
unpow1/265.1%
*-commutative65.1%
associate-*l*65.1%
times-frac65.1%
metadata-eval65.1%
Simplified65.1%
associate-*r*65.1%
frac-times65.1%
*-commutative65.1%
metadata-eval65.1%
expm1-log1p-u64.6%
expm1-udef64.6%
Applied egg-rr64.6%
Taylor expanded in M around 0 45.6%
unpow245.6%
*-commutative45.6%
times-frac45.7%
unpow245.7%
associate-*r*48.3%
times-frac47.8%
*-commutative47.8%
times-frac46.1%
associate-*l/47.9%
associate-*r/49.2%
times-frac56.6%
unpow256.6%
associate-/l*57.8%
associate-*r*55.7%
associate-*l/56.6%
*-commutative56.6%
associate-/l*57.8%
associate-/r/57.7%
Simplified57.7%
Taylor expanded in h around 0 55.7%
associate-*r/56.6%
unpow256.6%
associate-*r/57.7%
*-commutative57.7%
associate-*l*61.0%
Simplified61.0%
if 3.1999999999999999e100 < D Initial program 75.1%
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.6%
Simplified72.6%
Applied egg-rr21.4%
expm1-def24.1%
expm1-log1p67.4%
associate-/l*67.3%
*-commutative67.3%
Simplified67.3%
Final simplification61.9%
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.3e+98)
(*
(- 1.0 (* 0.125 (/ (/ (* D (* h (* M (/ M d)))) (/ d D)) l)))
(* (sqrt (/ d h)) (sqrt (/ d l))))
(*
(sqrt (* (/ d h) (/ d l)))
(- 1.0 (* (pow (* M (/ D (* d 2.0))) 2.0) (/ 0.5 (/ l h)))))))D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (D <= 5.3e+98) {
tmp = (1.0 - (0.125 * (((D * (h * (M * (M / d)))) / (d / D)) / l))) * (sqrt((d / h)) * sqrt((d / l)));
} else {
tmp = sqrt(((d / h) * (d / l))) * (1.0 - (pow((M * (D / (d * 2.0))), 2.0) * (0.5 / (l / h))));
}
return tmp;
}
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_1 <= 5.3d+98) then
tmp = (1.0d0 - (0.125d0 * (((d_1 * (h * (m * (m / d)))) / (d / d_1)) / l))) * (sqrt((d / h)) * sqrt((d / l)))
else
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 - (((m * (d_1 / (d * 2.0d0))) ** 2.0d0) * (0.5d0 / (l / h))))
end if
code = tmp
end function
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.3e+98) {
tmp = (1.0 - (0.125 * (((D * (h * (M * (M / d)))) / (d / D)) / l))) * (Math.sqrt((d / h)) * Math.sqrt((d / l)));
} else {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 - (Math.pow((M * (D / (d * 2.0))), 2.0) * (0.5 / (l / h))));
}
return tmp;
}
D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if D <= 5.3e+98: tmp = (1.0 - (0.125 * (((D * (h * (M * (M / d)))) / (d / D)) / l))) * (math.sqrt((d / h)) * math.sqrt((d / l))) else: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 - (math.pow((M * (D / (d * 2.0))), 2.0) * (0.5 / (l / h)))) return tmp
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (D <= 5.3e+98) tmp = Float64(Float64(1.0 - Float64(0.125 * Float64(Float64(Float64(D * Float64(h * Float64(M * Float64(M / d)))) / Float64(d / D)) / l))) * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))); else tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 - Float64((Float64(M * Float64(D / Float64(d * 2.0))) ^ 2.0) * Float64(0.5 / Float64(l / h))))); end return tmp end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (D <= 5.3e+98)
tmp = (1.0 - (0.125 * (((D * (h * (M * (M / d)))) / (d / D)) / l))) * (sqrt((d / h)) * sqrt((d / l)));
else
tmp = sqrt(((d / h) * (d / l))) * (1.0 - (((M * (D / (d * 2.0))) ^ 2.0) * (0.5 / (l / h))));
end
tmp_2 = tmp;
end
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.3e+98], N[(N[(1.0 - N[(0.125 * N[(N[(N[(D * N[(h * N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[Power[N[(M * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;D \leq 5.3 \cdot 10^{+98}:\\
\;\;\;\;\left(1 - 0.125 \cdot \frac{\frac{D \cdot \left(h \cdot \left(M \cdot \frac{M}{d}\right)\right)}{\frac{d}{D}}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2} \cdot \frac{0.5}{\frac{\ell}{h}}\right)\\
\end{array}
\end{array}
if D < 5.29999999999999997e98Initial program 65.2%
metadata-eval65.2%
unpow1/265.2%
metadata-eval65.2%
unpow1/265.2%
*-commutative65.2%
associate-*l*65.2%
times-frac65.2%
metadata-eval65.2%
Simplified65.2%
associate-*r*65.2%
frac-times65.2%
*-commutative65.2%
metadata-eval65.2%
expm1-log1p-u64.8%
expm1-udef64.8%
Applied egg-rr64.8%
Taylor expanded in M around 0 45.6%
unpow245.6%
*-commutative45.6%
times-frac45.7%
unpow245.7%
associate-*r*48.3%
times-frac47.8%
*-commutative47.8%
times-frac46.0%
associate-*l/47.9%
associate-*r/49.2%
times-frac56.6%
unpow256.6%
associate-/l*57.9%
associate-*r*55.8%
associate-*l/56.7%
*-commutative56.7%
associate-/l*57.8%
associate-/r/57.8%
Simplified57.8%
associate-*l/58.5%
*-commutative58.5%
Applied egg-rr58.5%
if 5.29999999999999997e98 < D Initial program 73.8%
associate-*l*73.8%
metadata-eval73.8%
unpow1/273.8%
metadata-eval73.8%
unpow1/273.8%
associate-*l*73.8%
metadata-eval73.8%
times-frac71.4%
Simplified71.4%
Applied egg-rr20.3%
expm1-def22.8%
expm1-log1p66.5%
associate-/l*66.4%
*-commutative66.4%
Simplified66.4%
Final simplification59.6%
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.25e-112)
(*
(sqrt (* (/ d h) (/ d l)))
(- 1.0 (* (pow (* M (/ D (* d 2.0))) 2.0) (/ 0.5 (/ l h)))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 1.25e-112) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 - (pow((M * (D / (d * 2.0))), 2.0) * (0.5 / (l / h))));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
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.25d-112) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 - (((m * (d_1 / (d * 2.0d0))) ** 2.0d0) * (0.5d0 / (l / h))))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
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.25e-112) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 - (Math.pow((M * (D / (d * 2.0))), 2.0) * (0.5 / (l / h))));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 1.25e-112: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 - (math.pow((M * (D / (d * 2.0))), 2.0) * (0.5 / (l / h)))) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 1.25e-112) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 - Float64((Float64(M * Float64(D / Float64(d * 2.0))) ^ 2.0) * Float64(0.5 / Float64(l / h))))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 1.25e-112)
tmp = sqrt(((d / h) * (d / l))) * (1.0 - (((M * (D / (d * 2.0))) ^ 2.0) * (0.5 / (l / h))));
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
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.25e-112], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[Power[N[(M * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.25 \cdot 10^{-112}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2} \cdot \frac{0.5}{\frac{\ell}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < 1.25000000000000011e-112Initial program 70.2%
associate-*l*69.7%
metadata-eval69.7%
unpow1/269.7%
metadata-eval69.7%
unpow1/269.7%
associate-*l*69.7%
metadata-eval69.7%
times-frac69.7%
Simplified69.7%
Applied egg-rr23.3%
expm1-def29.0%
expm1-log1p60.9%
associate-/l*60.9%
*-commutative60.9%
Simplified60.9%
if 1.25000000000000011e-112 < l Initial program 59.4%
associate-*l*59.4%
metadata-eval59.4%
unpow1/259.4%
metadata-eval59.4%
unpow1/259.4%
associate-*l*59.4%
metadata-eval59.4%
times-frac58.4%
Simplified58.4%
Taylor expanded in d around inf 60.2%
*-commutative60.2%
*-commutative60.2%
associate-/r*60.5%
Simplified60.5%
sqrt-div65.5%
Applied egg-rr65.5%
Final simplification62.5%
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.18e-265)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= l 1.4e-307)
(/ d (cbrt (pow (* h l) 1.5)))
(if (<= l 1.3e-122)
(* -0.125 (* (sqrt (* h (pow l -3.0))) (/ (* (* M D) (* M D)) d)))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))))D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1.18e-265) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (l <= 1.4e-307) {
tmp = d / cbrt(pow((h * l), 1.5));
} else if (l <= 1.3e-122) {
tmp = -0.125 * (sqrt((h * pow(l, -3.0))) * (((M * D) * (M * D)) / d));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
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.18e-265) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (l <= 1.4e-307) {
tmp = d / Math.cbrt(Math.pow((h * l), 1.5));
} else if (l <= 1.3e-122) {
tmp = -0.125 * (Math.sqrt((h * Math.pow(l, -3.0))) * (((M * D) * (M * D)) / d));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -1.18e-265) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (l <= 1.4e-307) tmp = Float64(d / cbrt((Float64(h * l) ^ 1.5))); elseif (l <= 1.3e-122) tmp = Float64(-0.125 * Float64(sqrt(Float64(h * (l ^ -3.0))) * Float64(Float64(Float64(M * D) * Float64(M * D)) / d))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
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.18e-265], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.4e-307], N[(d / N[Power[N[Power[N[(h * l), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.3e-122], N[(-0.125 * N[(N[Sqrt[N[(h * N[Power[l, -3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.18 \cdot 10^{-265}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq 1.4 \cdot 10^{-307}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\
\mathbf{elif}\;\ell \leq 1.3 \cdot 10^{-122}:\\
\;\;\;\;-0.125 \cdot \left(\sqrt{h \cdot {\ell}^{-3}} \cdot \frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{d}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.18000000000000005e-265Initial program 67.6%
associate-*l*67.6%
metadata-eval67.6%
unpow1/267.6%
metadata-eval67.6%
unpow1/267.6%
sub-neg67.6%
+-commutative67.6%
*-commutative67.6%
associate-*l*67.6%
distribute-rgt-neg-in67.6%
*-commutative67.6%
Simplified68.6%
Taylor expanded in M around 0 47.6%
if -1.18000000000000005e-265 < l < 1.4e-307Initial program 63.6%
associate-*l*63.6%
metadata-eval63.6%
unpow1/263.6%
metadata-eval63.6%
unpow1/263.6%
associate-*l*63.6%
metadata-eval63.6%
times-frac63.6%
Simplified63.6%
Taylor expanded in d around inf 38.3%
pow138.3%
*-commutative38.3%
sqrt-div38.1%
metadata-eval38.1%
*-commutative38.1%
Applied egg-rr38.1%
unpow138.1%
associate-*r/38.3%
*-rgt-identity38.3%
Simplified38.3%
add-cbrt-cube55.8%
pow1/355.1%
add-sqr-sqrt55.1%
pow155.1%
pow1/255.1%
pow-prod-up55.1%
metadata-eval55.1%
Applied egg-rr55.1%
unpow1/355.9%
Simplified55.9%
if 1.4e-307 < l < 1.29999999999999988e-122Initial program 79.0%
associate-*l*76.9%
metadata-eval76.9%
unpow1/276.9%
metadata-eval76.9%
unpow1/276.9%
associate-*l*76.9%
metadata-eval76.9%
times-frac74.5%
Simplified74.5%
Taylor expanded in d around 0 50.5%
unpow250.5%
unpow250.5%
unswap-sqr62.9%
Simplified62.9%
expm1-log1p-u62.9%
expm1-udef62.9%
div-inv62.9%
pow-flip62.9%
metadata-eval62.9%
Applied egg-rr62.9%
expm1-def62.9%
expm1-log1p62.9%
Simplified62.9%
if 1.29999999999999988e-122 < l Initial program 59.4%
associate-*l*59.4%
metadata-eval59.4%
unpow1/259.4%
metadata-eval59.4%
unpow1/259.4%
associate-*l*59.4%
metadata-eval59.4%
times-frac58.4%
Simplified58.4%
Taylor expanded in d around inf 60.2%
*-commutative60.2%
*-commutative60.2%
associate-/r*60.5%
Simplified60.5%
sqrt-div65.5%
Applied egg-rr65.5%
Final simplification56.6%
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 -6.2e-268)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= l 1.4e-307)
(/ d (cbrt (pow (* h l) 1.5)))
(if (<= l 8e-103)
(* -0.125 (* (/ (* (* M D) (* M D)) d) (/ (sqrt h) (pow l 1.5))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))))D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -6.2e-268) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (l <= 1.4e-307) {
tmp = d / cbrt(pow((h * l), 1.5));
} else if (l <= 8e-103) {
tmp = -0.125 * ((((M * D) * (M * D)) / d) * (sqrt(h) / pow(l, 1.5)));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
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 <= -6.2e-268) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (l <= 1.4e-307) {
tmp = d / Math.cbrt(Math.pow((h * l), 1.5));
} else if (l <= 8e-103) {
tmp = -0.125 * ((((M * D) * (M * D)) / d) * (Math.sqrt(h) / Math.pow(l, 1.5)));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -6.2e-268) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (l <= 1.4e-307) tmp = Float64(d / cbrt((Float64(h * l) ^ 1.5))); elseif (l <= 8e-103) tmp = Float64(-0.125 * Float64(Float64(Float64(Float64(M * D) * Float64(M * D)) / d) * Float64(sqrt(h) / (l ^ 1.5)))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
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, -6.2e-268], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.4e-307], N[(d / N[Power[N[Power[N[(h * l), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8e-103], N[(-0.125 * N[(N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.2 \cdot 10^{-268}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq 1.4 \cdot 10^{-307}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\
\mathbf{elif}\;\ell \leq 8 \cdot 10^{-103}:\\
\;\;\;\;-0.125 \cdot \left(\frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{d} \cdot \frac{\sqrt{h}}{{\ell}^{1.5}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -6.1999999999999996e-268Initial program 67.6%
associate-*l*67.6%
metadata-eval67.6%
unpow1/267.6%
metadata-eval67.6%
unpow1/267.6%
sub-neg67.6%
+-commutative67.6%
*-commutative67.6%
associate-*l*67.6%
distribute-rgt-neg-in67.6%
*-commutative67.6%
Simplified68.6%
Taylor expanded in M around 0 47.6%
if -6.1999999999999996e-268 < l < 1.4e-307Initial program 63.6%
associate-*l*63.6%
metadata-eval63.6%
unpow1/263.6%
metadata-eval63.6%
unpow1/263.6%
associate-*l*63.6%
metadata-eval63.6%
times-frac63.6%
Simplified63.6%
Taylor expanded in d around inf 38.3%
pow138.3%
*-commutative38.3%
sqrt-div38.1%
metadata-eval38.1%
*-commutative38.1%
Applied egg-rr38.1%
unpow138.1%
associate-*r/38.3%
*-rgt-identity38.3%
Simplified38.3%
add-cbrt-cube55.8%
pow1/355.1%
add-sqr-sqrt55.1%
pow155.1%
pow1/255.1%
pow-prod-up55.1%
metadata-eval55.1%
Applied egg-rr55.1%
unpow1/355.9%
Simplified55.9%
if 1.4e-307 < l < 7.99999999999999966e-103Initial program 77.1%
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.8%
Simplified72.8%
Taylor expanded in d around 0 49.3%
unpow249.3%
unpow249.3%
unswap-sqr61.4%
Simplified61.4%
sqrt-div61.4%
Applied egg-rr61.4%
sqr-pow61.4%
rem-sqrt-square67.8%
sqr-pow67.9%
fabs-sqr67.9%
sqr-pow67.8%
metadata-eval67.8%
Simplified67.8%
if 7.99999999999999966e-103 < l Initial program 60.1%
associate-*l*60.1%
metadata-eval60.1%
unpow1/260.1%
metadata-eval60.1%
unpow1/260.1%
associate-*l*60.1%
metadata-eval60.1%
times-frac59.1%
Simplified59.1%
Taylor expanded in d around inf 60.9%
*-commutative60.9%
*-commutative60.9%
associate-/r*61.2%
Simplified61.2%
sqrt-div66.3%
Applied egg-rr66.3%
Final simplification57.7%
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 -1.5e-80)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= d -2e-310)
(/ d (cbrt (pow (* h l) 1.5)))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -1.5e-80) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (d <= -2e-310) {
tmp = d / cbrt(pow((h * l), 1.5));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
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 <= -1.5e-80) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (d <= -2e-310) {
tmp = d / Math.cbrt(Math.pow((h * l), 1.5));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -1.5e-80) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (d <= -2e-310) tmp = Float64(d / cbrt((Float64(h * l) ^ 1.5))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
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, -1.5e-80], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2e-310], N[(d / N[Power[N[Power[N[(h * l), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.5 \cdot 10^{-80}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.50000000000000004e-80Initial program 75.9%
associate-*l*75.9%
metadata-eval75.9%
unpow1/275.9%
metadata-eval75.9%
unpow1/275.9%
sub-neg75.9%
+-commutative75.9%
*-commutative75.9%
associate-*l*75.9%
distribute-rgt-neg-in75.9%
*-commutative75.9%
Simplified77.0%
Taylor expanded in M around 0 58.7%
if -1.50000000000000004e-80 < d < -1.999999999999994e-310Initial program 48.0%
associate-*l*48.0%
metadata-eval48.0%
unpow1/248.0%
metadata-eval48.0%
unpow1/248.0%
associate-*l*48.0%
metadata-eval48.0%
times-frac48.0%
Simplified48.0%
Taylor expanded in d around inf 21.8%
pow121.8%
*-commutative21.8%
sqrt-div21.8%
metadata-eval21.8%
*-commutative21.8%
Applied egg-rr21.8%
unpow121.8%
associate-*r/21.8%
*-rgt-identity21.8%
Simplified21.8%
add-cbrt-cube30.0%
pow1/330.0%
add-sqr-sqrt30.0%
pow130.0%
pow1/230.0%
pow-prod-up30.0%
metadata-eval30.0%
Applied egg-rr30.0%
unpow1/330.0%
Simplified30.0%
if -1.999999999999994e-310 < d Initial program 65.2%
associate-*l*64.6%
metadata-eval64.6%
unpow1/264.6%
metadata-eval64.6%
unpow1/264.6%
associate-*l*64.6%
metadata-eval64.6%
times-frac63.1%
Simplified63.1%
Taylor expanded in d around inf 45.3%
*-commutative45.3%
*-commutative45.3%
associate-/r*45.5%
Simplified45.5%
sqrt-div51.8%
Applied egg-rr51.8%
Final simplification51.1%
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.4e-307) (/ d (cbrt (pow (* h l) 1.5))) (* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 1.4e-307) {
tmp = d / cbrt(pow((h * l), 1.5));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
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.4e-307) {
tmp = d / Math.cbrt(Math.pow((h * l), 1.5));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 1.4e-307) tmp = Float64(d / cbrt((Float64(h * l) ^ 1.5))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
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.4e-307], N[(d / N[Power[N[Power[N[(h * l), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.4 \cdot 10^{-307}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < 1.4e-307Initial program 67.3%
associate-*l*67.3%
metadata-eval67.3%
unpow1/267.3%
metadata-eval67.3%
unpow1/267.3%
associate-*l*67.3%
metadata-eval67.3%
times-frac68.1%
Simplified68.1%
Taylor expanded in d around inf 10.9%
pow110.9%
*-commutative10.9%
sqrt-div10.9%
metadata-eval10.9%
*-commutative10.9%
Applied egg-rr10.9%
unpow110.9%
associate-*r/10.9%
*-rgt-identity10.9%
Simplified10.9%
add-cbrt-cube14.0%
pow1/313.9%
add-sqr-sqrt13.9%
pow113.9%
pow1/213.9%
pow-prod-up13.9%
metadata-eval13.9%
Applied egg-rr13.9%
unpow1/314.0%
Simplified14.0%
if 1.4e-307 < l Initial program 65.7%
associate-*l*65.1%
metadata-eval65.1%
unpow1/265.1%
metadata-eval65.1%
unpow1/265.1%
associate-*l*65.1%
metadata-eval65.1%
times-frac63.6%
Simplified63.6%
Taylor expanded in d around inf 44.9%
*-commutative44.9%
*-commutative44.9%
associate-/r*45.0%
Simplified45.0%
sqrt-div51.4%
Applied egg-rr51.4%
Final simplification33.0%
NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= h -5e-310) (/ d (cbrt (pow (* h l) 1.5))) (/ d (* (sqrt h) (sqrt l)))))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -5e-310) {
tmp = d / cbrt(pow((h * l), 1.5));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -5e-310) {
tmp = d / Math.cbrt(Math.pow((h * l), 1.5));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= -5e-310) tmp = Float64(d / cbrt((Float64(h * l) ^ 1.5))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, -5e-310], N[(d / N[Power[N[Power[N[(h * l), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 67.8%
associate-*l*67.8%
metadata-eval67.8%
unpow1/267.8%
metadata-eval67.8%
unpow1/267.8%
associate-*l*67.8%
metadata-eval67.8%
times-frac68.7%
Simplified68.7%
Taylor expanded in d around inf 10.2%
pow110.2%
*-commutative10.2%
sqrt-div10.2%
metadata-eval10.2%
*-commutative10.2%
Applied egg-rr10.2%
unpow110.2%
associate-*r/10.2%
*-rgt-identity10.2%
Simplified10.2%
add-cbrt-cube13.3%
pow1/313.3%
add-sqr-sqrt13.3%
pow113.3%
pow1/213.3%
pow-prod-up13.3%
metadata-eval13.3%
Applied egg-rr13.3%
unpow1/313.3%
Simplified13.3%
if -4.999999999999985e-310 < h Initial program 65.2%
associate-*l*64.6%
metadata-eval64.6%
unpow1/264.6%
metadata-eval64.6%
unpow1/264.6%
associate-*l*64.6%
metadata-eval64.6%
times-frac63.1%
Simplified63.1%
Taylor expanded in d around inf 45.3%
pow145.3%
*-commutative45.3%
sqrt-div45.9%
metadata-eval45.9%
*-commutative45.9%
Applied egg-rr45.9%
unpow145.9%
associate-*r/46.1%
*-rgt-identity46.1%
Simplified46.1%
*-commutative46.1%
sqrt-prod51.8%
Applied egg-rr51.8%
Final simplification33.0%
NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= h -5e-310) (/ d (sqrt (* h l))) (/ d (* (sqrt h) (sqrt l)))))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -5e-310) {
tmp = d / sqrt((h * l));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (h <= (-5d-310)) then
tmp = d / sqrt((h * l))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -5e-310) {
tmp = d / Math.sqrt((h * l));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if h <= -5e-310: tmp = d / math.sqrt((h * l)) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= -5e-310) tmp = Float64(d / sqrt(Float64(h * l))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (h <= -5e-310)
tmp = d / sqrt((h * l));
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, -5e-310], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 67.8%
associate-*l*67.8%
metadata-eval67.8%
unpow1/267.8%
metadata-eval67.8%
unpow1/267.8%
associate-*l*67.8%
metadata-eval67.8%
times-frac68.7%
Simplified68.7%
Taylor expanded in d around inf 10.2%
pow110.2%
*-commutative10.2%
sqrt-div10.2%
metadata-eval10.2%
*-commutative10.2%
Applied egg-rr10.2%
unpow110.2%
associate-*r/10.2%
*-rgt-identity10.2%
Simplified10.2%
if -4.999999999999985e-310 < h Initial program 65.2%
associate-*l*64.6%
metadata-eval64.6%
unpow1/264.6%
metadata-eval64.6%
unpow1/264.6%
associate-*l*64.6%
metadata-eval64.6%
times-frac63.1%
Simplified63.1%
Taylor expanded in d around inf 45.3%
pow145.3%
*-commutative45.3%
sqrt-div45.9%
metadata-eval45.9%
*-commutative45.9%
Applied egg-rr45.9%
unpow145.9%
associate-*r/46.1%
*-rgt-identity46.1%
Simplified46.1%
*-commutative46.1%
sqrt-prod51.8%
Applied egg-rr51.8%
Final simplification31.5%
NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (/ d (sqrt (* h l))))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d / sqrt((h * l));
}
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = d / sqrt((h * l))
end function
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d / Math.sqrt((h * l));
}
D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d / math.sqrt((h * l))
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d / sqrt(Float64(h * l))) end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d / sqrt((h * l));
end
NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Initial program 66.5%
associate-*l*66.2%
metadata-eval66.2%
unpow1/266.2%
metadata-eval66.2%
unpow1/266.2%
associate-*l*66.2%
metadata-eval66.2%
times-frac65.8%
Simplified65.8%
Taylor expanded in d around inf 28.2%
pow128.2%
*-commutative28.2%
sqrt-div28.5%
metadata-eval28.5%
*-commutative28.5%
Applied egg-rr28.5%
unpow128.5%
associate-*r/28.6%
*-rgt-identity28.6%
Simplified28.6%
Final simplification28.6%
herbie shell --seed 2023192
(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)))))