
(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
(let* ((t_0 (pow (* D_m (/ M_m (/ d 0.5))) 2.0)) (t_1 (* (sqrt l) (sqrt h))))
(if (<= d -4e-310)
(*
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
(- 1.0 (* 0.5 (* h (/ t_0 l)))))
(if (<= d 1.7e-46)
(/
(* d (fma (pow (* D_m (* 0.5 (/ M_m d))) 2.0) (* -0.5 (/ h l)) 1.0))
t_1)
(* (fma h (/ -0.5 (/ l t_0)) 1.0) (/ d t_1))))))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((D_m * (M_m / (d / 0.5))), 2.0);
double t_1 = sqrt(l) * sqrt(h);
double tmp;
if (d <= -4e-310) {
tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * (1.0 - (0.5 * (h * (t_0 / l))));
} else if (d <= 1.7e-46) {
tmp = (d * fma(pow((D_m * (0.5 * (M_m / d))), 2.0), (-0.5 * (h / l)), 1.0)) / t_1;
} else {
tmp = fma(h, (-0.5 / (l / t_0)), 1.0) * (d / t_1);
}
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(D_m * Float64(M_m / Float64(d / 0.5))) ^ 2.0 t_1 = Float64(sqrt(l) * sqrt(h)) tmp = 0.0 if (d <= -4e-310) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_0 / l))))); elseif (d <= 1.7e-46) tmp = Float64(Float64(d * fma((Float64(D_m * Float64(0.5 * Float64(M_m / d))) ^ 2.0), Float64(-0.5 * Float64(h / l)), 1.0)) / t_1); else tmp = Float64(fma(h, Float64(-0.5 / Float64(l / t_0)), 1.0) * Float64(d / t_1)); 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[Power[N[(D$95$m * N[(M$95$m / N[(d / 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -4e-310], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.7e-46], N[(N[(d * 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]), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(h * N[(-0.5 / N[(l / t$95$0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / t$95$1), $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 := {\left(D_m \cdot \frac{M_m}{\frac{d}{0.5}}\right)}^{2}\\
t_1 := \sqrt{\ell} \cdot \sqrt{h}\\
\mathbf{if}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{t_0}{\ell}\right)\right)\\
\mathbf{elif}\;d \leq 1.7 \cdot 10^{-46}:\\
\;\;\;\;\frac{d \cdot \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)}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(h, \frac{-0.5}{\frac{\ell}{t_0}}, 1\right) \cdot \frac{d}{t_1}\\
\end{array}
\end{array}
if d < -3.999999999999988e-310Initial program 71.9%
Simplified72.7%
expm1-log1p-u72.4%
expm1-udef72.4%
*-commutative72.4%
frac-times71.7%
*-commutative71.7%
frac-times71.6%
div-inv71.6%
metadata-eval71.6%
Applied egg-rr71.6%
expm1-def71.6%
expm1-log1p71.8%
associate-*l/72.0%
*-commutative72.0%
associate-*l/72.8%
*-commutative72.8%
associate-*r/72.8%
associate-*l*72.8%
*-commutative72.8%
*-commutative72.8%
associate-*r/73.6%
associate-*l*73.6%
associate-*r/73.6%
*-commutative73.6%
associate-/l*73.6%
Simplified73.6%
frac-2neg73.6%
sqrt-div85.1%
Applied egg-rr85.1%
if -3.999999999999988e-310 < d < 1.69999999999999998e-46Initial program 43.3%
Simplified41.6%
sub-neg41.6%
distribute-rgt-in41.6%
*-un-lft-identity41.6%
sqrt-div45.0%
sqrt-div48.4%
frac-times48.4%
add-sqr-sqrt48.4%
Applied egg-rr56.3%
distribute-rgt1-in56.3%
+-commutative56.3%
associate-*r*56.3%
*-commutative56.3%
/-rgt-identity56.3%
associate-/l*56.3%
metadata-eval56.3%
times-frac61.8%
associate-*r/59.9%
*-commutative59.9%
Simplified59.9%
associate-*r/69.0%
+-commutative69.0%
*-commutative69.0%
fma-def69.0%
associate-*r/70.8%
*-commutative70.8%
metadata-eval70.8%
div-inv70.8%
associate-*r/69.0%
associate-/r/69.0%
sqrt-unprod51.2%
*-commutative51.2%
Applied egg-rr51.2%
sqrt-prod69.0%
Applied egg-rr69.0%
if 1.69999999999999998e-46 < d Initial program 76.2%
Simplified76.2%
sub-neg76.2%
distribute-rgt-in58.7%
*-un-lft-identity58.7%
sqrt-div58.7%
sqrt-div61.6%
frac-times61.7%
add-sqr-sqrt61.8%
Applied egg-rr71.9%
distribute-rgt1-in85.9%
Simplified94.1%
Final simplification84.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
(let* ((t_0 (* (sqrt l) (sqrt h))))
(if (<= d -1.35e-305)
(*
(sqrt (/ d h))
(*
(/ (sqrt (- d)) (sqrt (- l)))
(+ 1.0 (* (/ h l) (* -0.5 (pow (* (/ M_m 2.0) (/ D_m d)) 2.0))))))
(if (<= d 1.1e-54)
(/
(* d (fma (pow (* D_m (* 0.5 (/ M_m d))) 2.0) (* -0.5 (/ h l)) 1.0))
t_0)
(*
(fma h (/ -0.5 (/ l (pow (* D_m (/ M_m (/ d 0.5))) 2.0))) 1.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 = sqrt(l) * sqrt(h);
double tmp;
if (d <= -1.35e-305) {
tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0 + ((h / l) * (-0.5 * pow(((M_m / 2.0) * (D_m / d)), 2.0)))));
} else if (d <= 1.1e-54) {
tmp = (d * fma(pow((D_m * (0.5 * (M_m / d))), 2.0), (-0.5 * (h / l)), 1.0)) / t_0;
} else {
tmp = fma(h, (-0.5 / (l / pow((D_m * (M_m / (d / 0.5))), 2.0))), 1.0) * (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(sqrt(l) * sqrt(h)) tmp = 0.0 if (d <= -1.35e-305) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0)))))); elseif (d <= 1.1e-54) tmp = Float64(Float64(d * fma((Float64(D_m * Float64(0.5 * Float64(M_m / d))) ^ 2.0), Float64(-0.5 * Float64(h / l)), 1.0)) / t_0); else tmp = Float64(fma(h, Float64(-0.5 / Float64(l / (Float64(D_m * Float64(M_m / Float64(d / 0.5))) ^ 2.0))), 1.0) * Float64(d / t_0)); 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[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.35e-305], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.1e-54], N[(N[(d * 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]), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(h * N[(-0.5 / N[(l / N[Power[N[(D$95$m * N[(M$95$m / N[(d / 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / t$95$0), $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 := \sqrt{\ell} \cdot \sqrt{h}\\
\mathbf{if}\;d \leq -1.35 \cdot 10^{-305}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M_m}{2} \cdot \frac{D_m}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{elif}\;d \leq 1.1 \cdot 10^{-54}:\\
\;\;\;\;\frac{d \cdot \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)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(h, \frac{-0.5}{\frac{\ell}{{\left(D_m \cdot \frac{M_m}{\frac{d}{0.5}}\right)}^{2}}}, 1\right) \cdot \frac{d}{t_0}\\
\end{array}
\end{array}
if d < -1.35e-305Initial program 72.5%
Simplified72.4%
frac-2neg72.4%
sqrt-div75.7%
Applied egg-rr75.7%
if -1.35e-305 < d < 1.1e-54Initial program 42.5%
Simplified40.8%
sub-neg40.8%
distribute-rgt-in40.8%
*-un-lft-identity40.8%
sqrt-div44.2%
sqrt-div47.5%
frac-times47.5%
add-sqr-sqrt47.5%
Applied egg-rr55.3%
distribute-rgt1-in55.3%
+-commutative55.3%
associate-*r*55.3%
*-commutative55.3%
/-rgt-identity55.3%
associate-/l*55.3%
metadata-eval55.3%
times-frac60.6%
associate-*r/58.8%
*-commutative58.8%
Simplified58.8%
associate-*r/67.8%
+-commutative67.8%
*-commutative67.8%
fma-def67.8%
associate-*r/69.5%
*-commutative69.5%
metadata-eval69.5%
div-inv69.5%
associate-*r/67.8%
associate-/r/67.8%
sqrt-unprod50.3%
*-commutative50.3%
Applied egg-rr50.3%
sqrt-prod67.8%
Applied egg-rr67.8%
if 1.1e-54 < d Initial program 76.2%
Simplified76.2%
sub-neg76.2%
distribute-rgt-in58.7%
*-un-lft-identity58.7%
sqrt-div58.7%
sqrt-div61.6%
frac-times61.7%
add-sqr-sqrt61.8%
Applied egg-rr71.9%
distribute-rgt1-in85.9%
Simplified94.1%
Final simplification79.7%
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 (* (sqrt l) (sqrt h))))
(if (<= d -1.35e-305)
(*
(sqrt (/ d h))
(*
(/ (sqrt (- d)) (sqrt (- l)))
(+ 1.0 (* h (/ (* -0.5 (pow (* D_m (/ M_m (* d 2.0))) 2.0)) l)))))
(if (<= d 1.4e-48)
(/
(* d (fma (pow (* D_m (* 0.5 (/ M_m d))) 2.0) (* -0.5 (/ h l)) 1.0))
t_0)
(*
(fma h (/ -0.5 (/ l (pow (* D_m (/ M_m (/ d 0.5))) 2.0))) 1.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 = sqrt(l) * sqrt(h);
double tmp;
if (d <= -1.35e-305) {
tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0 + (h * ((-0.5 * pow((D_m * (M_m / (d * 2.0))), 2.0)) / l))));
} else if (d <= 1.4e-48) {
tmp = (d * fma(pow((D_m * (0.5 * (M_m / d))), 2.0), (-0.5 * (h / l)), 1.0)) / t_0;
} else {
tmp = fma(h, (-0.5 / (l / pow((D_m * (M_m / (d / 0.5))), 2.0))), 1.0) * (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(sqrt(l) * sqrt(h)) tmp = 0.0 if (d <= -1.35e-305) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(D_m * Float64(M_m / Float64(d * 2.0))) ^ 2.0)) / l))))); elseif (d <= 1.4e-48) tmp = Float64(Float64(d * fma((Float64(D_m * Float64(0.5 * Float64(M_m / d))) ^ 2.0), Float64(-0.5 * Float64(h / l)), 1.0)) / t_0); else tmp = Float64(fma(h, Float64(-0.5 / Float64(l / (Float64(D_m * Float64(M_m / Float64(d / 0.5))) ^ 2.0))), 1.0) * Float64(d / t_0)); 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[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.35e-305], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(D$95$m * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.4e-48], N[(N[(d * 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]), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(h * N[(-0.5 / N[(l / N[Power[N[(D$95$m * N[(M$95$m / N[(d / 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / t$95$0), $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 := \sqrt{\ell} \cdot \sqrt{h}\\
\mathbf{if}\;d \leq -1.35 \cdot 10^{-305}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 + h \cdot \frac{-0.5 \cdot {\left(D_m \cdot \frac{M_m}{d \cdot 2}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{elif}\;d \leq 1.4 \cdot 10^{-48}:\\
\;\;\;\;\frac{d \cdot \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)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(h, \frac{-0.5}{\frac{\ell}{{\left(D_m \cdot \frac{M_m}{\frac{d}{0.5}}\right)}^{2}}}, 1\right) \cdot \frac{d}{t_0}\\
\end{array}
\end{array}
if d < -1.35e-305Initial program 72.5%
Simplified72.4%
frac-2neg72.4%
sqrt-div75.7%
Applied egg-rr75.7%
*-commutative73.4%
clear-num73.4%
un-div-inv73.5%
*-commutative73.5%
div-inv73.5%
metadata-eval73.5%
Applied egg-rr75.7%
associate-/r/74.4%
*-commutative74.4%
/-rgt-identity74.4%
associate-/l*74.4%
metadata-eval74.4%
times-frac74.4%
associate-*r/75.2%
*-commutative75.2%
Simplified82.2%
if -1.35e-305 < d < 1.40000000000000002e-48Initial program 42.5%
Simplified40.8%
sub-neg40.8%
distribute-rgt-in40.8%
*-un-lft-identity40.8%
sqrt-div44.2%
sqrt-div47.5%
frac-times47.5%
add-sqr-sqrt47.5%
Applied egg-rr55.3%
distribute-rgt1-in55.3%
+-commutative55.3%
associate-*r*55.3%
*-commutative55.3%
/-rgt-identity55.3%
associate-/l*55.3%
metadata-eval55.3%
times-frac60.6%
associate-*r/58.8%
*-commutative58.8%
Simplified58.8%
associate-*r/67.8%
+-commutative67.8%
*-commutative67.8%
fma-def67.8%
associate-*r/69.5%
*-commutative69.5%
metadata-eval69.5%
div-inv69.5%
associate-*r/67.8%
associate-/r/67.8%
sqrt-unprod50.3%
*-commutative50.3%
Applied egg-rr50.3%
sqrt-prod67.8%
Applied egg-rr67.8%
if 1.40000000000000002e-48 < d Initial program 76.2%
Simplified76.2%
sub-neg76.2%
distribute-rgt-in58.7%
*-un-lft-identity58.7%
sqrt-div58.7%
sqrt-div61.6%
frac-times61.7%
add-sqr-sqrt61.8%
Applied egg-rr71.9%
distribute-rgt1-in85.9%
Simplified94.1%
Final simplification82.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
(let* ((t_0 (* (sqrt l) (sqrt h))))
(if (<= d -7.8e-296)
(*
(/ 1.0 (sqrt (/ h d)))
(*
(sqrt (/ d l))
(+ 1.0 (* h (/ (* -0.5 (pow (* D_m (/ M_m (* d 2.0))) 2.0)) l)))))
(if (<= d 1.8e-56)
(/
(* d (fma (pow (* D_m (* 0.5 (/ M_m d))) 2.0) (* -0.5 (/ h l)) 1.0))
t_0)
(*
(fma h (/ -0.5 (/ l (pow (* D_m (/ M_m (/ d 0.5))) 2.0))) 1.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 = sqrt(l) * sqrt(h);
double tmp;
if (d <= -7.8e-296) {
tmp = (1.0 / sqrt((h / d))) * (sqrt((d / l)) * (1.0 + (h * ((-0.5 * pow((D_m * (M_m / (d * 2.0))), 2.0)) / l))));
} else if (d <= 1.8e-56) {
tmp = (d * fma(pow((D_m * (0.5 * (M_m / d))), 2.0), (-0.5 * (h / l)), 1.0)) / t_0;
} else {
tmp = fma(h, (-0.5 / (l / pow((D_m * (M_m / (d / 0.5))), 2.0))), 1.0) * (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(sqrt(l) * sqrt(h)) tmp = 0.0 if (d <= -7.8e-296) tmp = Float64(Float64(1.0 / sqrt(Float64(h / d))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(D_m * Float64(M_m / Float64(d * 2.0))) ^ 2.0)) / l))))); elseif (d <= 1.8e-56) tmp = Float64(Float64(d * fma((Float64(D_m * Float64(0.5 * Float64(M_m / d))) ^ 2.0), Float64(-0.5 * Float64(h / l)), 1.0)) / t_0); else tmp = Float64(fma(h, Float64(-0.5 / Float64(l / (Float64(D_m * Float64(M_m / Float64(d / 0.5))) ^ 2.0))), 1.0) * Float64(d / t_0)); 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[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -7.8e-296], N[(N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(D$95$m * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.8e-56], N[(N[(d * 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]), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(h * N[(-0.5 / N[(l / N[Power[N[(D$95$m * N[(M$95$m / N[(d / 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / t$95$0), $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 := \sqrt{\ell} \cdot \sqrt{h}\\
\mathbf{if}\;d \leq -7.8 \cdot 10^{-296}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{h}{d}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{-0.5 \cdot {\left(D_m \cdot \frac{M_m}{d \cdot 2}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{elif}\;d \leq 1.8 \cdot 10^{-56}:\\
\;\;\;\;\frac{d \cdot \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)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(h, \frac{-0.5}{\frac{\ell}{{\left(D_m \cdot \frac{M_m}{\frac{d}{0.5}}\right)}^{2}}}, 1\right) \cdot \frac{d}{t_0}\\
\end{array}
\end{array}
if d < -7.80000000000000021e-296Initial program 73.7%
Simplified73.6%
clear-num72.8%
sqrt-div74.6%
metadata-eval74.6%
Applied egg-rr74.6%
*-commutative74.6%
clear-num74.6%
un-div-inv74.7%
*-commutative74.7%
div-inv74.7%
metadata-eval74.7%
Applied egg-rr74.7%
associate-/r/75.6%
*-commutative75.6%
/-rgt-identity75.6%
associate-/l*75.6%
metadata-eval75.6%
times-frac75.7%
associate-*r/76.5%
*-commutative76.5%
Simplified76.5%
if -7.80000000000000021e-296 < d < 1.79999999999999989e-56Initial program 41.0%
Simplified39.4%
sub-neg39.4%
distribute-rgt-in39.4%
*-un-lft-identity39.4%
sqrt-div42.6%
sqrt-div45.8%
frac-times45.8%
add-sqr-sqrt45.9%
Applied egg-rr53.3%
distribute-rgt1-in53.3%
+-commutative53.3%
associate-*r*53.3%
*-commutative53.3%
/-rgt-identity53.3%
associate-/l*53.3%
metadata-eval53.3%
times-frac58.5%
associate-*r/56.8%
*-commutative56.8%
Simplified56.8%
associate-*r/65.4%
+-commutative65.4%
*-commutative65.4%
fma-def65.4%
associate-*r/67.1%
*-commutative67.1%
metadata-eval67.1%
div-inv67.1%
associate-*r/65.4%
associate-/r/65.4%
sqrt-unprod48.5%
*-commutative48.5%
Applied egg-rr48.5%
sqrt-prod65.4%
Applied egg-rr65.4%
if 1.79999999999999989e-56 < d Initial program 76.2%
Simplified76.2%
sub-neg76.2%
distribute-rgt-in58.7%
*-un-lft-identity58.7%
sqrt-div58.7%
sqrt-div61.6%
frac-times61.7%
add-sqr-sqrt61.8%
Applied egg-rr71.9%
distribute-rgt1-in85.9%
Simplified94.1%
Final simplification79.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 (<= d -7.8e-296)
(*
(/ 1.0 (sqrt (/ h d)))
(*
(sqrt (/ d l))
(+ 1.0 (* h (/ (* -0.5 (pow (* D_m (/ M_m (* d 2.0))) 2.0)) l)))))
(*
(fma h (/ -0.5 (/ l (pow (* D_m (/ M_m (/ d 0.5))) 2.0))) 1.0)
(/ d (* (sqrt l) (sqrt h))))))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 <= -7.8e-296) {
tmp = (1.0 / sqrt((h / d))) * (sqrt((d / l)) * (1.0 + (h * ((-0.5 * pow((D_m * (M_m / (d * 2.0))), 2.0)) / l))));
} else {
tmp = fma(h, (-0.5 / (l / pow((D_m * (M_m / (d / 0.5))), 2.0))), 1.0) * (d / (sqrt(l) * sqrt(h)));
}
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 <= -7.8e-296) tmp = Float64(Float64(1.0 / sqrt(Float64(h / d))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(D_m * Float64(M_m / Float64(d * 2.0))) ^ 2.0)) / l))))); else tmp = Float64(fma(h, Float64(-0.5 / Float64(l / (Float64(D_m * Float64(M_m / Float64(d / 0.5))) ^ 2.0))), 1.0) * Float64(d / Float64(sqrt(l) * sqrt(h)))); 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, -7.8e-296], N[(N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(D$95$m * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(h * N[(-0.5 / N[(l / N[Power[N[(D$95$m * N[(M$95$m / N[(d / 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $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}\;d \leq -7.8 \cdot 10^{-296}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{h}{d}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{-0.5 \cdot {\left(D_m \cdot \frac{M_m}{d \cdot 2}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(h, \frac{-0.5}{\frac{\ell}{{\left(D_m \cdot \frac{M_m}{\frac{d}{0.5}}\right)}^{2}}}, 1\right) \cdot \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -7.80000000000000021e-296Initial program 73.7%
Simplified73.6%
clear-num72.8%
sqrt-div74.6%
metadata-eval74.6%
Applied egg-rr74.6%
*-commutative74.6%
clear-num74.6%
un-div-inv74.7%
*-commutative74.7%
div-inv74.7%
metadata-eval74.7%
Applied egg-rr74.7%
associate-/r/75.6%
*-commutative75.6%
/-rgt-identity75.6%
associate-/l*75.6%
metadata-eval75.6%
times-frac75.7%
associate-*r/76.5%
*-commutative76.5%
Simplified76.5%
if -7.80000000000000021e-296 < d Initial program 61.4%
Simplified60.8%
sub-neg60.8%
distribute-rgt-in50.6%
*-un-lft-identity50.6%
sqrt-div52.0%
sqrt-div55.0%
frac-times55.1%
add-sqr-sqrt55.1%
Applied egg-rr64.1%
distribute-rgt1-in72.2%
Simplified77.9%
Final simplification77.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 (<= l -2.05e+77)
(* (- d) (pow (* h l) -0.5))
(if (<= l -5e-310)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(+ 1.0 (* (/ h l) (* -0.5 (pow (* (/ M_m 2.0) (/ D_m d)) 2.0))))))
(*
(/ d (* (sqrt l) (sqrt h)))
(+ 1.0 (* (* -0.5 (/ h l)) (pow (/ (* D_m M_m) (* d 2.0)) 2.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 tmp;
if (l <= -2.05e+77) {
tmp = -d * pow((h * l), -0.5);
} else if (l <= -5e-310) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * pow(((M_m / 2.0) * (D_m / d)), 2.0)))));
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * pow(((D_m * M_m) / (d * 2.0)), 2.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) :: tmp
if (l <= (-2.05d+77)) then
tmp = -d * ((h * l) ** (-0.5d0))
else if (l <= (-5d-310)) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 + ((h / l) * ((-0.5d0) * (((m_m / 2.0d0) * (d_m / d)) ** 2.0d0)))))
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 + (((-0.5d0) * (h / l)) * (((d_m * m_m) / (d * 2.0d0)) ** 2.0d0)))
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 <= -2.05e+77) {
tmp = -d * Math.pow((h * l), -0.5);
} else if (l <= -5e-310) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * Math.pow(((M_m / 2.0) * (D_m / d)), 2.0)))));
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * Math.pow(((D_m * M_m) / (d * 2.0)), 2.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): tmp = 0 if l <= -2.05e+77: tmp = -d * math.pow((h * l), -0.5) elif l <= -5e-310: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * math.pow(((M_m / 2.0) * (D_m / d)), 2.0))))) else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * math.pow(((D_m * M_m) / (d * 2.0)), 2.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) tmp = 0.0 if (l <= -2.05e+77) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); elseif (l <= -5e-310) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0)))))); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 + Float64(Float64(-0.5 * Float64(h / l)) * (Float64(Float64(D_m * M_m) / Float64(d * 2.0)) ^ 2.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)
tmp = 0.0;
if (l <= -2.05e+77)
tmp = -d * ((h * l) ^ -0.5);
elseif (l <= -5e-310)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * (((M_m / 2.0) * (D_m / d)) ^ 2.0)))));
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * (((D_m * M_m) / (d * 2.0)) ^ 2.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_] := If[LessEqual[l, -2.05e+77], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $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 -2.05 \cdot 10^{+77}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M_m}{2} \cdot \frac{D_m}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 + \left(-0.5 \cdot \frac{h}{\ell}\right) \cdot {\left(\frac{D_m \cdot M_m}{d \cdot 2}\right)}^{2}\right)\\
\end{array}
\end{array}
if l < -2.05e77Initial program 52.6%
Simplified54.9%
add-sqr-sqrt47.5%
sqrt-unprod39.5%
*-commutative39.5%
*-commutative39.5%
swap-sqr39.6%
Applied egg-rr30.2%
Simplified30.5%
Taylor expanded in d around -inf 62.3%
mul-1-neg62.3%
*-commutative62.3%
distribute-rgt-neg-in62.3%
associate-/r*63.1%
unpow1/263.1%
associate-/l/62.3%
rem-exp-log58.6%
exp-neg58.6%
exp-prod58.6%
distribute-lft-neg-out58.6%
distribute-rgt-neg-in58.6%
metadata-eval58.6%
exp-to-pow62.5%
Simplified62.5%
if -2.05e77 < l < -4.999999999999985e-310Initial program 81.9%
Simplified81.9%
if -4.999999999999985e-310 < l Initial program 62.8%
Simplified62.1%
sub-neg62.1%
distribute-rgt-in51.7%
*-un-lft-identity51.7%
sqrt-div53.1%
sqrt-div56.3%
frac-times56.3%
add-sqr-sqrt56.4%
Applied egg-rr65.6%
distribute-rgt1-in73.8%
+-commutative73.8%
associate-*r*73.8%
*-commutative73.8%
/-rgt-identity73.8%
associate-/l*73.8%
metadata-eval73.8%
times-frac76.0%
associate-*r/75.3%
*-commutative75.3%
Simplified75.3%
associate-*r/76.0%
Applied egg-rr76.0%
Final simplification75.7%
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-240)
(*
(/ 1.0 (sqrt (/ h d)))
(*
(sqrt (/ d l))
(+ 1.0 (* h (/ (* -0.5 (pow (* D_m (/ M_m (* d 2.0))) 2.0)) l)))))
(*
(/ d (* (sqrt l) (sqrt h)))
(+ 1.0 (* (* -0.5 (/ h l)) (pow (/ (* D_m M_m) (* d 2.0)) 2.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 tmp;
if (l <= 3.8e-240) {
tmp = (1.0 / sqrt((h / d))) * (sqrt((d / l)) * (1.0 + (h * ((-0.5 * pow((D_m * (M_m / (d * 2.0))), 2.0)) / l))));
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * pow(((D_m * M_m) / (d * 2.0)), 2.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) :: tmp
if (l <= 3.8d-240) then
tmp = (1.0d0 / sqrt((h / d))) * (sqrt((d / l)) * (1.0d0 + (h * (((-0.5d0) * ((d_m * (m_m / (d * 2.0d0))) ** 2.0d0)) / l))))
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 + (((-0.5d0) * (h / l)) * (((d_m * m_m) / (d * 2.0d0)) ** 2.0d0)))
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.8e-240) {
tmp = (1.0 / Math.sqrt((h / d))) * (Math.sqrt((d / l)) * (1.0 + (h * ((-0.5 * Math.pow((D_m * (M_m / (d * 2.0))), 2.0)) / l))));
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * Math.pow(((D_m * M_m) / (d * 2.0)), 2.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): tmp = 0 if l <= 3.8e-240: tmp = (1.0 / math.sqrt((h / d))) * (math.sqrt((d / l)) * (1.0 + (h * ((-0.5 * math.pow((D_m * (M_m / (d * 2.0))), 2.0)) / l)))) else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * math.pow(((D_m * M_m) / (d * 2.0)), 2.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) tmp = 0.0 if (l <= 3.8e-240) tmp = Float64(Float64(1.0 / sqrt(Float64(h / d))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(D_m * Float64(M_m / Float64(d * 2.0))) ^ 2.0)) / l))))); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 + Float64(Float64(-0.5 * Float64(h / l)) * (Float64(Float64(D_m * M_m) / Float64(d * 2.0)) ^ 2.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)
tmp = 0.0;
if (l <= 3.8e-240)
tmp = (1.0 / sqrt((h / d))) * (sqrt((d / l)) * (1.0 + (h * ((-0.5 * ((D_m * (M_m / (d * 2.0))) ^ 2.0)) / l))));
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * (((D_m * M_m) / (d * 2.0)) ^ 2.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_] := If[LessEqual[l, 3.8e-240], N[(N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(D$95$m * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $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.8 \cdot 10^{-240}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{h}{d}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{-0.5 \cdot {\left(D_m \cdot \frac{M_m}{d \cdot 2}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 + \left(-0.5 \cdot \frac{h}{\ell}\right) \cdot {\left(\frac{D_m \cdot M_m}{d \cdot 2}\right)}^{2}\right)\\
\end{array}
\end{array}
if l < 3.79999999999999988e-240Initial program 70.6%
Simplified70.6%
clear-num69.8%
sqrt-div71.4%
metadata-eval71.4%
Applied egg-rr71.4%
*-commutative71.4%
clear-num71.4%
un-div-inv71.5%
*-commutative71.5%
div-inv71.5%
metadata-eval71.5%
Applied egg-rr71.5%
associate-/r/74.5%
*-commutative74.5%
/-rgt-identity74.5%
associate-/l*74.5%
metadata-eval74.5%
times-frac74.5%
associate-*r/75.1%
*-commutative75.1%
Simplified75.1%
if 3.79999999999999988e-240 < l Initial program 62.9%
Simplified63.0%
sub-neg63.0%
distribute-rgt-in54.6%
*-un-lft-identity54.6%
sqrt-div56.2%
sqrt-div58.9%
frac-times59.0%
add-sqr-sqrt59.1%
Applied egg-rr67.2%
distribute-rgt1-in74.1%
+-commutative74.1%
associate-*r*74.1%
*-commutative74.1%
/-rgt-identity74.1%
associate-/l*74.1%
metadata-eval74.1%
times-frac76.7%
associate-*r/76.6%
*-commutative76.6%
Simplified76.6%
associate-*r/76.7%
Applied egg-rr76.7%
Final simplification75.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 -5e+74)
(* (- d) (pow (* h l) -0.5))
(if (<= l 4.5e-240)
(*
(sqrt (* (/ d l) (/ d h)))
(- 1.0 (/ (* (pow (* (/ M_m 2.0) (/ D_m d)) 2.0) (* h 0.5)) l)))
(*
(/ d (* (sqrt l) (sqrt h)))
(+ 1.0 (* (* -0.5 (/ h l)) (pow (* D_m (/ M_m (* d 2.0))) 2.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 tmp;
if (l <= -5e+74) {
tmp = -d * pow((h * l), -0.5);
} else if (l <= 4.5e-240) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 - ((pow(((M_m / 2.0) * (D_m / d)), 2.0) * (h * 0.5)) / l));
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * pow((D_m * (M_m / (d * 2.0))), 2.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) :: tmp
if (l <= (-5d+74)) then
tmp = -d * ((h * l) ** (-0.5d0))
else if (l <= 4.5d-240) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - (((((m_m / 2.0d0) * (d_m / d)) ** 2.0d0) * (h * 0.5d0)) / l))
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 + (((-0.5d0) * (h / l)) * ((d_m * (m_m / (d * 2.0d0))) ** 2.0d0)))
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 <= -5e+74) {
tmp = -d * Math.pow((h * l), -0.5);
} else if (l <= 4.5e-240) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - ((Math.pow(((M_m / 2.0) * (D_m / d)), 2.0) * (h * 0.5)) / l));
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * Math.pow((D_m * (M_m / (d * 2.0))), 2.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): tmp = 0 if l <= -5e+74: tmp = -d * math.pow((h * l), -0.5) elif l <= 4.5e-240: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - ((math.pow(((M_m / 2.0) * (D_m / d)), 2.0) * (h * 0.5)) / l)) else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * math.pow((D_m * (M_m / (d * 2.0))), 2.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) tmp = 0.0 if (l <= -5e+74) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); elseif (l <= 4.5e-240) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(Float64((Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0) * Float64(h * 0.5)) / l))); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 + Float64(Float64(-0.5 * Float64(h / l)) * (Float64(D_m * Float64(M_m / Float64(d * 2.0))) ^ 2.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)
tmp = 0.0;
if (l <= -5e+74)
tmp = -d * ((h * l) ^ -0.5);
elseif (l <= 4.5e-240)
tmp = sqrt(((d / l) * (d / h))) * (1.0 - (((((M_m / 2.0) * (D_m / d)) ^ 2.0) * (h * 0.5)) / l));
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * ((D_m * (M_m / (d * 2.0))) ^ 2.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_] := If[LessEqual[l, -5e+74], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.5e-240], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * 0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(D$95$m * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $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 -5 \cdot 10^{+74}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{elif}\;\ell \leq 4.5 \cdot 10^{-240}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{{\left(\frac{M_m}{2} \cdot \frac{D_m}{d}\right)}^{2} \cdot \left(h \cdot 0.5\right)}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 + \left(-0.5 \cdot \frac{h}{\ell}\right) \cdot {\left(D_m \cdot \frac{M_m}{d \cdot 2}\right)}^{2}\right)\\
\end{array}
\end{array}
if l < -4.99999999999999963e74Initial program 52.6%
Simplified54.9%
add-sqr-sqrt47.5%
sqrt-unprod39.5%
*-commutative39.5%
*-commutative39.5%
swap-sqr39.6%
Applied egg-rr30.2%
Simplified30.5%
Taylor expanded in d around -inf 62.3%
mul-1-neg62.3%
*-commutative62.3%
distribute-rgt-neg-in62.3%
associate-/r*63.1%
unpow1/263.1%
associate-/l/62.3%
rem-exp-log58.6%
exp-neg58.6%
exp-prod58.6%
distribute-lft-neg-out58.6%
distribute-rgt-neg-in58.6%
metadata-eval58.6%
exp-to-pow62.5%
Simplified62.5%
if -4.99999999999999963e74 < l < 4.5000000000000001e-240Initial program 78.3%
Simplified77.3%
expm1-log1p-u77.1%
expm1-udef77.1%
*-commutative77.1%
frac-times78.0%
*-commutative78.0%
frac-times78.0%
div-inv78.0%
metadata-eval78.0%
Applied egg-rr78.0%
expm1-def78.0%
expm1-log1p78.2%
associate-*l/81.5%
*-commutative81.5%
associate-*l/81.5%
*-commutative81.5%
associate-*r/81.5%
associate-*l*81.5%
*-commutative81.5%
*-commutative81.5%
associate-*r/81.5%
associate-*l*81.5%
associate-*r/81.5%
*-commutative81.5%
associate-/l*81.5%
Simplified81.5%
expm1-log1p-u33.7%
expm1-udef29.0%
Applied egg-rr27.3%
expm1-def30.2%
expm1-log1p73.8%
associate-*r/74.7%
*-commutative74.7%
times-frac74.7%
Simplified74.7%
if 4.5000000000000001e-240 < l Initial program 62.9%
Simplified63.0%
sub-neg63.0%
distribute-rgt-in54.6%
*-un-lft-identity54.6%
sqrt-div56.2%
sqrt-div58.9%
frac-times59.0%
add-sqr-sqrt59.1%
Applied egg-rr67.2%
distribute-rgt1-in74.1%
+-commutative74.1%
associate-*r*74.1%
*-commutative74.1%
/-rgt-identity74.1%
associate-/l*74.1%
metadata-eval74.1%
times-frac76.7%
associate-*r/76.6%
*-commutative76.6%
Simplified76.6%
Final simplification73.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 -8.5e+73)
(* (- d) (pow (* h l) -0.5))
(if (<= l 1.2e-239)
(*
(sqrt (* (/ d l) (/ d h)))
(- 1.0 (/ (* (pow (* (/ M_m 2.0) (/ D_m d)) 2.0) (* h 0.5)) l)))
(*
(/ d (* (sqrt l) (sqrt h)))
(+ 1.0 (* (* -0.5 (/ h l)) (pow (/ (* D_m M_m) (* d 2.0)) 2.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 tmp;
if (l <= -8.5e+73) {
tmp = -d * pow((h * l), -0.5);
} else if (l <= 1.2e-239) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 - ((pow(((M_m / 2.0) * (D_m / d)), 2.0) * (h * 0.5)) / l));
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * pow(((D_m * M_m) / (d * 2.0)), 2.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) :: tmp
if (l <= (-8.5d+73)) then
tmp = -d * ((h * l) ** (-0.5d0))
else if (l <= 1.2d-239) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - (((((m_m / 2.0d0) * (d_m / d)) ** 2.0d0) * (h * 0.5d0)) / l))
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 + (((-0.5d0) * (h / l)) * (((d_m * m_m) / (d * 2.0d0)) ** 2.0d0)))
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 <= -8.5e+73) {
tmp = -d * Math.pow((h * l), -0.5);
} else if (l <= 1.2e-239) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - ((Math.pow(((M_m / 2.0) * (D_m / d)), 2.0) * (h * 0.5)) / l));
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * Math.pow(((D_m * M_m) / (d * 2.0)), 2.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): tmp = 0 if l <= -8.5e+73: tmp = -d * math.pow((h * l), -0.5) elif l <= 1.2e-239: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - ((math.pow(((M_m / 2.0) * (D_m / d)), 2.0) * (h * 0.5)) / l)) else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * math.pow(((D_m * M_m) / (d * 2.0)), 2.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) tmp = 0.0 if (l <= -8.5e+73) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); elseif (l <= 1.2e-239) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(Float64((Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0) * Float64(h * 0.5)) / l))); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 + Float64(Float64(-0.5 * Float64(h / l)) * (Float64(Float64(D_m * M_m) / Float64(d * 2.0)) ^ 2.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)
tmp = 0.0;
if (l <= -8.5e+73)
tmp = -d * ((h * l) ^ -0.5);
elseif (l <= 1.2e-239)
tmp = sqrt(((d / l) * (d / h))) * (1.0 - (((((M_m / 2.0) * (D_m / d)) ^ 2.0) * (h * 0.5)) / l));
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * (((D_m * M_m) / (d * 2.0)) ^ 2.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_] := If[LessEqual[l, -8.5e+73], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.2e-239], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * 0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $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 -8.5 \cdot 10^{+73}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{elif}\;\ell \leq 1.2 \cdot 10^{-239}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{{\left(\frac{M_m}{2} \cdot \frac{D_m}{d}\right)}^{2} \cdot \left(h \cdot 0.5\right)}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 + \left(-0.5 \cdot \frac{h}{\ell}\right) \cdot {\left(\frac{D_m \cdot M_m}{d \cdot 2}\right)}^{2}\right)\\
\end{array}
\end{array}
if l < -8.4999999999999998e73Initial program 52.6%
Simplified54.9%
add-sqr-sqrt47.5%
sqrt-unprod39.5%
*-commutative39.5%
*-commutative39.5%
swap-sqr39.6%
Applied egg-rr30.2%
Simplified30.5%
Taylor expanded in d around -inf 62.3%
mul-1-neg62.3%
*-commutative62.3%
distribute-rgt-neg-in62.3%
associate-/r*63.1%
unpow1/263.1%
associate-/l/62.3%
rem-exp-log58.6%
exp-neg58.6%
exp-prod58.6%
distribute-lft-neg-out58.6%
distribute-rgt-neg-in58.6%
metadata-eval58.6%
exp-to-pow62.5%
Simplified62.5%
if -8.4999999999999998e73 < l < 1.19999999999999996e-239Initial program 78.3%
Simplified77.3%
expm1-log1p-u77.1%
expm1-udef77.1%
*-commutative77.1%
frac-times78.0%
*-commutative78.0%
frac-times78.0%
div-inv78.0%
metadata-eval78.0%
Applied egg-rr78.0%
expm1-def78.0%
expm1-log1p78.2%
associate-*l/81.5%
*-commutative81.5%
associate-*l/81.5%
*-commutative81.5%
associate-*r/81.5%
associate-*l*81.5%
*-commutative81.5%
*-commutative81.5%
associate-*r/81.5%
associate-*l*81.5%
associate-*r/81.5%
*-commutative81.5%
associate-/l*81.5%
Simplified81.5%
expm1-log1p-u33.7%
expm1-udef29.0%
Applied egg-rr27.3%
expm1-def30.2%
expm1-log1p73.8%
associate-*r/74.7%
*-commutative74.7%
times-frac74.7%
Simplified74.7%
if 1.19999999999999996e-239 < l Initial program 62.9%
Simplified63.0%
sub-neg63.0%
distribute-rgt-in54.6%
*-un-lft-identity54.6%
sqrt-div56.2%
sqrt-div58.9%
frac-times59.0%
add-sqr-sqrt59.1%
Applied egg-rr67.2%
distribute-rgt1-in74.1%
+-commutative74.1%
associate-*r*74.1%
*-commutative74.1%
/-rgt-identity74.1%
associate-/l*74.1%
metadata-eval74.1%
times-frac76.7%
associate-*r/76.6%
*-commutative76.6%
Simplified76.6%
associate-*r/76.7%
Applied egg-rr76.7%
Final simplification73.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.8e-240)
(*
(- 1.0 (* 0.5 (* h (/ (pow (* D_m (/ M_m (/ d 0.5))) 2.0) l))))
(* (sqrt (/ d l)) (sqrt (/ d h))))
(*
(/ d (* (sqrt l) (sqrt h)))
(+ 1.0 (* (* -0.5 (/ h l)) (pow (/ (* D_m M_m) (* d 2.0)) 2.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 tmp;
if (l <= 3.8e-240) {
tmp = (1.0 - (0.5 * (h * (pow((D_m * (M_m / (d / 0.5))), 2.0) / l)))) * (sqrt((d / l)) * sqrt((d / h)));
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * pow(((D_m * M_m) / (d * 2.0)), 2.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) :: tmp
if (l <= 3.8d-240) then
tmp = (1.0d0 - (0.5d0 * (h * (((d_m * (m_m / (d / 0.5d0))) ** 2.0d0) / l)))) * (sqrt((d / l)) * sqrt((d / h)))
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 + (((-0.5d0) * (h / l)) * (((d_m * m_m) / (d * 2.0d0)) ** 2.0d0)))
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.8e-240) {
tmp = (1.0 - (0.5 * (h * (Math.pow((D_m * (M_m / (d / 0.5))), 2.0) / l)))) * (Math.sqrt((d / l)) * Math.sqrt((d / h)));
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * Math.pow(((D_m * M_m) / (d * 2.0)), 2.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): tmp = 0 if l <= 3.8e-240: tmp = (1.0 - (0.5 * (h * (math.pow((D_m * (M_m / (d / 0.5))), 2.0) / l)))) * (math.sqrt((d / l)) * math.sqrt((d / h))) else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * math.pow(((D_m * M_m) / (d * 2.0)), 2.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) tmp = 0.0 if (l <= 3.8e-240) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(D_m * Float64(M_m / Float64(d / 0.5))) ^ 2.0) / l)))) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)))); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 + Float64(Float64(-0.5 * Float64(h / l)) * (Float64(Float64(D_m * M_m) / Float64(d * 2.0)) ^ 2.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)
tmp = 0.0;
if (l <= 3.8e-240)
tmp = (1.0 - (0.5 * (h * (((D_m * (M_m / (d / 0.5))) ^ 2.0) / l)))) * (sqrt((d / l)) * sqrt((d / h)));
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * (((D_m * M_m) / (d * 2.0)) ^ 2.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_] := If[LessEqual[l, 3.8e-240], N[(N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(D$95$m * N[(M$95$m / N[(d / 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $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[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $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.8 \cdot 10^{-240}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(D_m \cdot \frac{M_m}{\frac{d}{0.5}}\right)}^{2}}{\ell}\right)\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 + \left(-0.5 \cdot \frac{h}{\ell}\right) \cdot {\left(\frac{D_m \cdot M_m}{d \cdot 2}\right)}^{2}\right)\\
\end{array}
\end{array}
if l < 3.79999999999999988e-240Initial program 70.6%
Simplified70.6%
expm1-log1p-u70.4%
expm1-udef70.4%
*-commutative70.4%
frac-times70.4%
*-commutative70.4%
frac-times70.3%
div-inv70.3%
metadata-eval70.3%
Applied egg-rr70.3%
expm1-def70.3%
expm1-log1p70.6%
associate-*l/73.5%
*-commutative73.5%
associate-*l/73.6%
*-commutative73.6%
associate-*r/73.6%
associate-*l*73.6%
*-commutative73.6%
*-commutative73.6%
associate-*r/74.3%
associate-*l*74.3%
associate-*r/74.3%
*-commutative74.3%
associate-/l*74.3%
Simplified74.3%
if 3.79999999999999988e-240 < l Initial program 62.9%
Simplified63.0%
sub-neg63.0%
distribute-rgt-in54.6%
*-un-lft-identity54.6%
sqrt-div56.2%
sqrt-div58.9%
frac-times59.0%
add-sqr-sqrt59.1%
Applied egg-rr67.2%
distribute-rgt1-in74.1%
+-commutative74.1%
associate-*r*74.1%
*-commutative74.1%
/-rgt-identity74.1%
associate-/l*74.1%
metadata-eval74.1%
times-frac76.7%
associate-*r/76.6%
*-commutative76.6%
Simplified76.6%
associate-*r/76.7%
Applied egg-rr76.7%
Final simplification75.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 -2.2e-78)
(* (- d) (pow (* h l) -0.5))
(if (<= l -6.4e-301)
(* d (exp (* (* 1.5 (- (log1p (+ (* h l) -1.0)))) 0.3333333333333333)))
(if (<= l 2.9e+104)
(*
(+ 1.0 (* (* -0.5 (/ h l)) (pow (* D_m (/ M_m (* d 2.0))) 2.0)))
(/ d (sqrt (* h l))))
(* d (* (pow l -0.5) (pow h -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 (l <= -2.2e-78) {
tmp = -d * pow((h * l), -0.5);
} else if (l <= -6.4e-301) {
tmp = d * exp(((1.5 * -log1p(((h * l) + -1.0))) * 0.3333333333333333));
} else if (l <= 2.9e+104) {
tmp = (1.0 + ((-0.5 * (h / l)) * pow((D_m * (M_m / (d * 2.0))), 2.0))) * (d / sqrt((h * l)));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
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 <= -2.2e-78) {
tmp = -d * Math.pow((h * l), -0.5);
} else if (l <= -6.4e-301) {
tmp = d * Math.exp(((1.5 * -Math.log1p(((h * l) + -1.0))) * 0.3333333333333333));
} else if (l <= 2.9e+104) {
tmp = (1.0 + ((-0.5 * (h / l)) * Math.pow((D_m * (M_m / (d * 2.0))), 2.0))) * (d / Math.sqrt((h * l)));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -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 l <= -2.2e-78: tmp = -d * math.pow((h * l), -0.5) elif l <= -6.4e-301: tmp = d * math.exp(((1.5 * -math.log1p(((h * l) + -1.0))) * 0.3333333333333333)) elif l <= 2.9e+104: tmp = (1.0 + ((-0.5 * (h / l)) * math.pow((D_m * (M_m / (d * 2.0))), 2.0))) * (d / math.sqrt((h * l))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -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 (l <= -2.2e-78) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); elseif (l <= -6.4e-301) tmp = Float64(d * exp(Float64(Float64(1.5 * Float64(-log1p(Float64(Float64(h * l) + -1.0)))) * 0.3333333333333333))); elseif (l <= 2.9e+104) tmp = Float64(Float64(1.0 + Float64(Float64(-0.5 * Float64(h / l)) * (Float64(D_m * Float64(M_m / Float64(d * 2.0))) ^ 2.0))) * Float64(d / sqrt(Float64(h * l)))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); 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, -2.2e-78], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -6.4e-301], N[(d * N[Exp[N[(N[(1.5 * (-N[Log[1 + N[(N[(h * l), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.9e+104], N[(N[(1.0 + N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(D$95$m * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \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 -2.2 \cdot 10^{-78}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{elif}\;\ell \leq -6.4 \cdot 10^{-301}:\\
\;\;\;\;d \cdot e^{\left(1.5 \cdot \left(-\mathsf{log1p}\left(h \cdot \ell + -1\right)\right)\right) \cdot 0.3333333333333333}\\
\mathbf{elif}\;\ell \leq 2.9 \cdot 10^{+104}:\\
\;\;\;\;\left(1 + \left(-0.5 \cdot \frac{h}{\ell}\right) \cdot {\left(D_m \cdot \frac{M_m}{d \cdot 2}\right)}^{2}\right) \cdot \frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -2.1999999999999999e-78Initial program 68.6%
Simplified69.9%
add-sqr-sqrt44.7%
sqrt-unprod36.8%
*-commutative36.8%
*-commutative36.8%
swap-sqr36.8%
Applied egg-rr29.2%
Simplified29.4%
Taylor expanded in d around -inf 54.4%
mul-1-neg54.4%
*-commutative54.4%
distribute-rgt-neg-in54.4%
associate-/r*54.9%
unpow1/254.9%
associate-/l/54.4%
rem-exp-log51.4%
exp-neg51.4%
exp-prod51.4%
distribute-lft-neg-out51.4%
distribute-rgt-neg-in51.4%
metadata-eval51.4%
exp-to-pow54.5%
Simplified54.5%
if -2.1999999999999999e-78 < l < -6.3999999999999998e-301Initial program 76.1%
Simplified76.1%
Taylor expanded in d around inf 19.5%
add-cbrt-cube26.0%
add-sqr-sqrt26.0%
pow126.0%
pow1/226.0%
pow-prod-up26.0%
associate-/r*26.0%
metadata-eval26.0%
Applied egg-rr26.0%
pow1/326.0%
pow-to-exp26.0%
pow-exp19.5%
rem-log-exp26.0%
pow-to-exp26.0%
log-pow19.5%
associate-/l/19.5%
log-rec17.4%
Applied egg-rr17.4%
log1p-expm1-u45.3%
expm1-udef45.3%
add-exp-log45.3%
*-commutative45.3%
Applied egg-rr45.3%
if -6.3999999999999998e-301 < l < 2.8999999999999998e104Initial program 72.5%
Simplified71.5%
sub-neg71.5%
distribute-rgt-in54.4%
*-un-lft-identity54.4%
sqrt-div56.4%
sqrt-div59.7%
frac-times59.7%
add-sqr-sqrt59.8%
Applied egg-rr71.9%
distribute-rgt1-in83.8%
+-commutative83.8%
associate-*r*83.8%
*-commutative83.8%
/-rgt-identity83.8%
associate-/l*83.8%
metadata-eval83.8%
times-frac86.0%
associate-*r/84.9%
*-commutative84.9%
Simplified84.9%
expm1-log1p-u84.0%
expm1-udef62.6%
sqrt-unprod59.7%
*-commutative59.7%
Applied egg-rr59.7%
expm1-def77.9%
expm1-log1p78.8%
Simplified78.8%
if 2.8999999999999998e104 < l Initial program 43.7%
Simplified43.8%
expm1-log1p-u43.3%
expm1-udef43.3%
*-commutative43.3%
frac-times43.3%
*-commutative43.3%
frac-times41.4%
div-inv41.4%
metadata-eval41.4%
Applied egg-rr41.4%
expm1-def41.4%
expm1-log1p41.6%
associate-*l/42.0%
*-commutative42.0%
associate-*l/44.3%
*-commutative44.3%
associate-*r/46.4%
associate-*l*46.4%
*-commutative46.4%
*-commutative46.4%
associate-*r/46.5%
associate-*l*46.5%
associate-*r/46.5%
*-commutative46.5%
associate-/l*46.5%
Simplified46.5%
Taylor expanded in d around inf 37.1%
associate-/r*38.4%
unpow1/238.4%
associate-/l/37.1%
rem-exp-log34.8%
exp-neg34.8%
exp-prod34.8%
distribute-lft-neg-out34.8%
distribute-rgt-neg-in34.8%
metadata-eval34.8%
exp-to-pow37.1%
Simplified37.1%
unpow-prod-down48.0%
Applied egg-rr48.0%
Final simplification60.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 (<= l -5.1e-77)
(* (- d) (pow (* h l) -0.5))
(if (<= l -6.4e-301)
(* d (exp (* (* 1.5 (- (log1p (+ (* h l) -1.0)))) 0.3333333333333333)))
(if (<= l 1.8e+104)
(/
(* d (+ 1.0 (* (* -0.5 (/ h l)) (pow (* 0.5 (* D_m (/ M_m d))) 2.0))))
(sqrt (* h l)))
(* d (* (pow l -0.5) (pow h -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 (l <= -5.1e-77) {
tmp = -d * pow((h * l), -0.5);
} else if (l <= -6.4e-301) {
tmp = d * exp(((1.5 * -log1p(((h * l) + -1.0))) * 0.3333333333333333));
} else if (l <= 1.8e+104) {
tmp = (d * (1.0 + ((-0.5 * (h / l)) * pow((0.5 * (D_m * (M_m / d))), 2.0)))) / sqrt((h * l));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
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 <= -5.1e-77) {
tmp = -d * Math.pow((h * l), -0.5);
} else if (l <= -6.4e-301) {
tmp = d * Math.exp(((1.5 * -Math.log1p(((h * l) + -1.0))) * 0.3333333333333333));
} else if (l <= 1.8e+104) {
tmp = (d * (1.0 + ((-0.5 * (h / l)) * Math.pow((0.5 * (D_m * (M_m / d))), 2.0)))) / Math.sqrt((h * l));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -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 l <= -5.1e-77: tmp = -d * math.pow((h * l), -0.5) elif l <= -6.4e-301: tmp = d * math.exp(((1.5 * -math.log1p(((h * l) + -1.0))) * 0.3333333333333333)) elif l <= 1.8e+104: tmp = (d * (1.0 + ((-0.5 * (h / l)) * math.pow((0.5 * (D_m * (M_m / d))), 2.0)))) / math.sqrt((h * l)) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -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 (l <= -5.1e-77) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); elseif (l <= -6.4e-301) tmp = Float64(d * exp(Float64(Float64(1.5 * Float64(-log1p(Float64(Float64(h * l) + -1.0)))) * 0.3333333333333333))); elseif (l <= 1.8e+104) tmp = Float64(Float64(d * Float64(1.0 + Float64(Float64(-0.5 * Float64(h / l)) * (Float64(0.5 * Float64(D_m * Float64(M_m / d))) ^ 2.0)))) / sqrt(Float64(h * l))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); 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, -5.1e-77], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -6.4e-301], N[(d * N[Exp[N[(N[(1.5 * (-N[Log[1 + N[(N[(h * l), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.8e+104], N[(N[(d * N[(1.0 + N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(0.5 * N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \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 -5.1 \cdot 10^{-77}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{elif}\;\ell \leq -6.4 \cdot 10^{-301}:\\
\;\;\;\;d \cdot e^{\left(1.5 \cdot \left(-\mathsf{log1p}\left(h \cdot \ell + -1\right)\right)\right) \cdot 0.3333333333333333}\\
\mathbf{elif}\;\ell \leq 1.8 \cdot 10^{+104}:\\
\;\;\;\;\frac{d \cdot \left(1 + \left(-0.5 \cdot \frac{h}{\ell}\right) \cdot {\left(0.5 \cdot \left(D_m \cdot \frac{M_m}{d}\right)\right)}^{2}\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -5.10000000000000032e-77Initial program 68.6%
Simplified69.9%
add-sqr-sqrt44.7%
sqrt-unprod36.8%
*-commutative36.8%
*-commutative36.8%
swap-sqr36.8%
Applied egg-rr29.2%
Simplified29.4%
Taylor expanded in d around -inf 54.4%
mul-1-neg54.4%
*-commutative54.4%
distribute-rgt-neg-in54.4%
associate-/r*54.9%
unpow1/254.9%
associate-/l/54.4%
rem-exp-log51.4%
exp-neg51.4%
exp-prod51.4%
distribute-lft-neg-out51.4%
distribute-rgt-neg-in51.4%
metadata-eval51.4%
exp-to-pow54.5%
Simplified54.5%
if -5.10000000000000032e-77 < l < -6.3999999999999998e-301Initial program 76.1%
Simplified76.1%
Taylor expanded in d around inf 19.5%
add-cbrt-cube26.0%
add-sqr-sqrt26.0%
pow126.0%
pow1/226.0%
pow-prod-up26.0%
associate-/r*26.0%
metadata-eval26.0%
Applied egg-rr26.0%
pow1/326.0%
pow-to-exp26.0%
pow-exp19.5%
rem-log-exp26.0%
pow-to-exp26.0%
log-pow19.5%
associate-/l/19.5%
log-rec17.4%
Applied egg-rr17.4%
log1p-expm1-u45.3%
expm1-udef45.3%
add-exp-log45.3%
*-commutative45.3%
Applied egg-rr45.3%
if -6.3999999999999998e-301 < l < 1.8e104Initial program 72.5%
Simplified71.5%
sub-neg71.5%
distribute-rgt-in54.4%
*-un-lft-identity54.4%
sqrt-div56.4%
sqrt-div59.7%
frac-times59.7%
add-sqr-sqrt59.8%
Applied egg-rr71.9%
distribute-rgt1-in83.8%
+-commutative83.8%
associate-*r*83.8%
*-commutative83.8%
/-rgt-identity83.8%
associate-/l*83.8%
metadata-eval83.8%
times-frac86.0%
associate-*r/84.9%
*-commutative84.9%
Simplified84.9%
associate-*r/84.9%
+-commutative84.9%
*-commutative84.9%
fma-def84.9%
associate-*r/86.0%
*-commutative86.0%
metadata-eval86.0%
div-inv86.0%
associate-*r/84.9%
associate-/r/84.9%
sqrt-unprod78.8%
*-commutative78.8%
Applied egg-rr78.8%
fma-udef78.8%
associate-*r*78.8%
*-commutative78.8%
Applied egg-rr78.8%
if 1.8e104 < l Initial program 43.7%
Simplified43.8%
expm1-log1p-u43.3%
expm1-udef43.3%
*-commutative43.3%
frac-times43.3%
*-commutative43.3%
frac-times41.4%
div-inv41.4%
metadata-eval41.4%
Applied egg-rr41.4%
expm1-def41.4%
expm1-log1p41.6%
associate-*l/42.0%
*-commutative42.0%
associate-*l/44.3%
*-commutative44.3%
associate-*r/46.4%
associate-*l*46.4%
*-commutative46.4%
*-commutative46.4%
associate-*r/46.5%
associate-*l*46.5%
associate-*r/46.5%
*-commutative46.5%
associate-/l*46.5%
Simplified46.5%
Taylor expanded in d around inf 37.1%
associate-/r*38.4%
unpow1/238.4%
associate-/l/37.1%
rem-exp-log34.8%
exp-neg34.8%
exp-prod34.8%
distribute-lft-neg-out34.8%
distribute-rgt-neg-in34.8%
metadata-eval34.8%
exp-to-pow37.1%
Simplified37.1%
unpow-prod-down48.0%
Applied egg-rr48.0%
Final simplification60.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 (<= l -1.75e+72)
(* (- d) (pow (* h l) -0.5))
(if (<= l 1.36e-276)
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* -0.5 (* (/ h l) (pow (/ (* M_m (* 0.5 D_m)) d) 2.0)))))
(if (<= l 8.6e+104)
(/
(* d (+ 1.0 (* (* -0.5 (/ h l)) (pow (* 0.5 (* D_m (/ M_m d))) 2.0))))
(sqrt (* h l)))
(* d (* (pow l -0.5) (pow h -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 (l <= -1.75e+72) {
tmp = -d * pow((h * l), -0.5);
} else if (l <= 1.36e-276) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * pow(((M_m * (0.5 * D_m)) / d), 2.0))));
} else if (l <= 8.6e+104) {
tmp = (d * (1.0 + ((-0.5 * (h / l)) * pow((0.5 * (D_m * (M_m / d))), 2.0)))) / sqrt((h * l));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -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 (l <= (-1.75d+72)) then
tmp = -d * ((h * l) ** (-0.5d0))
else if (l <= 1.36d-276) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * ((h / l) * (((m_m * (0.5d0 * d_m)) / d) ** 2.0d0))))
else if (l <= 8.6d+104) then
tmp = (d * (1.0d0 + (((-0.5d0) * (h / l)) * ((0.5d0 * (d_m * (m_m / d))) ** 2.0d0)))) / sqrt((h * l))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-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 (l <= -1.75e+72) {
tmp = -d * Math.pow((h * l), -0.5);
} else if (l <= 1.36e-276) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * Math.pow(((M_m * (0.5 * D_m)) / d), 2.0))));
} else if (l <= 8.6e+104) {
tmp = (d * (1.0 + ((-0.5 * (h / l)) * Math.pow((0.5 * (D_m * (M_m / d))), 2.0)))) / Math.sqrt((h * l));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -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 l <= -1.75e+72: tmp = -d * math.pow((h * l), -0.5) elif l <= 1.36e-276: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * math.pow(((M_m * (0.5 * D_m)) / d), 2.0)))) elif l <= 8.6e+104: tmp = (d * (1.0 + ((-0.5 * (h / l)) * math.pow((0.5 * (D_m * (M_m / d))), 2.0)))) / math.sqrt((h * l)) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -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 (l <= -1.75e+72) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); elseif (l <= 1.36e-276) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m * Float64(0.5 * D_m)) / d) ^ 2.0))))); elseif (l <= 8.6e+104) tmp = Float64(Float64(d * Float64(1.0 + Float64(Float64(-0.5 * Float64(h / l)) * (Float64(0.5 * Float64(D_m * Float64(M_m / d))) ^ 2.0)))) / sqrt(Float64(h * l))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -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 (l <= -1.75e+72)
tmp = -d * ((h * l) ^ -0.5);
elseif (l <= 1.36e-276)
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * (((M_m * (0.5 * D_m)) / d) ^ 2.0))));
elseif (l <= 8.6e+104)
tmp = (d * (1.0 + ((-0.5 * (h / l)) * ((0.5 * (D_m * (M_m / d))) ^ 2.0)))) / sqrt((h * l));
else
tmp = d * ((l ^ -0.5) * (h ^ -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[l, -1.75e+72], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.36e-276], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m * N[(0.5 * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8.6e+104], N[(N[(d * N[(1.0 + N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(0.5 * N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \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 -1.75 \cdot 10^{+72}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{elif}\;\ell \leq 1.36 \cdot 10^{-276}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M_m \cdot \left(0.5 \cdot D_m\right)}{d}\right)}^{2}\right)\right)\\
\mathbf{elif}\;\ell \leq 8.6 \cdot 10^{+104}:\\
\;\;\;\;\frac{d \cdot \left(1 + \left(-0.5 \cdot \frac{h}{\ell}\right) \cdot {\left(0.5 \cdot \left(D_m \cdot \frac{M_m}{d}\right)\right)}^{2}\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -1.75000000000000005e72Initial program 52.6%
Simplified54.9%
add-sqr-sqrt47.5%
sqrt-unprod39.5%
*-commutative39.5%
*-commutative39.5%
swap-sqr39.6%
Applied egg-rr30.2%
Simplified30.5%
Taylor expanded in d around -inf 62.3%
mul-1-neg62.3%
*-commutative62.3%
distribute-rgt-neg-in62.3%
associate-/r*63.1%
unpow1/263.1%
associate-/l/62.3%
rem-exp-log58.6%
exp-neg58.6%
exp-prod58.6%
distribute-lft-neg-out58.6%
distribute-rgt-neg-in58.6%
metadata-eval58.6%
exp-to-pow62.5%
Simplified62.5%
if -1.75000000000000005e72 < l < 1.35999999999999993e-276Initial program 82.2%
Simplified81.1%
sqrt-div5.7%
div-inv5.7%
Applied egg-rr5.7%
associate-*r/5.7%
*-rgt-identity5.7%
Simplified5.7%
expm1-log1p-u2.3%
expm1-udef2.3%
Applied egg-rr25.0%
expm1-def28.3%
expm1-log1p72.4%
associate-*r/73.5%
*-commutative73.5%
Simplified73.5%
if 1.35999999999999993e-276 < l < 8.6000000000000003e104Initial program 70.8%
Simplified70.8%
sub-neg70.8%
distribute-rgt-in56.7%
*-un-lft-identity56.7%
sqrt-div58.9%
sqrt-div62.5%
frac-times62.5%
add-sqr-sqrt62.6%
Applied egg-rr74.9%
distribute-rgt1-in85.7%
+-commutative85.7%
associate-*r*85.7%
*-commutative85.7%
/-rgt-identity85.7%
associate-/l*85.7%
metadata-eval85.7%
times-frac88.0%
associate-*r/88.0%
*-commutative88.0%
Simplified88.0%
associate-*r/88.0%
+-commutative88.0%
*-commutative88.0%
fma-def88.0%
associate-*r/88.0%
*-commutative88.0%
metadata-eval88.0%
div-inv88.0%
associate-*r/88.0%
associate-/r/88.0%
sqrt-unprod81.2%
*-commutative81.2%
Applied egg-rr81.2%
fma-udef81.2%
associate-*r*81.2%
*-commutative81.2%
Applied egg-rr81.2%
if 8.6000000000000003e104 < l Initial program 43.7%
Simplified43.8%
expm1-log1p-u43.3%
expm1-udef43.3%
*-commutative43.3%
frac-times43.3%
*-commutative43.3%
frac-times41.4%
div-inv41.4%
metadata-eval41.4%
Applied egg-rr41.4%
expm1-def41.4%
expm1-log1p41.6%
associate-*l/42.0%
*-commutative42.0%
associate-*l/44.3%
*-commutative44.3%
associate-*r/46.4%
associate-*l*46.4%
*-commutative46.4%
*-commutative46.4%
associate-*r/46.5%
associate-*l*46.5%
associate-*r/46.5%
*-commutative46.5%
associate-/l*46.5%
Simplified46.5%
Taylor expanded in d around inf 37.1%
associate-/r*38.4%
unpow1/238.4%
associate-/l/37.1%
rem-exp-log34.8%
exp-neg34.8%
exp-prod34.8%
distribute-lft-neg-out34.8%
distribute-rgt-neg-in34.8%
metadata-eval34.8%
exp-to-pow37.1%
Simplified37.1%
unpow-prod-down48.0%
Applied egg-rr48.0%
Final simplification69.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 -1.3e+75)
(* (- d) (pow (* h l) -0.5))
(if (<= l 5e-240)
(*
(sqrt (* (/ d l) (/ d h)))
(- 1.0 (/ (* (pow (* (/ M_m 2.0) (/ D_m d)) 2.0) (* h 0.5)) l)))
(if (<= l 5e+104)
(/
(* d (+ 1.0 (* (* -0.5 (/ h l)) (pow (* 0.5 (* D_m (/ M_m d))) 2.0))))
(sqrt (* h l)))
(* d (* (pow l -0.5) (pow h -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 (l <= -1.3e+75) {
tmp = -d * pow((h * l), -0.5);
} else if (l <= 5e-240) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 - ((pow(((M_m / 2.0) * (D_m / d)), 2.0) * (h * 0.5)) / l));
} else if (l <= 5e+104) {
tmp = (d * (1.0 + ((-0.5 * (h / l)) * pow((0.5 * (D_m * (M_m / d))), 2.0)))) / sqrt((h * l));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -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 (l <= (-1.3d+75)) then
tmp = -d * ((h * l) ** (-0.5d0))
else if (l <= 5d-240) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - (((((m_m / 2.0d0) * (d_m / d)) ** 2.0d0) * (h * 0.5d0)) / l))
else if (l <= 5d+104) then
tmp = (d * (1.0d0 + (((-0.5d0) * (h / l)) * ((0.5d0 * (d_m * (m_m / d))) ** 2.0d0)))) / sqrt((h * l))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-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 (l <= -1.3e+75) {
tmp = -d * Math.pow((h * l), -0.5);
} else if (l <= 5e-240) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - ((Math.pow(((M_m / 2.0) * (D_m / d)), 2.0) * (h * 0.5)) / l));
} else if (l <= 5e+104) {
tmp = (d * (1.0 + ((-0.5 * (h / l)) * Math.pow((0.5 * (D_m * (M_m / d))), 2.0)))) / Math.sqrt((h * l));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -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 l <= -1.3e+75: tmp = -d * math.pow((h * l), -0.5) elif l <= 5e-240: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - ((math.pow(((M_m / 2.0) * (D_m / d)), 2.0) * (h * 0.5)) / l)) elif l <= 5e+104: tmp = (d * (1.0 + ((-0.5 * (h / l)) * math.pow((0.5 * (D_m * (M_m / d))), 2.0)))) / math.sqrt((h * l)) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -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 (l <= -1.3e+75) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); elseif (l <= 5e-240) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(Float64((Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0) * Float64(h * 0.5)) / l))); elseif (l <= 5e+104) tmp = Float64(Float64(d * Float64(1.0 + Float64(Float64(-0.5 * Float64(h / l)) * (Float64(0.5 * Float64(D_m * Float64(M_m / d))) ^ 2.0)))) / sqrt(Float64(h * l))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -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 (l <= -1.3e+75)
tmp = -d * ((h * l) ^ -0.5);
elseif (l <= 5e-240)
tmp = sqrt(((d / l) * (d / h))) * (1.0 - (((((M_m / 2.0) * (D_m / d)) ^ 2.0) * (h * 0.5)) / l));
elseif (l <= 5e+104)
tmp = (d * (1.0 + ((-0.5 * (h / l)) * ((0.5 * (D_m * (M_m / d))) ^ 2.0)))) / sqrt((h * l));
else
tmp = d * ((l ^ -0.5) * (h ^ -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[l, -1.3e+75], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5e-240], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * 0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5e+104], N[(N[(d * N[(1.0 + N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(0.5 * N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \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 -1.3 \cdot 10^{+75}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{elif}\;\ell \leq 5 \cdot 10^{-240}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{{\left(\frac{M_m}{2} \cdot \frac{D_m}{d}\right)}^{2} \cdot \left(h \cdot 0.5\right)}{\ell}\right)\\
\mathbf{elif}\;\ell \leq 5 \cdot 10^{+104}:\\
\;\;\;\;\frac{d \cdot \left(1 + \left(-0.5 \cdot \frac{h}{\ell}\right) \cdot {\left(0.5 \cdot \left(D_m \cdot \frac{M_m}{d}\right)\right)}^{2}\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -1.29999999999999992e75Initial program 52.6%
Simplified54.9%
add-sqr-sqrt47.5%
sqrt-unprod39.5%
*-commutative39.5%
*-commutative39.5%
swap-sqr39.6%
Applied egg-rr30.2%
Simplified30.5%
Taylor expanded in d around -inf 62.3%
mul-1-neg62.3%
*-commutative62.3%
distribute-rgt-neg-in62.3%
associate-/r*63.1%
unpow1/263.1%
associate-/l/62.3%
rem-exp-log58.6%
exp-neg58.6%
exp-prod58.6%
distribute-lft-neg-out58.6%
distribute-rgt-neg-in58.6%
metadata-eval58.6%
exp-to-pow62.5%
Simplified62.5%
if -1.29999999999999992e75 < l < 5.0000000000000004e-240Initial program 78.3%
Simplified77.3%
expm1-log1p-u77.1%
expm1-udef77.1%
*-commutative77.1%
frac-times78.0%
*-commutative78.0%
frac-times78.0%
div-inv78.0%
metadata-eval78.0%
Applied egg-rr78.0%
expm1-def78.0%
expm1-log1p78.2%
associate-*l/81.5%
*-commutative81.5%
associate-*l/81.5%
*-commutative81.5%
associate-*r/81.5%
associate-*l*81.5%
*-commutative81.5%
*-commutative81.5%
associate-*r/81.5%
associate-*l*81.5%
associate-*r/81.5%
*-commutative81.5%
associate-/l*81.5%
Simplified81.5%
expm1-log1p-u33.7%
expm1-udef29.0%
Applied egg-rr27.3%
expm1-def30.2%
expm1-log1p73.8%
associate-*r/74.7%
*-commutative74.7%
times-frac74.7%
Simplified74.7%
if 5.0000000000000004e-240 < l < 4.9999999999999997e104Initial program 74.4%
Simplified74.4%
sub-neg74.4%
distribute-rgt-in61.2%
*-un-lft-identity61.2%
sqrt-div63.7%
sqrt-div66.5%
frac-times66.5%
add-sqr-sqrt66.6%
Applied egg-rr78.0%
distribute-rgt1-in89.1%
+-commutative89.1%
associate-*r*89.1%
*-commutative89.1%
/-rgt-identity89.1%
associate-/l*89.1%
metadata-eval89.1%
times-frac91.8%
associate-*r/91.8%
*-commutative91.8%
Simplified91.8%
associate-*r/91.8%
+-commutative91.8%
*-commutative91.8%
fma-def91.8%
associate-*r/91.8%
*-commutative91.8%
metadata-eval91.8%
div-inv91.8%
associate-*r/91.8%
associate-/r/91.8%
sqrt-unprod83.9%
*-commutative83.9%
Applied egg-rr83.9%
fma-udef83.9%
associate-*r*83.9%
*-commutative83.9%
Applied egg-rr83.9%
if 4.9999999999999997e104 < l Initial program 43.7%
Simplified43.8%
expm1-log1p-u43.3%
expm1-udef43.3%
*-commutative43.3%
frac-times43.3%
*-commutative43.3%
frac-times41.4%
div-inv41.4%
metadata-eval41.4%
Applied egg-rr41.4%
expm1-def41.4%
expm1-log1p41.6%
associate-*l/42.0%
*-commutative42.0%
associate-*l/44.3%
*-commutative44.3%
associate-*r/46.4%
associate-*l*46.4%
*-commutative46.4%
*-commutative46.4%
associate-*r/46.5%
associate-*l*46.5%
associate-*r/46.5%
*-commutative46.5%
associate-/l*46.5%
Simplified46.5%
Taylor expanded in d around inf 37.1%
associate-/r*38.4%
unpow1/238.4%
associate-/l/37.1%
rem-exp-log34.8%
exp-neg34.8%
exp-prod34.8%
distribute-lft-neg-out34.8%
distribute-rgt-neg-in34.8%
metadata-eval34.8%
exp-to-pow37.1%
Simplified37.1%
unpow-prod-down48.0%
Applied egg-rr48.0%
Final simplification70.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
(let* ((t_0
(*
d
(exp (* (* 1.5 (- (log1p (+ (* h l) -1.0)))) 0.3333333333333333)))))
(if (<= d -4.4e+81)
(* (- d) (pow (* h l) -0.5))
(if (<= d -3.7e+44)
t_0
(if (<= d -6.2e-140)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= d -4e-310) t_0 (* d (/ (sqrt (/ 1.0 l)) (sqrt h)))))))))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 = d * exp(((1.5 * -log1p(((h * l) + -1.0))) * 0.3333333333333333));
double tmp;
if (d <= -4.4e+81) {
tmp = -d * pow((h * l), -0.5);
} else if (d <= -3.7e+44) {
tmp = t_0;
} else if (d <= -6.2e-140) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (d <= -4e-310) {
tmp = t_0;
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
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 t_0 = d * Math.exp(((1.5 * -Math.log1p(((h * l) + -1.0))) * 0.3333333333333333));
double tmp;
if (d <= -4.4e+81) {
tmp = -d * Math.pow((h * l), -0.5);
} else if (d <= -3.7e+44) {
tmp = t_0;
} else if (d <= -6.2e-140) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (d <= -4e-310) {
tmp = t_0;
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
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 = d * math.exp(((1.5 * -math.log1p(((h * l) + -1.0))) * 0.3333333333333333)) tmp = 0 if d <= -4.4e+81: tmp = -d * math.pow((h * l), -0.5) elif d <= -3.7e+44: tmp = t_0 elif d <= -6.2e-140: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif d <= -4e-310: tmp = t_0 else: tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h)) 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(d * exp(Float64(Float64(1.5 * Float64(-log1p(Float64(Float64(h * l) + -1.0)))) * 0.3333333333333333))) tmp = 0.0 if (d <= -4.4e+81) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); elseif (d <= -3.7e+44) tmp = t_0; elseif (d <= -6.2e-140) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (d <= -4e-310) tmp = t_0; else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); 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[(d * N[Exp[N[(N[(1.5 * (-N[Log[1 + N[(N[(h * l), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -4.4e+81], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -3.7e+44], t$95$0, If[LessEqual[d, -6.2e-140], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], t$95$0, N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $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 := d \cdot e^{\left(1.5 \cdot \left(-\mathsf{log1p}\left(h \cdot \ell + -1\right)\right)\right) \cdot 0.3333333333333333}\\
\mathbf{if}\;d \leq -4.4 \cdot 10^{+81}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{elif}\;d \leq -3.7 \cdot 10^{+44}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -6.2 \cdot 10^{-140}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -4.39999999999999974e81Initial program 68.1%
Simplified70.2%
add-sqr-sqrt54.4%
sqrt-unprod46.2%
*-commutative46.2%
*-commutative46.2%
swap-sqr46.2%
Applied egg-rr35.4%
Simplified38.1%
Taylor expanded in d around -inf 75.9%
mul-1-neg75.9%
*-commutative75.9%
distribute-rgt-neg-in75.9%
associate-/r*76.5%
unpow1/276.5%
associate-/l/75.9%
rem-exp-log72.7%
exp-neg72.7%
exp-prod72.7%
distribute-lft-neg-out72.7%
distribute-rgt-neg-in72.7%
metadata-eval72.7%
exp-to-pow76.0%
Simplified76.0%
if -4.39999999999999974e81 < d < -3.7000000000000001e44 or -6.1999999999999998e-140 < d < -3.999999999999988e-310Initial program 66.2%
Simplified66.2%
Taylor expanded in d around inf 25.3%
add-cbrt-cube31.8%
add-sqr-sqrt31.8%
pow131.8%
pow1/231.8%
pow-prod-up31.8%
associate-/r*31.8%
metadata-eval31.8%
Applied egg-rr31.8%
pow1/331.8%
pow-to-exp31.8%
pow-exp25.3%
rem-log-exp31.8%
pow-to-exp31.8%
log-pow25.3%
associate-/l/25.3%
log-rec23.1%
Applied egg-rr23.1%
log1p-expm1-u45.1%
expm1-udef45.1%
add-exp-log45.1%
*-commutative45.1%
Applied egg-rr45.1%
if -3.7000000000000001e44 < d < -6.1999999999999998e-140Initial program 84.2%
Simplified84.2%
frac-2neg84.2%
sqrt-div85.1%
Applied egg-rr85.1%
Taylor expanded in h around 0 52.4%
if -3.999999999999988e-310 < d Initial program 62.8%
Simplified62.1%
expm1-log1p-u61.5%
expm1-udef61.5%
*-commutative61.5%
frac-times62.1%
*-commutative62.1%
frac-times60.7%
div-inv60.7%
metadata-eval60.7%
Applied egg-rr60.7%
expm1-def60.7%
expm1-log1p61.3%
associate-*l/64.9%
*-commutative64.9%
associate-*l/65.0%
*-commutative65.0%
associate-*r/65.7%
associate-*l*65.7%
*-commutative65.7%
*-commutative65.7%
associate-*r/65.7%
associate-*l*65.7%
associate-*r/65.7%
*-commutative65.7%
associate-/l*65.7%
Simplified65.7%
Taylor expanded in d around inf 37.2%
associate-/r*37.9%
unpow1/237.9%
associate-/l/37.2%
rem-exp-log35.2%
exp-neg35.2%
exp-prod35.2%
distribute-lft-neg-out35.2%
distribute-rgt-neg-in35.2%
metadata-eval35.2%
exp-to-pow37.2%
Simplified37.2%
Taylor expanded in d around 0 37.2%
associate-/l/37.9%
Simplified37.9%
sqrt-div43.6%
Applied egg-rr43.6%
Final simplification50.7%
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 -9.6e-142)
(* (- d) (pow (* h l) -0.5))
(if (<= d -4e-310)
(* d (cbrt (pow (/ 1.0 (* h l)) 1.5)))
(* d (/ (sqrt (/ 1.0 l)) (sqrt h))))))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 <= -9.6e-142) {
tmp = -d * pow((h * l), -0.5);
} else if (d <= -4e-310) {
tmp = d * cbrt(pow((1.0 / (h * l)), 1.5));
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
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 <= -9.6e-142) {
tmp = -d * Math.pow((h * l), -0.5);
} else if (d <= -4e-310) {
tmp = d * Math.cbrt(Math.pow((1.0 / (h * l)), 1.5));
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
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 <= -9.6e-142) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); elseif (d <= -4e-310) tmp = Float64(d * cbrt((Float64(1.0 / Float64(h * l)) ^ 1.5))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); 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, -9.6e-142], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(d * N[Power[N[Power[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $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}\;d \leq -9.6 \cdot 10^{-142}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt[3]{{\left(\frac{1}{h \cdot \ell}\right)}^{1.5}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -9.59999999999999952e-142Initial program 76.5%
Simplified77.6%
add-sqr-sqrt47.8%
sqrt-unprod42.0%
*-commutative42.0%
*-commutative42.0%
swap-sqr42.0%
Applied egg-rr34.3%
Simplified36.8%
Taylor expanded in d around -inf 58.4%
mul-1-neg58.4%
*-commutative58.4%
distribute-rgt-neg-in58.4%
associate-/r*58.7%
unpow1/258.7%
associate-/l/58.4%
rem-exp-log55.4%
exp-neg55.4%
exp-prod55.4%
distribute-lft-neg-out55.4%
distribute-rgt-neg-in55.4%
metadata-eval55.4%
exp-to-pow58.5%
Simplified58.5%
if -9.59999999999999952e-142 < d < -3.999999999999988e-310Initial program 60.1%
Simplified60.2%
Taylor expanded in d around inf 25.1%
add-cbrt-cube33.5%
pow1/333.5%
add-sqr-sqrt33.5%
pow133.5%
pow1/233.5%
pow-prod-up33.5%
associate-/r*33.5%
metadata-eval33.5%
Applied egg-rr33.5%
unpow1/333.5%
associate-/l/33.5%
Simplified33.5%
if -3.999999999999988e-310 < d Initial program 62.8%
Simplified62.1%
expm1-log1p-u61.5%
expm1-udef61.5%
*-commutative61.5%
frac-times62.1%
*-commutative62.1%
frac-times60.7%
div-inv60.7%
metadata-eval60.7%
Applied egg-rr60.7%
expm1-def60.7%
expm1-log1p61.3%
associate-*l/64.9%
*-commutative64.9%
associate-*l/65.0%
*-commutative65.0%
associate-*r/65.7%
associate-*l*65.7%
*-commutative65.7%
*-commutative65.7%
associate-*r/65.7%
associate-*l*65.7%
associate-*r/65.7%
*-commutative65.7%
associate-/l*65.7%
Simplified65.7%
Taylor expanded in d around inf 37.2%
associate-/r*37.9%
unpow1/237.9%
associate-/l/37.2%
rem-exp-log35.2%
exp-neg35.2%
exp-prod35.2%
distribute-lft-neg-out35.2%
distribute-rgt-neg-in35.2%
metadata-eval35.2%
exp-to-pow37.2%
Simplified37.2%
Taylor expanded in d around 0 37.2%
associate-/l/37.9%
Simplified37.9%
sqrt-div43.6%
Applied egg-rr43.6%
Final simplification47.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 3.6e-279) (* (- d) (pow (* h l) -0.5)) (* d (* (pow l -0.5) (pow h -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 (l <= 3.6e-279) {
tmp = -d * pow((h * l), -0.5);
} else {
tmp = d * (pow(l, -0.5) * pow(h, -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 (l <= 3.6d-279) then
tmp = -d * ((h * l) ** (-0.5d0))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-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 (l <= 3.6e-279) {
tmp = -d * Math.pow((h * l), -0.5);
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -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 l <= 3.6e-279: tmp = -d * math.pow((h * l), -0.5) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -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 (l <= 3.6e-279) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -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 (l <= 3.6e-279)
tmp = -d * ((h * l) ^ -0.5);
else
tmp = d * ((l ^ -0.5) * (h ^ -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[l, 3.6e-279], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $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.6 \cdot 10^{-279}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < 3.5999999999999997e-279Initial program 72.2%
Simplified72.9%
add-sqr-sqrt36.1%
sqrt-unprod31.4%
*-commutative31.4%
*-commutative31.4%
swap-sqr31.4%
Applied egg-rr26.1%
Simplified27.9%
Taylor expanded in d around -inf 45.2%
mul-1-neg45.2%
*-commutative45.2%
distribute-rgt-neg-in45.2%
associate-/r*45.5%
unpow1/245.5%
associate-/l/45.2%
rem-exp-log43.1%
exp-neg43.1%
exp-prod43.1%
distribute-lft-neg-out43.1%
distribute-rgt-neg-in43.1%
metadata-eval43.1%
exp-to-pow45.3%
Simplified45.3%
if 3.5999999999999997e-279 < l Initial program 62.1%
Simplified61.4%
expm1-log1p-u60.7%
expm1-udef60.7%
*-commutative60.7%
frac-times61.4%
*-commutative61.4%
frac-times60.0%
div-inv60.0%
metadata-eval60.0%
Applied egg-rr60.0%
expm1-def60.0%
expm1-log1p60.6%
associate-*l/64.3%
*-commutative64.3%
associate-*l/64.4%
*-commutative64.4%
associate-*r/65.1%
associate-*l*65.1%
*-commutative65.1%
*-commutative65.1%
associate-*r/65.2%
associate-*l*65.2%
associate-*r/65.2%
*-commutative65.2%
associate-/l*65.2%
Simplified65.2%
Taylor expanded in d around inf 37.9%
associate-/r*38.6%
unpow1/238.6%
associate-/l/37.9%
rem-exp-log35.7%
exp-neg35.8%
exp-prod35.8%
distribute-lft-neg-out35.8%
distribute-rgt-neg-in35.8%
metadata-eval35.8%
exp-to-pow37.9%
Simplified37.9%
unpow-prod-down44.4%
Applied egg-rr44.4%
Final simplification44.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 7.5e-281) (* (- d) (pow (* h l) -0.5)) (* d (/ (sqrt (/ 1.0 l)) (sqrt h)))))
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 <= 7.5e-281) {
tmp = -d * pow((h * l), -0.5);
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
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 <= 7.5d-281) then
tmp = -d * ((h * l) ** (-0.5d0))
else
tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
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 <= 7.5e-281) {
tmp = -d * Math.pow((h * l), -0.5);
} else {
tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
}
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 <= 7.5e-281: tmp = -d * math.pow((h * l), -0.5) else: tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h)) 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 <= 7.5e-281) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))); 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 <= 7.5e-281)
tmp = -d * ((h * l) ^ -0.5);
else
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
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, 7.5e-281], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $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 7.5 \cdot 10^{-281}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < 7.49999999999999968e-281Initial program 72.2%
Simplified72.9%
add-sqr-sqrt36.1%
sqrt-unprod31.4%
*-commutative31.4%
*-commutative31.4%
swap-sqr31.4%
Applied egg-rr26.1%
Simplified27.9%
Taylor expanded in d around -inf 45.2%
mul-1-neg45.2%
*-commutative45.2%
distribute-rgt-neg-in45.2%
associate-/r*45.5%
unpow1/245.5%
associate-/l/45.2%
rem-exp-log43.1%
exp-neg43.1%
exp-prod43.1%
distribute-lft-neg-out43.1%
distribute-rgt-neg-in43.1%
metadata-eval43.1%
exp-to-pow45.3%
Simplified45.3%
if 7.49999999999999968e-281 < l Initial program 62.1%
Simplified61.4%
expm1-log1p-u60.7%
expm1-udef60.7%
*-commutative60.7%
frac-times61.4%
*-commutative61.4%
frac-times60.0%
div-inv60.0%
metadata-eval60.0%
Applied egg-rr60.0%
expm1-def60.0%
expm1-log1p60.6%
associate-*l/64.3%
*-commutative64.3%
associate-*l/64.4%
*-commutative64.4%
associate-*r/65.1%
associate-*l*65.1%
*-commutative65.1%
*-commutative65.1%
associate-*r/65.2%
associate-*l*65.2%
associate-*r/65.2%
*-commutative65.2%
associate-/l*65.2%
Simplified65.2%
Taylor expanded in d around inf 37.9%
associate-/r*38.6%
unpow1/238.6%
associate-/l/37.9%
rem-exp-log35.7%
exp-neg35.8%
exp-prod35.8%
distribute-lft-neg-out35.8%
distribute-rgt-neg-in35.8%
metadata-eval35.8%
exp-to-pow37.9%
Simplified37.9%
Taylor expanded in d around 0 37.9%
associate-/l/38.6%
Simplified38.6%
sqrt-div44.5%
Applied egg-rr44.5%
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 (<= d -1.36e-142) (* (- 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 (d <= -1.36e-142) {
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 (d <= (-1.36d-142)) 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 (d <= -1.36e-142) {
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 d <= -1.36e-142: 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 (d <= -1.36e-142) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / 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 (d <= -1.36e-142)
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[d, -1.36e-142], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / 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}\;d \leq -1.36 \cdot 10^{-142}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if d < -1.35999999999999993e-142Initial program 76.5%
Simplified77.6%
add-sqr-sqrt47.8%
sqrt-unprod42.0%
*-commutative42.0%
*-commutative42.0%
swap-sqr42.0%
Applied egg-rr34.3%
Simplified36.8%
Taylor expanded in d around -inf 58.4%
mul-1-neg58.4%
*-commutative58.4%
distribute-rgt-neg-in58.4%
associate-/r*58.7%
unpow1/258.7%
associate-/l/58.4%
rem-exp-log55.4%
exp-neg55.4%
exp-prod55.4%
distribute-lft-neg-out55.4%
distribute-rgt-neg-in55.4%
metadata-eval55.4%
exp-to-pow58.5%
Simplified58.5%
if -1.35999999999999993e-142 < d Initial program 62.3%
Simplified61.7%
Taylor expanded in d around inf 34.7%
associate-/r*35.2%
Simplified35.2%
Final simplification43.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 (* 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) {
return d * sqrt((1.0 / (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((1.0d0 / (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((1.0 / (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((1.0 / (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(1.0 / 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((1.0 / (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[(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])\\
\\
d \cdot \sqrt{\frac{1}{h \cdot \ell}}
\end{array}
Initial program 67.2%
Simplified67.2%
Taylor expanded in d around inf 24.5%
Final simplification24.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 (* 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) {
return d * sqrt(((1.0 / 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(((1.0d0 / 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(((1.0 / 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(((1.0 / 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(Float64(1.0 / 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(((1.0 / 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[(N[(1.0 / h), $MachinePrecision] / 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])\\
\\
d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}
\end{array}
Initial program 67.2%
Simplified67.2%
Taylor expanded in d around inf 24.5%
associate-/r*24.9%
Simplified24.9%
Final simplification24.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 (* 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 67.2%
Simplified67.2%
expm1-log1p-u66.7%
expm1-udef66.7%
*-commutative66.7%
frac-times66.7%
*-commutative66.7%
frac-times66.0%
div-inv66.0%
metadata-eval66.0%
Applied egg-rr66.0%
expm1-def66.0%
expm1-log1p66.4%
associate-*l/68.3%
*-commutative68.3%
associate-*l/68.7%
*-commutative68.7%
associate-*r/69.1%
associate-*l*69.1%
*-commutative69.1%
*-commutative69.1%
associate-*r/69.5%
associate-*l*69.5%
associate-*r/69.5%
*-commutative69.5%
associate-/l*69.5%
Simplified69.5%
Taylor expanded in d around inf 24.5%
associate-/r*24.9%
unpow1/224.9%
associate-/l/24.5%
rem-exp-log23.5%
exp-neg23.5%
exp-prod23.1%
distribute-lft-neg-out23.1%
distribute-rgt-neg-in23.1%
metadata-eval23.1%
exp-to-pow24.2%
Simplified24.2%
Final simplification24.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 (/ 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 67.2%
Simplified67.2%
sub-neg67.2%
distribute-rgt-in56.8%
*-un-lft-identity56.8%
sqrt-div27.6%
sqrt-div29.2%
frac-times29.3%
add-sqr-sqrt29.3%
Applied egg-rr34.1%
distribute-rgt1-in38.4%
+-commutative38.4%
associate-*r*38.4%
*-commutative38.4%
/-rgt-identity38.4%
associate-/l*38.4%
metadata-eval38.4%
times-frac39.5%
associate-*r/39.1%
*-commutative39.1%
Simplified39.1%
associate-*r/41.0%
+-commutative41.0%
*-commutative41.0%
fma-def41.0%
associate-*r/41.4%
*-commutative41.4%
metadata-eval41.4%
div-inv41.4%
associate-*r/41.0%
associate-/r/41.0%
sqrt-unprod34.7%
*-commutative34.7%
Applied egg-rr34.7%
Taylor expanded in D around 0 24.1%
Final simplification24.1%
herbie shell --seed 2024010
(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)))))