
(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 19 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 (sqrt (- d))))
(if (<= l -5e-310)
(*
(/ t_0 (sqrt (- h)))
(*
(/ t_0 (sqrt (- l)))
(+ 1.0 (* (/ h l) (* (pow (* (/ M_m 2.0) (/ D_m d)) 2.0) -0.5)))))
(if (<= l 3.6e+48)
(/
(* d (fma -0.5 (* h (/ (pow (/ (* M_m 0.5) (/ d D_m)) 2.0) l)) 1.0))
(sqrt (* l h)))
(*
(/ (sqrt d) (sqrt h))
(*
(/ (sqrt d) (sqrt l))
(fma (/ h l) (* -0.5 (pow (/ D_m (* d (/ 2.0 M_m))) 2.0)) 1.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(-d);
double tmp;
if (l <= -5e-310) {
tmp = (t_0 / sqrt(-h)) * ((t_0 / sqrt(-l)) * (1.0 + ((h / l) * (pow(((M_m / 2.0) * (D_m / d)), 2.0) * -0.5))));
} else if (l <= 3.6e+48) {
tmp = (d * fma(-0.5, (h * (pow(((M_m * 0.5) / (d / D_m)), 2.0) / l)), 1.0)) / sqrt((l * h));
} else {
tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) / sqrt(l)) * fma((h / l), (-0.5 * pow((D_m / (d * (2.0 / M_m))), 2.0)), 1.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 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0) * -0.5))))); elseif (l <= 3.6e+48) tmp = Float64(Float64(d * fma(-0.5, Float64(h * Float64((Float64(Float64(M_m * 0.5) / Float64(d / D_m)) ^ 2.0) / l)), 1.0)) / sqrt(Float64(l * h))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(Float64(sqrt(d) / sqrt(l)) * fma(Float64(h / l), Float64(-0.5 * (Float64(D_m / Float64(d * Float64(2.0 / M_m))) ^ 2.0)), 1.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[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -5e-310], N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.6e+48], N[(N[(d * N[(-0.5 * N[(h * N[(N[Power[N[(N[(M$95$m * 0.5), $MachinePrecision] / N[(d / D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m / N[(d * N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $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 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-h}} \cdot \left(\frac{t\_0}{\sqrt{-\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2} \cdot -0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 3.6 \cdot 10^{+48}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(-0.5, h \cdot \frac{{\left(\frac{M\_m \cdot 0.5}{\frac{d}{D\_m}}\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(\frac{D\_m}{d \cdot \frac{2}{M\_m}}\right)}^{2}, 1\right)\right)\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.5%
Simplified65.7%
frac-2neg65.7%
sqrt-div73.4%
Applied egg-rr73.4%
frac-2neg73.4%
sqrt-div89.5%
Applied egg-rr89.5%
if -4.999999999999985e-310 < l < 3.59999999999999983e48Initial program 72.6%
Simplified72.6%
associate-*r/75.9%
div-inv75.9%
metadata-eval75.9%
Applied egg-rr75.9%
add-cbrt-cube60.4%
add-sqr-sqrt60.4%
cbrt-prod75.7%
Applied egg-rr75.7%
Applied egg-rr62.7%
+-commutative62.7%
*-commutative62.7%
*-rgt-identity62.7%
distribute-lft-in81.9%
*-commutative81.9%
*-commutative81.9%
fma-define81.9%
Simplified90.6%
associate-*l/90.7%
associate-*r/90.7%
Applied egg-rr90.7%
if 3.59999999999999983e48 < l Initial program 50.0%
Simplified50.0%
sqrt-div68.4%
Applied egg-rr68.4%
sqrt-div82.9%
Applied egg-rr82.9%
Final simplification88.4%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (- d))))
(if (<= l -5e-310)
(*
(/ t_0 (sqrt (- h)))
(*
(/ t_0 (sqrt (- l)))
(+ 1.0 (* (/ h l) (* (pow (* (/ M_m 2.0) (/ D_m d)) 2.0) -0.5)))))
(if (<= l 2.3e+148)
(/
(* d (fma -0.5 (* h (/ (pow (/ (* M_m 0.5) (/ d D_m)) 2.0) l)) 1.0))
(sqrt (* l h)))
(*
(fma (/ h l) (* -0.5 (pow (* D_m (/ M_m (* d 2.0))) 2.0)) 1.0)
(/ d (* (sqrt h) (sqrt l))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt(-d);
double tmp;
if (l <= -5e-310) {
tmp = (t_0 / sqrt(-h)) * ((t_0 / sqrt(-l)) * (1.0 + ((h / l) * (pow(((M_m / 2.0) * (D_m / d)), 2.0) * -0.5))));
} else if (l <= 2.3e+148) {
tmp = (d * fma(-0.5, (h * (pow(((M_m * 0.5) / (d / D_m)), 2.0) / l)), 1.0)) / sqrt((l * h));
} else {
tmp = fma((h / l), (-0.5 * pow((D_m * (M_m / (d * 2.0))), 2.0)), 1.0) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0) * -0.5))))); elseif (l <= 2.3e+148) tmp = Float64(Float64(d * fma(-0.5, Float64(h * Float64((Float64(Float64(M_m * 0.5) / Float64(d / D_m)) ^ 2.0) / l)), 1.0)) / sqrt(Float64(l * h))); else tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(D_m * Float64(M_m / Float64(d * 2.0))) ^ 2.0)), 1.0) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -5e-310], N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.3e+148], N[(N[(d * N[(-0.5 * N[(h * N[(N[Power[N[(N[(M$95$m * 0.5), $MachinePrecision] / N[(d / D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-h}} \cdot \left(\frac{t\_0}{\sqrt{-\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2} \cdot -0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 2.3 \cdot 10^{+148}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(-0.5, h \cdot \frac{{\left(\frac{M\_m \cdot 0.5}{\frac{d}{D\_m}}\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(D\_m \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.5%
Simplified65.7%
frac-2neg65.7%
sqrt-div73.4%
Applied egg-rr73.4%
frac-2neg73.4%
sqrt-div89.5%
Applied egg-rr89.5%
if -4.999999999999985e-310 < l < 2.3000000000000001e148Initial program 68.1%
Simplified68.1%
associate-*r/71.9%
div-inv71.9%
metadata-eval71.9%
Applied egg-rr71.9%
add-cbrt-cube57.9%
add-sqr-sqrt57.9%
cbrt-prod71.7%
Applied egg-rr71.7%
Applied egg-rr59.9%
+-commutative59.9%
*-commutative59.9%
*-rgt-identity59.9%
distribute-lft-in76.8%
*-commutative76.8%
*-commutative76.8%
fma-define76.8%
Simplified85.2%
associate-*l/87.7%
associate-*r/87.6%
Applied egg-rr87.6%
if 2.3000000000000001e148 < l Initial program 50.9%
Simplified50.9%
Applied egg-rr78.5%
unpow178.5%
*-commutative78.5%
+-commutative78.5%
*-commutative78.5%
associate-*r*78.5%
fma-define78.5%
*-commutative78.5%
/-rgt-identity78.5%
associate-/l*78.5%
metadata-eval78.5%
times-frac78.5%
associate-*r/78.5%
*-commutative78.5%
Simplified78.5%
Final simplification87.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (- d))))
(if (<= l -5e+163)
(*
(sqrt (/ d h))
(*
(/ t_0 (sqrt (- l)))
(fma (/ h l) (* -0.5 (pow (/ D_m (* d (/ 2.0 M_m))) 2.0)) 1.0)))
(if (<= l -5e-310)
(*
(/ t_0 (sqrt (- h)))
(*
(+ 1.0 (* (/ h l) (* (pow (* (/ M_m 2.0) (/ D_m d)) 2.0) -0.5)))
(sqrt (/ d l))))
(if (<= l 4.9e+147)
(/
(* d (fma -0.5 (* h (/ (pow (/ (* M_m 0.5) (/ d D_m)) 2.0) l)) 1.0))
(sqrt (* l h)))
(*
(fma (/ h l) (* -0.5 (pow (* D_m (/ M_m (* d 2.0))) 2.0)) 1.0)
(/ d (* (sqrt h) (sqrt l)))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt(-d);
double tmp;
if (l <= -5e+163) {
tmp = sqrt((d / h)) * ((t_0 / sqrt(-l)) * fma((h / l), (-0.5 * pow((D_m / (d * (2.0 / M_m))), 2.0)), 1.0));
} else if (l <= -5e-310) {
tmp = (t_0 / sqrt(-h)) * ((1.0 + ((h / l) * (pow(((M_m / 2.0) * (D_m / d)), 2.0) * -0.5))) * sqrt((d / l)));
} else if (l <= 4.9e+147) {
tmp = (d * fma(-0.5, (h * (pow(((M_m * 0.5) / (d / D_m)), 2.0) / l)), 1.0)) / sqrt((l * h));
} else {
tmp = fma((h / l), (-0.5 * pow((D_m * (M_m / (d * 2.0))), 2.0)), 1.0) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -5e+163) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(t_0 / sqrt(Float64(-l))) * fma(Float64(h / l), Float64(-0.5 * (Float64(D_m / Float64(d * Float64(2.0 / M_m))) ^ 2.0)), 1.0))); elseif (l <= -5e-310) tmp = Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0) * -0.5))) * sqrt(Float64(d / l)))); elseif (l <= 4.9e+147) tmp = Float64(Float64(d * fma(-0.5, Float64(h * Float64((Float64(Float64(M_m * 0.5) / Float64(d / D_m)) ^ 2.0) / l)), 1.0)) / sqrt(Float64(l * h))); else tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(D_m * Float64(M_m / Float64(d * 2.0))) ^ 2.0)), 1.0) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -5e+163], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m / N[(d * N[(2.0 / M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.9e+147], N[(N[(d * N[(-0.5 * N[(h * N[(N[Power[N[(N[(M$95$m * 0.5), $MachinePrecision] / N[(d / D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{+163}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t\_0}{\sqrt{-\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(\frac{D\_m}{d \cdot \frac{2}{M\_m}}\right)}^{2}, 1\right)\right)\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-h}} \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2} \cdot -0.5\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{elif}\;\ell \leq 4.9 \cdot 10^{+147}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(-0.5, h \cdot \frac{{\left(\frac{M\_m \cdot 0.5}{\frac{d}{D\_m}}\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(D\_m \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -5e163Initial program 41.4%
Simplified44.4%
frac-2neg44.7%
sqrt-div68.1%
Applied egg-rr64.6%
if -5e163 < l < -4.999999999999985e-310Initial program 73.0%
Simplified71.2%
frac-2neg74.7%
sqrt-div90.6%
Applied egg-rr86.1%
if -4.999999999999985e-310 < l < 4.8999999999999998e147Initial program 68.1%
Simplified68.1%
associate-*r/71.9%
div-inv71.9%
metadata-eval71.9%
Applied egg-rr71.9%
add-cbrt-cube57.9%
add-sqr-sqrt57.9%
cbrt-prod71.7%
Applied egg-rr71.7%
Applied egg-rr59.9%
+-commutative59.9%
*-commutative59.9%
*-rgt-identity59.9%
distribute-lft-in76.8%
*-commutative76.8%
*-commutative76.8%
fma-define76.8%
Simplified85.2%
associate-*l/87.7%
associate-*r/87.6%
Applied egg-rr87.6%
if 4.8999999999999998e147 < l Initial program 50.9%
Simplified50.9%
Applied egg-rr78.5%
unpow178.5%
*-commutative78.5%
+-commutative78.5%
*-commutative78.5%
associate-*r*78.5%
fma-define78.5%
*-commutative78.5%
/-rgt-identity78.5%
associate-/l*78.5%
metadata-eval78.5%
times-frac78.5%
associate-*r/78.5%
*-commutative78.5%
Simplified78.5%
Final simplification83.1%
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-310)
(*
(*
(/ (sqrt (- d)) (sqrt (- l)))
(+ 1.0 (* (/ h l) (* (pow (* (/ M_m 2.0) (/ D_m d)) 2.0) -0.5))))
(sqrt (/ d h)))
(if (<= l 4.9e+147)
(/
(* d (fma -0.5 (* h (/ (pow (/ (* M_m 0.5) (/ d D_m)) 2.0) l)) 1.0))
(sqrt (* l h)))
(*
(fma (/ h l) (* -0.5 (pow (* D_m (/ M_m (* d 2.0))) 2.0)) 1.0)
(/ d (* (sqrt h) (sqrt l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = ((sqrt(-d) / sqrt(-l)) * (1.0 + ((h / l) * (pow(((M_m / 2.0) * (D_m / d)), 2.0) * -0.5)))) * sqrt((d / h));
} else if (l <= 4.9e+147) {
tmp = (d * fma(-0.5, (h * (pow(((M_m * 0.5) / (d / D_m)), 2.0) / l)), 1.0)) / sqrt((l * h));
} else {
tmp = fma((h / l), (-0.5 * pow((D_m * (M_m / (d * 2.0))), 2.0)), 1.0) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0) * -0.5)))) * sqrt(Float64(d / h))); elseif (l <= 4.9e+147) tmp = Float64(Float64(d * fma(-0.5, Float64(h * Float64((Float64(Float64(M_m * 0.5) / Float64(d / D_m)) ^ 2.0) / l)), 1.0)) / sqrt(Float64(l * h))); else tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(D_m * Float64(M_m / Float64(d * 2.0))) ^ 2.0)), 1.0) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -5e-310], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.9e+147], N[(N[(d * N[(-0.5 * N[(h * N[(N[Power[N[(N[(M$95$m * 0.5), $MachinePrecision] / N[(d / D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2} \cdot -0.5\right)\right)\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;\ell \leq 4.9 \cdot 10^{+147}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(-0.5, h \cdot \frac{{\left(\frac{M\_m \cdot 0.5}{\frac{d}{D\_m}}\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(D\_m \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.5%
Simplified65.7%
frac-2neg65.7%
sqrt-div73.4%
Applied egg-rr73.4%
if -4.999999999999985e-310 < l < 4.8999999999999998e147Initial program 68.1%
Simplified68.1%
associate-*r/71.9%
div-inv71.9%
metadata-eval71.9%
Applied egg-rr71.9%
add-cbrt-cube57.9%
add-sqr-sqrt57.9%
cbrt-prod71.7%
Applied egg-rr71.7%
Applied egg-rr59.9%
+-commutative59.9%
*-commutative59.9%
*-rgt-identity59.9%
distribute-lft-in76.8%
*-commutative76.8%
*-commutative76.8%
fma-define76.8%
Simplified85.2%
associate-*l/87.7%
associate-*r/87.6%
Applied egg-rr87.6%
if 4.8999999999999998e147 < l Initial program 50.9%
Simplified50.9%
Applied egg-rr78.5%
unpow178.5%
*-commutative78.5%
+-commutative78.5%
*-commutative78.5%
associate-*r*78.5%
fma-define78.5%
*-commutative78.5%
/-rgt-identity78.5%
associate-/l*78.5%
metadata-eval78.5%
times-frac78.5%
associate-*r/78.5%
*-commutative78.5%
Simplified78.5%
Final simplification78.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-310)
(*
(sqrt (/ d h))
(*
(/ (sqrt (- d)) (sqrt (- l)))
(+ 1.0 (* (/ h l) (* -0.5 (pow (/ (/ (* M_m D_m) 2.0) d) 2.0))))))
(if (<= l 4.9e+147)
(/
(* d (fma -0.5 (* h (/ (pow (/ (* M_m 0.5) (/ d D_m)) 2.0) l)) 1.0))
(sqrt (* l h)))
(*
(fma (/ h l) (* -0.5 (pow (* D_m (/ M_m (* d 2.0))) 2.0)) 1.0)
(/ d (* (sqrt h) (sqrt l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0 + ((h / l) * (-0.5 * pow((((M_m * D_m) / 2.0) / d), 2.0)))));
} else if (l <= 4.9e+147) {
tmp = (d * fma(-0.5, (h * (pow(((M_m * 0.5) / (d / D_m)), 2.0) / l)), 1.0)) / sqrt((l * h));
} else {
tmp = fma((h / l), (-0.5 * pow((D_m * (M_m / (d * 2.0))), 2.0)), 1.0) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -5e-310) 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(Float64(M_m * D_m) / 2.0) / d) ^ 2.0)))))); elseif (l <= 4.9e+147) tmp = Float64(Float64(d * fma(-0.5, Float64(h * Float64((Float64(Float64(M_m * 0.5) / Float64(d / D_m)) ^ 2.0) / l)), 1.0)) / sqrt(Float64(l * h))); else tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(D_m * Float64(M_m / Float64(d * 2.0))) ^ 2.0)), 1.0) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -5e-310], 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[(N[(M$95$m * D$95$m), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.9e+147], N[(N[(d * N[(-0.5 * N[(h * N[(N[Power[N[(N[(M$95$m * 0.5), $MachinePrecision] / N[(d / D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{\frac{M\_m \cdot D\_m}{2}}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 4.9 \cdot 10^{+147}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(-0.5, h \cdot \frac{{\left(\frac{M\_m \cdot 0.5}{\frac{d}{D\_m}}\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(D\_m \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.5%
Simplified65.7%
frac-2neg65.7%
sqrt-div73.4%
Applied egg-rr73.4%
frac-times73.4%
associate-/r*73.4%
Applied egg-rr73.4%
if -4.999999999999985e-310 < l < 4.8999999999999998e147Initial program 68.1%
Simplified68.1%
associate-*r/71.9%
div-inv71.9%
metadata-eval71.9%
Applied egg-rr71.9%
add-cbrt-cube57.9%
add-sqr-sqrt57.9%
cbrt-prod71.7%
Applied egg-rr71.7%
Applied egg-rr59.9%
+-commutative59.9%
*-commutative59.9%
*-rgt-identity59.9%
distribute-lft-in76.8%
*-commutative76.8%
*-commutative76.8%
fma-define76.8%
Simplified85.2%
associate-*l/87.7%
associate-*r/87.6%
Applied egg-rr87.6%
if 4.8999999999999998e147 < l Initial program 50.9%
Simplified50.9%
Applied egg-rr78.5%
unpow178.5%
*-commutative78.5%
+-commutative78.5%
*-commutative78.5%
associate-*r*78.5%
fma-define78.5%
*-commutative78.5%
/-rgt-identity78.5%
associate-/l*78.5%
metadata-eval78.5%
times-frac78.5%
associate-*r/78.5%
*-commutative78.5%
Simplified78.5%
Final simplification78.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-310)
(*
(* (/ (sqrt (- d)) (sqrt (- l))) (sqrt (/ d h)))
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D_m d) (* M_m 0.5)) 2.0)) l))))
(if (<= l 1.55e+148)
(/
(* d (fma -0.5 (* h (/ (pow (/ (* M_m 0.5) (/ d D_m)) 2.0) l)) 1.0))
(sqrt (* l h)))
(*
(fma (/ h l) (* -0.5 (pow (* D_m (/ M_m (* d 2.0))) 2.0)) 1.0)
(/ d (* (sqrt h) (sqrt l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = ((sqrt(-d) / sqrt(-l)) * sqrt((d / h))) * (1.0 - (0.5 * ((h * pow(((D_m / d) * (M_m * 0.5)), 2.0)) / l)));
} else if (l <= 1.55e+148) {
tmp = (d * fma(-0.5, (h * (pow(((M_m * 0.5) / (d / D_m)), 2.0) / l)), 1.0)) / sqrt((l * h));
} else {
tmp = fma((h / l), (-0.5 * pow((D_m * (M_m / (d * 2.0))), 2.0)), 1.0) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D_m / d) * Float64(M_m * 0.5)) ^ 2.0)) / l)))); elseif (l <= 1.55e+148) tmp = Float64(Float64(d * fma(-0.5, Float64(h * Float64((Float64(Float64(M_m * 0.5) / Float64(d / D_m)) ^ 2.0) / l)), 1.0)) / sqrt(Float64(l * h))); else tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(D_m * Float64(M_m / Float64(d * 2.0))) ^ 2.0)), 1.0) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -5e-310], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.55e+148], N[(N[(d * N[(-0.5 * N[(h * N[(N[Power[N[(N[(M$95$m * 0.5), $MachinePrecision] / N[(d / D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D\_m}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;\ell \leq 1.55 \cdot 10^{+148}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(-0.5, h \cdot \frac{{\left(\frac{M\_m \cdot 0.5}{\frac{d}{D\_m}}\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(D\_m \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.5%
Simplified66.4%
associate-*r/67.3%
div-inv67.3%
metadata-eval67.3%
Applied egg-rr67.3%
frac-2neg65.7%
sqrt-div73.4%
Applied egg-rr74.8%
if -4.999999999999985e-310 < l < 1.54999999999999988e148Initial program 68.1%
Simplified68.1%
associate-*r/71.9%
div-inv71.9%
metadata-eval71.9%
Applied egg-rr71.9%
add-cbrt-cube57.9%
add-sqr-sqrt57.9%
cbrt-prod71.7%
Applied egg-rr71.7%
Applied egg-rr59.9%
+-commutative59.9%
*-commutative59.9%
*-rgt-identity59.9%
distribute-lft-in76.8%
*-commutative76.8%
*-commutative76.8%
fma-define76.8%
Simplified85.2%
associate-*l/87.7%
associate-*r/87.6%
Applied egg-rr87.6%
if 1.54999999999999988e148 < l Initial program 50.9%
Simplified50.9%
Applied egg-rr78.5%
unpow178.5%
*-commutative78.5%
+-commutative78.5%
*-commutative78.5%
associate-*r*78.5%
fma-define78.5%
*-commutative78.5%
/-rgt-identity78.5%
associate-/l*78.5%
metadata-eval78.5%
times-frac78.5%
associate-*r/78.5%
*-commutative78.5%
Simplified78.5%
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 (<= l -5e-310)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(*
(+ 1.0 (* (/ h l) (* (pow (* (/ M_m 2.0) (/ D_m d)) 2.0) -0.5)))
(sqrt (/ d l))))
(if (<= l 4.9e+147)
(/
(* d (fma -0.5 (* h (/ (pow (/ (* M_m 0.5) (/ d D_m)) 2.0) l)) 1.0))
(sqrt (* l h)))
(*
(fma (/ h l) (* -0.5 (pow (* D_m (/ M_m (* d 2.0))) 2.0)) 1.0)
(/ d (* (sqrt h) (sqrt l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * ((1.0 + ((h / l) * (pow(((M_m / 2.0) * (D_m / d)), 2.0) * -0.5))) * sqrt((d / l)));
} else if (l <= 4.9e+147) {
tmp = (d * fma(-0.5, (h * (pow(((M_m * 0.5) / (d / D_m)), 2.0) / l)), 1.0)) / sqrt((l * h));
} else {
tmp = fma((h / l), (-0.5 * pow((D_m * (M_m / (d * 2.0))), 2.0)), 1.0) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0) * -0.5))) * sqrt(Float64(d / l)))); elseif (l <= 4.9e+147) tmp = Float64(Float64(d * fma(-0.5, Float64(h * Float64((Float64(Float64(M_m * 0.5) / Float64(d / D_m)) ^ 2.0) / l)), 1.0)) / sqrt(Float64(l * h))); else tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(D_m * Float64(M_m / Float64(d * 2.0))) ^ 2.0)), 1.0) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -5e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.9e+147], N[(N[(d * N[(-0.5 * N[(h * N[(N[Power[N[(N[(M$95$m * 0.5), $MachinePrecision] / N[(d / D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2} \cdot -0.5\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{elif}\;\ell \leq 4.9 \cdot 10^{+147}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(-0.5, h \cdot \frac{{\left(\frac{M\_m \cdot 0.5}{\frac{d}{D\_m}}\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(D\_m \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.5%
Simplified65.7%
frac-2neg73.4%
sqrt-div89.5%
Applied egg-rr78.9%
if -4.999999999999985e-310 < l < 4.8999999999999998e147Initial program 68.1%
Simplified68.1%
associate-*r/71.9%
div-inv71.9%
metadata-eval71.9%
Applied egg-rr71.9%
add-cbrt-cube57.9%
add-sqr-sqrt57.9%
cbrt-prod71.7%
Applied egg-rr71.7%
Applied egg-rr59.9%
+-commutative59.9%
*-commutative59.9%
*-rgt-identity59.9%
distribute-lft-in76.8%
*-commutative76.8%
*-commutative76.8%
fma-define76.8%
Simplified85.2%
associate-*l/87.7%
associate-*r/87.6%
Applied egg-rr87.6%
if 4.8999999999999998e147 < l Initial program 50.9%
Simplified50.9%
Applied egg-rr78.5%
unpow178.5%
*-commutative78.5%
+-commutative78.5%
*-commutative78.5%
associate-*r*78.5%
fma-define78.5%
*-commutative78.5%
/-rgt-identity78.5%
associate-/l*78.5%
metadata-eval78.5%
times-frac78.5%
associate-*r/78.5%
*-commutative78.5%
Simplified78.5%
Final simplification81.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 2e-309)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D_m d) (* M_m 0.5)) 2.0)) l)))
(* (sqrt (/ d h)) (sqrt (/ d l))))
(if (<= l 5e+147)
(/
(* d (fma -0.5 (* h (/ (pow (/ (* M_m 0.5) (/ d D_m)) 2.0) l)) 1.0))
(sqrt (* l h)))
(*
(fma (/ h l) (* -0.5 (pow (* D_m (/ M_m (* d 2.0))) 2.0)) 1.0)
(/ d (* (sqrt h) (sqrt l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 2e-309) {
tmp = (1.0 - (0.5 * ((h * pow(((D_m / d) * (M_m * 0.5)), 2.0)) / l))) * (sqrt((d / h)) * sqrt((d / l)));
} else if (l <= 5e+147) {
tmp = (d * fma(-0.5, (h * (pow(((M_m * 0.5) / (d / D_m)), 2.0) / l)), 1.0)) / sqrt((l * h));
} else {
tmp = fma((h / l), (-0.5 * pow((D_m * (M_m / (d * 2.0))), 2.0)), 1.0) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= 2e-309) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D_m / d) * Float64(M_m * 0.5)) ^ 2.0)) / l))) * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))); elseif (l <= 5e+147) tmp = Float64(Float64(d * fma(-0.5, Float64(h * Float64((Float64(Float64(M_m * 0.5) / Float64(d / D_m)) ^ 2.0) / l)), 1.0)) / sqrt(Float64(l * h))); else tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(D_m * Float64(M_m / Float64(d * 2.0))) ^ 2.0)), 1.0) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, 2e-309], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5e+147], N[(N[(d * N[(-0.5 * N[(h * N[(N[Power[N[(N[(M$95$m * 0.5), $MachinePrecision] / N[(d / D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2 \cdot 10^{-309}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D\_m}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{elif}\;\ell \leq 5 \cdot 10^{+147}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(-0.5, h \cdot \frac{{\left(\frac{M\_m \cdot 0.5}{\frac{d}{D\_m}}\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(D\_m \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < 1.9999999999999988e-309Initial program 66.5%
Simplified66.4%
associate-*r/67.3%
div-inv67.3%
metadata-eval67.3%
Applied egg-rr67.3%
if 1.9999999999999988e-309 < l < 5.0000000000000002e147Initial program 68.1%
Simplified68.1%
associate-*r/71.9%
div-inv71.9%
metadata-eval71.9%
Applied egg-rr71.9%
add-cbrt-cube57.9%
add-sqr-sqrt57.9%
cbrt-prod71.7%
Applied egg-rr71.7%
Applied egg-rr59.9%
+-commutative59.9%
*-commutative59.9%
*-rgt-identity59.9%
distribute-lft-in76.8%
*-commutative76.8%
*-commutative76.8%
fma-define76.8%
Simplified85.2%
associate-*l/87.7%
associate-*r/87.6%
Applied egg-rr87.6%
if 5.0000000000000002e147 < l Initial program 50.9%
Simplified50.9%
Applied egg-rr78.5%
unpow178.5%
*-commutative78.5%
+-commutative78.5%
*-commutative78.5%
associate-*r*78.5%
fma-define78.5%
*-commutative78.5%
/-rgt-identity78.5%
associate-/l*78.5%
metadata-eval78.5%
times-frac78.5%
associate-*r/78.5%
*-commutative78.5%
Simplified78.5%
Final simplification75.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 h))))
(if (<= l -1.9e-81)
(/ (- d) t_0)
(if (<= l 1.05e-307)
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0))))
(sqrt (* (/ d h) (/ d l))))
(*
(/ d t_0)
(fma -0.5 (* h (/ (pow (* M_m (/ 0.5 (/ d D_m))) 2.0) l)) 1.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 * h));
double tmp;
if (l <= -1.9e-81) {
tmp = -d / t_0;
} else if (l <= 1.05e-307) {
tmp = (1.0 - (0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0)))) * sqrt(((d / h) * (d / l)));
} else {
tmp = (d / t_0) * fma(-0.5, (h * (pow((M_m * (0.5 / (d / D_m))), 2.0) / l)), 1.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 = sqrt(Float64(l * h)) tmp = 0.0 if (l <= -1.9e-81) tmp = Float64(Float64(-d) / t_0); elseif (l <= 1.05e-307) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0)))) * sqrt(Float64(Float64(d / h) * Float64(d / l)))); else tmp = Float64(Float64(d / t_0) * fma(-0.5, Float64(h * Float64((Float64(M_m * Float64(0.5 / Float64(d / D_m))) ^ 2.0) / l)), 1.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[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.9e-81], N[((-d) / t$95$0), $MachinePrecision], If[LessEqual[l, 1.05e-307], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / t$95$0), $MachinePrecision] * N[(-0.5 * N[(h * N[(N[Power[N[(M$95$m * N[(0.5 / N[(d / D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.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 h}\\
\mathbf{if}\;\ell \leq -1.9 \cdot 10^{-81}:\\
\;\;\;\;\frac{-d}{t\_0}\\
\mathbf{elif}\;\ell \leq 1.05 \cdot 10^{-307}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_0} \cdot \mathsf{fma}\left(-0.5, h \cdot \frac{{\left(M\_m \cdot \frac{0.5}{\frac{d}{D\_m}}\right)}^{2}}{\ell}, 1\right)\\
\end{array}
\end{array}
if l < -1.8999999999999999e-81Initial program 61.6%
Simplified61.6%
frac-2neg61.6%
sqrt-div73.6%
Applied egg-rr73.6%
Taylor expanded in d around -inf 53.9%
mul-1-neg53.9%
*-commutative53.9%
unpow1/253.9%
rem-exp-log51.1%
exp-neg51.1%
exp-prod51.1%
*-commutative51.1%
distribute-rgt-neg-in51.1%
log-pow51.1%
unpow1/251.1%
exp-neg51.1%
rem-exp-log53.8%
associate-/r/53.8%
*-lft-identity53.8%
associate-/l*53.8%
remove-double-div53.9%
distribute-neg-frac53.9%
Simplified53.9%
if -1.8999999999999999e-81 < l < 1.0500000000000001e-307Initial program 73.3%
Simplified71.6%
associate-*r/73.7%
div-inv73.7%
metadata-eval73.7%
Applied egg-rr73.7%
Applied egg-rr68.4%
unpow168.4%
rem-log-exp61.6%
*-commutative61.6%
rem-log-exp68.4%
associate-*l*68.4%
times-frac66.6%
Simplified66.6%
if 1.0500000000000001e-307 < l Initial program 62.7%
Simplified62.7%
associate-*r/63.7%
div-inv63.7%
metadata-eval63.7%
Applied egg-rr63.7%
add-cbrt-cube50.0%
add-sqr-sqrt50.0%
cbrt-prod63.5%
Applied egg-rr63.5%
Applied egg-rr59.4%
+-commutative59.4%
*-commutative59.4%
*-rgt-identity59.4%
distribute-lft-in71.1%
*-commutative71.1%
*-commutative71.1%
fma-define71.1%
Simplified77.6%
Final simplification67.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
(let* ((t_0 (sqrt (* l h))))
(if (<= l -2e-82)
(/ (- d) t_0)
(if (<= l 4.3e-308)
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0))))
(sqrt (* (/ d h) (/ d l))))
(/
(* d (fma -0.5 (* h (/ (pow (/ (* M_m 0.5) (/ d D_m)) 2.0) l)) 1.0))
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 * h));
double tmp;
if (l <= -2e-82) {
tmp = -d / t_0;
} else if (l <= 4.3e-308) {
tmp = (1.0 - (0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0)))) * sqrt(((d / h) * (d / l)));
} else {
tmp = (d * fma(-0.5, (h * (pow(((M_m * 0.5) / (d / D_m)), 2.0) / l)), 1.0)) / 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 = sqrt(Float64(l * h)) tmp = 0.0 if (l <= -2e-82) tmp = Float64(Float64(-d) / t_0); elseif (l <= 4.3e-308) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0)))) * sqrt(Float64(Float64(d / h) * Float64(d / l)))); else tmp = Float64(Float64(d * fma(-0.5, Float64(h * Float64((Float64(Float64(M_m * 0.5) / Float64(d / D_m)) ^ 2.0) / l)), 1.0)) / 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[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -2e-82], N[((-d) / t$95$0), $MachinePrecision], If[LessEqual[l, 4.3e-308], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d * N[(-0.5 * N[(h * N[(N[Power[N[(N[(M$95$m * 0.5), $MachinePrecision] / N[(d / D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;\ell \leq -2 \cdot 10^{-82}:\\
\;\;\;\;\frac{-d}{t\_0}\\
\mathbf{elif}\;\ell \leq 4.3 \cdot 10^{-308}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(-0.5, h \cdot \frac{{\left(\frac{M\_m \cdot 0.5}{\frac{d}{D\_m}}\right)}^{2}}{\ell}, 1\right)}{t\_0}\\
\end{array}
\end{array}
if l < -2e-82Initial program 61.6%
Simplified61.6%
frac-2neg61.6%
sqrt-div73.6%
Applied egg-rr73.6%
Taylor expanded in d around -inf 53.9%
mul-1-neg53.9%
*-commutative53.9%
unpow1/253.9%
rem-exp-log51.1%
exp-neg51.1%
exp-prod51.1%
*-commutative51.1%
distribute-rgt-neg-in51.1%
log-pow51.1%
unpow1/251.1%
exp-neg51.1%
rem-exp-log53.8%
associate-/r/53.8%
*-lft-identity53.8%
associate-/l*53.8%
remove-double-div53.9%
distribute-neg-frac53.9%
Simplified53.9%
if -2e-82 < l < 4.3000000000000002e-308Initial program 73.3%
Simplified71.6%
associate-*r/73.7%
div-inv73.7%
metadata-eval73.7%
Applied egg-rr73.7%
Applied egg-rr68.4%
unpow168.4%
rem-log-exp61.6%
*-commutative61.6%
rem-log-exp68.4%
associate-*l*68.4%
times-frac66.6%
Simplified66.6%
if 4.3000000000000002e-308 < l Initial program 62.7%
Simplified62.7%
associate-*r/63.7%
div-inv63.7%
metadata-eval63.7%
Applied egg-rr63.7%
add-cbrt-cube50.0%
add-sqr-sqrt50.0%
cbrt-prod63.5%
Applied egg-rr63.5%
Applied egg-rr59.4%
+-commutative59.4%
*-commutative59.4%
*-rgt-identity59.4%
distribute-lft-in71.1%
*-commutative71.1%
*-commutative71.1%
fma-define71.1%
Simplified77.6%
associate-*l/80.2%
associate-*r/80.1%
Applied egg-rr80.1%
Final simplification69.1%
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.7e-308)
(*
(sqrt (/ d h))
(*
(+ 1.0 (* (/ h l) (* (pow (* (/ M_m 2.0) (/ D_m d)) 2.0) -0.5)))
(sqrt (/ d l))))
(/
(* d (fma -0.5 (* h (/ (pow (/ (* M_m 0.5) (/ d D_m)) 2.0) l)) 1.0))
(sqrt (* l 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 <= 1.7e-308) {
tmp = sqrt((d / h)) * ((1.0 + ((h / l) * (pow(((M_m / 2.0) * (D_m / d)), 2.0) * -0.5))) * sqrt((d / l)));
} else {
tmp = (d * fma(-0.5, (h * (pow(((M_m * 0.5) / (d / D_m)), 2.0) / l)), 1.0)) / sqrt((l * 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 <= 1.7e-308) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0) * -0.5))) * sqrt(Float64(d / l)))); else tmp = Float64(Float64(d * fma(-0.5, Float64(h * Float64((Float64(Float64(M_m * 0.5) / Float64(d / D_m)) ^ 2.0) / l)), 1.0)) / sqrt(Float64(l * 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[l, 1.7e-308], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d * N[(-0.5 * N[(h * N[(N[Power[N[(N[(M$95$m * 0.5), $MachinePrecision] / N[(d / D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * 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 1.7 \cdot 10^{-308}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2} \cdot -0.5\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(-0.5, h \cdot \frac{{\left(\frac{M\_m \cdot 0.5}{\frac{d}{D\_m}}\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if l < 1.7000000000000002e-308Initial program 66.5%
Simplified65.7%
if 1.7000000000000002e-308 < l Initial program 62.7%
Simplified62.7%
associate-*r/63.7%
div-inv63.7%
metadata-eval63.7%
Applied egg-rr63.7%
add-cbrt-cube50.0%
add-sqr-sqrt50.0%
cbrt-prod63.5%
Applied egg-rr63.5%
Applied egg-rr59.4%
+-commutative59.4%
*-commutative59.4%
*-rgt-identity59.4%
distribute-lft-in71.1%
*-commutative71.1%
*-commutative71.1%
fma-define71.1%
Simplified77.6%
associate-*l/80.2%
associate-*r/80.1%
Applied egg-rr80.1%
Final simplification72.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 -5e-310)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0)))))
(/
(* d (fma -0.5 (* h (/ (pow (/ (* M_m 0.5) (/ d D_m)) 2.0) l)) 1.0))
(sqrt (* l 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 <= -5e-310) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0))));
} else {
tmp = (d * fma(-0.5, (h * (pow(((M_m * 0.5) / (d / D_m)), 2.0) / l)), 1.0)) / sqrt((l * 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 <= -5e-310) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0))))); else tmp = Float64(Float64(d * fma(-0.5, Float64(h * Float64((Float64(Float64(M_m * 0.5) / Float64(d / D_m)) ^ 2.0) / l)), 1.0)) / sqrt(Float64(l * 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[l, -5e-310], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d * N[(-0.5 * N[(h * N[(N[Power[N[(N[(M$95$m * 0.5), $MachinePrecision] / N[(d / D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * 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 -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(-0.5, h \cdot \frac{{\left(\frac{M\_m \cdot 0.5}{\frac{d}{D\_m}}\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.5%
Simplified66.4%
if -4.999999999999985e-310 < l Initial program 62.7%
Simplified62.7%
associate-*r/63.7%
div-inv63.7%
metadata-eval63.7%
Applied egg-rr63.7%
add-cbrt-cube50.0%
add-sqr-sqrt50.0%
cbrt-prod63.5%
Applied egg-rr63.5%
Applied egg-rr59.4%
+-commutative59.4%
*-commutative59.4%
*-rgt-identity59.4%
distribute-lft-in71.1%
*-commutative71.1%
*-commutative71.1%
fma-define71.1%
Simplified77.6%
associate-*l/80.2%
associate-*r/80.1%
Applied egg-rr80.1%
Final simplification72.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 8e-309)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D_m d) (* M_m 0.5)) 2.0)) l)))
(* (sqrt (/ d h)) (sqrt (/ d l))))
(/
(* d (fma -0.5 (* h (/ (pow (/ (* M_m 0.5) (/ d D_m)) 2.0) l)) 1.0))
(sqrt (* l 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 <= 8e-309) {
tmp = (1.0 - (0.5 * ((h * pow(((D_m / d) * (M_m * 0.5)), 2.0)) / l))) * (sqrt((d / h)) * sqrt((d / l)));
} else {
tmp = (d * fma(-0.5, (h * (pow(((M_m * 0.5) / (d / D_m)), 2.0) / l)), 1.0)) / sqrt((l * 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 <= 8e-309) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D_m / d) * Float64(M_m * 0.5)) ^ 2.0)) / l))) * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))); else tmp = Float64(Float64(d * fma(-0.5, Float64(h * Float64((Float64(Float64(M_m * 0.5) / Float64(d / D_m)) ^ 2.0) / l)), 1.0)) / sqrt(Float64(l * 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[l, 8e-309], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d * N[(-0.5 * N[(h * N[(N[Power[N[(N[(M$95$m * 0.5), $MachinePrecision] / N[(d / D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * 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 8 \cdot 10^{-309}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D\_m}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(-0.5, h \cdot \frac{{\left(\frac{M\_m \cdot 0.5}{\frac{d}{D\_m}}\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if l < 8.0000000000000003e-309Initial program 66.5%
Simplified66.4%
associate-*r/67.3%
div-inv67.3%
metadata-eval67.3%
Applied egg-rr67.3%
if 8.0000000000000003e-309 < l Initial program 62.7%
Simplified62.7%
associate-*r/63.7%
div-inv63.7%
metadata-eval63.7%
Applied egg-rr63.7%
add-cbrt-cube50.0%
add-sqr-sqrt50.0%
cbrt-prod63.5%
Applied egg-rr63.5%
Applied egg-rr59.4%
+-commutative59.4%
*-commutative59.4%
*-rgt-identity59.4%
distribute-lft-in71.1%
*-commutative71.1%
*-commutative71.1%
fma-define71.1%
Simplified77.6%
associate-*l/80.2%
associate-*r/80.1%
Applied egg-rr80.1%
Final simplification73.4%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (* l h))))
(if (<= l -6e-85)
(/ (- d) t_0)
(if (<= l 5e-310)
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0))))
(sqrt (* (/ d h) (/ d l))))
(*
(/ d t_0)
(+ 1.0 (* -0.5 (/ (pow (* (/ D_m d) (* M_m 0.5)) 2.0) (/ l 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 = sqrt((l * h));
double tmp;
if (l <= -6e-85) {
tmp = -d / t_0;
} else if (l <= 5e-310) {
tmp = (1.0 - (0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0)))) * sqrt(((d / h) * (d / l)));
} else {
tmp = (d / t_0) * (1.0 + (-0.5 * (pow(((D_m / d) * (M_m * 0.5)), 2.0) / (l / 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) :: t_0
real(8) :: tmp
t_0 = sqrt((l * h))
if (l <= (-6d-85)) then
tmp = -d / t_0
else if (l <= 5d-310) then
tmp = (1.0d0 - (0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_m / d)) ** 2.0d0)))) * sqrt(((d / h) * (d / l)))
else
tmp = (d / t_0) * (1.0d0 + ((-0.5d0) * ((((d_m / d) * (m_m * 0.5d0)) ** 2.0d0) / (l / 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 t_0 = Math.sqrt((l * h));
double tmp;
if (l <= -6e-85) {
tmp = -d / t_0;
} else if (l <= 5e-310) {
tmp = (1.0 - (0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D_m / d)), 2.0)))) * Math.sqrt(((d / h) * (d / l)));
} else {
tmp = (d / t_0) * (1.0 + (-0.5 * (Math.pow(((D_m / d) * (M_m * 0.5)), 2.0) / (l / 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 = math.sqrt((l * h)) tmp = 0 if l <= -6e-85: tmp = -d / t_0 elif l <= 5e-310: tmp = (1.0 - (0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D_m / d)), 2.0)))) * math.sqrt(((d / h) * (d / l))) else: tmp = (d / t_0) * (1.0 + (-0.5 * (math.pow(((D_m / d) * (M_m * 0.5)), 2.0) / (l / 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 = sqrt(Float64(l * h)) tmp = 0.0 if (l <= -6e-85) tmp = Float64(Float64(-d) / t_0); elseif (l <= 5e-310) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0)))) * sqrt(Float64(Float64(d / h) * Float64(d / l)))); else tmp = Float64(Float64(d / t_0) * Float64(1.0 + Float64(-0.5 * Float64((Float64(Float64(D_m / d) * Float64(M_m * 0.5)) ^ 2.0) / Float64(l / 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)
t_0 = sqrt((l * h));
tmp = 0.0;
if (l <= -6e-85)
tmp = -d / t_0;
elseif (l <= 5e-310)
tmp = (1.0 - (0.5 * ((h / l) * (((M_m / 2.0) * (D_m / d)) ^ 2.0)))) * sqrt(((d / h) * (d / l)));
else
tmp = (d / t_0) * (1.0 + (-0.5 * ((((D_m / d) * (M_m * 0.5)) ^ 2.0) / (l / 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_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -6e-85], N[((-d) / t$95$0), $MachinePrecision], If[LessEqual[l, 5e-310], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / t$95$0), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;\ell \leq -6 \cdot 10^{-85}:\\
\;\;\;\;\frac{-d}{t\_0}\\
\mathbf{elif}\;\ell \leq 5 \cdot 10^{-310}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_0} \cdot \left(1 + -0.5 \cdot \frac{{\left(\frac{D\_m}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}}{\frac{\ell}{h}}\right)\\
\end{array}
\end{array}
if l < -6.00000000000000044e-85Initial program 61.6%
Simplified61.6%
frac-2neg61.6%
sqrt-div73.6%
Applied egg-rr73.6%
Taylor expanded in d around -inf 53.9%
mul-1-neg53.9%
*-commutative53.9%
unpow1/253.9%
rem-exp-log51.1%
exp-neg51.1%
exp-prod51.1%
*-commutative51.1%
distribute-rgt-neg-in51.1%
log-pow51.1%
unpow1/251.1%
exp-neg51.1%
rem-exp-log53.8%
associate-/r/53.8%
*-lft-identity53.8%
associate-/l*53.8%
remove-double-div53.9%
distribute-neg-frac53.9%
Simplified53.9%
if -6.00000000000000044e-85 < l < 4.999999999999985e-310Initial program 73.3%
Simplified71.6%
associate-*r/73.7%
div-inv73.7%
metadata-eval73.7%
Applied egg-rr73.7%
Applied egg-rr68.4%
unpow168.4%
rem-log-exp61.6%
*-commutative61.6%
rem-log-exp68.4%
associate-*l*68.4%
times-frac66.6%
Simplified66.6%
if 4.999999999999985e-310 < l Initial program 62.7%
Simplified62.7%
associate-*r/63.7%
div-inv63.7%
metadata-eval63.7%
Applied egg-rr63.7%
add-cbrt-cube50.0%
add-sqr-sqrt50.0%
cbrt-prod63.5%
Applied egg-rr63.5%
Applied egg-rr59.4%
*-rgt-identity59.4%
*-commutative59.4%
distribute-lft-out71.1%
rem-log-exp66.2%
*-commutative66.2%
rem-log-exp71.1%
*-commutative71.1%
associate-*r*71.1%
Simplified71.1%
Final simplification64.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 h))))
(if (<= l -7.6e-102)
(/ (- d) t_0)
(if (<= l -5e-310)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(*
(/ d t_0)
(+ 1.0 (* -0.5 (/ (pow (* (/ D_m d) (* M_m 0.5)) 2.0) (/ l 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 = sqrt((l * h));
double tmp;
if (l <= -7.6e-102) {
tmp = -d / t_0;
} else if (l <= -5e-310) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = (d / t_0) * (1.0 + (-0.5 * (pow(((D_m / d) * (M_m * 0.5)), 2.0) / (l / 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) :: t_0
real(8) :: tmp
t_0 = sqrt((l * h))
if (l <= (-7.6d-102)) then
tmp = -d / t_0
else if (l <= (-5d-310)) then
tmp = sqrt((d / h)) * sqrt((d / l))
else
tmp = (d / t_0) * (1.0d0 + ((-0.5d0) * ((((d_m / d) * (m_m * 0.5d0)) ** 2.0d0) / (l / 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 t_0 = Math.sqrt((l * h));
double tmp;
if (l <= -7.6e-102) {
tmp = -d / t_0;
} else if (l <= -5e-310) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else {
tmp = (d / t_0) * (1.0 + (-0.5 * (Math.pow(((D_m / d) * (M_m * 0.5)), 2.0) / (l / 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 = math.sqrt((l * h)) tmp = 0 if l <= -7.6e-102: tmp = -d / t_0 elif l <= -5e-310: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) else: tmp = (d / t_0) * (1.0 + (-0.5 * (math.pow(((D_m / d) * (M_m * 0.5)), 2.0) / (l / 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 = sqrt(Float64(l * h)) tmp = 0.0 if (l <= -7.6e-102) tmp = Float64(Float64(-d) / t_0); elseif (l <= -5e-310) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = Float64(Float64(d / t_0) * Float64(1.0 + Float64(-0.5 * Float64((Float64(Float64(D_m / d) * Float64(M_m * 0.5)) ^ 2.0) / Float64(l / 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)
t_0 = sqrt((l * h));
tmp = 0.0;
if (l <= -7.6e-102)
tmp = -d / t_0;
elseif (l <= -5e-310)
tmp = sqrt((d / h)) * sqrt((d / l));
else
tmp = (d / t_0) * (1.0 + (-0.5 * ((((D_m / d) * (M_m * 0.5)) ^ 2.0) / (l / 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_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -7.6e-102], N[((-d) / t$95$0), $MachinePrecision], If[LessEqual[l, -5e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / t$95$0), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;\ell \leq -7.6 \cdot 10^{-102}:\\
\;\;\;\;\frac{-d}{t\_0}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_0} \cdot \left(1 + -0.5 \cdot \frac{{\left(\frac{D\_m}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}}{\frac{\ell}{h}}\right)\\
\end{array}
\end{array}
if l < -7.60000000000000052e-102Initial program 63.2%
Simplified63.2%
frac-2neg63.2%
sqrt-div75.4%
Applied egg-rr75.4%
Taylor expanded in d around -inf 54.8%
mul-1-neg54.8%
*-commutative54.8%
unpow1/254.8%
rem-exp-log51.9%
exp-neg51.9%
exp-prod51.9%
*-commutative51.9%
distribute-rgt-neg-in51.9%
log-pow51.9%
unpow1/251.9%
exp-neg51.9%
rem-exp-log54.7%
associate-/r/54.7%
*-lft-identity54.7%
associate-/l*54.7%
remove-double-div54.8%
distribute-neg-frac54.8%
Simplified54.8%
if -7.60000000000000052e-102 < l < -4.999999999999985e-310Initial program 72.0%
Simplified70.1%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in h around 0 35.0%
if -4.999999999999985e-310 < l Initial program 62.7%
Simplified62.7%
associate-*r/63.7%
div-inv63.7%
metadata-eval63.7%
Applied egg-rr63.7%
add-cbrt-cube50.0%
add-sqr-sqrt50.0%
cbrt-prod63.5%
Applied egg-rr63.5%
Applied egg-rr59.4%
*-rgt-identity59.4%
*-commutative59.4%
distribute-lft-out71.1%
rem-log-exp66.2%
*-commutative66.2%
rem-log-exp71.1%
*-commutative71.1%
associate-*r*71.1%
Simplified71.1%
Final simplification58.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 (<= h 9.2e-290) (/ (- d) (sqrt (* l h))) (* 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 (h <= 9.2e-290) {
tmp = -d / sqrt((l * h));
} 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 (h <= 9.2d-290) then
tmp = -d / sqrt((l * h))
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 (h <= 9.2e-290) {
tmp = -d / Math.sqrt((l * h));
} 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 h <= 9.2e-290: tmp = -d / math.sqrt((l * h)) 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 (h <= 9.2e-290) tmp = Float64(Float64(-d) / sqrt(Float64(l * h))); 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 (h <= 9.2e-290)
tmp = -d / sqrt((l * h));
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[h, 9.2e-290], N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq 9.2 \cdot 10^{-290}:\\
\;\;\;\;\frac{-d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if h < 9.2000000000000003e-290Initial program 65.5%
Simplified64.8%
frac-2neg64.8%
sqrt-div72.3%
Applied egg-rr72.3%
Taylor expanded in d around -inf 43.2%
mul-1-neg43.2%
*-commutative43.2%
unpow1/243.2%
rem-exp-log41.3%
exp-neg41.2%
exp-prod41.7%
*-commutative41.7%
distribute-rgt-neg-in41.7%
log-pow41.7%
unpow1/241.7%
exp-neg41.7%
rem-exp-log43.7%
associate-/r/43.7%
*-lft-identity43.7%
associate-/l*43.7%
remove-double-div43.7%
distribute-neg-frac43.7%
Simplified43.7%
if 9.2000000000000003e-290 < h Initial program 63.8%
Simplified63.7%
associate-*r/63.9%
div-inv63.9%
metadata-eval63.9%
Applied egg-rr63.9%
Taylor expanded in d around inf 42.9%
unpow-142.9%
metadata-eval42.9%
pow-sqr42.9%
rem-sqrt-square43.3%
rem-square-sqrt43.0%
fabs-sqr43.0%
rem-square-sqrt43.3%
Simplified43.3%
*-commutative43.3%
unpow-prod-down48.4%
Applied egg-rr48.4%
Final simplification45.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 6e-288) (/ (- d) (sqrt (* l h))) (* d (pow (* l 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 <= 6e-288) {
tmp = -d / sqrt((l * h));
} else {
tmp = d * pow((l * 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 <= 6d-288) then
tmp = -d / sqrt((l * h))
else
tmp = d * ((l * 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 <= 6e-288) {
tmp = -d / Math.sqrt((l * h));
} else {
tmp = d * Math.pow((l * 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 <= 6e-288: tmp = -d / math.sqrt((l * h)) else: tmp = d * math.pow((l * 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 <= 6e-288) tmp = Float64(Float64(-d) / sqrt(Float64(l * h))); else tmp = Float64(d * (Float64(l * 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 <= 6e-288)
tmp = -d / sqrt((l * h));
else
tmp = d * ((l * 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, 6e-288], N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 6 \cdot 10^{-288}:\\
\;\;\;\;\frac{-d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\end{array}
\end{array}
if l < 5.99999999999999998e-288Initial program 67.2%
Simplified66.5%
frac-2neg66.5%
sqrt-div71.8%
Applied egg-rr71.8%
Taylor expanded in d around -inf 44.3%
mul-1-neg44.3%
*-commutative44.3%
unpow1/244.3%
rem-exp-log42.4%
exp-neg42.4%
exp-prod42.8%
*-commutative42.8%
distribute-rgt-neg-in42.8%
log-pow42.8%
unpow1/242.8%
exp-neg42.8%
rem-exp-log44.8%
associate-/r/44.8%
*-lft-identity44.8%
associate-/l*44.8%
remove-double-div44.8%
distribute-neg-frac44.8%
Simplified44.8%
if 5.99999999999999998e-288 < l Initial program 61.8%
Simplified61.7%
associate-*r/62.8%
div-inv62.8%
metadata-eval62.8%
Applied egg-rr62.8%
Taylor expanded in d around inf 42.5%
unpow-142.5%
metadata-eval42.5%
pow-sqr42.5%
rem-sqrt-square42.8%
rem-square-sqrt42.6%
fabs-sqr42.6%
rem-square-sqrt42.8%
Simplified42.8%
Final simplification43.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 (* l 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) {
return d * pow((l * h), -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 * ((l * h) ** (-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((l * h), -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((l * h), -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(l * h) ^ -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 * ((l * h) ^ -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[(l * h), $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(\ell \cdot h\right)}^{-0.5}
\end{array}
Initial program 64.7%
Simplified64.6%
associate-*r/65.6%
div-inv65.6%
metadata-eval65.6%
Applied egg-rr65.6%
Taylor expanded in d around inf 23.1%
unpow-123.1%
metadata-eval23.1%
pow-sqr23.1%
rem-sqrt-square23.3%
rem-square-sqrt23.2%
fabs-sqr23.2%
rem-square-sqrt23.3%
Simplified23.3%
Final simplification23.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 (/ d (sqrt (* l 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) {
return d / sqrt((l * h));
}
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((l * h))
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((l * h));
}
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((l * h))
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(l * h))) 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((l * h));
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[(l * 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])\\
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 64.7%
associate-*r/66.0%
frac-2neg66.0%
metadata-eval66.0%
*-commutative66.0%
frac-times65.6%
div-inv65.6%
metadata-eval65.6%
Applied egg-rr65.6%
*-commutative65.6%
distribute-rgt-neg-in65.6%
distribute-rgt-neg-in65.6%
metadata-eval65.6%
associate-/l*66.4%
Simplified65.9%
clear-num65.9%
inv-pow65.9%
associate-/l*65.9%
Applied egg-rr65.9%
Taylor expanded in d around inf 23.1%
*-commutative23.1%
unpow1/223.1%
rem-exp-log22.2%
exp-neg22.2%
exp-prod22.4%
*-commutative22.4%
distribute-rgt-neg-in22.4%
log-pow22.4%
unpow1/222.4%
exp-neg22.4%
rem-exp-log23.3%
associate-*l/23.3%
*-lft-identity23.3%
Simplified23.3%
Final simplification23.3%
herbie shell --seed 2024030
(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)))))