
(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 23 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}
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= h -2e-310)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(*
(sqrt (/ d l))
(fma (pow (* 0.5 (* M_m (/ D_m d))) 2.0) (* -0.5 (/ h l)) 1.0)))
(*
d
(/
(fma
-0.5
(pow (/ (* (sqrt h) (* D_m (* M_m (/ 0.5 d)))) (sqrt l)) 2.0)
1.0)
(* (sqrt h) (sqrt l))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (h <= -2e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * fma(pow((0.5 * (M_m * (D_m / d))), 2.0), (-0.5 * (h / l)), 1.0));
} else {
tmp = d * (fma(-0.5, pow(((sqrt(h) * (D_m * (M_m * (0.5 / d)))) / sqrt(l)), 2.0), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (h <= -2e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * fma((Float64(0.5 * Float64(M_m * Float64(D_m / d))) ^ 2.0), Float64(-0.5 * Float64(h / l)), 1.0))); else tmp = Float64(d * Float64(fma(-0.5, (Float64(Float64(sqrt(h) * Float64(D_m * Float64(M_m * Float64(0.5 / d)))) / sqrt(l)) ^ 2.0), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[h, -2e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Power[N[(0.5 * N[(M$95$m * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(-0.5 * N[Power[N[(N[(N[Sqrt[h], $MachinePrecision] * N[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M\_m \cdot \frac{D\_m}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.5, {\left(\frac{\sqrt{h} \cdot \left(D\_m \cdot \left(M\_m \cdot \frac{0.5}{d}\right)\right)}{\sqrt{\ell}}\right)}^{2}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -1.999999999999994e-310Initial program 70.2%
Simplified68.3%
frac-2neg68.3%
sqrt-div77.0%
Applied egg-rr77.0%
if -1.999999999999994e-310 < h Initial program 61.1%
Simplified60.5%
sub-neg60.5%
distribute-rgt-in51.7%
*-un-lft-identity51.7%
*-commutative51.7%
sqrt-div55.7%
sqrt-div56.3%
frac-times56.3%
add-sqr-sqrt56.4%
Applied egg-rr69.6%
*-rgt-identity69.6%
*-commutative69.6%
distribute-lft-in75.9%
associate-*l/78.7%
associate-/l*78.7%
Simplified83.5%
add-sqr-sqrt83.4%
pow283.4%
sqrt-prod83.4%
sqrt-div83.4%
sqrt-pow188.3%
metadata-eval88.3%
pow188.3%
associate-*r*90.1%
Applied egg-rr90.1%
associate-*r/90.1%
associate-*l*88.3%
Simplified88.3%
Final simplification83.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (/ 0.5 d) (* M_m D_m))))
(if (<= h -2e-310)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(*
(sqrt (/ d l))
(fma (pow (* 0.5 (* M_m (/ D_m d))) 2.0) (* -0.5 (/ h l)) 1.0)))
(* d (/ (fma -0.5 (* h (* t_0 (/ t_0 l))) 1.0) (* (sqrt h) (sqrt l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (0.5 / d) * (M_m * D_m);
double tmp;
if (h <= -2e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * fma(pow((0.5 * (M_m * (D_m / d))), 2.0), (-0.5 * (h / l)), 1.0));
} else {
tmp = d * (fma(-0.5, (h * (t_0 * (t_0 / l))), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(0.5 / d) * Float64(M_m * D_m)) tmp = 0.0 if (h <= -2e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * fma((Float64(0.5 * Float64(M_m * Float64(D_m / d))) ^ 2.0), Float64(-0.5 * Float64(h / l)), 1.0))); else tmp = Float64(d * Float64(fma(-0.5, Float64(h * Float64(t_0 * Float64(t_0 / l))), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(0.5 / d), $MachinePrecision] * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -2e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Power[N[(0.5 * N[(M$95$m * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(-0.5 * N[(h * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{0.5}{d} \cdot \left(M\_m \cdot D\_m\right)\\
\mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M\_m \cdot \frac{D\_m}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.5, h \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right), 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -1.999999999999994e-310Initial program 70.2%
Simplified68.3%
frac-2neg68.3%
sqrt-div77.0%
Applied egg-rr77.0%
if -1.999999999999994e-310 < h Initial program 61.1%
Simplified60.5%
sub-neg60.5%
distribute-rgt-in51.7%
*-un-lft-identity51.7%
*-commutative51.7%
sqrt-div55.7%
sqrt-div56.3%
frac-times56.3%
add-sqr-sqrt56.4%
Applied egg-rr69.6%
*-rgt-identity69.6%
*-commutative69.6%
distribute-lft-in75.9%
associate-*l/78.7%
associate-/l*78.7%
Simplified83.5%
unpow283.5%
*-un-lft-identity83.5%
times-frac87.7%
associate-*r*86.1%
associate-*r*88.8%
Applied egg-rr88.8%
Final simplification83.6%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (/ 0.5 d) (* M_m D_m))))
(if (<= l -2e-310)
(*
(sqrt (/ d l))
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (* (/ h l) (* -0.5 (pow (* D_m (/ (/ M_m 2.0) d)) 2.0))))))
(* d (/ (fma -0.5 (* h (* t_0 (/ t_0 l))) 1.0) (* (sqrt h) (sqrt l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (0.5 / d) * (M_m * D_m);
double tmp;
if (l <= -2e-310) {
tmp = sqrt((d / l)) * ((sqrt(-d) / sqrt(-h)) * (1.0 + ((h / l) * (-0.5 * pow((D_m * ((M_m / 2.0) / d)), 2.0)))));
} else {
tmp = d * (fma(-0.5, (h * (t_0 * (t_0 / l))), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(0.5 / d) * Float64(M_m * D_m)) tmp = 0.0 if (l <= -2e-310) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D_m * Float64(Float64(M_m / 2.0) / d)) ^ 2.0)))))); else tmp = Float64(d * Float64(fma(-0.5, Float64(h * Float64(t_0 * Float64(t_0 / l))), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(0.5 / d), $MachinePrecision] * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2e-310], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(-0.5 * N[(h * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{0.5}{d} \cdot \left(M\_m \cdot D\_m\right)\\
\mathbf{if}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.5, h \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right), 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.999999999999994e-310Initial program 70.2%
Simplified69.3%
frac-2neg68.3%
sqrt-div77.0%
Applied egg-rr77.9%
if -1.999999999999994e-310 < l Initial program 61.1%
Simplified60.5%
sub-neg60.5%
distribute-rgt-in51.7%
*-un-lft-identity51.7%
*-commutative51.7%
sqrt-div55.7%
sqrt-div56.3%
frac-times56.3%
add-sqr-sqrt56.4%
Applied egg-rr69.6%
*-rgt-identity69.6%
*-commutative69.6%
distribute-lft-in75.9%
associate-*l/78.7%
associate-/l*78.7%
Simplified83.5%
unpow283.5%
*-un-lft-identity83.5%
times-frac87.7%
associate-*r*86.1%
associate-*r*88.8%
Applied egg-rr88.8%
Final simplification84.0%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (/ 0.5 d) (* M_m D_m))))
(if (<= l -1.45e-307)
(*
(sqrt (/ d l))
(* (sqrt (/ d h)) (+ 1.0 (/ (pow (* t_0 (sqrt (* h -0.5))) 2.0) l))))
(* d (/ (fma -0.5 (* h (* t_0 (/ t_0 l))) 1.0) (* (sqrt h) (sqrt l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (0.5 / d) * (M_m * D_m);
double tmp;
if (l <= -1.45e-307) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (pow((t_0 * sqrt((h * -0.5))), 2.0) / l)));
} else {
tmp = d * (fma(-0.5, (h * (t_0 * (t_0 / l))), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(0.5 / d) * Float64(M_m * D_m)) tmp = 0.0 if (l <= -1.45e-307) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64((Float64(t_0 * sqrt(Float64(h * -0.5))) ^ 2.0) / l)))); else tmp = Float64(d * Float64(fma(-0.5, Float64(h * Float64(t_0 * Float64(t_0 / l))), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(0.5 / d), $MachinePrecision] * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.45e-307], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[Power[N[(t$95$0 * N[Sqrt[N[(h * -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(-0.5 * N[(h * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{0.5}{d} \cdot \left(M\_m \cdot D\_m\right)\\
\mathbf{if}\;\ell \leq -1.45 \cdot 10^{-307}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{{\left(t\_0 \cdot \sqrt{h \cdot -0.5}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.5, h \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right), 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.45e-307Initial program 70.8%
Simplified69.9%
associate-*l/70.8%
*-commutative70.8%
add-sqr-sqrt70.8%
pow270.8%
unpow270.8%
sqrt-prod41.9%
add-sqr-sqrt70.8%
associate-/l/70.8%
Applied egg-rr70.8%
add-sqr-sqrt70.8%
pow270.8%
associate-*r*70.8%
sqrt-prod70.8%
sqrt-pow170.8%
metadata-eval70.8%
pow170.8%
associate-*r/72.5%
div-inv72.5%
metadata-eval72.5%
div-inv72.5%
clear-num72.5%
Applied egg-rr72.5%
if -1.45e-307 < l Initial program 60.7%
Simplified60.0%
sub-neg60.0%
distribute-rgt-in51.4%
*-un-lft-identity51.4%
*-commutative51.4%
sqrt-div55.3%
sqrt-div55.9%
frac-times55.9%
add-sqr-sqrt56.0%
Applied egg-rr69.2%
*-rgt-identity69.2%
*-commutative69.2%
distribute-lft-in75.4%
associate-*l/78.2%
associate-/l*78.1%
Simplified82.9%
unpow282.9%
*-un-lft-identity82.9%
times-frac87.1%
associate-*r*85.6%
associate-*r*88.2%
Applied egg-rr88.2%
Final simplification81.4%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -3.8e-189)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= l -2e-310)
(* d (sqrt (log1p (expm1 (/ (/ 1.0 h) l)))))
(if (<= l 1.35e+153)
(*
d
(/
(fma (pow (* D_m (* 0.5 (/ M_m d))) 2.0) (* -0.5 (/ h l)) 1.0)
(sqrt (* h l))))
(/ (/ d (sqrt h)) (sqrt l))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -3.8e-189) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (l <= -2e-310) {
tmp = d * sqrt(log1p(expm1(((1.0 / h) / l))));
} else if (l <= 1.35e+153) {
tmp = d * (fma(pow((D_m * (0.5 * (M_m / d))), 2.0), (-0.5 * (h / l)), 1.0) / sqrt((h * l)));
} else {
tmp = (d / sqrt(h)) / sqrt(l);
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -3.8e-189) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (l <= -2e-310) tmp = Float64(d * sqrt(log1p(expm1(Float64(Float64(1.0 / h) / l))))); elseif (l <= 1.35e+153) tmp = Float64(d * Float64(fma((Float64(D_m * Float64(0.5 * Float64(M_m / d))) ^ 2.0), Float64(-0.5 * Float64(h / l)), 1.0) / sqrt(Float64(h * l)))); else tmp = Float64(Float64(d / sqrt(h)) / sqrt(l)); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -3.8e-189], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-310], N[(d * N[Sqrt[N[Log[1 + N[(Exp[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.35e+153], N[(d * N[(N[(N[Power[N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.8 \cdot 10^{-189}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\frac{1}{h}}{\ell}\right)\right)}\\
\mathbf{elif}\;\ell \leq 1.35 \cdot 10^{+153}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left({\left(D\_m \cdot \left(0.5 \cdot \frac{M\_m}{d}\right)\right)}^{2}, -0.5 \cdot \frac{h}{\ell}, 1\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -3.80000000000000022e-189Initial program 66.5%
Simplified65.4%
Taylor expanded in M around 0 50.4%
if -3.80000000000000022e-189 < l < -1.999999999999994e-310Initial program 83.5%
Simplified79.0%
Taylor expanded in d around inf 27.1%
log1p-expm1-u62.9%
associate-/r*62.9%
Applied egg-rr62.9%
if -1.999999999999994e-310 < l < 1.35e153Initial program 68.9%
Simplified68.9%
add-sqr-sqrt24.5%
sqrt-unprod19.3%
*-commutative19.3%
*-commutative19.3%
swap-sqr19.3%
Applied egg-rr15.1%
*-commutative15.1%
sqrt-prod15.1%
sqrt-div16.9%
sqrt-pow128.5%
metadata-eval28.5%
pow128.5%
*-commutative28.5%
sqrt-unprod30.8%
sqrt-pow183.8%
metadata-eval83.8%
pow183.8%
distribute-lft-in75.1%
Applied egg-rr62.3%
Simplified77.9%
if 1.35e153 < l Initial program 40.8%
Simplified38.5%
Taylor expanded in d around inf 51.3%
sqrt-div51.2%
metadata-eval51.2%
*-commutative51.2%
sqrt-unprod58.3%
div-inv58.3%
sqrt-unprod51.2%
*-commutative51.2%
Applied egg-rr51.2%
*-un-lft-identity51.2%
sqrt-prod58.3%
*-commutative58.3%
times-frac56.1%
Applied egg-rr56.1%
associate-*l/56.0%
*-lft-identity56.0%
Simplified56.0%
Final simplification63.6%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (/ 0.5 d) (* M_m D_m))))
(if (<= h 6.5e-303)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D_m d) (* 0.5 M_m)) 2.0)) l)))
(* (sqrt (/ d l)) (sqrt (/ d h))))
(* d (/ (fma -0.5 (* h (* t_0 (/ t_0 l))) 1.0) (* (sqrt h) (sqrt l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (0.5 / d) * (M_m * D_m);
double tmp;
if (h <= 6.5e-303) {
tmp = (1.0 - (0.5 * ((h * pow(((D_m / d) * (0.5 * M_m)), 2.0)) / l))) * (sqrt((d / l)) * sqrt((d / h)));
} else {
tmp = d * (fma(-0.5, (h * (t_0 * (t_0 / l))), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(0.5 / d) * Float64(M_m * D_m)) tmp = 0.0 if (h <= 6.5e-303) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D_m / d) * Float64(0.5 * M_m)) ^ 2.0)) / l))) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)))); else tmp = Float64(d * Float64(fma(-0.5, Float64(h * Float64(t_0 * Float64(t_0 / l))), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(0.5 / d), $MachinePrecision] * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, 6.5e-303], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * M$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(-0.5 * N[(h * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{0.5}{d} \cdot \left(M\_m \cdot D\_m\right)\\
\mathbf{if}\;h \leq 6.5 \cdot 10^{-303}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D\_m}{d} \cdot \left(0.5 \cdot M\_m\right)\right)}^{2}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.5, h \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right), 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < 6.50000000000000028e-303Initial program 70.7%
Simplified68.9%
associate-*r/69.9%
*-commutative69.9%
div-inv69.9%
metadata-eval69.9%
Applied egg-rr69.9%
if 6.50000000000000028e-303 < h Initial program 60.5%
Simplified59.9%
sub-neg59.9%
distribute-rgt-in51.8%
*-un-lft-identity51.8%
*-commutative51.8%
sqrt-div55.8%
sqrt-div56.4%
frac-times56.4%
add-sqr-sqrt56.5%
Applied egg-rr69.9%
*-rgt-identity69.9%
*-commutative69.9%
distribute-lft-in75.6%
associate-*l/78.4%
associate-/l*78.4%
Simplified83.2%
unpow283.2%
*-un-lft-identity83.2%
times-frac87.5%
associate-*r*86.0%
associate-*r*88.7%
Applied egg-rr88.7%
Final simplification80.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -4.7e-188)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= l -2e-310)
(* d (sqrt (log1p (expm1 (/ (/ 1.0 h) l)))))
(/
(* d (fma -0.5 (/ h (/ l (pow (* (/ 0.5 d) (* M_m D_m)) 2.0))) 1.0))
(sqrt (* h l))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -4.7e-188) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (l <= -2e-310) {
tmp = d * sqrt(log1p(expm1(((1.0 / h) / l))));
} else {
tmp = (d * fma(-0.5, (h / (l / pow(((0.5 / d) * (M_m * D_m)), 2.0))), 1.0)) / sqrt((h * l));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -4.7e-188) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (l <= -2e-310) tmp = Float64(d * sqrt(log1p(expm1(Float64(Float64(1.0 / h) / l))))); else tmp = Float64(Float64(d * fma(-0.5, Float64(h / Float64(l / (Float64(Float64(0.5 / d) * Float64(M_m * D_m)) ^ 2.0))), 1.0)) / sqrt(Float64(h * l))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -4.7e-188], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-310], N[(d * N[Sqrt[N[Log[1 + N[(Exp[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d * N[(-0.5 * N[(h / N[(l / N[Power[N[(N[(0.5 / d), $MachinePrecision] * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.7 \cdot 10^{-188}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\frac{1}{h}}{\ell}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(-0.5, \frac{h}{\frac{\ell}{{\left(\frac{0.5}{d} \cdot \left(M\_m \cdot D\_m\right)\right)}^{2}}}, 1\right)}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if l < -4.69999999999999998e-188Initial program 66.5%
Simplified65.4%
Taylor expanded in M around 0 50.4%
if -4.69999999999999998e-188 < l < -1.999999999999994e-310Initial program 83.5%
Simplified79.0%
Taylor expanded in d around inf 27.1%
log1p-expm1-u62.9%
associate-/r*62.9%
Applied egg-rr62.9%
if -1.999999999999994e-310 < l Initial program 61.1%
Simplified60.5%
sub-neg60.5%
distribute-rgt-in51.7%
*-un-lft-identity51.7%
*-commutative51.7%
sqrt-div55.7%
sqrt-div56.3%
frac-times56.3%
add-sqr-sqrt56.4%
Applied egg-rr69.6%
*-rgt-identity69.6%
*-commutative69.6%
distribute-lft-in75.9%
associate-*l/78.7%
associate-/l*78.7%
Simplified83.5%
associate-*r/82.9%
clear-num82.9%
un-div-inv82.9%
associate-*r*83.5%
*-commutative83.5%
sqrt-prod75.1%
Applied egg-rr75.1%
Final simplification65.4%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= h 6.5e-303)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D_m d) (* 0.5 M_m)) 2.0)) l)))
(* (sqrt (/ d l)) (sqrt (/ d h))))
(/
(* d (fma -0.5 (/ h (/ l (pow (* (/ 0.5 d) (* M_m D_m)) 2.0))) 1.0))
(sqrt (* h l)))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (h <= 6.5e-303) {
tmp = (1.0 - (0.5 * ((h * pow(((D_m / d) * (0.5 * M_m)), 2.0)) / l))) * (sqrt((d / l)) * sqrt((d / h)));
} else {
tmp = (d * fma(-0.5, (h / (l / pow(((0.5 / d) * (M_m * D_m)), 2.0))), 1.0)) / sqrt((h * l));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (h <= 6.5e-303) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D_m / d) * Float64(0.5 * M_m)) ^ 2.0)) / l))) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)))); else tmp = Float64(Float64(d * fma(-0.5, Float64(h / Float64(l / (Float64(Float64(0.5 / d) * Float64(M_m * D_m)) ^ 2.0))), 1.0)) / sqrt(Float64(h * l))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[h, 6.5e-303], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * M$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d * N[(-0.5 * N[(h / N[(l / N[Power[N[(N[(0.5 / d), $MachinePrecision] * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq 6.5 \cdot 10^{-303}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D\_m}{d} \cdot \left(0.5 \cdot M\_m\right)\right)}^{2}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(-0.5, \frac{h}{\frac{\ell}{{\left(\frac{0.5}{d} \cdot \left(M\_m \cdot D\_m\right)\right)}^{2}}}, 1\right)}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if h < 6.50000000000000028e-303Initial program 70.7%
Simplified68.9%
associate-*r/69.9%
*-commutative69.9%
div-inv69.9%
metadata-eval69.9%
Applied egg-rr69.9%
if 6.50000000000000028e-303 < h Initial program 60.5%
Simplified59.9%
sub-neg59.9%
distribute-rgt-in51.8%
*-un-lft-identity51.8%
*-commutative51.8%
sqrt-div55.8%
sqrt-div56.4%
frac-times56.4%
add-sqr-sqrt56.5%
Applied egg-rr69.9%
*-rgt-identity69.9%
*-commutative69.9%
distribute-lft-in75.6%
associate-*l/78.4%
associate-/l*78.4%
Simplified83.2%
associate-*r/82.6%
clear-num82.6%
un-div-inv82.6%
associate-*r*83.3%
*-commutative83.3%
sqrt-prod75.1%
Applied egg-rr75.1%
Final simplification72.8%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= h 1.15e-301)
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M_m 2.0)) 2.0))))
(* (sqrt (/ d l)) (sqrt (/ d h))))
(/
(* d (fma -0.5 (/ h (/ l (pow (* (/ 0.5 d) (* M_m D_m)) 2.0))) 1.0))
(sqrt (* h l)))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (h <= 1.15e-301) {
tmp = (1.0 - (0.5 * ((h / l) * pow(((D_m / d) * (M_m / 2.0)), 2.0)))) * (sqrt((d / l)) * sqrt((d / h)));
} else {
tmp = (d * fma(-0.5, (h / (l / pow(((0.5 / d) * (M_m * D_m)), 2.0))), 1.0)) / sqrt((h * l));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (h <= 1.15e-301) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M_m / 2.0)) ^ 2.0)))) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)))); else tmp = Float64(Float64(d * fma(-0.5, Float64(h / Float64(l / (Float64(Float64(0.5 / d) * Float64(M_m * D_m)) ^ 2.0))), 1.0)) / sqrt(Float64(h * l))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[h, 1.15e-301], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M$95$m / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d * N[(-0.5 * N[(h / N[(l / N[Power[N[(N[(0.5 / d), $MachinePrecision] * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq 1.15 \cdot 10^{-301}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M\_m}{2}\right)}^{2}\right)\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(-0.5, \frac{h}{\frac{\ell}{{\left(\frac{0.5}{d} \cdot \left(M\_m \cdot D\_m\right)\right)}^{2}}}, 1\right)}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if h < 1.1500000000000001e-301Initial program 70.7%
Simplified68.9%
if 1.1500000000000001e-301 < h Initial program 60.5%
Simplified59.9%
sub-neg59.9%
distribute-rgt-in51.8%
*-un-lft-identity51.8%
*-commutative51.8%
sqrt-div55.8%
sqrt-div56.4%
frac-times56.4%
add-sqr-sqrt56.5%
Applied egg-rr69.9%
*-rgt-identity69.9%
*-commutative69.9%
distribute-lft-in75.6%
associate-*l/78.4%
associate-/l*78.4%
Simplified83.2%
associate-*r/82.6%
clear-num82.6%
un-div-inv82.6%
associate-*r*83.3%
*-commutative83.3%
sqrt-prod75.1%
Applied egg-rr75.1%
Final simplification72.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= h 8.5e-303)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (/ (* h (* -0.5 (pow (* D_m (/ M_m (* d 2.0))) 2.0))) l))))
(/
(* d (fma -0.5 (/ h (/ l (pow (* (/ 0.5 d) (* M_m D_m)) 2.0))) 1.0))
(sqrt (* h l)))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (h <= 8.5e-303) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * (-0.5 * pow((D_m * (M_m / (d * 2.0))), 2.0))) / l)));
} else {
tmp = (d * fma(-0.5, (h / (l / pow(((0.5 / d) * (M_m * D_m)), 2.0))), 1.0)) / sqrt((h * l));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (h <= 8.5e-303) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(D_m * Float64(M_m / Float64(d * 2.0))) ^ 2.0))) / l)))); else tmp = Float64(Float64(d * fma(-0.5, Float64(h / Float64(l / (Float64(Float64(0.5 / d) * Float64(M_m * D_m)) ^ 2.0))), 1.0)) / sqrt(Float64(h * l))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[h, 8.5e-303], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(D$95$m * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d * N[(-0.5 * N[(h / N[(l / N[Power[N[(N[(0.5 / d), $MachinePrecision] * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq 8.5 \cdot 10^{-303}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(D\_m \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(-0.5, \frac{h}{\frac{\ell}{{\left(\frac{0.5}{d} \cdot \left(M\_m \cdot D\_m\right)\right)}^{2}}}, 1\right)}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if h < 8.5e-303Initial program 70.7%
Simplified69.8%
associate-*l/70.7%
*-commutative70.7%
add-sqr-sqrt70.7%
pow270.7%
unpow270.7%
sqrt-prod40.8%
add-sqr-sqrt70.7%
associate-/l/70.7%
Applied egg-rr70.7%
if 8.5e-303 < h Initial program 60.5%
Simplified59.9%
sub-neg59.9%
distribute-rgt-in51.8%
*-un-lft-identity51.8%
*-commutative51.8%
sqrt-div55.8%
sqrt-div56.4%
frac-times56.4%
add-sqr-sqrt56.5%
Applied egg-rr69.9%
*-rgt-identity69.9%
*-commutative69.9%
distribute-lft-in75.6%
associate-*l/78.4%
associate-/l*78.4%
Simplified83.2%
associate-*r/82.6%
clear-num82.6%
un-div-inv82.6%
associate-*r*83.3%
*-commutative83.3%
sqrt-prod75.1%
Applied egg-rr75.1%
Final simplification73.2%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= h 6.5e-303)
(*
(sqrt (/ d l))
(*
(+ 1.0 (* (/ h l) (* -0.5 (pow (* D_m (/ (/ M_m 2.0) d)) 2.0))))
(sqrt (/ d h))))
(/
(* d (fma -0.5 (/ h (/ l (pow (* (/ 0.5 d) (* M_m D_m)) 2.0))) 1.0))
(sqrt (* h l)))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (h <= 6.5e-303) {
tmp = sqrt((d / l)) * ((1.0 + ((h / l) * (-0.5 * pow((D_m * ((M_m / 2.0) / d)), 2.0)))) * sqrt((d / h)));
} else {
tmp = (d * fma(-0.5, (h / (l / pow(((0.5 / d) * (M_m * D_m)), 2.0))), 1.0)) / sqrt((h * l));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (h <= 6.5e-303) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D_m * Float64(Float64(M_m / 2.0) / d)) ^ 2.0)))) * sqrt(Float64(d / h)))); else tmp = Float64(Float64(d * fma(-0.5, Float64(h / Float64(l / (Float64(Float64(0.5 / d) * Float64(M_m * D_m)) ^ 2.0))), 1.0)) / sqrt(Float64(h * l))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[h, 6.5e-303], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d * N[(-0.5 * N[(h / N[(l / N[Power[N[(N[(0.5 / d), $MachinePrecision] * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq 6.5 \cdot 10^{-303}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(-0.5, \frac{h}{\frac{\ell}{{\left(\frac{0.5}{d} \cdot \left(M\_m \cdot D\_m\right)\right)}^{2}}}, 1\right)}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if h < 6.50000000000000028e-303Initial program 70.7%
Simplified69.8%
if 6.50000000000000028e-303 < h Initial program 60.5%
Simplified59.9%
sub-neg59.9%
distribute-rgt-in51.8%
*-un-lft-identity51.8%
*-commutative51.8%
sqrt-div55.8%
sqrt-div56.4%
frac-times56.4%
add-sqr-sqrt56.5%
Applied egg-rr69.9%
*-rgt-identity69.9%
*-commutative69.9%
distribute-lft-in75.6%
associate-*l/78.4%
associate-/l*78.4%
Simplified83.2%
associate-*r/82.6%
clear-num82.6%
un-div-inv82.6%
associate-*r*83.3%
*-commutative83.3%
sqrt-prod75.1%
Applied egg-rr75.1%
Final simplification72.8%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -1.52e-72)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= d -5e-310)
(* d (sqrt (log1p (expm1 (/ (/ 1.0 h) l)))))
(if (<= d 6.4e+89)
(* -0.125 (/ (/ (* (sqrt h) (pow (* M_m D_m) 2.0)) d) (pow l 1.5)))
(/ (/ d (sqrt h)) (sqrt l))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -1.52e-72) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (d <= -5e-310) {
tmp = d * sqrt(log1p(expm1(((1.0 / h) / l))));
} else if (d <= 6.4e+89) {
tmp = -0.125 * (((sqrt(h) * pow((M_m * D_m), 2.0)) / d) / pow(l, 1.5));
} else {
tmp = (d / sqrt(h)) / sqrt(l);
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -1.52e-72) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (d <= -5e-310) {
tmp = d * Math.sqrt(Math.log1p(Math.expm1(((1.0 / h) / l))));
} else if (d <= 6.4e+89) {
tmp = -0.125 * (((Math.sqrt(h) * Math.pow((M_m * D_m), 2.0)) / d) / Math.pow(l, 1.5));
} else {
tmp = (d / Math.sqrt(h)) / Math.sqrt(l);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if d <= -1.52e-72: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif d <= -5e-310: tmp = d * math.sqrt(math.log1p(math.expm1(((1.0 / h) / l)))) elif d <= 6.4e+89: tmp = -0.125 * (((math.sqrt(h) * math.pow((M_m * D_m), 2.0)) / d) / math.pow(l, 1.5)) else: tmp = (d / math.sqrt(h)) / math.sqrt(l) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -1.52e-72) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (d <= -5e-310) tmp = Float64(d * sqrt(log1p(expm1(Float64(Float64(1.0 / h) / l))))); elseif (d <= 6.4e+89) tmp = Float64(-0.125 * Float64(Float64(Float64(sqrt(h) * (Float64(M_m * D_m) ^ 2.0)) / d) / (l ^ 1.5))); else tmp = Float64(Float64(d / sqrt(h)) / sqrt(l)); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -1.52e-72], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Sqrt[N[Log[1 + N[(Exp[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6.4e+89], N[(-0.125 * N[(N[(N[(N[Sqrt[h], $MachinePrecision] * N[Power[N[(M$95$m * D$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.52 \cdot 10^{-72}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\frac{1}{h}}{\ell}\right)\right)}\\
\mathbf{elif}\;d \leq 6.4 \cdot 10^{+89}:\\
\;\;\;\;-0.125 \cdot \frac{\frac{\sqrt{h} \cdot {\left(M\_m \cdot D\_m\right)}^{2}}{d}}{{\ell}^{1.5}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.5200000000000001e-72Initial program 86.3%
Simplified83.4%
Taylor expanded in M around 0 59.7%
if -1.5200000000000001e-72 < d < -4.999999999999985e-310Initial program 42.3%
Simplified42.3%
Taylor expanded in d around inf 14.8%
log1p-expm1-u28.9%
associate-/r*28.9%
Applied egg-rr28.9%
if -4.999999999999985e-310 < d < 6.39999999999999974e89Initial program 55.9%
Simplified55.0%
Taylor expanded in d around 0 39.1%
associate-*r*39.1%
associate-/l*38.0%
Simplified38.0%
sqrt-div41.0%
associate-*r/41.0%
*-commutative41.0%
associate-*r/42.1%
pow-prod-down48.8%
sqrt-pow156.7%
metadata-eval56.7%
Applied egg-rr56.7%
*-commutative56.7%
associate-*r*56.7%
*-commutative56.7%
associate-/l*56.7%
associate-*r/59.4%
Simplified59.4%
if 6.39999999999999974e89 < d Initial program 74.0%
Simplified74.2%
Taylor expanded in d around inf 66.1%
sqrt-div66.1%
metadata-eval66.1%
*-commutative66.1%
sqrt-unprod75.2%
div-inv75.4%
sqrt-unprod66.3%
*-commutative66.3%
Applied egg-rr66.3%
*-un-lft-identity66.3%
sqrt-prod75.4%
*-commutative75.4%
times-frac73.2%
Applied egg-rr73.2%
associate-*l/73.3%
*-lft-identity73.3%
Simplified73.3%
Final simplification56.8%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -6.5e-190)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= l -2e-310)
(* d (sqrt (log1p (expm1 (/ (/ 1.0 h) l)))))
(/ (/ d (sqrt h)) (sqrt l)))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -6.5e-190) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (l <= -2e-310) {
tmp = d * sqrt(log1p(expm1(((1.0 / h) / l))));
} else {
tmp = (d / sqrt(h)) / sqrt(l);
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -6.5e-190) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (l <= -2e-310) {
tmp = d * Math.sqrt(Math.log1p(Math.expm1(((1.0 / h) / l))));
} else {
tmp = (d / Math.sqrt(h)) / Math.sqrt(l);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -6.5e-190: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif l <= -2e-310: tmp = d * math.sqrt(math.log1p(math.expm1(((1.0 / h) / l)))) else: tmp = (d / math.sqrt(h)) / math.sqrt(l) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -6.5e-190) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (l <= -2e-310) tmp = Float64(d * sqrt(log1p(expm1(Float64(Float64(1.0 / h) / l))))); else tmp = Float64(Float64(d / sqrt(h)) / sqrt(l)); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -6.5e-190], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-310], N[(d * N[Sqrt[N[Log[1 + N[(Exp[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.5 \cdot 10^{-190}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\frac{1}{h}}{\ell}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -6.4999999999999997e-190Initial program 66.5%
Simplified65.4%
Taylor expanded in M around 0 50.4%
if -6.4999999999999997e-190 < l < -1.999999999999994e-310Initial program 83.5%
Simplified79.0%
Taylor expanded in d around inf 27.1%
log1p-expm1-u62.9%
associate-/r*62.9%
Applied egg-rr62.9%
if -1.999999999999994e-310 < l Initial program 61.1%
Simplified60.5%
Taylor expanded in d around inf 38.0%
sqrt-div38.2%
metadata-eval38.2%
*-commutative38.2%
sqrt-unprod41.8%
div-inv41.8%
sqrt-unprod38.2%
*-commutative38.2%
Applied egg-rr38.2%
*-un-lft-identity38.2%
sqrt-prod41.8%
*-commutative41.8%
times-frac41.2%
Applied egg-rr41.2%
associate-*l/41.2%
*-lft-identity41.2%
Simplified41.2%
Final simplification46.4%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -3.4e-188)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= l -2e-310)
(* d (log (exp (pow (* h l) -0.5))))
(/ (/ d (sqrt h)) (sqrt l)))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -3.4e-188) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (l <= -2e-310) {
tmp = d * log(exp(pow((h * l), -0.5)));
} else {
tmp = (d / sqrt(h)) / sqrt(l);
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-3.4d-188)) then
tmp = sqrt((d / l)) * sqrt((d / h))
else if (l <= (-2d-310)) then
tmp = d * log(exp(((h * l) ** (-0.5d0))))
else
tmp = (d / sqrt(h)) / sqrt(l)
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -3.4e-188) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (l <= -2e-310) {
tmp = d * Math.log(Math.exp(Math.pow((h * l), -0.5)));
} else {
tmp = (d / Math.sqrt(h)) / Math.sqrt(l);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -3.4e-188: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif l <= -2e-310: tmp = d * math.log(math.exp(math.pow((h * l), -0.5))) else: tmp = (d / math.sqrt(h)) / math.sqrt(l) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -3.4e-188) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (l <= -2e-310) tmp = Float64(d * log(exp((Float64(h * l) ^ -0.5)))); else tmp = Float64(Float64(d / sqrt(h)) / sqrt(l)); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= -3.4e-188)
tmp = sqrt((d / l)) * sqrt((d / h));
elseif (l <= -2e-310)
tmp = d * log(exp(((h * l) ^ -0.5)));
else
tmp = (d / sqrt(h)) / sqrt(l);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -3.4e-188], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-310], N[(d * N[Log[N[Exp[N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.4 \cdot 10^{-188}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \log \left(e^{{\left(h \cdot \ell\right)}^{-0.5}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -3.40000000000000027e-188Initial program 66.5%
Simplified65.4%
Taylor expanded in M around 0 50.4%
if -3.40000000000000027e-188 < l < -1.999999999999994e-310Initial program 83.5%
Simplified79.0%
Taylor expanded in d around inf 27.1%
add-log-exp58.7%
inv-pow58.7%
sqrt-pow158.7%
metadata-eval58.7%
Applied egg-rr58.7%
if -1.999999999999994e-310 < l Initial program 61.1%
Simplified60.5%
Taylor expanded in d around inf 38.0%
sqrt-div38.2%
metadata-eval38.2%
*-commutative38.2%
sqrt-unprod41.8%
div-inv41.8%
sqrt-unprod38.2%
*-commutative38.2%
Applied egg-rr38.2%
*-un-lft-identity38.2%
sqrt-prod41.8%
*-commutative41.8%
times-frac41.2%
Applied egg-rr41.2%
associate-*l/41.2%
*-lft-identity41.2%
Simplified41.2%
Final simplification46.0%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -4.3e-190)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= l -2e-310)
(log1p (expm1 (/ d (sqrt (* h l)))))
(/ (/ d (sqrt h)) (sqrt l)))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -4.3e-190) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (l <= -2e-310) {
tmp = log1p(expm1((d / sqrt((h * l)))));
} else {
tmp = (d / sqrt(h)) / sqrt(l);
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -4.3e-190) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (l <= -2e-310) {
tmp = Math.log1p(Math.expm1((d / Math.sqrt((h * l)))));
} else {
tmp = (d / Math.sqrt(h)) / Math.sqrt(l);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -4.3e-190: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif l <= -2e-310: tmp = math.log1p(math.expm1((d / math.sqrt((h * l))))) else: tmp = (d / math.sqrt(h)) / math.sqrt(l) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -4.3e-190) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (l <= -2e-310) tmp = log1p(expm1(Float64(d / sqrt(Float64(h * l))))); else tmp = Float64(Float64(d / sqrt(h)) / sqrt(l)); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -4.3e-190], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-310], N[Log[1 + N[(Exp[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.3 \cdot 10^{-190}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{d}{\sqrt{h \cdot \ell}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.3e-190Initial program 66.5%
Simplified65.4%
Taylor expanded in M around 0 50.4%
if -4.3e-190 < l < -1.999999999999994e-310Initial program 83.5%
Simplified79.0%
Taylor expanded in d around inf 27.1%
pow127.1%
metadata-eval27.1%
sqrt-pow15.2%
sqrt-prod5.2%
div-inv5.2%
log1p-expm1-u5.1%
sqrt-div5.1%
sqrt-pow154.9%
metadata-eval54.9%
pow154.9%
Applied egg-rr54.9%
if -1.999999999999994e-310 < l Initial program 61.1%
Simplified60.5%
Taylor expanded in d around inf 38.0%
sqrt-div38.2%
metadata-eval38.2%
*-commutative38.2%
sqrt-unprod41.8%
div-inv41.8%
sqrt-unprod38.2%
*-commutative38.2%
Applied egg-rr38.2%
*-un-lft-identity38.2%
sqrt-prod41.8%
*-commutative41.8%
times-frac41.2%
Applied egg-rr41.2%
associate-*l/41.2%
*-lft-identity41.2%
Simplified41.2%
Final simplification45.6%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -3.7e-190)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= l -2e-310)
(* d (pow (* h (* l (* h l))) -0.25))
(/ (/ d (sqrt h)) (sqrt l)))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -3.7e-190) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (l <= -2e-310) {
tmp = d * pow((h * (l * (h * l))), -0.25);
} else {
tmp = (d / sqrt(h)) / sqrt(l);
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-3.7d-190)) then
tmp = sqrt((d / l)) * sqrt((d / h))
else if (l <= (-2d-310)) then
tmp = d * ((h * (l * (h * l))) ** (-0.25d0))
else
tmp = (d / sqrt(h)) / sqrt(l)
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -3.7e-190) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (l <= -2e-310) {
tmp = d * Math.pow((h * (l * (h * l))), -0.25);
} else {
tmp = (d / Math.sqrt(h)) / Math.sqrt(l);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -3.7e-190: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif l <= -2e-310: tmp = d * math.pow((h * (l * (h * l))), -0.25) else: tmp = (d / math.sqrt(h)) / math.sqrt(l) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -3.7e-190) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (l <= -2e-310) tmp = Float64(d * (Float64(h * Float64(l * Float64(h * l))) ^ -0.25)); else tmp = Float64(Float64(d / sqrt(h)) / sqrt(l)); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= -3.7e-190)
tmp = sqrt((d / l)) * sqrt((d / h));
elseif (l <= -2e-310)
tmp = d * ((h * (l * (h * l))) ^ -0.25);
else
tmp = (d / sqrt(h)) / sqrt(l);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -3.7e-190], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-310], N[(d * N[Power[N[(h * N[(l * N[(h * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.25], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.7 \cdot 10^{-190}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;d \cdot {\left(h \cdot \left(\ell \cdot \left(h \cdot \ell\right)\right)\right)}^{-0.25}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -3.7000000000000002e-190Initial program 66.5%
Simplified65.4%
Taylor expanded in M around 0 50.4%
if -3.7000000000000002e-190 < l < -1.999999999999994e-310Initial program 83.5%
Simplified79.0%
Taylor expanded in d around inf 27.1%
add-cbrt-cube31.0%
pow1/331.0%
add-sqr-sqrt31.0%
pow131.0%
pow1/231.0%
pow-prod-up31.0%
associate-/r*31.0%
metadata-eval31.0%
Applied egg-rr31.0%
unpow1/331.0%
associate-/r*31.0%
Simplified31.0%
pow1/331.0%
pow-pow27.1%
metadata-eval27.1%
pow1/227.1%
inv-pow27.1%
sqrt-pow123.2%
metadata-eval23.2%
sqr-pow23.2%
pow-prod-down35.1%
pow235.1%
metadata-eval35.1%
Applied egg-rr35.1%
unpow235.1%
*-commutative35.1%
associate-*r*46.9%
*-commutative46.9%
Applied egg-rr46.9%
if -1.999999999999994e-310 < l Initial program 61.1%
Simplified60.5%
Taylor expanded in d around inf 38.0%
sqrt-div38.2%
metadata-eval38.2%
*-commutative38.2%
sqrt-unprod41.8%
div-inv41.8%
sqrt-unprod38.2%
*-commutative38.2%
Applied egg-rr38.2%
*-un-lft-identity38.2%
sqrt-prod41.8%
*-commutative41.8%
times-frac41.2%
Applied egg-rr41.2%
associate-*l/41.2%
*-lft-identity41.2%
Simplified41.2%
Final simplification44.9%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -3.3e-190)
(fabs (/ d (sqrt (* h l))))
(if (<= l -2e-310)
(* d (pow (* h (* l (* h l))) -0.25))
(/ (/ d (sqrt h)) (sqrt l)))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -3.3e-190) {
tmp = fabs((d / sqrt((h * l))));
} else if (l <= -2e-310) {
tmp = d * pow((h * (l * (h * l))), -0.25);
} else {
tmp = (d / sqrt(h)) / sqrt(l);
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-3.3d-190)) then
tmp = abs((d / sqrt((h * l))))
else if (l <= (-2d-310)) then
tmp = d * ((h * (l * (h * l))) ** (-0.25d0))
else
tmp = (d / sqrt(h)) / sqrt(l)
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -3.3e-190) {
tmp = Math.abs((d / Math.sqrt((h * l))));
} else if (l <= -2e-310) {
tmp = d * Math.pow((h * (l * (h * l))), -0.25);
} else {
tmp = (d / Math.sqrt(h)) / Math.sqrt(l);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -3.3e-190: tmp = math.fabs((d / math.sqrt((h * l)))) elif l <= -2e-310: tmp = d * math.pow((h * (l * (h * l))), -0.25) else: tmp = (d / math.sqrt(h)) / math.sqrt(l) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -3.3e-190) tmp = abs(Float64(d / sqrt(Float64(h * l)))); elseif (l <= -2e-310) tmp = Float64(d * (Float64(h * Float64(l * Float64(h * l))) ^ -0.25)); else tmp = Float64(Float64(d / sqrt(h)) / sqrt(l)); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= -3.3e-190)
tmp = abs((d / sqrt((h * l))));
elseif (l <= -2e-310)
tmp = d * ((h * (l * (h * l))) ^ -0.25);
else
tmp = (d / sqrt(h)) / sqrt(l);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -3.3e-190], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, -2e-310], N[(d * N[Power[N[(h * N[(l * N[(h * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.25], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.3 \cdot 10^{-190}:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;d \cdot {\left(h \cdot \left(\ell \cdot \left(h \cdot \ell\right)\right)\right)}^{-0.25}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -3.30000000000000019e-190Initial program 66.5%
Simplified65.4%
Taylor expanded in d around inf 3.6%
sqrt-div3.7%
metadata-eval3.7%
*-commutative3.7%
sqrt-unprod0.0%
div-inv0.0%
add-sqr-sqrt0.0%
sqrt-prod0.0%
rem-sqrt-square0.0%
sqrt-unprod46.2%
*-commutative46.2%
Applied egg-rr46.2%
if -3.30000000000000019e-190 < l < -1.999999999999994e-310Initial program 83.5%
Simplified79.0%
Taylor expanded in d around inf 27.1%
add-cbrt-cube31.0%
pow1/331.0%
add-sqr-sqrt31.0%
pow131.0%
pow1/231.0%
pow-prod-up31.0%
associate-/r*31.0%
metadata-eval31.0%
Applied egg-rr31.0%
unpow1/331.0%
associate-/r*31.0%
Simplified31.0%
pow1/331.0%
pow-pow27.1%
metadata-eval27.1%
pow1/227.1%
inv-pow27.1%
sqrt-pow123.2%
metadata-eval23.2%
sqr-pow23.2%
pow-prod-down35.1%
pow235.1%
metadata-eval35.1%
Applied egg-rr35.1%
unpow235.1%
*-commutative35.1%
associate-*r*46.9%
*-commutative46.9%
Applied egg-rr46.9%
if -1.999999999999994e-310 < l Initial program 61.1%
Simplified60.5%
Taylor expanded in d around inf 38.0%
sqrt-div38.2%
metadata-eval38.2%
*-commutative38.2%
sqrt-unprod41.8%
div-inv41.8%
sqrt-unprod38.2%
*-commutative38.2%
Applied egg-rr38.2%
*-un-lft-identity38.2%
sqrt-prod41.8%
*-commutative41.8%
times-frac41.2%
Applied egg-rr41.2%
associate-*l/41.2%
*-lft-identity41.2%
Simplified41.2%
Final simplification43.5%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= M_m 5800000000.0) (fabs (/ d (sqrt (* h l)))) (* d (- (pow (* h l) -0.5)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (M_m <= 5800000000.0) {
tmp = fabs((d / sqrt((h * l))));
} else {
tmp = d * -pow((h * l), -0.5);
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (m_m <= 5800000000.0d0) then
tmp = abs((d / sqrt((h * l))))
else
tmp = d * -((h * l) ** (-0.5d0))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (M_m <= 5800000000.0) {
tmp = Math.abs((d / Math.sqrt((h * l))));
} else {
tmp = d * -Math.pow((h * l), -0.5);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if M_m <= 5800000000.0: tmp = math.fabs((d / math.sqrt((h * l)))) else: tmp = d * -math.pow((h * l), -0.5) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (M_m <= 5800000000.0) tmp = abs(Float64(d / sqrt(Float64(h * l)))); else tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (M_m <= 5800000000.0)
tmp = abs((d / sqrt((h * l))));
else
tmp = d * -((h * l) ^ -0.5);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[M$95$m, 5800000000.0], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;M\_m \leq 5800000000:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\end{array}
\end{array}
if M < 5.8e9Initial program 66.6%
Simplified65.6%
Taylor expanded in d around inf 31.4%
sqrt-div31.1%
metadata-eval31.1%
*-commutative31.1%
sqrt-unprod29.6%
div-inv29.7%
add-sqr-sqrt29.6%
sqrt-prod19.6%
rem-sqrt-square29.7%
sqrt-unprod48.3%
*-commutative48.3%
Applied egg-rr48.3%
if 5.8e9 < M Initial program 61.4%
Simplified60.1%
Taylor expanded in d around inf 10.5%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt16.3%
neg-mul-116.3%
distribute-lft-neg-in16.3%
distribute-rgt-neg-in16.3%
unpow-116.3%
metadata-eval16.3%
pow-sqr16.3%
rem-sqrt-square16.3%
rem-square-sqrt16.2%
fabs-sqr16.2%
rem-square-sqrt16.3%
Simplified16.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (pow (* h l) -0.5)))
(if (<= l -3.7e-190)
(* d (- t_0))
(if (<= l -2e-307) (* d (pow (* h (* l (* h l))) -0.25)) (* d t_0)))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = pow((h * l), -0.5);
double tmp;
if (l <= -3.7e-190) {
tmp = d * -t_0;
} else if (l <= -2e-307) {
tmp = d * pow((h * (l * (h * l))), -0.25);
} else {
tmp = d * t_0;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = (h * l) ** (-0.5d0)
if (l <= (-3.7d-190)) then
tmp = d * -t_0
else if (l <= (-2d-307)) then
tmp = d * ((h * (l * (h * l))) ** (-0.25d0))
else
tmp = d * t_0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.pow((h * l), -0.5);
double tmp;
if (l <= -3.7e-190) {
tmp = d * -t_0;
} else if (l <= -2e-307) {
tmp = d * Math.pow((h * (l * (h * l))), -0.25);
} else {
tmp = d * t_0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.pow((h * l), -0.5) tmp = 0 if l <= -3.7e-190: tmp = d * -t_0 elif l <= -2e-307: tmp = d * math.pow((h * (l * (h * l))), -0.25) else: tmp = d * t_0 return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(h * l) ^ -0.5 tmp = 0.0 if (l <= -3.7e-190) tmp = Float64(d * Float64(-t_0)); elseif (l <= -2e-307) tmp = Float64(d * (Float64(h * Float64(l * Float64(h * l))) ^ -0.25)); else tmp = Float64(d * t_0); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (h * l) ^ -0.5;
tmp = 0.0;
if (l <= -3.7e-190)
tmp = d * -t_0;
elseif (l <= -2e-307)
tmp = d * ((h * (l * (h * l))) ^ -0.25);
else
tmp = d * t_0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[l, -3.7e-190], N[(d * (-t$95$0)), $MachinePrecision], If[LessEqual[l, -2e-307], N[(d * N[Power[N[(h * N[(l * N[(h * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.25], $MachinePrecision]), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -3.7 \cdot 10^{-190}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-307}:\\
\;\;\;\;d \cdot {\left(h \cdot \left(\ell \cdot \left(h \cdot \ell\right)\right)\right)}^{-0.25}\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
\end{array}
if l < -3.7000000000000002e-190Initial program 66.5%
Simplified65.4%
Taylor expanded in d around inf 3.6%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt45.9%
neg-mul-145.9%
distribute-lft-neg-in45.9%
distribute-rgt-neg-in45.9%
unpow-145.9%
metadata-eval45.9%
pow-sqr45.9%
rem-sqrt-square46.2%
rem-square-sqrt46.0%
fabs-sqr46.0%
rem-square-sqrt46.2%
Simplified46.2%
if -3.7000000000000002e-190 < l < -1.99999999999999982e-307Initial program 87.1%
Simplified82.4%
Taylor expanded in d around inf 28.2%
add-cbrt-cube32.3%
pow1/332.3%
add-sqr-sqrt32.3%
pow132.3%
pow1/232.3%
pow-prod-up32.3%
associate-/r*32.3%
metadata-eval32.3%
Applied egg-rr32.3%
unpow1/332.3%
associate-/r*32.3%
Simplified32.3%
pow1/332.3%
pow-pow28.2%
metadata-eval28.2%
pow1/228.2%
inv-pow28.2%
sqrt-pow124.1%
metadata-eval24.1%
sqr-pow24.1%
pow-prod-down36.5%
pow236.5%
metadata-eval36.5%
Applied egg-rr36.5%
unpow236.5%
*-commutative36.5%
associate-*r*48.8%
*-commutative48.8%
Applied egg-rr48.8%
if -1.99999999999999982e-307 < l Initial program 60.7%
Simplified60.0%
add-sqr-sqrt27.4%
sqrt-unprod23.7%
*-commutative23.7%
*-commutative23.7%
swap-sqr23.7%
Applied egg-rr18.7%
Taylor expanded in h around 0 37.7%
unpow-137.7%
metadata-eval37.7%
pow-sqr37.7%
rem-sqrt-square38.0%
rem-square-sqrt37.8%
fabs-sqr37.8%
rem-square-sqrt38.0%
Simplified38.0%
Final simplification41.8%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= l -3.2e-190) (* d (- (pow (* h l) -0.5))) (* d (sqrt (/ 1.0 (* h l))))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -3.2e-190) {
tmp = d * -pow((h * l), -0.5);
} else {
tmp = d * sqrt((1.0 / (h * l)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-3.2d-190)) then
tmp = d * -((h * l) ** (-0.5d0))
else
tmp = d * sqrt((1.0d0 / (h * l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -3.2e-190) {
tmp = d * -Math.pow((h * l), -0.5);
} else {
tmp = d * Math.sqrt((1.0 / (h * l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -3.2e-190: tmp = d * -math.pow((h * l), -0.5) else: tmp = d * math.sqrt((1.0 / (h * l))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -3.2e-190) tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5))); else tmp = Float64(d * sqrt(Float64(1.0 / Float64(h * l)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= -3.2e-190)
tmp = d * -((h * l) ^ -0.5);
else
tmp = d * sqrt((1.0 / (h * l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -3.2e-190], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.2 \cdot 10^{-190}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\end{array}
\end{array}
if l < -3.2000000000000001e-190Initial program 66.5%
Simplified65.4%
Taylor expanded in d around inf 3.6%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt45.9%
neg-mul-145.9%
distribute-lft-neg-in45.9%
distribute-rgt-neg-in45.9%
unpow-145.9%
metadata-eval45.9%
pow-sqr45.9%
rem-sqrt-square46.2%
rem-square-sqrt46.0%
fabs-sqr46.0%
rem-square-sqrt46.2%
Simplified46.2%
if -3.2000000000000001e-190 < l Initial program 64.3%
Simplified63.1%
Taylor expanded in d around inf 36.4%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (let* ((t_0 (pow (* h l) -0.5))) (if (<= d -5.1e-263) (* d (- t_0)) (* d t_0))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = pow((h * l), -0.5);
double tmp;
if (d <= -5.1e-263) {
tmp = d * -t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = (h * l) ** (-0.5d0)
if (d <= (-5.1d-263)) then
tmp = d * -t_0
else
tmp = d * t_0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.pow((h * l), -0.5);
double tmp;
if (d <= -5.1e-263) {
tmp = d * -t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.pow((h * l), -0.5) tmp = 0 if d <= -5.1e-263: tmp = d * -t_0 else: tmp = d * t_0 return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(h * l) ^ -0.5 tmp = 0.0 if (d <= -5.1e-263) tmp = Float64(d * Float64(-t_0)); else tmp = Float64(d * t_0); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (h * l) ^ -0.5;
tmp = 0.0;
if (d <= -5.1e-263)
tmp = d * -t_0;
else
tmp = d * t_0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[d, -5.1e-263], N[(d * (-t$95$0)), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{if}\;d \leq -5.1 \cdot 10^{-263}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
\end{array}
if d < -5.09999999999999971e-263Initial program 76.8%
Simplified74.8%
Taylor expanded in d around inf 8.3%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt42.0%
neg-mul-142.0%
distribute-lft-neg-in42.0%
distribute-rgt-neg-in42.0%
unpow-142.0%
metadata-eval42.0%
pow-sqr42.0%
rem-sqrt-square42.2%
rem-square-sqrt42.0%
fabs-sqr42.0%
rem-square-sqrt42.2%
Simplified42.2%
if -5.09999999999999971e-263 < d Initial program 57.4%
Simplified56.8%
add-sqr-sqrt25.7%
sqrt-unprod22.2%
*-commutative22.2%
*-commutative22.2%
swap-sqr22.2%
Applied egg-rr17.5%
Taylor expanded in h around 0 36.1%
unpow-136.1%
metadata-eval36.1%
pow-sqr36.1%
rem-sqrt-square36.4%
rem-square-sqrt36.2%
fabs-sqr36.2%
rem-square-sqrt36.4%
Simplified36.4%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (* d (pow (* h l) -0.5)))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
return d * pow((h * l), -0.5);
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
code = d * ((h * l) ** (-0.5d0))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
return d * Math.pow((h * l), -0.5);
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): return d * math.pow((h * l), -0.5)
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) return Float64(d * (Float64(h * l) ^ -0.5)) end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp = code(d, h, l, M_m, D_m)
tmp = d * ((h * l) ^ -0.5);
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
d \cdot {\left(h \cdot \ell\right)}^{-0.5}
\end{array}
Initial program 65.1%
Simplified63.9%
add-sqr-sqrt34.4%
sqrt-unprod28.3%
*-commutative28.3%
*-commutative28.3%
swap-sqr28.3%
Applied egg-rr20.9%
Taylor expanded in h around 0 25.1%
unpow-125.1%
metadata-eval25.1%
pow-sqr25.2%
rem-sqrt-square25.0%
rem-square-sqrt24.8%
fabs-sqr24.8%
rem-square-sqrt25.0%
Simplified25.0%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (/ d (sqrt (* h l))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
return d / sqrt((h * l));
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
code = d / sqrt((h * l))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
return d / Math.sqrt((h * l));
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): return d / math.sqrt((h * l))
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) return Float64(d / sqrt(Float64(h * l))) end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp = code(d, h, l, M_m, D_m)
tmp = d / sqrt((h * l));
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Initial program 65.1%
Simplified63.9%
Taylor expanded in d around inf 25.1%
sqrt-div24.9%
metadata-eval24.9%
*-commutative24.9%
sqrt-unprod23.5%
div-inv23.5%
sqrt-unprod24.9%
*-commutative24.9%
Applied egg-rr24.9%
herbie shell --seed 2024108
(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)))))