
(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 21 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))) (t_1 (/ t_0 (sqrt (- h)))))
(if (<= l -7.6e-70)
(*
(/ t_0 (sqrt (- l)))
(* t_1 (+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M_m 2.0) d)) 2.0) -0.5)))))
(if (<= l -5e-310)
(*
(sqrt (/ d l))
(*
t_1
(+ 1.0 (* (/ 1.0 l) (* h (* -0.125 (pow (* D_m (/ M_m d)) 2.0)))))))
(*
d
(/
(fma (* -0.125 (pow (/ M_m (/ d D_m)) 2.0)) (/ h l) 1.0)
(* (sqrt h) (sqrt l))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt(-d);
double t_1 = t_0 / sqrt(-h);
double tmp;
if (l <= -7.6e-70) {
tmp = (t_0 / sqrt(-l)) * (t_1 * (1.0 + ((h / l) * (pow((D_m * ((M_m / 2.0) / d)), 2.0) * -0.5))));
} else if (l <= -5e-310) {
tmp = sqrt((d / l)) * (t_1 * (1.0 + ((1.0 / l) * (h * (-0.125 * pow((D_m * (M_m / d)), 2.0))))));
} else {
tmp = d * (fma((-0.125 * pow((M_m / (d / D_m)), 2.0)), (h / l), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(-d)) t_1 = Float64(t_0 / sqrt(Float64(-h))) tmp = 0.0 if (l <= -7.6e-70) tmp = Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(t_1 * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D_m * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5))))); elseif (l <= -5e-310) tmp = Float64(sqrt(Float64(d / l)) * Float64(t_1 * Float64(1.0 + Float64(Float64(1.0 / l) * Float64(h * Float64(-0.125 * (Float64(D_m * Float64(M_m / d)) ^ 2.0))))))); else tmp = Float64(d * Float64(fma(Float64(-0.125 * (Float64(M_m / Float64(d / D_m)) ^ 2.0)), Float64(h / l), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -7.6e-70], N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D$95$m * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 * N[(1.0 + N[(N[(1.0 / l), $MachinePrecision] * N[(h * N[(-0.125 * N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(-0.125 * N[Power[N[(M$95$m / N[(d / D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
t_1 := \frac{t\_0}{\sqrt{-h}}\\
\mathbf{if}\;\ell \leq -7.6 \cdot 10^{-70}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-\ell}} \cdot \left(t\_1 \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(D\_m \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(t\_1 \cdot \left(1 + \frac{1}{\ell} \cdot \left(h \cdot \left(-0.125 \cdot {\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.125 \cdot {\left(\frac{M\_m}{\frac{d}{D\_m}}\right)}^{2}, \frac{h}{\ell}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -7.5999999999999995e-70Initial program 59.2%
Simplified59.1%
frac-2neg59.1%
sqrt-div71.7%
Applied egg-rr71.7%
frac-2neg71.7%
sqrt-div87.2%
Applied egg-rr87.2%
if -7.5999999999999995e-70 < l < -4.999999999999985e-310Initial program 80.9%
Simplified80.8%
associate-*l/87.2%
clear-num87.2%
*-commutative87.2%
associate-*r/87.2%
div-inv87.2%
metadata-eval87.2%
Applied egg-rr87.2%
associate-/r/87.2%
associate-/l*87.2%
Simplified87.2%
Taylor expanded in D around 0 55.5%
*-commutative55.5%
associate-/l*53.4%
unpow253.4%
unpow253.4%
unpow253.4%
times-frac64.0%
swap-sqr87.2%
unpow287.2%
associate-*r/87.2%
*-commutative87.2%
associate-/l*87.2%
Simplified87.2%
frac-2neg80.8%
sqrt-div87.2%
Applied egg-rr97.6%
if -4.999999999999985e-310 < l Initial program 67.3%
Simplified67.4%
pow167.4%
associate-*r*67.4%
sqrt-div74.3%
sqrt-div80.4%
frac-times80.3%
add-sqr-sqrt80.5%
unpow-prod-down79.8%
metadata-eval79.8%
clear-num79.8%
un-div-inv79.8%
Applied egg-rr79.8%
unpow179.8%
associate-*l/81.7%
associate-/l*81.7%
fma-define81.7%
associate-*r*81.7%
fma-define81.7%
*-commutative81.7%
associate-*l*81.7%
metadata-eval81.7%
*-commutative81.7%
associate-/r/81.7%
associate-*l/80.2%
associate-/l*81.7%
Simplified81.7%
clear-num81.7%
un-div-inv81.7%
Applied egg-rr81.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 (- d))))
(if (<= l -2e+218)
(*
(/ t_0 (sqrt (- l)))
(*
(+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M_m 2.0) d)) 2.0) -0.5)))
(sqrt (/ d h))))
(if (<= l -5e-310)
(*
(sqrt (/ d l))
(*
(/ t_0 (sqrt (- h)))
(+ 1.0 (* (/ 1.0 l) (* h (* -0.125 (pow (* D_m (/ M_m d)) 2.0)))))))
(*
d
(/
(fma (* -0.125 (pow (/ M_m (/ d D_m)) 2.0)) (/ h l) 1.0)
(* (sqrt h) (sqrt l))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt(-d);
double tmp;
if (l <= -2e+218) {
tmp = (t_0 / sqrt(-l)) * ((1.0 + ((h / l) * (pow((D_m * ((M_m / 2.0) / d)), 2.0) * -0.5))) * sqrt((d / h)));
} else if (l <= -5e-310) {
tmp = sqrt((d / l)) * ((t_0 / sqrt(-h)) * (1.0 + ((1.0 / l) * (h * (-0.125 * pow((D_m * (M_m / d)), 2.0))))));
} else {
tmp = d * (fma((-0.125 * pow((M_m / (d / D_m)), 2.0)), (h / l), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -2e+218) tmp = Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D_m * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5))) * sqrt(Float64(d / h)))); elseif (l <= -5e-310) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(1.0 / l) * Float64(h * Float64(-0.125 * (Float64(D_m * Float64(M_m / d)) ^ 2.0))))))); else tmp = Float64(d * Float64(fma(Float64(-0.125 * (Float64(M_m / Float64(d / D_m)) ^ 2.0)), Float64(h / l), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -2e+218], N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D$95$m * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(1.0 / l), $MachinePrecision] * N[(h * N[(-0.125 * N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(-0.125 * N[Power[N[(M$95$m / N[(d / D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -2 \cdot 10^{+218}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-\ell}} \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left({\left(D\_m \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\right) \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\frac{t\_0}{\sqrt{-h}} \cdot \left(1 + \frac{1}{\ell} \cdot \left(h \cdot \left(-0.125 \cdot {\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.125 \cdot {\left(\frac{M\_m}{\frac{d}{D\_m}}\right)}^{2}, \frac{h}{\ell}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.00000000000000017e218Initial program 42.7%
Simplified42.3%
frac-2neg42.3%
sqrt-div75.2%
Applied egg-rr75.2%
if -2.00000000000000017e218 < l < -4.999999999999985e-310Initial program 72.0%
Simplified71.9%
associate-*l/75.7%
clear-num75.7%
*-commutative75.7%
associate-*r/75.7%
div-inv75.7%
metadata-eval75.7%
Applied egg-rr75.7%
associate-/r/75.7%
associate-/l*75.7%
Simplified75.7%
Taylor expanded in D around 0 45.8%
*-commutative45.8%
associate-/l*44.0%
unpow244.0%
unpow244.0%
unpow244.0%
times-frac57.5%
swap-sqr74.7%
unpow274.7%
associate-*r/75.7%
*-commutative75.7%
associate-/l*75.7%
Simplified75.7%
frac-2neg75.1%
sqrt-div86.7%
Applied egg-rr88.2%
if -4.999999999999985e-310 < l Initial program 67.3%
Simplified67.4%
pow167.4%
associate-*r*67.4%
sqrt-div74.3%
sqrt-div80.4%
frac-times80.3%
add-sqr-sqrt80.5%
unpow-prod-down79.8%
metadata-eval79.8%
clear-num79.8%
un-div-inv79.8%
Applied egg-rr79.8%
unpow179.8%
associate-*l/81.7%
associate-/l*81.7%
fma-define81.7%
associate-*r*81.7%
fma-define81.7%
*-commutative81.7%
associate-*l*81.7%
metadata-eval81.7%
*-commutative81.7%
associate-/r/81.7%
associate-*l/80.2%
associate-/l*81.7%
Simplified81.7%
clear-num81.7%
un-div-inv81.7%
Applied egg-rr81.7%
Final simplification83.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 -5e-310)
(*
(sqrt (/ d l))
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (* (/ 1.0 l) (* h (* -0.125 (pow (* D_m (/ M_m d)) 2.0)))))))
(*
d
(/
(fma (* -0.125 (pow (/ M_m (/ d D_m)) 2.0)) (/ h l) 1.0)
(* (sqrt h) (sqrt l))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = sqrt((d / l)) * ((sqrt(-d) / sqrt(-h)) * (1.0 + ((1.0 / l) * (h * (-0.125 * pow((D_m * (M_m / d)), 2.0))))));
} else {
tmp = d * (fma((-0.125 * pow((M_m / (d / D_m)), 2.0)), (h / l), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -5e-310) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(1.0 / l) * Float64(h * Float64(-0.125 * (Float64(D_m * Float64(M_m / d)) ^ 2.0))))))); else tmp = Float64(d * Float64(fma(Float64(-0.125 * (Float64(M_m / Float64(d / D_m)) ^ 2.0)), Float64(h / l), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -5e-310], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(1.0 / l), $MachinePrecision] * N[(h * N[(-0.125 * N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(-0.125 * N[Power[N[(M$95$m / N[(d / D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(1 + \frac{1}{\ell} \cdot \left(h \cdot \left(-0.125 \cdot {\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.125 \cdot {\left(\frac{M\_m}{\frac{d}{D\_m}}\right)}^{2}, \frac{h}{\ell}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 67.3%
Simplified67.2%
associate-*l/70.4%
clear-num70.4%
*-commutative70.4%
associate-*r/70.4%
div-inv70.4%
metadata-eval70.4%
Applied egg-rr70.4%
associate-/r/70.5%
associate-/l*70.4%
Simplified70.4%
Taylor expanded in D around 0 42.6%
*-commutative42.6%
associate-/l*41.1%
unpow241.1%
unpow241.1%
unpow241.1%
times-frac53.3%
swap-sqr69.6%
unpow269.6%
associate-*r/70.5%
*-commutative70.5%
associate-/l*70.4%
Simplified70.4%
frac-2neg75.1%
sqrt-div87.2%
Applied egg-rr82.5%
if -4.999999999999985e-310 < l Initial program 67.3%
Simplified67.4%
pow167.4%
associate-*r*67.4%
sqrt-div74.3%
sqrt-div80.4%
frac-times80.3%
add-sqr-sqrt80.5%
unpow-prod-down79.8%
metadata-eval79.8%
clear-num79.8%
un-div-inv79.8%
Applied egg-rr79.8%
unpow179.8%
associate-*l/81.7%
associate-/l*81.7%
fma-define81.7%
associate-*r*81.7%
fma-define81.7%
*-commutative81.7%
associate-*l*81.7%
metadata-eval81.7%
*-commutative81.7%
associate-/r/81.7%
associate-*l/80.2%
associate-/l*81.7%
Simplified81.7%
clear-num81.7%
un-div-inv81.7%
Applied egg-rr81.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 -4.7e-108)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+
1.0
(* (/ 1.0 l) (pow (* (sqrt (* h -0.125)) (/ (* D_m M_m) d)) 2.0)))))
(if (<= d -1e-310)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ -1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0)))))
(*
d
(/
(fma (* -0.125 (pow (/ M_m (/ d D_m)) 2.0)) (/ h l) 1.0)
(* (sqrt h) (sqrt l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -4.7e-108) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((1.0 / l) * pow((sqrt((h * -0.125)) * ((D_m * M_m) / d)), 2.0))));
} else if (d <= -1e-310) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0))));
} else {
tmp = d * (fma((-0.125 * pow((M_m / (d / D_m)), 2.0)), (h / l), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -4.7e-108) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(1.0 / l) * (Float64(sqrt(Float64(h * -0.125)) * Float64(Float64(D_m * M_m) / d)) ^ 2.0))))); elseif (d <= -1e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * 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(d * Float64(fma(Float64(-0.125 * (Float64(M_m / Float64(d / D_m)) ^ 2.0)), Float64(h / l), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -4.7e-108], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(1.0 / l), $MachinePrecision] * N[Power[N[(N[Sqrt[N[(h * -0.125), $MachinePrecision]], $MachinePrecision] * N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $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[(d * N[(N[(N[(-0.125 * N[Power[N[(M$95$m / N[(d / D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -4.7 \cdot 10^{-108}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{1}{\ell} \cdot {\left(\sqrt{h \cdot -0.125} \cdot \frac{D\_m \cdot M\_m}{d}\right)}^{2}\right)\right)\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\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}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.125 \cdot {\left(\frac{M\_m}{\frac{d}{D\_m}}\right)}^{2}, \frac{h}{\ell}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -4.70000000000000013e-108Initial program 77.4%
Simplified77.3%
associate-*l/82.2%
clear-num82.1%
*-commutative82.1%
associate-*r/82.3%
div-inv82.3%
metadata-eval82.3%
Applied egg-rr82.3%
associate-/r/82.3%
associate-/l*82.2%
Simplified82.2%
Taylor expanded in D around 0 52.3%
*-commutative52.3%
associate-/l*52.5%
unpow252.5%
unpow252.5%
unpow252.5%
times-frac64.0%
swap-sqr82.3%
unpow282.3%
associate-*r/82.3%
*-commutative82.3%
associate-/l*82.2%
Simplified82.2%
add-sqr-sqrt82.2%
pow282.2%
associate-*r*82.2%
sqrt-prod82.1%
*-commutative82.1%
associate-/r/81.0%
sqrt-pow183.4%
metadata-eval83.4%
pow183.4%
associate-/r/83.4%
*-commutative83.4%
associate-*r/84.6%
Applied egg-rr84.6%
if -4.70000000000000013e-108 < d < -9.999999999999969e-311Initial program 49.2%
Simplified46.8%
sqrt-unprod39.3%
pow1/239.3%
frac-times17.6%
pow217.6%
Applied egg-rr17.6%
unpow1/217.6%
Simplified17.6%
Taylor expanded in d around -inf 63.1%
if -9.999999999999969e-311 < d Initial program 67.3%
Simplified67.4%
pow167.4%
associate-*r*67.4%
sqrt-div74.3%
sqrt-div80.4%
frac-times80.3%
add-sqr-sqrt80.5%
unpow-prod-down79.8%
metadata-eval79.8%
clear-num79.8%
un-div-inv79.8%
Applied egg-rr79.8%
unpow179.8%
associate-*l/81.7%
associate-/l*81.7%
fma-define81.7%
associate-*r*81.7%
fma-define81.7%
*-commutative81.7%
associate-*l*81.7%
metadata-eval81.7%
*-commutative81.7%
associate-/r/81.7%
associate-*l/80.2%
associate-/l*81.7%
Simplified81.7%
clear-num81.7%
un-div-inv81.7%
Applied egg-rr81.7%
Final simplification79.4%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -8.6e-108)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (/ (* (* h -0.125) (pow (/ (* D_m M_m) d) 2.0)) l))))
(if (<= d -1e-310)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ -1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0)))))
(*
d
(/
(fma (* -0.125 (pow (/ M_m (/ d D_m)) 2.0)) (/ h l) 1.0)
(* (sqrt h) (sqrt l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -8.6e-108) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (((h * -0.125) * pow(((D_m * M_m) / d), 2.0)) / l)));
} else if (d <= -1e-310) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0))));
} else {
tmp = d * (fma((-0.125 * pow((M_m / (d / D_m)), 2.0)), (h / l), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -8.6e-108) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(Float64(h * -0.125) * (Float64(Float64(D_m * M_m) / d) ^ 2.0)) / l)))); elseif (d <= -1e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * 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(d * Float64(fma(Float64(-0.125 * (Float64(M_m / Float64(d / D_m)) ^ 2.0)), Float64(h / l), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -8.6e-108], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(N[(h * -0.125), $MachinePrecision] * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $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[(d * N[(N[(N[(-0.125 * N[Power[N[(M$95$m / N[(d / D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -8.6 \cdot 10^{-108}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left(h \cdot -0.125\right) \cdot {\left(\frac{D\_m \cdot M\_m}{d}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\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}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.125 \cdot {\left(\frac{M\_m}{\frac{d}{D\_m}}\right)}^{2}, \frac{h}{\ell}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -8.6000000000000001e-108Initial program 77.4%
Simplified77.3%
associate-*l/82.2%
clear-num82.1%
*-commutative82.1%
associate-*r/82.3%
div-inv82.3%
metadata-eval82.3%
Applied egg-rr82.3%
associate-/r/82.3%
associate-/l*82.2%
Simplified82.2%
Taylor expanded in D around 0 52.3%
*-commutative52.3%
associate-/l*52.5%
unpow252.5%
unpow252.5%
unpow252.5%
times-frac64.0%
swap-sqr82.3%
unpow282.3%
associate-*r/82.3%
*-commutative82.3%
associate-/l*82.2%
Simplified82.2%
associate-*l/82.2%
*-un-lft-identity82.2%
associate-*r*82.2%
associate-*r/82.3%
Applied egg-rr82.3%
if -8.6000000000000001e-108 < d < -9.999999999999969e-311Initial program 49.2%
Simplified46.8%
sqrt-unprod39.3%
pow1/239.3%
frac-times17.6%
pow217.6%
Applied egg-rr17.6%
unpow1/217.6%
Simplified17.6%
Taylor expanded in d around -inf 63.1%
if -9.999999999999969e-311 < d Initial program 67.3%
Simplified67.4%
pow167.4%
associate-*r*67.4%
sqrt-div74.3%
sqrt-div80.4%
frac-times80.3%
add-sqr-sqrt80.5%
unpow-prod-down79.8%
metadata-eval79.8%
clear-num79.8%
un-div-inv79.8%
Applied egg-rr79.8%
unpow179.8%
associate-*l/81.7%
associate-/l*81.7%
fma-define81.7%
associate-*r*81.7%
fma-define81.7%
*-commutative81.7%
associate-*l*81.7%
metadata-eval81.7%
*-commutative81.7%
associate-/r/81.7%
associate-*l/80.2%
associate-/l*81.7%
Simplified81.7%
clear-num81.7%
un-div-inv81.7%
Applied egg-rr81.7%
Final simplification78.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 (<= d -9.5e-108)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (/ (* (* h -0.125) (pow (/ (* D_m M_m) d) 2.0)) l))))
(if (<= d -1e-310)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ -1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0)))))
(*
d
(/
(fma (* -0.125 (pow (* M_m (/ D_m d)) 2.0)) (/ h l) 1.0)
(* (sqrt h) (sqrt l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -9.5e-108) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (((h * -0.125) * pow(((D_m * M_m) / d), 2.0)) / l)));
} else if (d <= -1e-310) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0))));
} else {
tmp = d * (fma((-0.125 * pow((M_m * (D_m / d)), 2.0)), (h / l), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -9.5e-108) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(Float64(h * -0.125) * (Float64(Float64(D_m * M_m) / d) ^ 2.0)) / l)))); elseif (d <= -1e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * 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(d * Float64(fma(Float64(-0.125 * (Float64(M_m * Float64(D_m / d)) ^ 2.0)), Float64(h / l), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -9.5e-108], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(N[(h * -0.125), $MachinePrecision] * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $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[(d * N[(N[(N[(-0.125 * N[Power[N[(M$95$m * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -9.5 \cdot 10^{-108}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left(h \cdot -0.125\right) \cdot {\left(\frac{D\_m \cdot M\_m}{d}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\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}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.125 \cdot {\left(M\_m \cdot \frac{D\_m}{d}\right)}^{2}, \frac{h}{\ell}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -9.5000000000000005e-108Initial program 77.4%
Simplified77.3%
associate-*l/82.2%
clear-num82.1%
*-commutative82.1%
associate-*r/82.3%
div-inv82.3%
metadata-eval82.3%
Applied egg-rr82.3%
associate-/r/82.3%
associate-/l*82.2%
Simplified82.2%
Taylor expanded in D around 0 52.3%
*-commutative52.3%
associate-/l*52.5%
unpow252.5%
unpow252.5%
unpow252.5%
times-frac64.0%
swap-sqr82.3%
unpow282.3%
associate-*r/82.3%
*-commutative82.3%
associate-/l*82.2%
Simplified82.2%
associate-*l/82.2%
*-un-lft-identity82.2%
associate-*r*82.2%
associate-*r/82.3%
Applied egg-rr82.3%
if -9.5000000000000005e-108 < d < -9.999999999999969e-311Initial program 49.2%
Simplified46.8%
sqrt-unprod39.3%
pow1/239.3%
frac-times17.6%
pow217.6%
Applied egg-rr17.6%
unpow1/217.6%
Simplified17.6%
Taylor expanded in d around -inf 63.1%
if -9.999999999999969e-311 < d Initial program 67.3%
Simplified67.4%
pow167.4%
associate-*r*67.4%
sqrt-div74.3%
sqrt-div80.4%
frac-times80.3%
add-sqr-sqrt80.5%
unpow-prod-down79.8%
metadata-eval79.8%
clear-num79.8%
un-div-inv79.8%
Applied egg-rr79.8%
unpow179.8%
associate-*l/81.7%
associate-/l*81.7%
fma-define81.7%
associate-*r*81.7%
fma-define81.7%
*-commutative81.7%
associate-*l*81.7%
metadata-eval81.7%
*-commutative81.7%
associate-/r/81.7%
associate-*l/80.2%
associate-/l*81.7%
Simplified81.7%
Final simplification78.6%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0)))))
(if (<= d -8e-108)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (/ (* (* h -0.125) (pow (/ (* D_m M_m) d) 2.0)) l))))
(if (<= d -1e-310)
(* (* d (sqrt (/ 1.0 (* l h)))) (+ -1.0 t_0))
(* (- 1.0 t_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 = 0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0));
double tmp;
if (d <= -8e-108) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (((h * -0.125) * pow(((D_m * M_m) / d), 2.0)) / l)));
} else if (d <= -1e-310) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + t_0);
} else {
tmp = (1.0 - t_0) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_m / d)) ** 2.0d0))
if (d <= (-8d-108)) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + (((h * (-0.125d0)) * (((d_m * m_m) / d) ** 2.0d0)) / l)))
else if (d <= (-1d-310)) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + t_0)
else
tmp = (1.0d0 - t_0) * (d / (sqrt(h) * sqrt(l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D_m / d)), 2.0));
double tmp;
if (d <= -8e-108) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + (((h * -0.125) * Math.pow(((D_m * M_m) / d), 2.0)) / l)));
} else if (d <= -1e-310) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + t_0);
} else {
tmp = (1.0 - t_0) * (d / (Math.sqrt(h) * Math.sqrt(l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = 0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D_m / d)), 2.0)) tmp = 0 if d <= -8e-108: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + (((h * -0.125) * math.pow(((D_m * M_m) / d), 2.0)) / l))) elif d <= -1e-310: tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + t_0) else: tmp = (1.0 - t_0) * (d / (math.sqrt(h) * math.sqrt(l))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0))) tmp = 0.0 if (d <= -8e-108) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(Float64(h * -0.125) * (Float64(Float64(D_m * M_m) / d) ^ 2.0)) / l)))); elseif (d <= -1e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + t_0)); else tmp = Float64(Float64(1.0 - t_0) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = 0.5 * ((h / l) * (((M_m / 2.0) * (D_m / d)) ^ 2.0));
tmp = 0.0;
if (d <= -8e-108)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (((h * -0.125) * (((D_m * M_m) / d) ^ 2.0)) / l)));
elseif (d <= -1e-310)
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + t_0);
else
tmp = (1.0 - t_0) * (d / (sqrt(h) * sqrt(l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$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]}, If[LessEqual[d, -8e-108], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(N[(h * -0.125), $MachinePrecision] * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$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 := 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\\
\mathbf{if}\;d \leq -8 \cdot 10^{-108}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left(h \cdot -0.125\right) \cdot {\left(\frac{D\_m \cdot M\_m}{d}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\_0\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -8.00000000000000032e-108Initial program 77.4%
Simplified77.3%
associate-*l/82.2%
clear-num82.1%
*-commutative82.1%
associate-*r/82.3%
div-inv82.3%
metadata-eval82.3%
Applied egg-rr82.3%
associate-/r/82.3%
associate-/l*82.2%
Simplified82.2%
Taylor expanded in D around 0 52.3%
*-commutative52.3%
associate-/l*52.5%
unpow252.5%
unpow252.5%
unpow252.5%
times-frac64.0%
swap-sqr82.3%
unpow282.3%
associate-*r/82.3%
*-commutative82.3%
associate-/l*82.2%
Simplified82.2%
associate-*l/82.2%
*-un-lft-identity82.2%
associate-*r*82.2%
associate-*r/82.3%
Applied egg-rr82.3%
if -8.00000000000000032e-108 < d < -9.999999999999969e-311Initial program 49.2%
Simplified46.8%
sqrt-unprod39.3%
pow1/239.3%
frac-times17.6%
pow217.6%
Applied egg-rr17.6%
unpow1/217.6%
Simplified17.6%
Taylor expanded in d around -inf 63.1%
if -9.999999999999969e-311 < d Initial program 67.3%
Simplified67.4%
*-commutative67.4%
sqrt-div73.5%
sqrt-div80.4%
frac-times80.3%
add-sqr-sqrt80.5%
Applied egg-rr80.5%
Final simplification78.0%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l 2.7e-274)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (/ (* (* h -0.125) (pow (/ (* D_m M_m) d) 2.0)) l))))
(if (<= l 3.3e+134)
(/
(* d (- 1.0 (* h (* 0.125 (/ (pow (* D_m (/ M_m d)) 2.0) l)))))
(sqrt (* l h)))
(* d (/ 1.0 (* (sqrt h) (sqrt l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 2.7e-274) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (((h * -0.125) * pow(((D_m * M_m) / d), 2.0)) / l)));
} else if (l <= 3.3e+134) {
tmp = (d * (1.0 - (h * (0.125 * (pow((D_m * (M_m / d)), 2.0) / l))))) / sqrt((l * h));
} else {
tmp = d * (1.0 / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= 2.7d-274) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + (((h * (-0.125d0)) * (((d_m * m_m) / d) ** 2.0d0)) / l)))
else if (l <= 3.3d+134) then
tmp = (d * (1.0d0 - (h * (0.125d0 * (((d_m * (m_m / d)) ** 2.0d0) / l))))) / sqrt((l * h))
else
tmp = d * (1.0d0 / (sqrt(h) * sqrt(l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 2.7e-274) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + (((h * -0.125) * Math.pow(((D_m * M_m) / d), 2.0)) / l)));
} else if (l <= 3.3e+134) {
tmp = (d * (1.0 - (h * (0.125 * (Math.pow((D_m * (M_m / d)), 2.0) / l))))) / Math.sqrt((l * h));
} else {
tmp = d * (1.0 / (Math.sqrt(h) * Math.sqrt(l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= 2.7e-274: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + (((h * -0.125) * math.pow(((D_m * M_m) / d), 2.0)) / l))) elif l <= 3.3e+134: tmp = (d * (1.0 - (h * (0.125 * (math.pow((D_m * (M_m / d)), 2.0) / l))))) / math.sqrt((l * h)) else: tmp = d * (1.0 / (math.sqrt(h) * math.sqrt(l))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= 2.7e-274) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(Float64(h * -0.125) * (Float64(Float64(D_m * M_m) / d) ^ 2.0)) / l)))); elseif (l <= 3.3e+134) tmp = Float64(Float64(d * Float64(1.0 - Float64(h * Float64(0.125 * Float64((Float64(D_m * Float64(M_m / d)) ^ 2.0) / l))))) / sqrt(Float64(l * h))); else tmp = Float64(d * Float64(1.0 / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= 2.7e-274)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (((h * -0.125) * (((D_m * M_m) / d) ^ 2.0)) / l)));
elseif (l <= 3.3e+134)
tmp = (d * (1.0 - (h * (0.125 * (((D_m * (M_m / d)) ^ 2.0) / l))))) / sqrt((l * h));
else
tmp = d * (1.0 / (sqrt(h) * sqrt(l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, 2.7e-274], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(N[(h * -0.125), $MachinePrecision] * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.3e+134], N[(N[(d * N[(1.0 - N[(h * N[(0.125 * N[(N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(1.0 / 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.7 \cdot 10^{-274}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left(h \cdot -0.125\right) \cdot {\left(\frac{D\_m \cdot M\_m}{d}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{elif}\;\ell \leq 3.3 \cdot 10^{+134}:\\
\;\;\;\;\frac{d \cdot \left(1 - h \cdot \left(0.125 \cdot \frac{{\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}}{\ell}\right)\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{1}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < 2.7e-274Initial program 68.3%
Simplified68.2%
associate-*l/71.2%
clear-num71.2%
*-commutative71.2%
associate-*r/71.2%
div-inv71.2%
metadata-eval71.2%
Applied egg-rr71.2%
associate-/r/71.3%
associate-/l*71.2%
Simplified71.2%
Taylor expanded in D around 0 43.3%
*-commutative43.3%
associate-/l*42.0%
unpow242.0%
unpow242.0%
unpow242.0%
times-frac55.0%
swap-sqr70.4%
unpow270.4%
associate-*r/71.3%
*-commutative71.3%
associate-/l*71.2%
Simplified71.2%
associate-*l/71.2%
*-un-lft-identity71.2%
associate-*r*71.2%
associate-*r/71.3%
Applied egg-rr71.3%
if 2.7e-274 < l < 3.3e134Initial program 71.3%
Simplified70.1%
pow170.1%
associate-*r*70.1%
sqrt-div77.9%
sqrt-div82.5%
frac-times82.5%
add-sqr-sqrt82.6%
unpow-prod-down81.4%
metadata-eval81.4%
clear-num81.4%
un-div-inv81.4%
Applied egg-rr81.4%
unpow181.4%
associate-*l/82.7%
associate-/l*81.4%
fma-define81.4%
associate-*r*81.4%
fma-define81.4%
*-commutative81.4%
associate-*l*81.4%
metadata-eval81.4%
*-commutative81.4%
associate-/r/81.5%
associate-*l/81.4%
associate-/l*81.4%
Simplified81.4%
associate-*r/82.7%
associate-*r/83.8%
sqrt-unprod83.8%
Applied egg-rr83.8%
Taylor expanded in h around -inf 59.7%
associate-*r*59.7%
neg-mul-159.7%
sub-neg59.7%
distribute-lft-in59.7%
Simplified87.7%
if 3.3e134 < l Initial program 57.2%
Simplified59.4%
pow159.4%
associate-*r*59.4%
sqrt-div63.7%
sqrt-div73.4%
frac-times73.4%
add-sqr-sqrt73.6%
unpow-prod-down73.6%
metadata-eval73.6%
clear-num73.6%
un-div-inv73.7%
Applied egg-rr73.7%
unpow173.7%
associate-*l/77.2%
associate-/l*79.3%
fma-define79.3%
associate-*r*79.3%
fma-define79.3%
*-commutative79.3%
associate-*l*79.3%
metadata-eval79.3%
*-commutative79.3%
associate-/r/79.3%
associate-*l/74.9%
associate-/l*79.3%
Simplified79.3%
Taylor expanded in M around 0 68.6%
Final simplification75.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 (pow (* D_m (/ M_m d)) 2.0)))
(if (<= l -4.25e+40)
(* d (- (sqrt (/ (/ 1.0 l) h))))
(if (<= l -5e-310)
(* (sqrt (* (/ d l) (/ d h))) (+ 1.0 (* -0.5 (* t_0 (* (/ h l) 0.25)))))
(if (<= l 7.5e+133)
(/ (* d (- 1.0 (* h (* 0.125 (/ t_0 l))))) (sqrt (* l h)))
(* d (/ 1.0 (* (sqrt h) (sqrt l)))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = pow((D_m * (M_m / d)), 2.0);
double tmp;
if (l <= -4.25e+40) {
tmp = d * -sqrt(((1.0 / l) / h));
} else if (l <= -5e-310) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (t_0 * ((h / l) * 0.25))));
} else if (l <= 7.5e+133) {
tmp = (d * (1.0 - (h * (0.125 * (t_0 / l))))) / sqrt((l * h));
} else {
tmp = d * (1.0 / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = (d_m * (m_m / d)) ** 2.0d0
if (l <= (-4.25d+40)) then
tmp = d * -sqrt(((1.0d0 / l) / h))
else if (l <= (-5d-310)) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * (t_0 * ((h / l) * 0.25d0))))
else if (l <= 7.5d+133) then
tmp = (d * (1.0d0 - (h * (0.125d0 * (t_0 / l))))) / sqrt((l * h))
else
tmp = d * (1.0d0 / (sqrt(h) * sqrt(l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.pow((D_m * (M_m / d)), 2.0);
double tmp;
if (l <= -4.25e+40) {
tmp = d * -Math.sqrt(((1.0 / l) / h));
} else if (l <= -5e-310) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (t_0 * ((h / l) * 0.25))));
} else if (l <= 7.5e+133) {
tmp = (d * (1.0 - (h * (0.125 * (t_0 / l))))) / Math.sqrt((l * h));
} else {
tmp = d * (1.0 / (Math.sqrt(h) * Math.sqrt(l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.pow((D_m * (M_m / d)), 2.0) tmp = 0 if l <= -4.25e+40: tmp = d * -math.sqrt(((1.0 / l) / h)) elif l <= -5e-310: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (t_0 * ((h / l) * 0.25)))) elif l <= 7.5e+133: tmp = (d * (1.0 - (h * (0.125 * (t_0 / l))))) / math.sqrt((l * h)) else: tmp = d * (1.0 / (math.sqrt(h) * math.sqrt(l))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(M_m / d)) ^ 2.0 tmp = 0.0 if (l <= -4.25e+40) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); elseif (l <= -5e-310) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64(t_0 * Float64(Float64(h / l) * 0.25))))); elseif (l <= 7.5e+133) tmp = Float64(Float64(d * Float64(1.0 - Float64(h * Float64(0.125 * Float64(t_0 / l))))) / sqrt(Float64(l * h))); else tmp = Float64(d * Float64(1.0 / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (D_m * (M_m / d)) ^ 2.0;
tmp = 0.0;
if (l <= -4.25e+40)
tmp = d * -sqrt(((1.0 / l) / h));
elseif (l <= -5e-310)
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (t_0 * ((h / l) * 0.25))));
elseif (l <= 7.5e+133)
tmp = (d * (1.0 - (h * (0.125 * (t_0 / l))))) / sqrt((l * h));
else
tmp = d * (1.0 / (sqrt(h) * sqrt(l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[l, -4.25e+40], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, -5e-310], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.5e+133], N[(N[(d * N[(1.0 - N[(h * N[(0.125 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(1.0 / 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 := {\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}\\
\mathbf{if}\;\ell \leq -4.25 \cdot 10^{+40}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(t\_0 \cdot \left(\frac{h}{\ell} \cdot 0.25\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 7.5 \cdot 10^{+133}:\\
\;\;\;\;\frac{d \cdot \left(1 - h \cdot \left(0.125 \cdot \frac{t\_0}{\ell}\right)\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{1}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.24999999999999998e40Initial program 51.2%
Simplified49.1%
Taylor expanded in d around inf 7.0%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt56.7%
mul-1-neg56.7%
*-commutative56.7%
associate-/r*58.6%
Simplified58.6%
if -4.24999999999999998e40 < l < -4.999999999999985e-310Initial program 77.9%
Simplified77.9%
add-sqr-sqrt77.9%
pow277.9%
sqrt-prod77.9%
sqrt-pow177.9%
metadata-eval77.9%
associate-*l/77.9%
div-inv77.9%
metadata-eval77.9%
*-commutative77.9%
pow177.9%
clear-num76.5%
un-div-inv76.5%
Applied egg-rr76.5%
pow176.5%
Applied egg-rr62.9%
unpow162.9%
*-commutative62.9%
associate-*l*62.9%
associate-/l*62.9%
Simplified62.9%
if -4.999999999999985e-310 < l < 7.49999999999999992e133Initial program 72.4%
Simplified71.4%
pow171.4%
associate-*r*71.4%
sqrt-div79.7%
sqrt-div83.9%
frac-times83.9%
add-sqr-sqrt84.0%
unpow-prod-down82.9%
metadata-eval82.9%
clear-num82.9%
un-div-inv82.9%
Applied egg-rr82.9%
unpow182.9%
associate-*l/84.1%
associate-/l*82.9%
fma-define82.9%
associate-*r*82.9%
fma-define82.9%
*-commutative82.9%
associate-*l*82.9%
metadata-eval82.9%
*-commutative82.9%
associate-/r/83.0%
associate-*l/82.9%
associate-/l*82.9%
Simplified82.9%
associate-*r/84.1%
associate-*r/85.1%
sqrt-unprod82.9%
Applied egg-rr82.9%
Taylor expanded in h around -inf 59.4%
associate-*r*59.4%
neg-mul-159.4%
sub-neg59.4%
distribute-lft-in59.4%
Simplified86.5%
if 7.49999999999999992e133 < l Initial program 57.2%
Simplified59.4%
pow159.4%
associate-*r*59.4%
sqrt-div63.7%
sqrt-div73.4%
frac-times73.4%
add-sqr-sqrt73.6%
unpow-prod-down73.6%
metadata-eval73.6%
clear-num73.6%
un-div-inv73.7%
Applied egg-rr73.7%
unpow173.7%
associate-*l/77.2%
associate-/l*79.3%
fma-define79.3%
associate-*r*79.3%
fma-define79.3%
*-commutative79.3%
associate-*l*79.3%
metadata-eval79.3%
*-commutative79.3%
associate-/r/79.3%
associate-*l/74.9%
associate-/l*79.3%
Simplified79.3%
Taylor expanded in M around 0 68.6%
Final simplification70.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.05e-177)
(* d (- (sqrt (/ (/ 1.0 l) h))))
(if (<= l -5e-310)
(* d (pow (+ -1.0 (fma h l 1.0)) -0.5))
(if (<= l 6.5e+134)
(/
(* d (- 1.0 (* h (* 0.125 (/ (pow (* D_m (/ M_m d)) 2.0) l)))))
(sqrt (* l h)))
(* d (/ 1.0 (* (sqrt h) (sqrt l))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -1.05e-177) {
tmp = d * -sqrt(((1.0 / l) / h));
} else if (l <= -5e-310) {
tmp = d * pow((-1.0 + fma(h, l, 1.0)), -0.5);
} else if (l <= 6.5e+134) {
tmp = (d * (1.0 - (h * (0.125 * (pow((D_m * (M_m / d)), 2.0) / l))))) / sqrt((l * h));
} else {
tmp = d * (1.0 / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -1.05e-177) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); elseif (l <= -5e-310) tmp = Float64(d * (Float64(-1.0 + fma(h, l, 1.0)) ^ -0.5)); elseif (l <= 6.5e+134) tmp = Float64(Float64(d * Float64(1.0 - Float64(h * Float64(0.125 * Float64((Float64(D_m * Float64(M_m / d)) ^ 2.0) / l))))) / sqrt(Float64(l * h))); else tmp = Float64(d * Float64(1.0 / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -1.05e-177], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, -5e-310], N[(d * N[Power[N[(-1.0 + N[(h * l + 1.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.5e+134], N[(N[(d * N[(1.0 - N[(h * N[(0.125 * N[(N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(1.0 / 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 -1.05 \cdot 10^{-177}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}^{-0.5}\\
\mathbf{elif}\;\ell \leq 6.5 \cdot 10^{+134}:\\
\;\;\;\;\frac{d \cdot \left(1 - h \cdot \left(0.125 \cdot \frac{{\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}}{\ell}\right)\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{1}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.05e-177Initial program 63.6%
Simplified62.6%
Taylor expanded in d around inf 6.7%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt46.5%
mul-1-neg46.5%
*-commutative46.5%
associate-/r*47.8%
Simplified47.8%
if -1.05e-177 < l < -4.999999999999985e-310Initial program 85.7%
Simplified85.7%
Taylor expanded in d around inf 39.9%
pow139.9%
metadata-eval39.9%
sqrt-pow114.9%
sqrt-prod14.9%
div-inv14.9%
sqrt-div15.0%
sqrt-pow135.2%
metadata-eval35.2%
pow135.2%
Applied egg-rr35.2%
div-inv35.2%
pow1/235.2%
pow-flip35.2%
*-commutative35.2%
metadata-eval35.2%
Applied egg-rr35.2%
expm1-log1p-u35.2%
expm1-undefine62.7%
Applied egg-rr62.7%
sub-neg62.7%
metadata-eval62.7%
+-commutative62.7%
log1p-undefine62.7%
rem-exp-log62.7%
+-commutative62.7%
*-commutative62.7%
fma-define62.7%
Simplified62.7%
if -4.999999999999985e-310 < l < 6.5e134Initial program 72.4%
Simplified71.4%
pow171.4%
associate-*r*71.4%
sqrt-div79.7%
sqrt-div83.9%
frac-times83.9%
add-sqr-sqrt84.0%
unpow-prod-down82.9%
metadata-eval82.9%
clear-num82.9%
un-div-inv82.9%
Applied egg-rr82.9%
unpow182.9%
associate-*l/84.1%
associate-/l*82.9%
fma-define82.9%
associate-*r*82.9%
fma-define82.9%
*-commutative82.9%
associate-*l*82.9%
metadata-eval82.9%
*-commutative82.9%
associate-/r/83.0%
associate-*l/82.9%
associate-/l*82.9%
Simplified82.9%
associate-*r/84.1%
associate-*r/85.1%
sqrt-unprod82.9%
Applied egg-rr82.9%
Taylor expanded in h around -inf 59.4%
associate-*r*59.4%
neg-mul-159.4%
sub-neg59.4%
distribute-lft-in59.4%
Simplified86.5%
if 6.5e134 < l Initial program 57.2%
Simplified59.4%
pow159.4%
associate-*r*59.4%
sqrt-div63.7%
sqrt-div73.4%
frac-times73.4%
add-sqr-sqrt73.6%
unpow-prod-down73.6%
metadata-eval73.6%
clear-num73.6%
un-div-inv73.7%
Applied egg-rr73.7%
unpow173.7%
associate-*l/77.2%
associate-/l*79.3%
fma-define79.3%
associate-*r*79.3%
fma-define79.3%
*-commutative79.3%
associate-*l*79.3%
metadata-eval79.3%
*-commutative79.3%
associate-/r/79.3%
associate-*l/74.9%
associate-/l*79.3%
Simplified79.3%
Taylor expanded in M around 0 68.6%
Final simplification65.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 -2.5e-178)
(* d (- (sqrt (/ (/ 1.0 l) h))))
(if (<= l -5e-310)
(* d (pow (+ -1.0 (fma h l 1.0)) -0.5))
(if (<= l 1.1e+130)
(/
(* d (+ 1.0 (* (/ h l) (* -0.125 (pow (* M_m (/ D_m d)) 2.0)))))
(sqrt (* l h)))
(* d (/ 1.0 (* (sqrt h) (sqrt l))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -2.5e-178) {
tmp = d * -sqrt(((1.0 / l) / h));
} else if (l <= -5e-310) {
tmp = d * pow((-1.0 + fma(h, l, 1.0)), -0.5);
} else if (l <= 1.1e+130) {
tmp = (d * (1.0 + ((h / l) * (-0.125 * pow((M_m * (D_m / d)), 2.0))))) / sqrt((l * h));
} else {
tmp = d * (1.0 / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -2.5e-178) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); elseif (l <= -5e-310) tmp = Float64(d * (Float64(-1.0 + fma(h, l, 1.0)) ^ -0.5)); elseif (l <= 1.1e+130) tmp = Float64(Float64(d * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.125 * (Float64(M_m * Float64(D_m / d)) ^ 2.0))))) / sqrt(Float64(l * h))); else tmp = Float64(d * Float64(1.0 / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -2.5e-178], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, -5e-310], N[(d * N[Power[N[(-1.0 + N[(h * l + 1.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.1e+130], N[(N[(d * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.125 * N[Power[N[(M$95$m * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(1.0 / 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.5 \cdot 10^{-178}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}^{-0.5}\\
\mathbf{elif}\;\ell \leq 1.1 \cdot 10^{+130}:\\
\;\;\;\;\frac{d \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.125 \cdot {\left(M\_m \cdot \frac{D\_m}{d}\right)}^{2}\right)\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{1}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.49999999999999988e-178Initial program 63.6%
Simplified62.6%
Taylor expanded in d around inf 6.7%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt46.5%
mul-1-neg46.5%
*-commutative46.5%
associate-/r*47.8%
Simplified47.8%
if -2.49999999999999988e-178 < l < -4.999999999999985e-310Initial program 85.7%
Simplified85.7%
Taylor expanded in d around inf 39.9%
pow139.9%
metadata-eval39.9%
sqrt-pow114.9%
sqrt-prod14.9%
div-inv14.9%
sqrt-div15.0%
sqrt-pow135.2%
metadata-eval35.2%
pow135.2%
Applied egg-rr35.2%
div-inv35.2%
pow1/235.2%
pow-flip35.2%
*-commutative35.2%
metadata-eval35.2%
Applied egg-rr35.2%
expm1-log1p-u35.2%
expm1-undefine62.7%
Applied egg-rr62.7%
sub-neg62.7%
metadata-eval62.7%
+-commutative62.7%
log1p-undefine62.7%
rem-exp-log62.7%
+-commutative62.7%
*-commutative62.7%
fma-define62.7%
Simplified62.7%
if -4.999999999999985e-310 < l < 1.09999999999999997e130Initial program 73.3%
Simplified72.2%
pow172.2%
associate-*r*72.2%
sqrt-div80.6%
sqrt-div84.9%
frac-times84.8%
add-sqr-sqrt85.0%
unpow-prod-down83.9%
metadata-eval83.9%
clear-num83.9%
un-div-inv83.9%
Applied egg-rr83.9%
unpow183.9%
associate-*l/85.1%
associate-/l*83.9%
fma-define83.9%
associate-*r*83.9%
fma-define83.9%
*-commutative83.9%
associate-*l*83.9%
metadata-eval83.9%
*-commutative83.9%
associate-/r/83.9%
associate-*l/83.9%
associate-/l*83.9%
Simplified83.9%
associate-*r/85.1%
associate-*r/86.1%
sqrt-unprod83.9%
Applied egg-rr83.9%
fma-undefine83.9%
associate-/l*82.8%
Applied egg-rr82.8%
if 1.09999999999999997e130 < l Initial program 56.0%
Simplified58.1%
pow158.1%
associate-*r*58.1%
sqrt-div62.3%
sqrt-div71.8%
frac-times71.8%
add-sqr-sqrt72.0%
unpow-prod-down72.0%
metadata-eval72.0%
clear-num72.0%
un-div-inv72.0%
Applied egg-rr72.0%
unpow172.0%
associate-*l/75.5%
associate-/l*77.6%
fma-define77.6%
associate-*r*77.6%
fma-define77.6%
*-commutative77.6%
associate-*l*77.6%
metadata-eval77.6%
*-commutative77.6%
associate-/r/77.5%
associate-*l/73.3%
associate-/l*77.5%
Simplified77.5%
Taylor expanded in M around 0 67.1%
Final simplification64.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)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ -1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0)))))
(if (<= l 6e+134)
(/
(* d (- 1.0 (* h (* 0.125 (/ (pow (* D_m (/ M_m d)) 2.0) l)))))
(sqrt (* l h)))
(* d (/ 1.0 (* (sqrt h) (sqrt l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0))));
} else if (l <= 6e+134) {
tmp = (d * (1.0 - (h * (0.125 * (pow((D_m * (M_m / d)), 2.0) / l))))) / sqrt((l * h));
} else {
tmp = d * (1.0 / (sqrt(h) * sqrt(l)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + (0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_m / d)) ** 2.0d0))))
else if (l <= 6d+134) then
tmp = (d * (1.0d0 - (h * (0.125d0 * (((d_m * (m_m / d)) ** 2.0d0) / l))))) / sqrt((l * h))
else
tmp = d * (1.0d0 / (sqrt(h) * sqrt(l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D_m / d)), 2.0))));
} else if (l <= 6e+134) {
tmp = (d * (1.0 - (h * (0.125 * (Math.pow((D_m * (M_m / d)), 2.0) / l))))) / Math.sqrt((l * h));
} else {
tmp = d * (1.0 / (Math.sqrt(h) * Math.sqrt(l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -5e-310: tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D_m / d)), 2.0)))) elif l <= 6e+134: tmp = (d * (1.0 - (h * (0.125 * (math.pow((D_m * (M_m / d)), 2.0) / l))))) / math.sqrt((l * h)) else: tmp = d * (1.0 / (math.sqrt(h) * math.sqrt(l))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0))))); elseif (l <= 6e+134) tmp = Float64(Float64(d * Float64(1.0 - Float64(h * Float64(0.125 * Float64((Float64(D_m * Float64(M_m / d)) ^ 2.0) / l))))) / sqrt(Float64(l * h))); else tmp = Float64(d * Float64(1.0 / Float64(sqrt(h) * sqrt(l)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= -5e-310)
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + (0.5 * ((h / l) * (((M_m / 2.0) * (D_m / d)) ^ 2.0))));
elseif (l <= 6e+134)
tmp = (d * (1.0 - (h * (0.125 * (((D_m * (M_m / d)) ^ 2.0) / l))))) / sqrt((l * h));
else
tmp = d * (1.0 / (sqrt(h) * sqrt(l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $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], If[LessEqual[l, 6e+134], N[(N[(d * N[(1.0 - N[(h * N[(0.125 * N[(N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(1.0 / 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(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\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{elif}\;\ell \leq 6 \cdot 10^{+134}:\\
\;\;\;\;\frac{d \cdot \left(1 - h \cdot \left(0.125 \cdot \frac{{\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}}{\ell}\right)\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{1}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 67.3%
Simplified66.5%
sqrt-unprod54.2%
pow1/254.2%
frac-times36.5%
pow236.5%
Applied egg-rr36.5%
unpow1/236.5%
Simplified36.5%
Taylor expanded in d around -inf 68.3%
if -4.999999999999985e-310 < l < 5.99999999999999993e134Initial program 72.4%
Simplified71.4%
pow171.4%
associate-*r*71.4%
sqrt-div79.7%
sqrt-div83.9%
frac-times83.9%
add-sqr-sqrt84.0%
unpow-prod-down82.9%
metadata-eval82.9%
clear-num82.9%
un-div-inv82.9%
Applied egg-rr82.9%
unpow182.9%
associate-*l/84.1%
associate-/l*82.9%
fma-define82.9%
associate-*r*82.9%
fma-define82.9%
*-commutative82.9%
associate-*l*82.9%
metadata-eval82.9%
*-commutative82.9%
associate-/r/83.0%
associate-*l/82.9%
associate-/l*82.9%
Simplified82.9%
associate-*r/84.1%
associate-*r/85.1%
sqrt-unprod82.9%
Applied egg-rr82.9%
Taylor expanded in h around -inf 59.4%
associate-*r*59.4%
neg-mul-159.4%
sub-neg59.4%
distribute-lft-in59.4%
Simplified86.5%
if 5.99999999999999993e134 < l Initial program 57.2%
Simplified59.4%
pow159.4%
associate-*r*59.4%
sqrt-div63.7%
sqrt-div73.4%
frac-times73.4%
add-sqr-sqrt73.6%
unpow-prod-down73.6%
metadata-eval73.6%
clear-num73.6%
un-div-inv73.7%
Applied egg-rr73.7%
unpow173.7%
associate-*l/77.2%
associate-/l*79.3%
fma-define79.3%
associate-*r*79.3%
fma-define79.3%
*-commutative79.3%
associate-*l*79.3%
metadata-eval79.3%
*-commutative79.3%
associate-/r/79.3%
associate-*l/74.9%
associate-/l*79.3%
Simplified79.3%
Taylor expanded in M around 0 68.6%
Final simplification74.4%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -9e-178)
(* d (- (sqrt (/ (/ 1.0 l) h))))
(if (<= l -5e-310)
(* d (pow (+ -1.0 (fma h l 1.0)) -0.5))
(/ d (* (sqrt h) (sqrt l))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -9e-178) {
tmp = d * -sqrt(((1.0 / l) / h));
} else if (l <= -5e-310) {
tmp = d * pow((-1.0 + fma(h, l, 1.0)), -0.5);
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -9e-178) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); elseif (l <= -5e-310) tmp = Float64(d * (Float64(-1.0 + fma(h, l, 1.0)) ^ -0.5)); else tmp = 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, -9e-178], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, -5e-310], N[(d * N[Power[N[(-1.0 + N[(h * l + 1.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -9 \cdot 10^{-178}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -8.99999999999999957e-178Initial program 63.6%
Simplified62.6%
Taylor expanded in d around inf 6.7%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt46.5%
mul-1-neg46.5%
*-commutative46.5%
associate-/r*47.8%
Simplified47.8%
if -8.99999999999999957e-178 < l < -4.999999999999985e-310Initial program 85.7%
Simplified85.7%
Taylor expanded in d around inf 39.9%
pow139.9%
metadata-eval39.9%
sqrt-pow114.9%
sqrt-prod14.9%
div-inv14.9%
sqrt-div15.0%
sqrt-pow135.2%
metadata-eval35.2%
pow135.2%
Applied egg-rr35.2%
div-inv35.2%
pow1/235.2%
pow-flip35.2%
*-commutative35.2%
metadata-eval35.2%
Applied egg-rr35.2%
expm1-log1p-u35.2%
expm1-undefine62.7%
Applied egg-rr62.7%
sub-neg62.7%
metadata-eval62.7%
+-commutative62.7%
log1p-undefine62.7%
rem-exp-log62.7%
+-commutative62.7%
*-commutative62.7%
fma-define62.7%
Simplified62.7%
if -4.999999999999985e-310 < l Initial program 67.3%
Simplified67.4%
Taylor expanded in d around inf 37.9%
pow137.9%
metadata-eval37.9%
sqrt-pow128.6%
sqrt-prod20.8%
div-inv20.8%
sqrt-div28.5%
sqrt-pow137.8%
metadata-eval37.8%
pow137.8%
Applied egg-rr37.8%
sqrt-prod46.2%
Applied egg-rr46.2%
*-commutative46.2%
Simplified46.2%
Final simplification48.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 -6e-187)
(* d (- (sqrt (/ (/ 1.0 l) h))))
(if (<= l -5e-310)
(/ d (cbrt (pow (* l h) 1.5)))
(/ d (* (sqrt h) (sqrt l))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -6e-187) {
tmp = d * -sqrt(((1.0 / l) / h));
} else if (l <= -5e-310) {
tmp = d / cbrt(pow((l * h), 1.5));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -6e-187) {
tmp = d * -Math.sqrt(((1.0 / l) / h));
} else if (l <= -5e-310) {
tmp = d / Math.cbrt(Math.pow((l * h), 1.5));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -6e-187) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); elseif (l <= -5e-310) tmp = Float64(d / cbrt((Float64(l * h) ^ 1.5))); else tmp = 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, -6e-187], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, -5e-310], N[(d / N[Power[N[Power[N[(l * h), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6 \cdot 10^{-187}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -6.00000000000000008e-187Initial program 64.7%
Simplified63.7%
Taylor expanded in d around inf 6.6%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt46.2%
mul-1-neg46.2%
*-commutative46.2%
associate-/r*47.5%
Simplified47.5%
if -6.00000000000000008e-187 < l < -4.999999999999985e-310Initial program 83.3%
Simplified83.3%
Taylor expanded in d around inf 46.2%
pow146.2%
metadata-eval46.2%
sqrt-pow111.7%
sqrt-prod11.7%
div-inv11.7%
sqrt-div11.8%
sqrt-pow140.8%
metadata-eval40.8%
pow140.8%
Applied egg-rr40.8%
add-cbrt-cube51.2%
add-sqr-sqrt51.2%
pow151.2%
pow1/251.2%
pow-prod-up51.2%
*-commutative51.2%
metadata-eval51.2%
Applied egg-rr51.2%
if -4.999999999999985e-310 < l Initial program 67.3%
Simplified67.4%
Taylor expanded in d around inf 37.9%
pow137.9%
metadata-eval37.9%
sqrt-pow128.6%
sqrt-prod20.8%
div-inv20.8%
sqrt-div28.5%
sqrt-pow137.8%
metadata-eval37.8%
pow137.8%
Applied egg-rr37.8%
sqrt-prod46.2%
Applied egg-rr46.2%
*-commutative46.2%
Simplified46.2%
Final simplification47.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.12e-243) (* d (- (sqrt (/ (/ 1.0 l) h)))) (/ 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 <= 1.12e-243) {
tmp = d * -sqrt(((1.0 / l) / h));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= 1.12d-243) then
tmp = d * -sqrt(((1.0d0 / l) / h))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 1.12e-243) {
tmp = d * -Math.sqrt(((1.0 / l) / h));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= 1.12e-243: tmp = d * -math.sqrt(((1.0 / l) / h)) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= 1.12e-243) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= 1.12e-243)
tmp = d * -sqrt(((1.0 / l) / h));
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, 1.12e-243], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.12 \cdot 10^{-243}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < 1.12000000000000005e-243Initial program 68.2%
Simplified67.4%
Taylor expanded in d around inf 11.9%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt41.8%
mul-1-neg41.8%
*-commutative41.8%
associate-/r*42.8%
Simplified42.8%
if 1.12000000000000005e-243 < l Initial program 66.2%
Simplified66.3%
Taylor expanded in d around inf 41.1%
pow141.1%
metadata-eval41.1%
sqrt-pow130.8%
sqrt-prod23.0%
div-inv23.0%
sqrt-div30.8%
sqrt-pow141.0%
metadata-eval41.0%
pow141.0%
Applied egg-rr41.0%
sqrt-prod48.8%
Applied egg-rr48.8%
*-commutative48.8%
Simplified48.8%
Final simplification45.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.45e-188) (* d (- (sqrt (/ (/ 1.0 l) h)))) (* d (sqrt (* (/ 1.0 l) (/ 1.0 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.45e-188) {
tmp = d * -sqrt(((1.0 / l) / h));
} else {
tmp = d * sqrt(((1.0 / l) * (1.0 / 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 <= (-1.45d-188)) then
tmp = d * -sqrt(((1.0d0 / l) / h))
else
tmp = d * sqrt(((1.0d0 / l) * (1.0d0 / 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 <= -1.45e-188) {
tmp = d * -Math.sqrt(((1.0 / l) / h));
} else {
tmp = d * Math.sqrt(((1.0 / l) * (1.0 / 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 <= -1.45e-188: tmp = d * -math.sqrt(((1.0 / l) / h)) else: tmp = d * math.sqrt(((1.0 / l) * (1.0 / 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.45e-188) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) * Float64(1.0 / 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 <= -1.45e-188)
tmp = d * -sqrt(((1.0 / l) / h));
else
tmp = d * sqrt(((1.0 / l) * (1.0 / 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, -1.45e-188], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] * N[(1.0 / 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}\;\ell \leq -1.45 \cdot 10^{-188}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{\ell} \cdot \frac{1}{h}}\\
\end{array}
\end{array}
if l < -1.4500000000000001e-188Initial program 64.7%
Simplified63.7%
Taylor expanded in d around inf 6.6%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt46.2%
mul-1-neg46.2%
*-commutative46.2%
associate-/r*47.5%
Simplified47.5%
if -1.4500000000000001e-188 < l Initial program 69.2%
Simplified69.3%
Taylor expanded in d around inf 38.9%
inv-pow38.9%
*-commutative38.9%
unpow-prod-down39.7%
inv-pow39.7%
inv-pow39.7%
Applied egg-rr39.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 (/ (/ 1.0 l) h)))) (if (<= l -2.4e-188) (* d (- t_0)) (* d t_0))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt(((1.0 / l) / h));
double tmp;
if (l <= -2.4e-188) {
tmp = d * -t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((1.0d0 / l) / h))
if (l <= (-2.4d-188)) then
tmp = d * -t_0
else
tmp = d * t_0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt(((1.0 / l) / h));
double tmp;
if (l <= -2.4e-188) {
tmp = d * -t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt(((1.0 / l) / h)) tmp = 0 if l <= -2.4e-188: tmp = d * -t_0 else: tmp = d * t_0 return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(Float64(1.0 / l) / h)) tmp = 0.0 if (l <= -2.4e-188) tmp = Float64(d * Float64(-t_0)); else tmp = Float64(d * t_0); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt(((1.0 / l) / h));
tmp = 0.0;
if (l <= -2.4e-188)
tmp = d * -t_0;
else
tmp = d * t_0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -2.4e-188], N[(d * (-t$95$0)), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{if}\;\ell \leq -2.4 \cdot 10^{-188}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
\end{array}
if l < -2.4e-188Initial program 64.7%
Simplified63.7%
Taylor expanded in d around inf 6.6%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt46.2%
mul-1-neg46.2%
*-commutative46.2%
associate-/r*47.5%
Simplified47.5%
if -2.4e-188 < l Initial program 69.2%
Simplified69.3%
pow169.3%
associate-*r*69.3%
sqrt-div65.3%
sqrt-div70.6%
frac-times70.6%
add-sqr-sqrt70.7%
unpow-prod-down70.1%
metadata-eval70.1%
clear-num70.1%
un-div-inv70.1%
Applied egg-rr70.1%
unpow170.1%
associate-*l/71.8%
associate-/l*71.8%
fma-define71.8%
associate-*r*71.8%
fma-define71.8%
*-commutative71.8%
associate-*l*71.8%
metadata-eval71.8%
*-commutative71.8%
associate-/r/71.8%
associate-*l/70.4%
associate-/l*71.8%
Simplified71.8%
Taylor expanded in M around 0 38.9%
*-commutative38.9%
associate-/r*39.7%
Simplified39.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 -2.4e-187) (* d (- (pow (* l h) -0.5))) (* d (sqrt (/ (/ 1.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 tmp;
if (l <= -2.4e-187) {
tmp = d * -pow((l * h), -0.5);
} else {
tmp = d * sqrt(((1.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) :: tmp
if (l <= (-2.4d-187)) then
tmp = d * -((l * h) ** (-0.5d0))
else
tmp = d * sqrt(((1.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 tmp;
if (l <= -2.4e-187) {
tmp = d * -Math.pow((l * h), -0.5);
} else {
tmp = d * Math.sqrt(((1.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): tmp = 0 if l <= -2.4e-187: tmp = d * -math.pow((l * h), -0.5) else: tmp = d * math.sqrt(((1.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) tmp = 0.0 if (l <= -2.4e-187) tmp = Float64(d * Float64(-(Float64(l * h) ^ -0.5))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / 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)
tmp = 0.0;
if (l <= -2.4e-187)
tmp = d * -((l * h) ^ -0.5);
else
tmp = d * sqrt(((1.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_] := If[LessEqual[l, -2.4e-187], N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / 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 -2.4 \cdot 10^{-187}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\end{array}
\end{array}
if l < -2.40000000000000013e-187Initial program 64.7%
Simplified63.7%
Taylor expanded in d around inf 6.6%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt46.2%
mul-1-neg46.2%
unpow-146.2%
metadata-eval46.2%
pow-sqr46.2%
rem-sqrt-square46.5%
rem-square-sqrt46.2%
fabs-sqr46.2%
rem-square-sqrt46.5%
Simplified46.5%
if -2.40000000000000013e-187 < l Initial program 69.2%
Simplified69.3%
pow169.3%
associate-*r*69.3%
sqrt-div65.3%
sqrt-div70.6%
frac-times70.6%
add-sqr-sqrt70.7%
unpow-prod-down70.1%
metadata-eval70.1%
clear-num70.1%
un-div-inv70.1%
Applied egg-rr70.1%
unpow170.1%
associate-*l/71.8%
associate-/l*71.8%
fma-define71.8%
associate-*r*71.8%
fma-define71.8%
*-commutative71.8%
associate-*l*71.8%
metadata-eval71.8%
*-commutative71.8%
associate-/r/71.8%
associate-*l/70.4%
associate-/l*71.8%
Simplified71.8%
Taylor expanded in M around 0 38.9%
*-commutative38.9%
associate-/r*39.7%
Simplified39.7%
Final simplification42.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 (pow (* l h) -0.5))) (if (<= l -2.5e-209) (* d (- t_0)) (* d t_0))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = pow((l * h), -0.5);
double tmp;
if (l <= -2.5e-209) {
tmp = d * -t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = (l * h) ** (-0.5d0)
if (l <= (-2.5d-209)) then
tmp = d * -t_0
else
tmp = d * t_0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.pow((l * h), -0.5);
double tmp;
if (l <= -2.5e-209) {
tmp = d * -t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.pow((l * h), -0.5) tmp = 0 if l <= -2.5e-209: tmp = d * -t_0 else: tmp = d * t_0 return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(l * h) ^ -0.5 tmp = 0.0 if (l <= -2.5e-209) tmp = Float64(d * Float64(-t_0)); else tmp = Float64(d * t_0); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (l * h) ^ -0.5;
tmp = 0.0;
if (l <= -2.5e-209)
tmp = d * -t_0;
else
tmp = d * t_0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[l, -2.5e-209], N[(d * (-t$95$0)), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -2.5 \cdot 10^{-209}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
\end{array}
if l < -2.5000000000000002e-209Initial program 65.6%
Simplified64.6%
Taylor expanded in d around inf 7.3%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt45.8%
mul-1-neg45.8%
unpow-145.8%
metadata-eval45.8%
pow-sqr45.8%
rem-sqrt-square46.1%
rem-square-sqrt45.9%
fabs-sqr45.9%
rem-square-sqrt46.1%
Simplified46.1%
if -2.5000000000000002e-209 < l Initial program 68.6%
Simplified68.7%
pow168.7%
associate-*r*68.7%
sqrt-div66.6%
sqrt-div72.0%
frac-times72.0%
add-sqr-sqrt72.2%
unpow-prod-down71.5%
metadata-eval71.5%
clear-num71.5%
un-div-inv71.5%
Applied egg-rr71.5%
unpow171.5%
associate-*l/73.3%
associate-/l*73.3%
fma-define73.3%
associate-*r*73.3%
fma-define73.3%
*-commutative73.3%
associate-*l*73.3%
metadata-eval73.3%
*-commutative73.3%
associate-/r/73.3%
associate-*l/71.9%
associate-/l*73.2%
Simplified73.2%
Taylor expanded in M around 0 39.0%
unpow-139.0%
metadata-eval39.0%
pow-sqr39.0%
rem-sqrt-square39.0%
rem-square-sqrt38.8%
fabs-sqr38.8%
rem-square-sqrt39.0%
Simplified39.0%
Final simplification42.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 (* 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 67.3%
Simplified66.9%
pow166.9%
associate-*r*66.9%
sqrt-div37.7%
sqrt-div40.8%
frac-times40.8%
add-sqr-sqrt40.9%
unpow-prod-down40.5%
metadata-eval40.5%
clear-num40.5%
un-div-inv40.5%
Applied egg-rr40.5%
unpow140.5%
associate-*l/41.5%
associate-/l*41.5%
fma-define41.5%
associate-*r*41.5%
fma-define41.5%
*-commutative41.5%
associate-*l*41.5%
metadata-eval41.5%
*-commutative41.5%
associate-/r/41.5%
associate-*l/40.7%
associate-/l*41.5%
Simplified41.5%
Taylor expanded in M around 0 25.2%
unpow-125.2%
metadata-eval25.2%
pow-sqr25.2%
rem-sqrt-square24.9%
rem-square-sqrt24.8%
fabs-sqr24.8%
rem-square-sqrt24.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 (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 67.3%
Simplified66.9%
Taylor expanded in d around inf 25.2%
pow125.2%
metadata-eval25.2%
sqrt-pow126.1%
sqrt-prod20.7%
div-inv20.7%
sqrt-div26.1%
sqrt-pow124.8%
metadata-eval24.8%
pow124.8%
Applied egg-rr24.8%
Final simplification24.8%
herbie shell --seed 2024163
(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)))))