
(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 14 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 (* -0.5 (* (/ h l) (pow (* D (/ M (* d 2.0))) 2.0)))))
(if (<= h -1.15e+56)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(- 1.0 (* 0.5 (* (* (* (/ D d) (/ D d)) (/ (* h M) (/ l M))) 0.25)))))
(if (<= h -2e-310)
(* (* d (pow (* h l) -0.5)) (- -1.0 t_0))
(* (+ 1.0 t_0) (* d (* (pow h -0.5) (pow l -0.5))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = -0.5 * ((h / l) * pow((D * (M / (d * 2.0))), 2.0));
double tmp;
if (h <= -1.15e+56) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((((D / d) * (D / d)) * ((h * M) / (l / M))) * 0.25))));
} else if (h <= -2e-310) {
tmp = (d * pow((h * l), -0.5)) * (-1.0 - t_0);
} else {
tmp = (1.0 + t_0) * (d * (pow(h, -0.5) * pow(l, -0.5)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = (-0.5d0) * ((h / l) * ((d_1 * (m / (d * 2.0d0))) ** 2.0d0))
if (h <= (-1.15d+56)) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * ((((d_1 / d) * (d_1 / d)) * ((h * m) / (l / m))) * 0.25d0))))
else if (h <= (-2d-310)) then
tmp = (d * ((h * l) ** (-0.5d0))) * ((-1.0d0) - t_0)
else
tmp = (1.0d0 + t_0) * (d * ((h ** (-0.5d0)) * (l ** (-0.5d0))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = -0.5 * ((h / l) * Math.pow((D * (M / (d * 2.0))), 2.0));
double tmp;
if (h <= -1.15e+56) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * ((((D / d) * (D / d)) * ((h * M) / (l / M))) * 0.25))));
} else if (h <= -2e-310) {
tmp = (d * Math.pow((h * l), -0.5)) * (-1.0 - t_0);
} else {
tmp = (1.0 + t_0) * (d * (Math.pow(h, -0.5) * Math.pow(l, -0.5)));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = -0.5 * ((h / l) * math.pow((D * (M / (d * 2.0))), 2.0)) tmp = 0 if h <= -1.15e+56: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * ((((D / d) * (D / d)) * ((h * M) / (l / M))) * 0.25)))) elif h <= -2e-310: tmp = (d * math.pow((h * l), -0.5)) * (-1.0 - t_0) else: tmp = (1.0 + t_0) * (d * (math.pow(h, -0.5) * math.pow(l, -0.5))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(-0.5 * Float64(Float64(h / l) * (Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0))) tmp = 0.0 if (h <= -1.15e+56) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(h * M) / Float64(l / M))) * 0.25))))); elseif (h <= -2e-310) tmp = Float64(Float64(d * (Float64(h * l) ^ -0.5)) * Float64(-1.0 - t_0)); else tmp = Float64(Float64(1.0 + t_0) * Float64(d * Float64((h ^ -0.5) * (l ^ -0.5)))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = -0.5 * ((h / l) * ((D * (M / (d * 2.0))) ^ 2.0));
tmp = 0.0;
if (h <= -1.15e+56)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((((D / d) * (D / d)) * ((h * M) / (l / M))) * 0.25))));
elseif (h <= -2e-310)
tmp = (d * ((h * l) ^ -0.5)) * (-1.0 - t_0);
else
tmp = (1.0 + t_0) * (d * ((h ^ -0.5) * (l ^ -0.5)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1.15e+56], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(h * M), $MachinePrecision] / N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], N[(N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + t$95$0), $MachinePrecision] * N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)\\
\mathbf{if}\;h \leq -1.15 \cdot 10^{+56}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{h \cdot M}{\frac{\ell}{M}}\right) \cdot 0.25\right)\right)\right)\\
\mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right) \cdot \left(-1 - t_0\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + t_0\right) \cdot \left(d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\right)\\
\end{array}
\end{array}
if h < -1.15000000000000007e56Initial program 51.8%
associate-*l*51.8%
metadata-eval51.8%
unpow1/251.8%
metadata-eval51.8%
unpow1/251.8%
associate-*l*51.8%
metadata-eval51.8%
times-frac53.8%
Simplified53.8%
Taylor expanded in M around 0 36.8%
*-commutative36.8%
*-commutative36.8%
times-frac41.0%
unpow241.0%
unpow241.0%
times-frac47.9%
*-commutative47.9%
unpow247.9%
associate-*r*49.6%
associate-/l*57.9%
Simplified57.9%
if -1.15000000000000007e56 < h < -1.999999999999994e-310Initial program 69.4%
expm1-log1p-u43.3%
expm1-udef34.7%
Applied egg-rr28.3%
expm1-def35.6%
expm1-log1p57.2%
sub-neg57.2%
unpow1/257.2%
*-commutative57.2%
distribute-lft-neg-in57.2%
metadata-eval57.2%
associate-/l/57.2%
Simplified57.2%
Taylor expanded in d around -inf 80.4%
mul-1-neg80.4%
distribute-rgt-neg-in80.4%
*-commutative80.4%
unpow-180.4%
sqr-pow80.5%
rem-sqrt-square80.5%
metadata-eval80.5%
sqr-pow80.2%
fabs-sqr80.2%
sqr-pow80.5%
Simplified80.5%
if -1.999999999999994e-310 < h Initial program 60.9%
expm1-log1p-u39.2%
expm1-udef28.1%
Applied egg-rr21.5%
expm1-def29.5%
expm1-log1p48.9%
sub-neg48.9%
unpow1/248.9%
*-commutative48.9%
distribute-lft-neg-in48.9%
metadata-eval48.9%
associate-/l/48.9%
Simplified48.9%
Taylor expanded in d around 0 69.3%
*-commutative69.3%
*-commutative69.3%
unpow-169.3%
sqr-pow69.3%
rem-sqrt-square70.1%
metadata-eval70.1%
sqr-pow70.0%
fabs-sqr70.0%
sqr-pow70.1%
Simplified70.1%
unpow-prod-down80.4%
Applied egg-rr80.4%
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 (* d (pow (* h l) -0.5))) (t_1 (pow (* D (/ M (* d 2.0))) 2.0)))
(if (<= h -1.22e+57)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(- 1.0 (* 0.5 (* (* (* (/ D d) (/ D d)) (/ (* h M) (/ l M))) 0.25)))))
(if (<= h -2e-310)
(* t_0 (- -1.0 (* -0.5 (* (/ h l) t_1))))
(* t_0 (+ 1.0 (* -0.5 (/ (* h t_1) l))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = d * pow((h * l), -0.5);
double t_1 = pow((D * (M / (d * 2.0))), 2.0);
double tmp;
if (h <= -1.22e+57) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((((D / d) * (D / d)) * ((h * M) / (l / M))) * 0.25))));
} else if (h <= -2e-310) {
tmp = t_0 * (-1.0 - (-0.5 * ((h / l) * t_1)));
} else {
tmp = t_0 * (1.0 + (-0.5 * ((h * t_1) / l)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d * ((h * l) ** (-0.5d0))
t_1 = (d_1 * (m / (d * 2.0d0))) ** 2.0d0
if (h <= (-1.22d+57)) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * ((((d_1 / d) * (d_1 / d)) * ((h * m) / (l / m))) * 0.25d0))))
else if (h <= (-2d-310)) then
tmp = t_0 * ((-1.0d0) - ((-0.5d0) * ((h / l) * t_1)))
else
tmp = t_0 * (1.0d0 + ((-0.5d0) * ((h * t_1) / l)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = d * Math.pow((h * l), -0.5);
double t_1 = Math.pow((D * (M / (d * 2.0))), 2.0);
double tmp;
if (h <= -1.22e+57) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * ((((D / d) * (D / d)) * ((h * M) / (l / M))) * 0.25))));
} else if (h <= -2e-310) {
tmp = t_0 * (-1.0 - (-0.5 * ((h / l) * t_1)));
} else {
tmp = t_0 * (1.0 + (-0.5 * ((h * t_1) / l)));
}
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((h * l), -0.5) t_1 = math.pow((D * (M / (d * 2.0))), 2.0) tmp = 0 if h <= -1.22e+57: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * ((((D / d) * (D / d)) * ((h * M) / (l / M))) * 0.25)))) elif h <= -2e-310: tmp = t_0 * (-1.0 - (-0.5 * ((h / l) * t_1))) else: tmp = t_0 * (1.0 + (-0.5 * ((h * t_1) / l))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(d * (Float64(h * l) ^ -0.5)) t_1 = Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0 tmp = 0.0 if (h <= -1.22e+57) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(h * M) / Float64(l / M))) * 0.25))))); elseif (h <= -2e-310) tmp = Float64(t_0 * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * t_1)))); else tmp = Float64(t_0 * Float64(1.0 + Float64(-0.5 * Float64(Float64(h * t_1) / l)))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = d * ((h * l) ^ -0.5);
t_1 = (D * (M / (d * 2.0))) ^ 2.0;
tmp = 0.0;
if (h <= -1.22e+57)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((((D / d) * (D / d)) * ((h * M) / (l / M))) * 0.25))));
elseif (h <= -2e-310)
tmp = t_0 * (-1.0 - (-0.5 * ((h / l) * t_1)));
else
tmp = t_0 * (1.0 + (-0.5 * ((h * t_1) / l)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[h, -1.22e+57], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(h * M), $MachinePrecision] / N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], N[(t$95$0 * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(1.0 + N[(-0.5 * N[(N[(h * t$95$1), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
t_1 := {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\\
\mathbf{if}\;h \leq -1.22 \cdot 10^{+57}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{h \cdot M}{\frac{\ell}{M}}\right) \cdot 0.25\right)\right)\right)\\
\mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_0 \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot t_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(1 + -0.5 \cdot \frac{h \cdot t_1}{\ell}\right)\\
\end{array}
\end{array}
if h < -1.22e57Initial program 51.8%
associate-*l*51.8%
metadata-eval51.8%
unpow1/251.8%
metadata-eval51.8%
unpow1/251.8%
associate-*l*51.8%
metadata-eval51.8%
times-frac53.8%
Simplified53.8%
Taylor expanded in M around 0 36.8%
*-commutative36.8%
*-commutative36.8%
times-frac41.0%
unpow241.0%
unpow241.0%
times-frac47.9%
*-commutative47.9%
unpow247.9%
associate-*r*49.6%
associate-/l*57.9%
Simplified57.9%
if -1.22e57 < h < -1.999999999999994e-310Initial program 69.4%
expm1-log1p-u43.3%
expm1-udef34.7%
Applied egg-rr28.3%
expm1-def35.6%
expm1-log1p57.2%
sub-neg57.2%
unpow1/257.2%
*-commutative57.2%
distribute-lft-neg-in57.2%
metadata-eval57.2%
associate-/l/57.2%
Simplified57.2%
Taylor expanded in d around -inf 80.4%
mul-1-neg80.4%
distribute-rgt-neg-in80.4%
*-commutative80.4%
unpow-180.4%
sqr-pow80.5%
rem-sqrt-square80.5%
metadata-eval80.5%
sqr-pow80.2%
fabs-sqr80.2%
sqr-pow80.5%
Simplified80.5%
if -1.999999999999994e-310 < h Initial program 60.9%
expm1-log1p-u39.2%
expm1-udef28.1%
Applied egg-rr21.5%
expm1-def29.5%
expm1-log1p48.9%
sub-neg48.9%
unpow1/248.9%
*-commutative48.9%
distribute-lft-neg-in48.9%
metadata-eval48.9%
associate-/l/48.9%
Simplified48.9%
Taylor expanded in d around 0 69.3%
*-commutative69.3%
*-commutative69.3%
unpow-169.3%
sqr-pow69.3%
rem-sqrt-square70.1%
metadata-eval70.1%
sqr-pow70.0%
fabs-sqr70.0%
sqr-pow70.1%
Simplified70.1%
associate-*l/73.2%
*-commutative73.2%
Applied egg-rr73.2%
Final simplification72.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 (* h l))))
(if (<= l -7.4e-273)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= l -5e-310)
(* d (sqrt (cbrt (* t_0 (* t_0 t_0)))))
(*
d
(*
(pow (* h l) -0.5)
(+ 1.0 (* -0.5 (* (/ h l) (pow (* (/ D d) (/ M 2.0)) 2.0))))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 / (h * l);
double tmp;
if (l <= -7.4e-273) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (l <= -5e-310) {
tmp = d * sqrt(cbrt((t_0 * (t_0 * t_0))));
} else {
tmp = d * (pow((h * l), -0.5) * (1.0 + (-0.5 * ((h / l) * pow(((D / d) * (M / 2.0)), 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 / (h * l);
double tmp;
if (l <= -7.4e-273) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (l <= -5e-310) {
tmp = d * Math.sqrt(Math.cbrt((t_0 * (t_0 * t_0))));
} else {
tmp = d * (Math.pow((h * l), -0.5) * (1.0 + (-0.5 * ((h / l) * Math.pow(((D / d) * (M / 2.0)), 2.0)))));
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(1.0 / Float64(h * l)) tmp = 0.0 if (l <= -7.4e-273) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (l <= -5e-310) tmp = Float64(d * sqrt(cbrt(Float64(t_0 * Float64(t_0 * t_0))))); else tmp = Float64(d * Float64((Float64(h * l) ^ -0.5) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M / 2.0)) ^ 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[(h * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -7.4e-273], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(d * N[Sqrt[N[Power[N[(t$95$0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \frac{1}{h \cdot \ell}\\
\mathbf{if}\;\ell \leq -7.4 \cdot 10^{-273}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\sqrt[3]{t_0 \cdot \left(t_0 \cdot t_0\right)}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\left(h \cdot \ell\right)}^{-0.5} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right)\right)\\
\end{array}
\end{array}
if l < -7.4000000000000007e-273Initial program 61.7%
associate-*l*61.7%
metadata-eval61.7%
unpow1/261.7%
metadata-eval61.7%
unpow1/261.7%
sub-neg61.7%
+-commutative61.7%
*-commutative61.7%
distribute-rgt-neg-in61.7%
fma-def61.7%
Simplified61.0%
Taylor expanded in h around 0 45.8%
if -7.4000000000000007e-273 < l < -4.999999999999985e-310Initial program 74.3%
Taylor expanded in d around inf 64.6%
add-cbrt-cube65.2%
*-commutative65.2%
*-commutative65.2%
*-commutative65.2%
Applied egg-rr65.2%
if -4.999999999999985e-310 < l Initial program 60.9%
expm1-log1p-u39.2%
expm1-udef28.1%
Applied egg-rr21.5%
expm1-def29.5%
expm1-log1p48.9%
sub-neg48.9%
unpow1/248.9%
*-commutative48.9%
distribute-lft-neg-in48.9%
metadata-eval48.9%
associate-/l/48.9%
Simplified48.9%
Taylor expanded in d around 0 69.3%
*-commutative69.3%
*-commutative69.3%
unpow-169.3%
sqr-pow69.3%
rem-sqrt-square70.1%
metadata-eval70.1%
sqr-pow70.0%
fabs-sqr70.0%
sqr-pow70.1%
Simplified70.1%
distribute-rgt-in60.7%
*-un-lft-identity60.7%
associate-*r/60.9%
*-commutative60.9%
times-frac60.9%
Applied egg-rr60.9%
*-commutative60.9%
associate-*l*66.3%
distribute-lft-out66.3%
*-rgt-identity66.3%
distribute-lft-in71.1%
Simplified71.1%
Final simplification59.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 (* h l))))
(if (<= l -2.1e-272)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= l -5e-310)
(* d (sqrt (cbrt (* t_0 (* t_0 t_0)))))
(*
(* d (pow (* h l) -0.5))
(+ 1.0 (* -0.5 (/ (* h (pow (* D (/ M (* d 2.0))) 2.0)) l))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 / (h * l);
double tmp;
if (l <= -2.1e-272) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (l <= -5e-310) {
tmp = d * sqrt(cbrt((t_0 * (t_0 * t_0))));
} else {
tmp = (d * pow((h * l), -0.5)) * (1.0 + (-0.5 * ((h * pow((D * (M / (d * 2.0))), 2.0)) / l)));
}
return tmp;
}
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 / (h * l);
double tmp;
if (l <= -2.1e-272) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (l <= -5e-310) {
tmp = d * Math.sqrt(Math.cbrt((t_0 * (t_0 * t_0))));
} else {
tmp = (d * Math.pow((h * l), -0.5)) * (1.0 + (-0.5 * ((h * Math.pow((D * (M / (d * 2.0))), 2.0)) / l)));
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(1.0 / Float64(h * l)) tmp = 0.0 if (l <= -2.1e-272) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (l <= -5e-310) tmp = Float64(d * sqrt(cbrt(Float64(t_0 * Float64(t_0 * t_0))))); else tmp = Float64(Float64(d * (Float64(h * l) ^ -0.5)) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h * (Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0)) / l)))); end return tmp end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.1e-272], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(d * N[Sqrt[N[Power[N[(t$95$0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h * N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \frac{1}{h \cdot \ell}\\
\mathbf{if}\;\ell \leq -2.1 \cdot 10^{-272}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\sqrt[3]{t_0 \cdot \left(t_0 \cdot t_0\right)}}\\
\mathbf{else}:\\
\;\;\;\;\left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right) \cdot \left(1 + -0.5 \cdot \frac{h \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}}{\ell}\right)\\
\end{array}
\end{array}
if l < -2.09999999999999987e-272Initial program 61.7%
associate-*l*61.7%
metadata-eval61.7%
unpow1/261.7%
metadata-eval61.7%
unpow1/261.7%
sub-neg61.7%
+-commutative61.7%
*-commutative61.7%
distribute-rgt-neg-in61.7%
fma-def61.7%
Simplified61.0%
Taylor expanded in h around 0 45.8%
if -2.09999999999999987e-272 < l < -4.999999999999985e-310Initial program 74.3%
Taylor expanded in d around inf 64.6%
add-cbrt-cube65.2%
*-commutative65.2%
*-commutative65.2%
*-commutative65.2%
Applied egg-rr65.2%
if -4.999999999999985e-310 < l Initial program 60.9%
expm1-log1p-u39.2%
expm1-udef28.1%
Applied egg-rr21.5%
expm1-def29.5%
expm1-log1p48.9%
sub-neg48.9%
unpow1/248.9%
*-commutative48.9%
distribute-lft-neg-in48.9%
metadata-eval48.9%
associate-/l/48.9%
Simplified48.9%
Taylor expanded in d around 0 69.3%
*-commutative69.3%
*-commutative69.3%
unpow-169.3%
sqr-pow69.3%
rem-sqrt-square70.1%
metadata-eval70.1%
sqr-pow70.0%
fabs-sqr70.0%
sqr-pow70.1%
Simplified70.1%
associate-*l/73.2%
*-commutative73.2%
Applied egg-rr73.2%
Final simplification60.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 (pow (* D (/ M (* d 2.0))) 2.0)))
(if (<= d 3.7e-264)
(* (+ 1.0 (* -0.5 (* (/ h l) t_0))) (sqrt (* (/ d h) (/ d l))))
(* (* d (pow (* h l) -0.5)) (+ 1.0 (* -0.5 (/ (* h t_0) l)))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((D * (M / (d * 2.0))), 2.0);
double tmp;
if (d <= 3.7e-264) {
tmp = (1.0 + (-0.5 * ((h / l) * t_0))) * sqrt(((d / h) * (d / l)));
} else {
tmp = (d * pow((h * l), -0.5)) * (1.0 + (-0.5 * ((h * t_0) / l)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = (d_1 * (m / (d * 2.0d0))) ** 2.0d0
if (d <= 3.7d-264) then
tmp = (1.0d0 + ((-0.5d0) * ((h / l) * t_0))) * sqrt(((d / h) * (d / l)))
else
tmp = (d * ((h * l) ** (-0.5d0))) * (1.0d0 + ((-0.5d0) * ((h * t_0) / l)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow((D * (M / (d * 2.0))), 2.0);
double tmp;
if (d <= 3.7e-264) {
tmp = (1.0 + (-0.5 * ((h / l) * t_0))) * Math.sqrt(((d / h) * (d / l)));
} else {
tmp = (d * Math.pow((h * l), -0.5)) * (1.0 + (-0.5 * ((h * t_0) / l)));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.pow((D * (M / (d * 2.0))), 2.0) tmp = 0 if d <= 3.7e-264: tmp = (1.0 + (-0.5 * ((h / l) * t_0))) * math.sqrt(((d / h) * (d / l))) else: tmp = (d * math.pow((h * l), -0.5)) * (1.0 + (-0.5 * ((h * t_0) / l))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0 tmp = 0.0 if (d <= 3.7e-264) tmp = Float64(Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * t_0))) * sqrt(Float64(Float64(d / h) * Float64(d / l)))); else tmp = Float64(Float64(d * (Float64(h * l) ^ -0.5)) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h * t_0) / l)))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (D * (M / (d * 2.0))) ^ 2.0;
tmp = 0.0;
if (d <= 3.7e-264)
tmp = (1.0 + (-0.5 * ((h / l) * t_0))) * sqrt(((d / h) * (d / l)));
else
tmp = (d * ((h * l) ^ -0.5)) * (1.0 + (-0.5 * ((h * t_0) / l)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[d, 3.7e-264], N[(N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h * t$95$0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\\
\mathbf{if}\;d \leq 3.7 \cdot 10^{-264}:\\
\;\;\;\;\left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot t_0\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right) \cdot \left(1 + -0.5 \cdot \frac{h \cdot t_0}{\ell}\right)\\
\end{array}
\end{array}
if d < 3.69999999999999996e-264Initial program 61.6%
expm1-log1p-u39.0%
expm1-udef29.1%
Applied egg-rr24.0%
expm1-def31.0%
expm1-log1p49.3%
sub-neg49.3%
unpow1/249.3%
*-commutative49.3%
distribute-lft-neg-in49.3%
metadata-eval49.3%
associate-/l/49.3%
Simplified49.3%
if 3.69999999999999996e-264 < d Initial program 62.0%
expm1-log1p-u39.7%
expm1-udef28.9%
Applied egg-rr22.1%
expm1-def29.7%
expm1-log1p49.7%
sub-neg49.7%
unpow1/249.7%
*-commutative49.7%
distribute-lft-neg-in49.7%
metadata-eval49.7%
associate-/l/49.7%
Simplified49.7%
Taylor expanded in d around 0 71.5%
*-commutative71.5%
*-commutative71.5%
unpow-171.5%
sqr-pow71.5%
rem-sqrt-square72.3%
metadata-eval72.3%
sqr-pow72.2%
fabs-sqr72.2%
sqr-pow72.3%
Simplified72.3%
associate-*l/75.5%
*-commutative75.5%
Applied egg-rr75.5%
Final simplification62.3%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (+ 1.0 (* -0.5 (/ (* h (pow (* D (/ M (* d 2.0))) 2.0)) l)))))
(if (<= d 3.7e-264)
(* t_0 (sqrt (* (/ d h) (/ d l))))
(* (* d (pow (* h l) -0.5)) t_0))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 + (-0.5 * ((h * pow((D * (M / (d * 2.0))), 2.0)) / l));
double tmp;
if (d <= 3.7e-264) {
tmp = t_0 * sqrt(((d / h) * (d / l)));
} else {
tmp = (d * pow((h * l), -0.5)) * t_0;
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + ((-0.5d0) * ((h * ((d_1 * (m / (d * 2.0d0))) ** 2.0d0)) / l))
if (d <= 3.7d-264) then
tmp = t_0 * sqrt(((d / h) * (d / l)))
else
tmp = (d * ((h * l) ** (-0.5d0))) * t_0
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 + (-0.5 * ((h * Math.pow((D * (M / (d * 2.0))), 2.0)) / l));
double tmp;
if (d <= 3.7e-264) {
tmp = t_0 * Math.sqrt(((d / h) * (d / l)));
} else {
tmp = (d * Math.pow((h * l), -0.5)) * t_0;
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 1.0 + (-0.5 * ((h * math.pow((D * (M / (d * 2.0))), 2.0)) / l)) tmp = 0 if d <= 3.7e-264: tmp = t_0 * math.sqrt(((d / h) * (d / l))) else: tmp = (d * math.pow((h * l), -0.5)) * t_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(h * (Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0)) / l))) tmp = 0.0 if (d <= 3.7e-264) tmp = Float64(t_0 * sqrt(Float64(Float64(d / h) * Float64(d / l)))); else tmp = Float64(Float64(d * (Float64(h * l) ^ -0.5)) * t_0); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 1.0 + (-0.5 * ((h * ((D * (M / (d * 2.0))) ^ 2.0)) / l));
tmp = 0.0;
if (d <= 3.7e-264)
tmp = t_0 * sqrt(((d / h) * (d / l)));
else
tmp = (d * ((h * l) ^ -0.5)) * t_0;
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(1.0 + N[(-0.5 * N[(N[(h * N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, 3.7e-264], N[(t$95$0 * N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 1 + -0.5 \cdot \frac{h \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}}{\ell}\\
\mathbf{if}\;d \leq 3.7 \cdot 10^{-264}:\\
\;\;\;\;t_0 \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right) \cdot t_0\\
\end{array}
\end{array}
if d < 3.69999999999999996e-264Initial program 61.6%
expm1-log1p-u39.0%
expm1-udef29.1%
Applied egg-rr24.0%
expm1-def31.0%
expm1-log1p49.3%
sub-neg49.3%
unpow1/249.3%
*-commutative49.3%
distribute-lft-neg-in49.3%
metadata-eval49.3%
associate-/l/49.3%
Simplified49.3%
associate-*l/4.7%
*-commutative4.7%
Applied egg-rr51.2%
if 3.69999999999999996e-264 < d Initial program 62.0%
expm1-log1p-u39.7%
expm1-udef28.9%
Applied egg-rr22.1%
expm1-def29.7%
expm1-log1p49.7%
sub-neg49.7%
unpow1/249.7%
*-commutative49.7%
distribute-lft-neg-in49.7%
metadata-eval49.7%
associate-/l/49.7%
Simplified49.7%
Taylor expanded in d around 0 71.5%
*-commutative71.5%
*-commutative71.5%
unpow-171.5%
sqr-pow71.5%
rem-sqrt-square72.3%
metadata-eval72.3%
sqr-pow72.2%
fabs-sqr72.2%
sqr-pow72.3%
Simplified72.3%
associate-*l/75.5%
*-commutative75.5%
Applied egg-rr75.5%
Final simplification63.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 (pow (* D (/ M (* d 2.0))) 2.0)) (t_1 (* d (pow (* h l) -0.5))))
(if (<= h -2e-310)
(* t_1 (- -1.0 (* -0.5 (* (/ h l) t_0))))
(* t_1 (+ 1.0 (* -0.5 (/ (* h t_0) l)))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((D * (M / (d * 2.0))), 2.0);
double t_1 = d * pow((h * l), -0.5);
double tmp;
if (h <= -2e-310) {
tmp = t_1 * (-1.0 - (-0.5 * ((h / l) * t_0)));
} else {
tmp = t_1 * (1.0 + (-0.5 * ((h * t_0) / l)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (d_1 * (m / (d * 2.0d0))) ** 2.0d0
t_1 = d * ((h * l) ** (-0.5d0))
if (h <= (-2d-310)) then
tmp = t_1 * ((-1.0d0) - ((-0.5d0) * ((h / l) * t_0)))
else
tmp = t_1 * (1.0d0 + ((-0.5d0) * ((h * t_0) / l)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow((D * (M / (d * 2.0))), 2.0);
double t_1 = d * Math.pow((h * l), -0.5);
double tmp;
if (h <= -2e-310) {
tmp = t_1 * (-1.0 - (-0.5 * ((h / l) * t_0)));
} else {
tmp = t_1 * (1.0 + (-0.5 * ((h * t_0) / l)));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.pow((D * (M / (d * 2.0))), 2.0) t_1 = d * math.pow((h * l), -0.5) tmp = 0 if h <= -2e-310: tmp = t_1 * (-1.0 - (-0.5 * ((h / l) * t_0))) else: tmp = t_1 * (1.0 + (-0.5 * ((h * t_0) / l))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0 t_1 = Float64(d * (Float64(h * l) ^ -0.5)) tmp = 0.0 if (h <= -2e-310) tmp = Float64(t_1 * Float64(-1.0 - Float64(-0.5 * Float64(Float64(h / l) * t_0)))); else tmp = Float64(t_1 * Float64(1.0 + Float64(-0.5 * Float64(Float64(h * t_0) / l)))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (D * (M / (d * 2.0))) ^ 2.0;
t_1 = d * ((h * l) ^ -0.5);
tmp = 0.0;
if (h <= -2e-310)
tmp = t_1 * (-1.0 - (-0.5 * ((h / l) * t_0)));
else
tmp = t_1 * (1.0 + (-0.5 * ((h * t_0) / l)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -2e-310], N[(t$95$1 * N[(-1.0 - N[(-0.5 * N[(N[(h / l), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(1.0 + N[(-0.5 * N[(N[(h * t$95$0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\\
t_1 := d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_1 \cdot \left(-1 - -0.5 \cdot \left(\frac{h}{\ell} \cdot t_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(1 + -0.5 \cdot \frac{h \cdot t_0}{\ell}\right)\\
\end{array}
\end{array}
if h < -1.999999999999994e-310Initial program 62.8%
expm1-log1p-u39.4%
expm1-udef30.0%
Applied egg-rr24.7%
expm1-def31.2%
expm1-log1p50.1%
sub-neg50.1%
unpow1/250.1%
*-commutative50.1%
distribute-lft-neg-in50.1%
metadata-eval50.1%
associate-/l/50.1%
Simplified50.1%
Taylor expanded in d around -inf 68.3%
mul-1-neg68.3%
distribute-rgt-neg-in68.3%
*-commutative68.3%
unpow-168.3%
sqr-pow68.3%
rem-sqrt-square68.3%
metadata-eval68.3%
sqr-pow68.1%
fabs-sqr68.1%
sqr-pow68.3%
Simplified68.3%
if -1.999999999999994e-310 < h Initial program 60.9%
expm1-log1p-u39.2%
expm1-udef28.1%
Applied egg-rr21.5%
expm1-def29.5%
expm1-log1p48.9%
sub-neg48.9%
unpow1/248.9%
*-commutative48.9%
distribute-lft-neg-in48.9%
metadata-eval48.9%
associate-/l/48.9%
Simplified48.9%
Taylor expanded in d around 0 69.3%
*-commutative69.3%
*-commutative69.3%
unpow-169.3%
sqr-pow69.3%
rem-sqrt-square70.1%
metadata-eval70.1%
sqr-pow70.0%
fabs-sqr70.0%
sqr-pow70.1%
Simplified70.1%
associate-*l/73.2%
*-commutative73.2%
Applied egg-rr73.2%
Final simplification70.8%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ 1.0 (* h l))))
(if (<= l -2.9e-272)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= l -5e-310)
(* d (sqrt (cbrt (* t_0 (* t_0 t_0)))))
(/ d (* (sqrt h) (sqrt l)))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 / (h * l);
double tmp;
if (l <= -2.9e-272) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (l <= -5e-310) {
tmp = d * sqrt(cbrt((t_0 * (t_0 * t_0))));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 / (h * l);
double tmp;
if (l <= -2.9e-272) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (l <= -5e-310) {
tmp = d * Math.sqrt(Math.cbrt((t_0 * (t_0 * t_0))));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(1.0 / Float64(h * l)) tmp = 0.0 if (l <= -2.9e-272) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (l <= -5e-310) tmp = Float64(d * sqrt(cbrt(Float64(t_0 * Float64(t_0 * t_0))))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.9e-272], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(d * N[Sqrt[N[Power[N[(t$95$0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \frac{1}{h \cdot \ell}\\
\mathbf{if}\;\ell \leq -2.9 \cdot 10^{-272}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\sqrt[3]{t_0 \cdot \left(t_0 \cdot t_0\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.89999999999999995e-272Initial program 61.7%
associate-*l*61.7%
metadata-eval61.7%
unpow1/261.7%
metadata-eval61.7%
unpow1/261.7%
sub-neg61.7%
+-commutative61.7%
*-commutative61.7%
distribute-rgt-neg-in61.7%
fma-def61.7%
Simplified61.0%
Taylor expanded in h around 0 45.8%
if -2.89999999999999995e-272 < l < -4.999999999999985e-310Initial program 74.3%
Taylor expanded in d around inf 64.6%
add-cbrt-cube65.2%
*-commutative65.2%
*-commutative65.2%
*-commutative65.2%
Applied egg-rr65.2%
if -4.999999999999985e-310 < l Initial program 60.9%
Taylor expanded in d around inf 48.4%
expm1-log1p-u45.9%
expm1-udef36.6%
*-commutative36.6%
sqrt-div37.4%
metadata-eval37.4%
*-commutative37.4%
Applied egg-rr37.4%
expm1-def46.7%
expm1-log1p49.1%
associate-*r/49.3%
*-rgt-identity49.3%
Simplified49.3%
sqrt-prod55.5%
Applied egg-rr55.5%
Final simplification51.6%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (* (/ d h) (/ d l))))
(t_1
(*
t_0
(+ 1.0 (* (/ (* (* D D) (* h (* M M))) (* l (* d d))) -0.125)))))
(if (<= l -1.75e+79)
t_0
(if (<= l -1.55e-257)
t_1
(if (<= l -1.45e-295)
(/ d (sqrt (* h l)))
(if (<= l 1.25e-297) t_1 (/ d (* (sqrt h) (sqrt l)))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(((d / h) * (d / l)));
double t_1 = t_0 * (1.0 + ((((D * D) * (h * (M * M))) / (l * (d * d))) * -0.125));
double tmp;
if (l <= -1.75e+79) {
tmp = t_0;
} else if (l <= -1.55e-257) {
tmp = t_1;
} else if (l <= -1.45e-295) {
tmp = d / sqrt((h * l));
} else if (l <= 1.25e-297) {
tmp = t_1;
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt(((d / h) * (d / l)))
t_1 = t_0 * (1.0d0 + ((((d_1 * d_1) * (h * (m * m))) / (l * (d * d))) * (-0.125d0)))
if (l <= (-1.75d+79)) then
tmp = t_0
else if (l <= (-1.55d-257)) then
tmp = t_1
else if (l <= (-1.45d-295)) then
tmp = d / sqrt((h * l))
else if (l <= 1.25d-297) then
tmp = t_1
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt(((d / h) * (d / l)));
double t_1 = t_0 * (1.0 + ((((D * D) * (h * (M * M))) / (l * (d * d))) * -0.125));
double tmp;
if (l <= -1.75e+79) {
tmp = t_0;
} else if (l <= -1.55e-257) {
tmp = t_1;
} else if (l <= -1.45e-295) {
tmp = d / Math.sqrt((h * l));
} else if (l <= 1.25e-297) {
tmp = t_1;
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt(((d / h) * (d / l))) t_1 = t_0 * (1.0 + ((((D * D) * (h * (M * M))) / (l * (d * d))) * -0.125)) tmp = 0 if l <= -1.75e+79: tmp = t_0 elif l <= -1.55e-257: tmp = t_1 elif l <= -1.45e-295: tmp = d / math.sqrt((h * l)) elif l <= 1.25e-297: tmp = t_1 else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(Float64(d / h) * Float64(d / l))) t_1 = Float64(t_0 * Float64(1.0 + Float64(Float64(Float64(Float64(D * D) * Float64(h * Float64(M * M))) / Float64(l * Float64(d * d))) * -0.125))) tmp = 0.0 if (l <= -1.75e+79) tmp = t_0; elseif (l <= -1.55e-257) tmp = t_1; elseif (l <= -1.45e-295) tmp = Float64(d / sqrt(Float64(h * l))); elseif (l <= 1.25e-297) tmp = t_1; else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt(((d / h) * (d / l)));
t_1 = t_0 * (1.0 + ((((D * D) * (h * (M * M))) / (l * (d * d))) * -0.125));
tmp = 0.0;
if (l <= -1.75e+79)
tmp = t_0;
elseif (l <= -1.55e-257)
tmp = t_1;
elseif (l <= -1.45e-295)
tmp = d / sqrt((h * l));
elseif (l <= 1.25e-297)
tmp = t_1;
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(1.0 + N[(N[(N[(N[(D * D), $MachinePrecision] * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.75e+79], t$95$0, If[LessEqual[l, -1.55e-257], t$95$1, If[LessEqual[l, -1.45e-295], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.25e-297], t$95$1, N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
t_1 := t_0 \cdot \left(1 + \frac{\left(D \cdot D\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)}{\ell \cdot \left(d \cdot d\right)} \cdot -0.125\right)\\
\mathbf{if}\;\ell \leq -1.75 \cdot 10^{+79}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -1.55 \cdot 10^{-257}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -1.45 \cdot 10^{-295}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;\ell \leq 1.25 \cdot 10^{-297}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.7499999999999999e79Initial program 58.9%
expm1-log1p-u49.4%
expm1-udef34.6%
Applied egg-rr33.0%
expm1-def42.6%
expm1-log1p50.0%
unpow1/250.0%
*-commutative50.0%
sub-neg50.0%
*-commutative50.0%
distribute-rgt-neg-in50.0%
metadata-eval50.0%
associate-*r*50.0%
associate-*l/48.4%
*-commutative48.4%
associate-*r*48.4%
*-commutative48.4%
Simplified50.0%
Taylor expanded in D around 0 46.4%
if -1.7499999999999999e79 < l < -1.55000000000000004e-257 or -1.45000000000000008e-295 < l < 1.25e-297Initial program 63.7%
expm1-log1p-u33.8%
expm1-udef27.9%
Applied egg-rr18.9%
expm1-def23.4%
expm1-log1p47.8%
unpow1/247.8%
*-commutative47.8%
sub-neg47.8%
*-commutative47.8%
distribute-rgt-neg-in47.8%
metadata-eval47.8%
associate-*r*47.8%
associate-*l/51.4%
*-commutative51.4%
associate-*r*51.4%
*-commutative51.4%
Simplified47.8%
Taylor expanded in D around 0 40.7%
*-commutative40.7%
*-commutative40.7%
*-commutative40.7%
times-frac39.0%
*-commutative39.0%
times-frac40.7%
unpow240.7%
unpow240.7%
unpow240.7%
Simplified40.7%
if -1.55000000000000004e-257 < l < -1.45000000000000008e-295Initial program 77.8%
Taylor expanded in d around inf 67.1%
expm1-log1p-u0.5%
expm1-udef0.4%
*-commutative0.4%
sqrt-div0.4%
metadata-eval0.4%
*-commutative0.4%
Applied egg-rr0.4%
expm1-def0.5%
expm1-log1p67.1%
associate-*r/67.1%
*-rgt-identity67.1%
Simplified67.1%
if 1.25e-297 < l Initial program 61.0%
Taylor expanded in d around inf 49.1%
expm1-log1p-u46.6%
expm1-udef37.1%
*-commutative37.1%
sqrt-div37.5%
metadata-eval37.5%
*-commutative37.5%
Applied egg-rr37.5%
expm1-def46.9%
expm1-log1p49.4%
associate-*r/49.5%
*-rgt-identity49.5%
Simplified49.5%
sqrt-prod55.5%
Applied egg-rr55.5%
Final simplification50.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 -4.8e-273) (* (sqrt (/ d h)) (sqrt (/ d l))) (if (<= l -5e-310) (/ d (sqrt (* h l))) (/ d (* (sqrt h) (sqrt l))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -4.8e-273) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (l <= -5e-310) {
tmp = d / sqrt((h * l));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-4.8d-273)) then
tmp = sqrt((d / h)) * sqrt((d / l))
else if (l <= (-5d-310)) then
tmp = d / sqrt((h * l))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -4.8e-273) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (l <= -5e-310) {
tmp = d / Math.sqrt((h * l));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -4.8e-273: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) elif l <= -5e-310: tmp = d / math.sqrt((h * l)) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -4.8e-273) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (l <= -5e-310) tmp = Float64(d / sqrt(Float64(h * l))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -4.8e-273)
tmp = sqrt((d / h)) * sqrt((d / l));
elseif (l <= -5e-310)
tmp = d / sqrt((h * l));
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -4.8e-273], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -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}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.8 \cdot 10^{-273}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \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 l < -4.79999999999999963e-273Initial program 61.7%
associate-*l*61.7%
metadata-eval61.7%
unpow1/261.7%
metadata-eval61.7%
unpow1/261.7%
sub-neg61.7%
+-commutative61.7%
*-commutative61.7%
distribute-rgt-neg-in61.7%
fma-def61.7%
Simplified61.0%
Taylor expanded in h around 0 45.8%
if -4.79999999999999963e-273 < l < -4.999999999999985e-310Initial program 74.3%
Taylor expanded in d around inf 64.6%
expm1-log1p-u0.5%
expm1-udef0.3%
*-commutative0.3%
sqrt-div0.3%
metadata-eval0.3%
*-commutative0.3%
Applied egg-rr0.3%
expm1-def0.5%
expm1-log1p64.6%
associate-*r/64.6%
*-rgt-identity64.6%
Simplified64.6%
if -4.999999999999985e-310 < l Initial program 60.9%
Taylor expanded in d around inf 48.4%
expm1-log1p-u45.9%
expm1-udef36.6%
*-commutative36.6%
sqrt-div37.4%
metadata-eval37.4%
*-commutative37.4%
Applied egg-rr37.4%
expm1-def46.7%
expm1-log1p49.1%
associate-*r/49.3%
*-rgt-identity49.3%
Simplified49.3%
sqrt-prod55.5%
Applied egg-rr55.5%
Final simplification51.6%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (* (/ d h) (/ d l)))))
(if (<= d -3.4e+110)
t_0
(if (or (<= d -2.9e-220) (and (not (<= d 3.6e-89)) (<= d 5.9e+85)))
(* t_0 (+ 1.0 (* (/ (* (* D D) (* h (* M M))) (* l (* d d))) -0.125)))
(* d (sqrt (/ (/ 1.0 h) l)))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(((d / h) * (d / l)));
double tmp;
if (d <= -3.4e+110) {
tmp = t_0;
} else if ((d <= -2.9e-220) || (!(d <= 3.6e-89) && (d <= 5.9e+85))) {
tmp = t_0 * (1.0 + ((((D * D) * (h * (M * M))) / (l * (d * d))) * -0.125));
} else {
tmp = d * sqrt(((1.0 / h) / l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((d / h) * (d / l)))
if (d <= (-3.4d+110)) then
tmp = t_0
else if ((d <= (-2.9d-220)) .or. (.not. (d <= 3.6d-89)) .and. (d <= 5.9d+85)) then
tmp = t_0 * (1.0d0 + ((((d_1 * d_1) * (h * (m * m))) / (l * (d * d))) * (-0.125d0)))
else
tmp = d * sqrt(((1.0d0 / h) / l))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt(((d / h) * (d / l)));
double tmp;
if (d <= -3.4e+110) {
tmp = t_0;
} else if ((d <= -2.9e-220) || (!(d <= 3.6e-89) && (d <= 5.9e+85))) {
tmp = t_0 * (1.0 + ((((D * D) * (h * (M * M))) / (l * (d * d))) * -0.125));
} else {
tmp = d * Math.sqrt(((1.0 / h) / l));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt(((d / h) * (d / l))) tmp = 0 if d <= -3.4e+110: tmp = t_0 elif (d <= -2.9e-220) or (not (d <= 3.6e-89) and (d <= 5.9e+85)): tmp = t_0 * (1.0 + ((((D * D) * (h * (M * M))) / (l * (d * d))) * -0.125)) else: tmp = d * math.sqrt(((1.0 / h) / l)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(Float64(d / h) * Float64(d / l))) tmp = 0.0 if (d <= -3.4e+110) tmp = t_0; elseif ((d <= -2.9e-220) || (!(d <= 3.6e-89) && (d <= 5.9e+85))) tmp = Float64(t_0 * Float64(1.0 + Float64(Float64(Float64(Float64(D * D) * Float64(h * Float64(M * M))) / Float64(l * Float64(d * d))) * -0.125))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt(((d / h) * (d / l)));
tmp = 0.0;
if (d <= -3.4e+110)
tmp = t_0;
elseif ((d <= -2.9e-220) || (~((d <= 3.6e-89)) && (d <= 5.9e+85)))
tmp = t_0 * (1.0 + ((((D * D) * (h * (M * M))) / (l * (d * d))) * -0.125));
else
tmp = d * sqrt(((1.0 / h) / l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -3.4e+110], t$95$0, If[Or[LessEqual[d, -2.9e-220], And[N[Not[LessEqual[d, 3.6e-89]], $MachinePrecision], LessEqual[d, 5.9e+85]]], N[(t$95$0 * N[(1.0 + N[(N[(N[(N[(D * D), $MachinePrecision] * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{if}\;d \leq -3.4 \cdot 10^{+110}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -2.9 \cdot 10^{-220} \lor \neg \left(d \leq 3.6 \cdot 10^{-89}\right) \land d \leq 5.9 \cdot 10^{+85}:\\
\;\;\;\;t_0 \cdot \left(1 + \frac{\left(D \cdot D\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)}{\ell \cdot \left(d \cdot d\right)} \cdot -0.125\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if d < -3.4000000000000001e110Initial program 64.8%
expm1-log1p-u53.3%
expm1-udef52.4%
Applied egg-rr43.5%
expm1-def44.5%
expm1-log1p52.9%
unpow1/252.9%
*-commutative52.9%
sub-neg52.9%
*-commutative52.9%
distribute-rgt-neg-in52.9%
metadata-eval52.9%
associate-*r*52.9%
associate-*l/51.6%
*-commutative51.6%
associate-*r*51.6%
*-commutative51.6%
Simplified52.9%
Taylor expanded in D around 0 46.6%
if -3.4000000000000001e110 < d < -2.8999999999999998e-220 or 3.60000000000000007e-89 < d < 5.9e85Initial program 71.6%
expm1-log1p-u36.6%
expm1-udef18.5%
Applied egg-rr13.6%
expm1-def26.8%
expm1-log1p57.4%
unpow1/257.4%
*-commutative57.4%
sub-neg57.4%
*-commutative57.4%
distribute-rgt-neg-in57.4%
metadata-eval57.4%
associate-*r*57.4%
associate-*l/59.4%
*-commutative59.4%
associate-*r*59.4%
*-commutative59.4%
Simplified57.4%
Taylor expanded in D around 0 47.0%
*-commutative47.0%
*-commutative47.0%
*-commutative47.0%
times-frac51.7%
*-commutative51.7%
times-frac47.0%
unpow247.0%
unpow247.0%
unpow247.0%
Simplified47.0%
if -2.8999999999999998e-220 < d < 3.60000000000000007e-89 or 5.9e85 < d Initial program 51.4%
sqr-pow51.3%
metadata-eval51.3%
metadata-eval51.3%
metadata-eval51.3%
metadata-eval51.3%
Applied egg-rr51.3%
expm1-log1p-u50.2%
expm1-udef38.8%
metadata-eval38.8%
pow1/238.8%
Applied egg-rr38.8%
expm1-def50.2%
expm1-log1p51.3%
Simplified51.3%
Taylor expanded in d around inf 52.0%
*-commutative52.0%
*-commutative52.0%
associate-/r*52.8%
Simplified52.8%
Final simplification49.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) (/ d l)))))
(if (<= l -3e-273)
t_0
(if (<= l 6e-199)
(/ d (sqrt (* h l)))
(if (<= l 2.1e-118)
(* t_0 (* (/ -0.125 (* d d)) (/ (* D D) (/ l (* M (* h M))))))
(* d (sqrt (/ (/ 1.0 h) l))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(((d / h) * (d / l)));
double tmp;
if (l <= -3e-273) {
tmp = t_0;
} else if (l <= 6e-199) {
tmp = d / sqrt((h * l));
} else if (l <= 2.1e-118) {
tmp = t_0 * ((-0.125 / (d * d)) * ((D * D) / (l / (M * (h * M)))));
} else {
tmp = d * sqrt(((1.0 / h) / l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((d / h) * (d / l)))
if (l <= (-3d-273)) then
tmp = t_0
else if (l <= 6d-199) then
tmp = d / sqrt((h * l))
else if (l <= 2.1d-118) then
tmp = t_0 * (((-0.125d0) / (d * d)) * ((d_1 * d_1) / (l / (m * (h * m)))))
else
tmp = d * sqrt(((1.0d0 / h) / l))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt(((d / h) * (d / l)));
double tmp;
if (l <= -3e-273) {
tmp = t_0;
} else if (l <= 6e-199) {
tmp = d / Math.sqrt((h * l));
} else if (l <= 2.1e-118) {
tmp = t_0 * ((-0.125 / (d * d)) * ((D * D) / (l / (M * (h * M)))));
} else {
tmp = d * Math.sqrt(((1.0 / h) / l));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt(((d / h) * (d / l))) tmp = 0 if l <= -3e-273: tmp = t_0 elif l <= 6e-199: tmp = d / math.sqrt((h * l)) elif l <= 2.1e-118: tmp = t_0 * ((-0.125 / (d * d)) * ((D * D) / (l / (M * (h * M))))) else: tmp = d * math.sqrt(((1.0 / h) / l)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(Float64(d / h) * Float64(d / l))) tmp = 0.0 if (l <= -3e-273) tmp = t_0; elseif (l <= 6e-199) tmp = Float64(d / sqrt(Float64(h * l))); elseif (l <= 2.1e-118) tmp = Float64(t_0 * Float64(Float64(-0.125 / Float64(d * d)) * Float64(Float64(D * D) / Float64(l / Float64(M * Float64(h * M)))))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt(((d / h) * (d / l)));
tmp = 0.0;
if (l <= -3e-273)
tmp = t_0;
elseif (l <= 6e-199)
tmp = d / sqrt((h * l));
elseif (l <= 2.1e-118)
tmp = t_0 * ((-0.125 / (d * d)) * ((D * D) / (l / (M * (h * M)))));
else
tmp = d * sqrt(((1.0 / h) / l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -3e-273], t$95$0, If[LessEqual[l, 6e-199], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.1e-118], N[(t$95$0 * N[(N[(-0.125 / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[(N[(D * D), $MachinePrecision] / N[(l / N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -3 \cdot 10^{-273}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 6 \cdot 10^{-199}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;\ell \leq 2.1 \cdot 10^{-118}:\\
\;\;\;\;t_0 \cdot \left(\frac{-0.125}{d \cdot d} \cdot \frac{D \cdot D}{\frac{\ell}{M \cdot \left(h \cdot M\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if l < -2.99999999999999987e-273Initial program 61.7%
expm1-log1p-u43.2%
expm1-udef32.8%
Applied egg-rr27.0%
expm1-def34.1%
expm1-log1p48.6%
unpow1/248.6%
*-commutative48.6%
sub-neg48.6%
*-commutative48.6%
distribute-rgt-neg-in48.6%
metadata-eval48.6%
associate-*r*48.6%
associate-*l/50.7%
*-commutative50.7%
associate-*r*50.7%
*-commutative50.7%
Simplified48.6%
Taylor expanded in D around 0 37.5%
if -2.99999999999999987e-273 < l < 5.99999999999999966e-199Initial program 55.3%
Taylor expanded in d around inf 44.0%
expm1-log1p-u22.6%
expm1-udef22.7%
*-commutative22.7%
sqrt-div24.3%
metadata-eval24.3%
*-commutative24.3%
Applied egg-rr24.3%
expm1-def24.3%
expm1-log1p45.6%
associate-*r/45.7%
*-rgt-identity45.7%
Simplified45.7%
if 5.99999999999999966e-199 < l < 2.1e-118Initial program 68.6%
expm1-log1p-u30.0%
expm1-udef24.9%
Applied egg-rr16.2%
expm1-def21.3%
expm1-log1p58.7%
unpow1/258.7%
*-commutative58.7%
sub-neg58.7%
*-commutative58.7%
distribute-rgt-neg-in58.7%
metadata-eval58.7%
associate-*r*58.7%
associate-*l/58.8%
*-commutative58.8%
associate-*r*58.8%
*-commutative58.8%
Simplified58.7%
Taylor expanded in D around inf 26.7%
associate-*r/26.7%
times-frac31.9%
unpow231.9%
associate-/l*31.8%
unpow231.8%
*-commutative31.8%
unpow231.8%
associate-*l*36.9%
Simplified36.9%
if 2.1e-118 < l Initial program 63.2%
sqr-pow63.2%
metadata-eval63.2%
metadata-eval63.2%
metadata-eval63.2%
metadata-eval63.2%
Applied egg-rr63.2%
expm1-log1p-u61.0%
expm1-udef45.6%
metadata-eval45.6%
pow1/245.6%
Applied egg-rr45.6%
expm1-def61.0%
expm1-log1p63.2%
Simplified63.2%
Taylor expanded in d around inf 58.9%
*-commutative58.9%
*-commutative58.9%
associate-/r*60.0%
Simplified60.0%
Final simplification46.3%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= l -3.6e-273) (sqrt (* (/ d h) (/ d l))) (/ d (sqrt (* h l)))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -3.6e-273) {
tmp = sqrt(((d / h) * (d / l)));
} else {
tmp = d / sqrt((h * l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-3.6d-273)) then
tmp = sqrt(((d / h) * (d / l)))
else
tmp = d / sqrt((h * l))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -3.6e-273) {
tmp = Math.sqrt(((d / h) * (d / l)));
} else {
tmp = d / Math.sqrt((h * l));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -3.6e-273: tmp = math.sqrt(((d / h) * (d / l))) else: tmp = d / math.sqrt((h * l)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -3.6e-273) tmp = sqrt(Float64(Float64(d / h) * Float64(d / l))); else tmp = Float64(d / sqrt(Float64(h * l))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -3.6e-273)
tmp = sqrt(((d / h) * (d / l)));
else
tmp = d / sqrt((h * l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -3.6e-273], N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.6 \cdot 10^{-273}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if l < -3.59999999999999993e-273Initial program 61.7%
expm1-log1p-u43.2%
expm1-udef32.8%
Applied egg-rr27.0%
expm1-def34.1%
expm1-log1p48.6%
unpow1/248.6%
*-commutative48.6%
sub-neg48.6%
*-commutative48.6%
distribute-rgt-neg-in48.6%
metadata-eval48.6%
associate-*r*48.6%
associate-*l/50.7%
*-commutative50.7%
associate-*r*50.7%
*-commutative50.7%
Simplified48.6%
Taylor expanded in D around 0 37.5%
if -3.59999999999999993e-273 < l Initial program 62.0%
Taylor expanded in d around inf 49.7%
expm1-log1p-u42.4%
expm1-udef33.8%
*-commutative33.8%
sqrt-div34.5%
metadata-eval34.5%
*-commutative34.5%
Applied egg-rr34.5%
expm1-def43.1%
expm1-log1p50.3%
associate-*r/50.5%
*-rgt-identity50.5%
Simplified50.5%
Final simplification44.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 (/ d (sqrt (* h l))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d / sqrt((h * l));
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = d / sqrt((h * l))
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d / Math.sqrt((h * l));
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d / math.sqrt((h * l))
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d / sqrt(Float64(h * l))) end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d / sqrt((h * l));
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Initial program 61.8%
Taylor expanded in d around inf 31.5%
expm1-log1p-u25.7%
expm1-udef20.9%
*-commutative20.9%
sqrt-div21.3%
metadata-eval21.3%
*-commutative21.3%
Applied egg-rr21.3%
expm1-def26.0%
expm1-log1p31.9%
associate-*r/32.0%
*-rgt-identity32.0%
Simplified32.0%
Final simplification32.0%
herbie shell --seed 2023257
(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)))))