
(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 17 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)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (* M_m (* 0.5 (/ D d))))
(t_1
(*
(sqrt (/ d l))
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (/ (* h (* -0.5 (pow t_0 2.0))) l))))))
(if (<= h -1.75e+131)
t_1
(if (<= h -7.8e-106)
(*
(* d (sqrt (/ (/ 1.0 l) h)))
(+ (* 0.5 (pow (* t_0 (sqrt (/ h l))) 2.0)) -1.0))
(if (<= h -1e-309)
t_1
(*
d
(/
(fma h (* -0.5 (/ (pow (* D (* M_m (/ 0.5 d))) 2.0) l)) 1.0)
(* (sqrt l) (sqrt h)))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = M_m * (0.5 * (D / d));
double t_1 = sqrt((d / l)) * ((sqrt(-d) / sqrt(-h)) * (1.0 + ((h * (-0.5 * pow(t_0, 2.0))) / l)));
double tmp;
if (h <= -1.75e+131) {
tmp = t_1;
} else if (h <= -7.8e-106) {
tmp = (d * sqrt(((1.0 / l) / h))) * ((0.5 * pow((t_0 * sqrt((h / l))), 2.0)) + -1.0);
} else if (h <= -1e-309) {
tmp = t_1;
} else {
tmp = d * (fma(h, (-0.5 * (pow((D * (M_m * (0.5 / d))), 2.0) / l)), 1.0) / (sqrt(l) * sqrt(h)));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(M_m * Float64(0.5 * Float64(D / d))) t_1 = Float64(sqrt(Float64(d / l)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (t_0 ^ 2.0))) / l)))) tmp = 0.0 if (h <= -1.75e+131) tmp = t_1; elseif (h <= -7.8e-106) tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(Float64(0.5 * (Float64(t_0 * sqrt(Float64(h / l))) ^ 2.0)) + -1.0)); elseif (h <= -1e-309) tmp = t_1; else tmp = Float64(d * Float64(fma(h, Float64(-0.5 * Float64((Float64(D * Float64(M_m * Float64(0.5 / d))) ^ 2.0) / l)), 1.0) / Float64(sqrt(l) * sqrt(h)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(M$95$m * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1.75e+131], t$95$1, If[LessEqual[h, -7.8e-106], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[Power[N[(t$95$0 * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -1e-309], t$95$1, N[(d * N[(N[(h * N[(-0.5 * N[(N[Power[N[(D * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := M\_m \cdot \left(0.5 \cdot \frac{D}{d}\right)\\
t_1 := \sqrt{\frac{d}{\ell}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(1 + \frac{h \cdot \left(-0.5 \cdot {t\_0}^{2}\right)}{\ell}\right)\right)\\
\mathbf{if}\;h \leq -1.75 \cdot 10^{+131}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;h \leq -7.8 \cdot 10^{-106}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(0.5 \cdot {\left(t\_0 \cdot \sqrt{\frac{h}{\ell}}\right)}^{2} + -1\right)\\
\mathbf{elif}\;h \leq -1 \cdot 10^{-309}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, -0.5 \cdot \frac{{\left(D \cdot \left(M\_m \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if h < -1.7499999999999999e131 or -7.80000000000000019e-106 < h < -1.000000000000002e-309Initial program 56.2%
Simplified57.4%
associate-*l/58.9%
*-commutative58.9%
associate-*r/58.9%
associate-*l/57.7%
*-commutative57.7%
div-inv57.7%
metadata-eval57.7%
associate-*l*57.7%
Applied egg-rr57.7%
frac-2neg57.7%
sqrt-div78.0%
Applied egg-rr78.0%
if -1.7499999999999999e131 < h < -7.80000000000000019e-106Initial program 75.5%
Simplified75.5%
add-sqr-sqrt75.5%
pow275.5%
sqrt-prod75.4%
sqrt-pow178.7%
metadata-eval78.7%
pow178.7%
div-inv78.7%
metadata-eval78.7%
associate-*l*78.7%
Applied egg-rr78.7%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt92.6%
neg-mul-192.6%
Simplified92.6%
if -1.000000000000002e-309 < h Initial program 66.6%
Simplified66.6%
Applied egg-rr72.8%
*-rgt-identity72.8%
distribute-lft-in83.7%
associate-*l/89.2%
associate-/l*89.2%
Simplified90.8%
Final simplification87.1%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0
(*
(sqrt (/ d l))
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (* (/ h l) (* -0.5 (pow (* D (/ (/ M_m 2.0) d)) 2.0))))))))
(if (<= h -1.35e+133)
t_0
(if (<= h -7.2e-106)
(*
(* d (sqrt (/ (/ 1.0 l) h)))
(+ (* 0.5 (pow (* (* M_m (* 0.5 (/ D d))) (sqrt (/ h l))) 2.0)) -1.0))
(if (<= h -1e-309)
t_0
(*
d
(/
(fma h (* -0.5 (/ (pow (* D (* M_m (/ 0.5 d))) 2.0) l)) 1.0)
(* (sqrt l) (sqrt h)))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt((d / l)) * ((sqrt(-d) / sqrt(-h)) * (1.0 + ((h / l) * (-0.5 * pow((D * ((M_m / 2.0) / d)), 2.0)))));
double tmp;
if (h <= -1.35e+133) {
tmp = t_0;
} else if (h <= -7.2e-106) {
tmp = (d * sqrt(((1.0 / l) / h))) * ((0.5 * pow(((M_m * (0.5 * (D / d))) * sqrt((h / l))), 2.0)) + -1.0);
} else if (h <= -1e-309) {
tmp = t_0;
} else {
tmp = d * (fma(h, (-0.5 * (pow((D * (M_m * (0.5 / d))), 2.0) / l)), 1.0) / (sqrt(l) * sqrt(h)));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(sqrt(Float64(d / l)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D * Float64(Float64(M_m / 2.0) / d)) ^ 2.0)))))) tmp = 0.0 if (h <= -1.35e+133) tmp = t_0; elseif (h <= -7.2e-106) tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(Float64(0.5 * (Float64(Float64(M_m * Float64(0.5 * Float64(D / d))) * sqrt(Float64(h / l))) ^ 2.0)) + -1.0)); elseif (h <= -1e-309) tmp = t_0; else tmp = Float64(d * Float64(fma(h, Float64(-0.5 * Float64((Float64(D * Float64(M_m * Float64(0.5 / d))) ^ 2.0) / l)), 1.0) / Float64(sqrt(l) * sqrt(h)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1.35e+133], t$95$0, If[LessEqual[h, -7.2e-106], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[Power[N[(N[(M$95$m * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -1e-309], t$95$0, N[(d * N[(N[(h * N[(-0.5 * N[(N[Power[N[(D * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{if}\;h \leq -1.35 \cdot 10^{+133}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;h \leq -7.2 \cdot 10^{-106}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(0.5 \cdot {\left(\left(M\_m \cdot \left(0.5 \cdot \frac{D}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2} + -1\right)\\
\mathbf{elif}\;h \leq -1 \cdot 10^{-309}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, -0.5 \cdot \frac{{\left(D \cdot \left(M\_m \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if h < -1.3500000000000001e133 or -7.20000000000000025e-106 < h < -1.000000000000002e-309Initial program 56.2%
Simplified57.4%
frac-2neg57.7%
sqrt-div78.0%
Applied egg-rr76.5%
if -1.3500000000000001e133 < h < -7.20000000000000025e-106Initial program 75.5%
Simplified75.5%
add-sqr-sqrt75.5%
pow275.5%
sqrt-prod75.4%
sqrt-pow178.7%
metadata-eval78.7%
pow178.7%
div-inv78.7%
metadata-eval78.7%
associate-*l*78.7%
Applied egg-rr78.7%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt92.6%
neg-mul-192.6%
Simplified92.6%
if -1.000000000000002e-309 < h Initial program 66.6%
Simplified66.6%
Applied egg-rr72.8%
*-rgt-identity72.8%
distribute-lft-in83.7%
associate-*l/89.2%
associate-/l*89.2%
Simplified90.8%
Final simplification86.6%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= d -1.05e-299)
(*
(* d (pow (* h l) -0.5))
(+ (* 0.5 (* h (/ (pow (* M_m (/ (* 0.5 D) d)) 2.0) l))) -1.0))
(*
d
(/
(fma h (* -0.5 (/ (pow (* D (* M_m (/ 0.5 d))) 2.0) l)) 1.0)
(* (sqrt l) (sqrt h))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -1.05e-299) {
tmp = (d * pow((h * l), -0.5)) * ((0.5 * (h * (pow((M_m * ((0.5 * D) / d)), 2.0) / l))) + -1.0);
} else {
tmp = d * (fma(h, (-0.5 * (pow((D * (M_m * (0.5 / d))), 2.0) / l)), 1.0) / (sqrt(l) * sqrt(h)));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (d <= -1.05e-299) tmp = Float64(Float64(d * (Float64(h * l) ^ -0.5)) * Float64(Float64(0.5 * Float64(h * Float64((Float64(M_m * Float64(Float64(0.5 * D) / d)) ^ 2.0) / l))) + -1.0)); else tmp = Float64(d * Float64(fma(h, Float64(-0.5 * Float64((Float64(D * Float64(M_m * Float64(0.5 / d))) ^ 2.0) / l)), 1.0) / Float64(sqrt(l) * sqrt(h)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -1.05e-299], N[(N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[(h * N[(N[Power[N[(M$95$m * N[(N[(0.5 * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(h * N[(-0.5 * N[(N[Power[N[(D * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.05 \cdot 10^{-299}:\\
\;\;\;\;\left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right) \cdot \left(0.5 \cdot \left(h \cdot \frac{{\left(M\_m \cdot \frac{0.5 \cdot D}{d}\right)}^{2}}{\ell}\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, -0.5 \cdot \frac{{\left(D \cdot \left(M\_m \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -1.05000000000000005e-299Initial program 63.8%
Simplified63.8%
Taylor expanded in d around 0 3.7%
*-commutative3.7%
Simplified3.7%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt68.7%
mul-1-neg68.7%
*-commutative68.7%
unpow-168.7%
metadata-eval68.7%
pow-sqr68.7%
rem-sqrt-square68.7%
rem-square-sqrt68.6%
fabs-sqr68.6%
rem-square-sqrt68.7%
*-commutative68.7%
Simplified68.7%
clear-num68.7%
un-div-inv69.5%
div-inv69.5%
metadata-eval69.5%
associate-*l*69.5%
Applied egg-rr69.5%
associate-/r/73.5%
associate-*r/73.5%
Simplified73.5%
if -1.05000000000000005e-299 < d Initial program 66.1%
Simplified66.0%
Applied egg-rr72.2%
*-rgt-identity72.2%
distribute-lft-in83.1%
associate-*l/88.6%
associate-/l*88.5%
Simplified90.1%
Final simplification81.9%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (* h (/ (pow (* M_m (/ (* 0.5 D) d)) 2.0) l))))
(if (<= d -1.05e-299)
(* (* d (pow (* h l) -0.5)) (+ (* 0.5 t_0) -1.0))
(if (<= d 2.8e-172)
(* d (/ (fma -0.5 t_0 1.0) (sqrt (* h l))))
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D d) (/ M_m 2.0)) 2.0))))
(/ d (* (sqrt l) (sqrt h))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = h * (pow((M_m * ((0.5 * D) / d)), 2.0) / l);
double tmp;
if (d <= -1.05e-299) {
tmp = (d * pow((h * l), -0.5)) * ((0.5 * t_0) + -1.0);
} else if (d <= 2.8e-172) {
tmp = d * (fma(-0.5, t_0, 1.0) / sqrt((h * l)));
} else {
tmp = (1.0 - (0.5 * ((h / l) * pow(((D / d) * (M_m / 2.0)), 2.0)))) * (d / (sqrt(l) * sqrt(h)));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(h * Float64((Float64(M_m * Float64(Float64(0.5 * D) / d)) ^ 2.0) / l)) tmp = 0.0 if (d <= -1.05e-299) tmp = Float64(Float64(d * (Float64(h * l) ^ -0.5)) * Float64(Float64(0.5 * t_0) + -1.0)); elseif (d <= 2.8e-172) tmp = Float64(d * Float64(fma(-0.5, t_0, 1.0) / sqrt(Float64(h * l)))); else tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M_m / 2.0)) ^ 2.0)))) * Float64(d / Float64(sqrt(l) * sqrt(h)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(h * N[(N[Power[N[(M$95$m * N[(N[(0.5 * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.05e-299], N[(N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * t$95$0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.8e-172], N[(d * N[(N[(-0.5 * t$95$0 + 1.0), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := h \cdot \frac{{\left(M\_m \cdot \frac{0.5 \cdot D}{d}\right)}^{2}}{\ell}\\
\mathbf{if}\;d \leq -1.05 \cdot 10^{-299}:\\
\;\;\;\;\left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right) \cdot \left(0.5 \cdot t\_0 + -1\right)\\
\mathbf{elif}\;d \leq 2.8 \cdot 10^{-172}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.5, t\_0, 1\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M\_m}{2}\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -1.05000000000000005e-299Initial program 63.8%
Simplified63.8%
Taylor expanded in d around 0 3.7%
*-commutative3.7%
Simplified3.7%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt68.7%
mul-1-neg68.7%
*-commutative68.7%
unpow-168.7%
metadata-eval68.7%
pow-sqr68.7%
rem-sqrt-square68.7%
rem-square-sqrt68.6%
fabs-sqr68.6%
rem-square-sqrt68.7%
*-commutative68.7%
Simplified68.7%
clear-num68.7%
un-div-inv69.5%
div-inv69.5%
metadata-eval69.5%
associate-*l*69.5%
Applied egg-rr69.5%
associate-/r/73.5%
associate-*r/73.5%
Simplified73.5%
if -1.05000000000000005e-299 < d < 2.80000000000000011e-172Initial program 33.1%
Simplified33.1%
add-sqr-sqrt33.0%
pow233.0%
sqrt-prod33.0%
sqrt-pow133.0%
metadata-eval33.0%
pow133.0%
div-inv33.0%
metadata-eval33.0%
associate-*l*33.0%
Applied egg-rr33.0%
*-commutative33.0%
sqrt-div53.6%
sqrt-div60.8%
frac-times60.9%
add-sqr-sqrt60.9%
Applied egg-rr60.9%
associate-*l/85.8%
cancel-sign-sub-inv85.8%
metadata-eval85.8%
*-commutative85.8%
unpow-prod-down85.8%
pow285.8%
add-sqr-sqrt85.8%
associate-*r*85.8%
sqrt-unprod78.6%
Applied egg-rr78.6%
associate-/l*78.6%
+-commutative78.6%
fma-define78.6%
associate-*l/71.9%
associate-/l*78.9%
associate-*l*78.9%
*-commutative78.9%
associate-*l/78.9%
*-commutative78.9%
Simplified78.9%
if 2.80000000000000011e-172 < d Initial program 75.2%
Simplified75.2%
*-commutative76.3%
sqrt-div80.9%
sqrt-div90.1%
frac-times90.2%
add-sqr-sqrt90.4%
Applied egg-rr89.2%
Final simplification80.3%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (* h (/ (pow (* M_m (/ (* 0.5 D) d)) 2.0) l))))
(if (<= l -1e-310)
(* (* d (pow (* h l) -0.5)) (+ (* 0.5 t_0) -1.0))
(if (<= l 4.6e+166)
(* d (/ (fma -0.5 t_0 1.0) (sqrt (* h l))))
(/ d (* (sqrt l) (sqrt h)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = h * (pow((M_m * ((0.5 * D) / d)), 2.0) / l);
double tmp;
if (l <= -1e-310) {
tmp = (d * pow((h * l), -0.5)) * ((0.5 * t_0) + -1.0);
} else if (l <= 4.6e+166) {
tmp = d * (fma(-0.5, t_0, 1.0) / sqrt((h * l)));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(h * Float64((Float64(M_m * Float64(Float64(0.5 * D) / d)) ^ 2.0) / l)) tmp = 0.0 if (l <= -1e-310) tmp = Float64(Float64(d * (Float64(h * l) ^ -0.5)) * Float64(Float64(0.5 * t_0) + -1.0)); elseif (l <= 4.6e+166) tmp = Float64(d * Float64(fma(-0.5, t_0, 1.0) / sqrt(Float64(h * l)))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(h * N[(N[Power[N[(M$95$m * N[(N[(0.5 * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1e-310], N[(N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * t$95$0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.6e+166], N[(d * N[(N[(-0.5 * t$95$0 + 1.0), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := h \cdot \frac{{\left(M\_m \cdot \frac{0.5 \cdot D}{d}\right)}^{2}}{\ell}\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right) \cdot \left(0.5 \cdot t\_0 + -1\right)\\
\mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+166}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.5, t\_0, 1\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -9.999999999999969e-311Initial program 63.3%
Simplified63.3%
Taylor expanded in d around 0 3.6%
*-commutative3.6%
Simplified3.6%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt68.2%
mul-1-neg68.2%
*-commutative68.2%
unpow-168.2%
metadata-eval68.2%
pow-sqr68.2%
rem-sqrt-square68.2%
rem-square-sqrt68.0%
fabs-sqr68.0%
rem-square-sqrt68.2%
*-commutative68.2%
Simplified68.2%
clear-num68.2%
un-div-inv68.9%
div-inv68.9%
metadata-eval68.9%
associate-*l*68.9%
Applied egg-rr68.9%
associate-/r/72.9%
associate-*r/72.9%
Simplified72.9%
if -9.999999999999969e-311 < l < 4.60000000000000015e166Initial program 71.8%
Simplified71.8%
add-sqr-sqrt71.8%
pow271.8%
sqrt-prod71.8%
sqrt-pow173.0%
metadata-eval73.0%
pow173.0%
div-inv73.0%
metadata-eval73.0%
associate-*l*73.0%
Applied egg-rr73.0%
*-commutative73.0%
sqrt-div78.0%
sqrt-div86.8%
frac-times86.8%
add-sqr-sqrt86.9%
Applied egg-rr86.9%
associate-*l/92.1%
cancel-sign-sub-inv92.1%
metadata-eval92.1%
*-commutative92.1%
unpow-prod-down90.9%
pow290.9%
add-sqr-sqrt91.0%
associate-*r*91.0%
sqrt-unprod83.8%
Applied egg-rr83.8%
associate-/l*83.7%
+-commutative83.7%
fma-define83.7%
associate-*l/85.7%
associate-/l*86.8%
associate-*l*86.8%
*-commutative86.8%
associate-*l/86.8%
*-commutative86.8%
Simplified86.8%
if 4.60000000000000015e166 < l Initial program 50.2%
Simplified50.2%
add-sqr-sqrt50.2%
pow250.2%
sqrt-prod50.2%
sqrt-pow150.2%
metadata-eval50.2%
pow150.2%
div-inv50.2%
metadata-eval50.2%
associate-*l*50.2%
Applied egg-rr50.2%
*-commutative50.2%
sqrt-div68.0%
sqrt-div77.0%
frac-times77.1%
add-sqr-sqrt77.5%
Applied egg-rr77.5%
Taylor expanded in M around 0 71.5%
Final simplification78.0%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (pow (* h l) -0.5)))
(if (<= l -1e-310)
(*
(* d t_0)
(+ (* 0.5 (* h (/ (pow (* M_m (/ (* 0.5 D) d)) 2.0) l))) -1.0))
(if (<= l 1.1e+167)
(*
d
(* t_0 (+ 1.0 (* -0.5 (* (pow (* M_m (* 0.5 (/ D d))) 2.0) (/ h l))))))
(/ d (* (sqrt l) (sqrt h)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = pow((h * l), -0.5);
double tmp;
if (l <= -1e-310) {
tmp = (d * t_0) * ((0.5 * (h * (pow((M_m * ((0.5 * D) / d)), 2.0) / l))) + -1.0);
} else if (l <= 1.1e+167) {
tmp = d * (t_0 * (1.0 + (-0.5 * (pow((M_m * (0.5 * (D / d))), 2.0) * (h / l)))));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
real(8) :: t_0
real(8) :: tmp
t_0 = (h * l) ** (-0.5d0)
if (l <= (-1d-310)) then
tmp = (d * t_0) * ((0.5d0 * (h * (((m_m * ((0.5d0 * d_1) / d)) ** 2.0d0) / l))) + (-1.0d0))
else if (l <= 1.1d+167) then
tmp = d * (t_0 * (1.0d0 + ((-0.5d0) * (((m_m * (0.5d0 * (d_1 / d))) ** 2.0d0) * (h / l)))))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.pow((h * l), -0.5);
double tmp;
if (l <= -1e-310) {
tmp = (d * t_0) * ((0.5 * (h * (Math.pow((M_m * ((0.5 * D) / d)), 2.0) / l))) + -1.0);
} else if (l <= 1.1e+167) {
tmp = d * (t_0 * (1.0 + (-0.5 * (Math.pow((M_m * (0.5 * (D / d))), 2.0) * (h / l)))));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.pow((h * l), -0.5) tmp = 0 if l <= -1e-310: tmp = (d * t_0) * ((0.5 * (h * (math.pow((M_m * ((0.5 * D) / d)), 2.0) / l))) + -1.0) elif l <= 1.1e+167: tmp = d * (t_0 * (1.0 + (-0.5 * (math.pow((M_m * (0.5 * (D / d))), 2.0) * (h / l))))) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(h * l) ^ -0.5 tmp = 0.0 if (l <= -1e-310) tmp = Float64(Float64(d * t_0) * Float64(Float64(0.5 * Float64(h * Float64((Float64(M_m * Float64(Float64(0.5 * D) / d)) ^ 2.0) / l))) + -1.0)); elseif (l <= 1.1e+167) tmp = Float64(d * Float64(t_0 * Float64(1.0 + Float64(-0.5 * Float64((Float64(M_m * Float64(0.5 * Float64(D / d))) ^ 2.0) * Float64(h / l)))))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = (h * l) ^ -0.5;
tmp = 0.0;
if (l <= -1e-310)
tmp = (d * t_0) * ((0.5 * (h * (((M_m * ((0.5 * D) / d)) ^ 2.0) / l))) + -1.0);
elseif (l <= 1.1e+167)
tmp = d * (t_0 * (1.0 + (-0.5 * (((M_m * (0.5 * (D / d))) ^ 2.0) * (h / l)))));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[l, -1e-310], N[(N[(d * t$95$0), $MachinePrecision] * N[(N[(0.5 * N[(h * N[(N[Power[N[(M$95$m * N[(N[(0.5 * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.1e+167], N[(d * N[(t$95$0 * N[(1.0 + N[(-0.5 * N[(N[Power[N[(M$95$m * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot t\_0\right) \cdot \left(0.5 \cdot \left(h \cdot \frac{{\left(M\_m \cdot \frac{0.5 \cdot D}{d}\right)}^{2}}{\ell}\right) + -1\right)\\
\mathbf{elif}\;\ell \leq 1.1 \cdot 10^{+167}:\\
\;\;\;\;d \cdot \left(t\_0 \cdot \left(1 + -0.5 \cdot \left({\left(M\_m \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -9.999999999999969e-311Initial program 63.3%
Simplified63.3%
Taylor expanded in d around 0 3.6%
*-commutative3.6%
Simplified3.6%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt68.2%
mul-1-neg68.2%
*-commutative68.2%
unpow-168.2%
metadata-eval68.2%
pow-sqr68.2%
rem-sqrt-square68.2%
rem-square-sqrt68.0%
fabs-sqr68.0%
rem-square-sqrt68.2%
*-commutative68.2%
Simplified68.2%
clear-num68.2%
un-div-inv68.9%
div-inv68.9%
metadata-eval68.9%
associate-*l*68.9%
Applied egg-rr68.9%
associate-/r/72.9%
associate-*r/72.9%
Simplified72.9%
if -9.999999999999969e-311 < l < 1.10000000000000002e167Initial program 71.8%
Simplified71.8%
Taylor expanded in d around 0 77.9%
*-commutative77.9%
Simplified77.9%
pow177.9%
Applied egg-rr83.8%
unpow183.8%
*-commutative83.8%
associate-/l*83.8%
Simplified83.8%
if 1.10000000000000002e167 < l Initial program 50.2%
Simplified50.2%
add-sqr-sqrt50.2%
pow250.2%
sqrt-prod50.2%
sqrt-pow150.2%
metadata-eval50.2%
pow150.2%
div-inv50.2%
metadata-eval50.2%
associate-*l*50.2%
Applied egg-rr50.2%
*-commutative50.2%
sqrt-div68.0%
sqrt-div77.0%
frac-times77.1%
add-sqr-sqrt77.5%
Applied egg-rr77.5%
Taylor expanded in M around 0 71.5%
Final simplification76.8%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= l -1e-310)
(*
(/ d (sqrt (* h l)))
(+ (* 0.5 (* (/ h l) (pow (* (/ D d) (/ M_m 2.0)) 2.0))) -1.0))
(if (<= l 2.4e+167)
(*
d
(*
(pow (* h l) -0.5)
(+ 1.0 (* -0.5 (* (pow (* M_m (* 0.5 (/ D d))) 2.0) (/ h l))))))
(/ d (* (sqrt l) (sqrt h))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -1e-310) {
tmp = (d / sqrt((h * l))) * ((0.5 * ((h / l) * pow(((D / d) * (M_m / 2.0)), 2.0))) + -1.0);
} else if (l <= 2.4e+167) {
tmp = d * (pow((h * l), -0.5) * (1.0 + (-0.5 * (pow((M_m * (0.5 * (D / d))), 2.0) * (h / l)))));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
real(8) :: tmp
if (l <= (-1d-310)) then
tmp = (d / sqrt((h * l))) * ((0.5d0 * ((h / l) * (((d_1 / d) * (m_m / 2.0d0)) ** 2.0d0))) + (-1.0d0))
else if (l <= 2.4d+167) then
tmp = d * (((h * l) ** (-0.5d0)) * (1.0d0 + ((-0.5d0) * (((m_m * (0.5d0 * (d_1 / d))) ** 2.0d0) * (h / l)))))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -1e-310) {
tmp = (d / Math.sqrt((h * l))) * ((0.5 * ((h / l) * Math.pow(((D / d) * (M_m / 2.0)), 2.0))) + -1.0);
} else if (l <= 2.4e+167) {
tmp = d * (Math.pow((h * l), -0.5) * (1.0 + (-0.5 * (Math.pow((M_m * (0.5 * (D / d))), 2.0) * (h / l)))));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -1e-310: tmp = (d / math.sqrt((h * l))) * ((0.5 * ((h / l) * math.pow(((D / d) * (M_m / 2.0)), 2.0))) + -1.0) elif l <= 2.4e+167: tmp = d * (math.pow((h * l), -0.5) * (1.0 + (-0.5 * (math.pow((M_m * (0.5 * (D / d))), 2.0) * (h / l))))) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -1e-310) tmp = Float64(Float64(d / sqrt(Float64(h * l))) * Float64(Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M_m / 2.0)) ^ 2.0))) + -1.0)); elseif (l <= 2.4e+167) tmp = Float64(d * Float64((Float64(h * l) ^ -0.5) * Float64(1.0 + Float64(-0.5 * Float64((Float64(M_m * Float64(0.5 * Float64(D / d))) ^ 2.0) * Float64(h / l)))))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= -1e-310)
tmp = (d / sqrt((h * l))) * ((0.5 * ((h / l) * (((D / d) * (M_m / 2.0)) ^ 2.0))) + -1.0);
elseif (l <= 2.4e+167)
tmp = d * (((h * l) ^ -0.5) * (1.0 + (-0.5 * (((M_m * (0.5 * (D / d))) ^ 2.0) * (h / l)))));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -1e-310], N[(N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.4e+167], N[(d * N[(N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[Power[N[(M$95$m * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M\_m}{2}\right)}^{2}\right) + -1\right)\\
\mathbf{elif}\;\ell \leq 2.4 \cdot 10^{+167}:\\
\;\;\;\;d \cdot \left({\left(h \cdot \ell\right)}^{-0.5} \cdot \left(1 + -0.5 \cdot \left({\left(M\_m \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -9.999999999999969e-311Initial program 63.3%
Simplified63.3%
sqrt-unprod52.1%
pow1/252.1%
frac-times35.6%
pow235.6%
Applied egg-rr35.6%
unpow1/235.6%
*-commutative35.6%
Simplified35.6%
sqrt-div40.9%
Applied egg-rr40.9%
unpow240.9%
sqr-neg40.9%
rem-sqrt-square68.2%
rem-square-sqrt68.0%
fabs-sqr68.0%
rem-square-sqrt68.2%
Simplified68.2%
if -9.999999999999969e-311 < l < 2.39999999999999999e167Initial program 71.8%
Simplified71.8%
Taylor expanded in d around 0 77.9%
*-commutative77.9%
Simplified77.9%
pow177.9%
Applied egg-rr83.8%
unpow183.8%
*-commutative83.8%
associate-/l*83.8%
Simplified83.8%
if 2.39999999999999999e167 < l Initial program 50.2%
Simplified50.2%
add-sqr-sqrt50.2%
pow250.2%
sqrt-prod50.2%
sqrt-pow150.2%
metadata-eval50.2%
pow150.2%
div-inv50.2%
metadata-eval50.2%
associate-*l*50.2%
Applied egg-rr50.2%
*-commutative50.2%
sqrt-div68.0%
sqrt-div77.0%
frac-times77.1%
add-sqr-sqrt77.5%
Applied egg-rr77.5%
Taylor expanded in M around 0 71.5%
Final simplification74.5%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= d -2.55e-95)
(* d (- (sqrt (/ (/ 1.0 h) l))))
(if (<= d 6.8e-308)
(/ (* -0.125 (* (pow (* M_m D) 2.0) (/ (pow (/ h l) 1.5) d))) h)
(/
(* d (+ 1.0 (* -0.5 (* (/ h l) (pow (* (/ D d) (* M_m 0.5)) 2.0)))))
(sqrt (* h l))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -2.55e-95) {
tmp = d * -sqrt(((1.0 / h) / l));
} else if (d <= 6.8e-308) {
tmp = (-0.125 * (pow((M_m * D), 2.0) * (pow((h / l), 1.5) / d))) / h;
} else {
tmp = (d * (1.0 + (-0.5 * ((h / l) * pow(((D / d) * (M_m * 0.5)), 2.0))))) / sqrt((h * l));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
real(8) :: tmp
if (d <= (-2.55d-95)) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else if (d <= 6.8d-308) then
tmp = ((-0.125d0) * (((m_m * d_1) ** 2.0d0) * (((h / l) ** 1.5d0) / d))) / h
else
tmp = (d * (1.0d0 + ((-0.5d0) * ((h / l) * (((d_1 / d) * (m_m * 0.5d0)) ** 2.0d0))))) / sqrt((h * l))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -2.55e-95) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else if (d <= 6.8e-308) {
tmp = (-0.125 * (Math.pow((M_m * D), 2.0) * (Math.pow((h / l), 1.5) / d))) / h;
} else {
tmp = (d * (1.0 + (-0.5 * ((h / l) * Math.pow(((D / d) * (M_m * 0.5)), 2.0))))) / Math.sqrt((h * l));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if d <= -2.55e-95: tmp = d * -math.sqrt(((1.0 / h) / l)) elif d <= 6.8e-308: tmp = (-0.125 * (math.pow((M_m * D), 2.0) * (math.pow((h / l), 1.5) / d))) / h else: tmp = (d * (1.0 + (-0.5 * ((h / l) * math.pow(((D / d) * (M_m * 0.5)), 2.0))))) / math.sqrt((h * l)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (d <= -2.55e-95) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); elseif (d <= 6.8e-308) tmp = Float64(Float64(-0.125 * Float64((Float64(M_m * D) ^ 2.0) * Float64((Float64(h / l) ^ 1.5) / d))) / h); else tmp = Float64(Float64(d * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0))))) / sqrt(Float64(h * l))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (d <= -2.55e-95)
tmp = d * -sqrt(((1.0 / h) / l));
elseif (d <= 6.8e-308)
tmp = (-0.125 * (((M_m * D) ^ 2.0) * (((h / l) ^ 1.5) / d))) / h;
else
tmp = (d * (1.0 + (-0.5 * ((h / l) * (((D / d) * (M_m * 0.5)) ^ 2.0))))) / sqrt((h * l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -2.55e-95], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, 6.8e-308], N[(N[(-0.125 * N[(N[Power[N[(M$95$m * D), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(d * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.55 \cdot 10^{-95}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{elif}\;d \leq 6.8 \cdot 10^{-308}:\\
\;\;\;\;\frac{-0.125 \cdot \left({\left(M\_m \cdot D\right)}^{2} \cdot \frac{{\left(\frac{h}{\ell}\right)}^{1.5}}{d}\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{d \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}\right)\right)}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if d < -2.55e-95Initial program 74.1%
Simplified74.0%
Taylor expanded in h around 0 22.4%
fma-define22.4%
associate-/l*22.4%
cube-div35.4%
Simplified35.4%
Taylor expanded in D around 0 51.0%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt60.9%
mul-1-neg60.9%
associate-/r*62.2%
Simplified62.2%
if -2.55e-95 < d < 6.79999999999999998e-308Initial program 47.1%
Simplified47.0%
Taylor expanded in h around 0 14.6%
fma-define14.6%
associate-/l*14.5%
cube-div28.4%
Simplified28.4%
Taylor expanded in D around inf 16.6%
associate-*l/16.7%
associate-/l*16.7%
cube-div31.7%
unpow1/231.7%
exp-to-pow31.5%
*-commutative31.5%
exp-prod37.0%
*-commutative37.0%
associate-*l*37.0%
metadata-eval37.0%
exp-to-pow37.4%
unpow237.4%
unpow237.4%
swap-sqr55.9%
unpow255.9%
Simplified55.9%
if 6.79999999999999998e-308 < d Initial program 66.6%
Simplified66.6%
add-sqr-sqrt66.6%
pow266.6%
sqrt-prod66.6%
sqrt-pow167.4%
metadata-eval67.4%
pow167.4%
div-inv67.4%
metadata-eval67.4%
associate-*l*67.4%
Applied egg-rr67.4%
*-commutative67.4%
sqrt-div75.6%
sqrt-div84.4%
frac-times84.5%
add-sqr-sqrt84.6%
Applied egg-rr84.6%
associate-*l/90.1%
cancel-sign-sub-inv90.1%
metadata-eval90.1%
*-commutative90.1%
unpow-prod-down89.2%
pow289.2%
add-sqr-sqrt89.2%
associate-*r*89.2%
sqrt-unprod77.0%
Applied egg-rr77.0%
Final simplification68.4%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= d -6.5e-96)
(* d (- (sqrt (/ (/ 1.0 h) l))))
(if (<= d 3.8e-307)
(/ (* -0.125 (* (pow (* M_m D) 2.0) (/ (pow (/ h l) 1.5) d))) h)
(*
d
(/
(+ 1.0 (* (pow (* M_m (/ (* 0.5 D) d)) 2.0) (* -0.5 (/ h l))))
(sqrt (* h l)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -6.5e-96) {
tmp = d * -sqrt(((1.0 / h) / l));
} else if (d <= 3.8e-307) {
tmp = (-0.125 * (pow((M_m * D), 2.0) * (pow((h / l), 1.5) / d))) / h;
} else {
tmp = d * ((1.0 + (pow((M_m * ((0.5 * D) / d)), 2.0) * (-0.5 * (h / l)))) / sqrt((h * l)));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
real(8) :: tmp
if (d <= (-6.5d-96)) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else if (d <= 3.8d-307) then
tmp = ((-0.125d0) * (((m_m * d_1) ** 2.0d0) * (((h / l) ** 1.5d0) / d))) / h
else
tmp = d * ((1.0d0 + (((m_m * ((0.5d0 * d_1) / d)) ** 2.0d0) * ((-0.5d0) * (h / l)))) / sqrt((h * l)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -6.5e-96) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else if (d <= 3.8e-307) {
tmp = (-0.125 * (Math.pow((M_m * D), 2.0) * (Math.pow((h / l), 1.5) / d))) / h;
} else {
tmp = d * ((1.0 + (Math.pow((M_m * ((0.5 * D) / d)), 2.0) * (-0.5 * (h / l)))) / Math.sqrt((h * l)));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if d <= -6.5e-96: tmp = d * -math.sqrt(((1.0 / h) / l)) elif d <= 3.8e-307: tmp = (-0.125 * (math.pow((M_m * D), 2.0) * (math.pow((h / l), 1.5) / d))) / h else: tmp = d * ((1.0 + (math.pow((M_m * ((0.5 * D) / d)), 2.0) * (-0.5 * (h / l)))) / math.sqrt((h * l))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (d <= -6.5e-96) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); elseif (d <= 3.8e-307) tmp = Float64(Float64(-0.125 * Float64((Float64(M_m * D) ^ 2.0) * Float64((Float64(h / l) ^ 1.5) / d))) / h); else tmp = Float64(d * Float64(Float64(1.0 + Float64((Float64(M_m * Float64(Float64(0.5 * D) / d)) ^ 2.0) * Float64(-0.5 * Float64(h / l)))) / sqrt(Float64(h * l)))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (d <= -6.5e-96)
tmp = d * -sqrt(((1.0 / h) / l));
elseif (d <= 3.8e-307)
tmp = (-0.125 * (((M_m * D) ^ 2.0) * (((h / l) ^ 1.5) / d))) / h;
else
tmp = d * ((1.0 + (((M_m * ((0.5 * D) / d)) ^ 2.0) * (-0.5 * (h / l)))) / sqrt((h * l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -6.5e-96], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, 3.8e-307], N[(N[(-0.125 * N[(N[Power[N[(M$95$m * D), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(d * N[(N[(1.0 + N[(N[Power[N[(M$95$m * N[(N[(0.5 * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -6.5 \cdot 10^{-96}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{elif}\;d \leq 3.8 \cdot 10^{-307}:\\
\;\;\;\;\frac{-0.125 \cdot \left({\left(M\_m \cdot D\right)}^{2} \cdot \frac{{\left(\frac{h}{\ell}\right)}^{1.5}}{d}\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{1 + {\left(M\_m \cdot \frac{0.5 \cdot D}{d}\right)}^{2} \cdot \left(-0.5 \cdot \frac{h}{\ell}\right)}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if d < -6.50000000000000001e-96Initial program 74.1%
Simplified74.0%
Taylor expanded in h around 0 22.4%
fma-define22.4%
associate-/l*22.4%
cube-div35.4%
Simplified35.4%
Taylor expanded in D around 0 51.0%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt60.9%
mul-1-neg60.9%
associate-/r*62.2%
Simplified62.2%
if -6.50000000000000001e-96 < d < 3.79999999999999985e-307Initial program 47.1%
Simplified47.0%
Taylor expanded in h around 0 14.6%
fma-define14.6%
associate-/l*14.5%
cube-div28.4%
Simplified28.4%
Taylor expanded in D around inf 16.6%
associate-*l/16.7%
associate-/l*16.7%
cube-div31.7%
unpow1/231.7%
exp-to-pow31.5%
*-commutative31.5%
exp-prod37.0%
*-commutative37.0%
associate-*l*37.0%
metadata-eval37.0%
exp-to-pow37.4%
unpow237.4%
unpow237.4%
swap-sqr55.9%
unpow255.9%
Simplified55.9%
if 3.79999999999999985e-307 < d Initial program 66.6%
Simplified66.6%
add-sqr-sqrt66.6%
pow266.6%
sqrt-prod66.6%
sqrt-pow167.4%
metadata-eval67.4%
pow167.4%
div-inv67.4%
metadata-eval67.4%
associate-*l*67.4%
Applied egg-rr67.4%
*-commutative67.4%
sqrt-div75.6%
sqrt-div84.4%
frac-times84.5%
add-sqr-sqrt84.6%
Applied egg-rr84.6%
associate-*l/90.1%
cancel-sign-sub-inv90.1%
metadata-eval90.1%
*-commutative90.1%
unpow-prod-down89.2%
pow289.2%
add-sqr-sqrt89.2%
associate-*r*89.2%
sqrt-unprod77.0%
Applied egg-rr77.0%
associate-/l*77.0%
associate-*r*77.0%
associate-*l*77.0%
associate-*r/77.0%
*-commutative77.0%
Simplified77.0%
Final simplification68.4%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= d -2.35e-98)
(* d (- (sqrt (/ (/ 1.0 h) l))))
(if (<= d 1.15e-196)
(/ (* -0.125 (* (pow (* M_m D) 2.0) (/ (pow (/ h l) 1.5) d))) h)
(/ d (* (sqrt l) (sqrt h))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -2.35e-98) {
tmp = d * -sqrt(((1.0 / h) / l));
} else if (d <= 1.15e-196) {
tmp = (-0.125 * (pow((M_m * D), 2.0) * (pow((h / l), 1.5) / d))) / h;
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
real(8) :: tmp
if (d <= (-2.35d-98)) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else if (d <= 1.15d-196) then
tmp = ((-0.125d0) * (((m_m * d_1) ** 2.0d0) * (((h / l) ** 1.5d0) / d))) / h
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -2.35e-98) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else if (d <= 1.15e-196) {
tmp = (-0.125 * (Math.pow((M_m * D), 2.0) * (Math.pow((h / l), 1.5) / d))) / h;
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if d <= -2.35e-98: tmp = d * -math.sqrt(((1.0 / h) / l)) elif d <= 1.15e-196: tmp = (-0.125 * (math.pow((M_m * D), 2.0) * (math.pow((h / l), 1.5) / d))) / h else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (d <= -2.35e-98) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); elseif (d <= 1.15e-196) tmp = Float64(Float64(-0.125 * Float64((Float64(M_m * D) ^ 2.0) * Float64((Float64(h / l) ^ 1.5) / d))) / h); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (d <= -2.35e-98)
tmp = d * -sqrt(((1.0 / h) / l));
elseif (d <= 1.15e-196)
tmp = (-0.125 * (((M_m * D) ^ 2.0) * (((h / l) ^ 1.5) / d))) / h;
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -2.35e-98], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, 1.15e-196], N[(N[(-0.125 * N[(N[Power[N[(M$95$m * D), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.35 \cdot 10^{-98}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{elif}\;d \leq 1.15 \cdot 10^{-196}:\\
\;\;\;\;\frac{-0.125 \cdot \left({\left(M\_m \cdot D\right)}^{2} \cdot \frac{{\left(\frac{h}{\ell}\right)}^{1.5}}{d}\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -2.35000000000000003e-98Initial program 74.1%
Simplified74.0%
Taylor expanded in h around 0 22.4%
fma-define22.4%
associate-/l*22.4%
cube-div35.4%
Simplified35.4%
Taylor expanded in D around 0 51.0%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt60.9%
mul-1-neg60.9%
associate-/r*62.2%
Simplified62.2%
if -2.35000000000000003e-98 < d < 1.1500000000000001e-196Initial program 40.6%
Simplified40.6%
Taylor expanded in h around 0 16.1%
fma-define16.1%
associate-/l*16.0%
cube-div31.4%
Simplified31.4%
Taylor expanded in D around inf 21.7%
associate-*l/21.7%
associate-/l*21.7%
cube-div36.5%
unpow1/236.5%
exp-to-pow36.3%
*-commutative36.3%
exp-prod43.0%
*-commutative43.0%
associate-*l*43.0%
metadata-eval43.0%
exp-to-pow43.4%
unpow243.4%
unpow243.4%
swap-sqr58.0%
unpow258.0%
Simplified58.0%
if 1.1500000000000001e-196 < d Initial program 74.8%
Simplified74.7%
add-sqr-sqrt74.7%
pow274.7%
sqrt-prod74.7%
sqrt-pow175.8%
metadata-eval75.8%
pow175.8%
div-inv75.8%
metadata-eval75.8%
associate-*l*75.8%
Applied egg-rr75.8%
*-commutative75.8%
sqrt-div81.0%
sqrt-div89.7%
frac-times89.8%
add-sqr-sqrt89.9%
Applied egg-rr89.9%
Taylor expanded in M around 0 61.0%
Final simplification60.5%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (if (<= l 4e-249) (* d (- (sqrt (/ (/ 1.0 h) l)))) (/ d (* (sqrt l) (sqrt h)))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= 4e-249) {
tmp = d * -sqrt(((1.0 / h) / l));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
real(8) :: tmp
if (l <= 4d-249) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= 4e-249) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= 4e-249: tmp = d * -math.sqrt(((1.0 / h) / l)) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= 4e-249) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= 4e-249)
tmp = d * -sqrt(((1.0 / h) / l));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, 4e-249], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 4 \cdot 10^{-249}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 4.00000000000000022e-249Initial program 63.6%
Simplified63.5%
Taylor expanded in h around 0 19.2%
fma-define19.2%
associate-/l*19.1%
cube-div33.4%
Simplified33.4%
Taylor expanded in D around 0 33.8%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt45.0%
mul-1-neg45.0%
associate-/r*45.7%
Simplified45.7%
if 4.00000000000000022e-249 < l Initial program 66.5%
Simplified66.4%
add-sqr-sqrt66.4%
pow266.4%
sqrt-prod66.4%
sqrt-pow167.4%
metadata-eval67.4%
pow167.4%
div-inv67.4%
metadata-eval67.4%
associate-*l*67.4%
Applied egg-rr67.4%
*-commutative67.4%
sqrt-div75.9%
sqrt-div84.3%
frac-times84.4%
add-sqr-sqrt84.6%
Applied egg-rr84.6%
Taylor expanded in M around 0 57.8%
Final simplification51.5%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (if (<= l 2.7e-244) (* d (- (sqrt (/ (/ 1.0 h) l)))) (* d (pow (* h l) -0.5))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= 2.7e-244) {
tmp = d * -sqrt(((1.0 / h) / l));
} else {
tmp = d * pow((h * l), -0.5);
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
real(8) :: tmp
if (l <= 2.7d-244) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else
tmp = d * ((h * l) ** (-0.5d0))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= 2.7e-244) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else {
tmp = d * Math.pow((h * l), -0.5);
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= 2.7e-244: tmp = d * -math.sqrt(((1.0 / h) / l)) else: tmp = d * math.pow((h * l), -0.5) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= 2.7e-244) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); else tmp = Float64(d * (Float64(h * l) ^ -0.5)); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= 2.7e-244)
tmp = d * -sqrt(((1.0 / h) / l));
else
tmp = d * ((h * l) ^ -0.5);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, 2.7e-244], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.7 \cdot 10^{-244}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\end{array}
\end{array}
if l < 2.7e-244Initial program 63.6%
Simplified63.5%
Taylor expanded in h around 0 19.2%
fma-define19.2%
associate-/l*19.1%
cube-div33.4%
Simplified33.4%
Taylor expanded in D around 0 33.8%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt45.0%
mul-1-neg45.0%
associate-/r*45.7%
Simplified45.7%
if 2.7e-244 < l Initial program 66.5%
Simplified65.7%
associate-*l/66.5%
*-commutative66.5%
associate-*r/67.3%
associate-*l/67.3%
*-commutative67.3%
div-inv67.3%
metadata-eval67.3%
associate-*l*67.3%
Applied egg-rr67.3%
clear-num67.3%
inv-pow67.3%
Applied egg-rr67.3%
Taylor expanded in l around inf 49.3%
*-commutative49.3%
unpow-149.3%
metadata-eval49.3%
pow-sqr49.4%
rem-sqrt-square50.7%
rem-square-sqrt50.5%
fabs-sqr50.5%
rem-square-sqrt50.7%
Simplified50.7%
Final simplification48.1%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (let* ((t_0 (pow (* h l) -0.5))) (if (<= l 1.7e-244) (* d (- t_0)) (* d t_0))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = pow((h * l), -0.5);
double tmp;
if (l <= 1.7e-244) {
tmp = d * -t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
real(8) :: t_0
real(8) :: tmp
t_0 = (h * l) ** (-0.5d0)
if (l <= 1.7d-244) then
tmp = d * -t_0
else
tmp = d * t_0
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.pow((h * l), -0.5);
double tmp;
if (l <= 1.7e-244) {
tmp = d * -t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.pow((h * l), -0.5) tmp = 0 if l <= 1.7e-244: tmp = d * -t_0 else: tmp = d * t_0 return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(h * l) ^ -0.5 tmp = 0.0 if (l <= 1.7e-244) tmp = Float64(d * Float64(-t_0)); else tmp = Float64(d * t_0); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = (h * l) ^ -0.5;
tmp = 0.0;
if (l <= 1.7e-244)
tmp = d * -t_0;
else
tmp = d * t_0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[l, 1.7e-244], N[(d * (-t$95$0)), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq 1.7 \cdot 10^{-244}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
\end{array}
if l < 1.70000000000000004e-244Initial program 63.6%
Simplified64.3%
associate-*l/65.2%
*-commutative65.2%
associate-*r/65.1%
associate-*l/64.4%
*-commutative64.4%
div-inv64.4%
metadata-eval64.4%
associate-*l*64.4%
Applied egg-rr64.4%
clear-num64.2%
inv-pow64.2%
Applied egg-rr64.2%
Taylor expanded in l around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt45.0%
associate-*r*45.0%
*-commutative45.0%
*-commutative45.0%
unpow-145.0%
metadata-eval45.0%
pow-sqr45.0%
rem-sqrt-square45.0%
rem-square-sqrt44.9%
fabs-sqr44.9%
rem-square-sqrt45.0%
neg-mul-145.0%
Simplified45.0%
if 1.70000000000000004e-244 < l Initial program 66.5%
Simplified65.7%
associate-*l/66.5%
*-commutative66.5%
associate-*r/67.3%
associate-*l/67.3%
*-commutative67.3%
div-inv67.3%
metadata-eval67.3%
associate-*l*67.3%
Applied egg-rr67.3%
clear-num67.3%
inv-pow67.3%
Applied egg-rr67.3%
Taylor expanded in l around inf 49.3%
*-commutative49.3%
unpow-149.3%
metadata-eval49.3%
pow-sqr49.4%
rem-sqrt-square50.7%
rem-square-sqrt50.5%
fabs-sqr50.5%
rem-square-sqrt50.7%
Simplified50.7%
Final simplification47.7%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (if (<= l -2.15e-271) (* d (/ (sqrt (/ h l)) h)) (* d (pow (* h l) -0.5))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -2.15e-271) {
tmp = d * (sqrt((h / l)) / h);
} else {
tmp = d * pow((h * l), -0.5);
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
real(8) :: tmp
if (l <= (-2.15d-271)) then
tmp = d * (sqrt((h / l)) / h)
else
tmp = d * ((h * l) ** (-0.5d0))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (l <= -2.15e-271) {
tmp = d * (Math.sqrt((h / l)) / h);
} else {
tmp = d * Math.pow((h * l), -0.5);
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -2.15e-271: tmp = d * (math.sqrt((h / l)) / h) else: tmp = d * math.pow((h * l), -0.5) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (l <= -2.15e-271) tmp = Float64(d * Float64(sqrt(Float64(h / l)) / h)); else tmp = Float64(d * (Float64(h * l) ^ -0.5)); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (l <= -2.15e-271)
tmp = d * (sqrt((h / l)) / h);
else
tmp = d * ((h * l) ^ -0.5);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -2.15e-271], N[(d * N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision], N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.15 \cdot 10^{-271}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{h}{\ell}}}{h}\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\end{array}
\end{array}
if l < -2.15e-271Initial program 63.2%
Simplified63.1%
Taylor expanded in h around 0 19.4%
fma-define19.4%
associate-/l*19.4%
cube-div33.4%
Simplified33.4%
Taylor expanded in D around 0 37.1%
associate-/l*43.0%
Applied egg-rr43.0%
if -2.15e-271 < l Initial program 66.6%
Simplified65.8%
associate-*l/67.3%
*-commutative67.3%
associate-*r/68.1%
associate-*l/68.1%
*-commutative68.1%
div-inv68.1%
metadata-eval68.1%
associate-*l*68.1%
Applied egg-rr68.1%
clear-num68.1%
inv-pow68.1%
Applied egg-rr68.1%
Taylor expanded in l around inf 46.5%
*-commutative46.5%
unpow-146.5%
metadata-eval46.5%
pow-sqr46.6%
rem-sqrt-square47.1%
rem-square-sqrt46.9%
fabs-sqr46.9%
rem-square-sqrt47.1%
Simplified47.1%
Final simplification45.1%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (* d (sqrt (/ (/ 1.0 h) l))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
return d * sqrt(((1.0 / h) / l));
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
code = d * sqrt(((1.0d0 / h) / l))
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
return d * Math.sqrt(((1.0 / h) / l));
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): return d * math.sqrt(((1.0 / h) / l))
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) return Float64(d * sqrt(Float64(Float64(1.0 / h) / l))) end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp = code(d, h, l, M_m, D)
tmp = d * sqrt(((1.0 / h) / l));
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}
\end{array}
Initial program 65.0%
Simplified64.9%
Taylor expanded in h around 0 22.0%
fma-define22.0%
associate-/l*22.0%
cube-div37.3%
Simplified37.3%
Taylor expanded in D around 0 38.4%
Taylor expanded in d around 0 28.4%
associate-/r*28.4%
Simplified28.4%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (* d (sqrt (/ 1.0 (* h l)))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
return d * sqrt((1.0 / (h * l)));
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
code = d * sqrt((1.0d0 / (h * l)))
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
return d * Math.sqrt((1.0 / (h * l)));
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): return d * math.sqrt((1.0 / (h * l)))
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) return Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp = code(d, h, l, M_m, D)
tmp = d * sqrt((1.0 / (h * l)));
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
d \cdot \sqrt{\frac{1}{h \cdot \ell}}
\end{array}
Initial program 65.0%
Simplified64.9%
Taylor expanded in h around 0 22.0%
fma-define22.0%
associate-/l*22.0%
cube-div37.3%
Simplified37.3%
Taylor expanded in D around 0 38.4%
Taylor expanded in d around 0 28.4%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (* d (pow (* h l) -0.5)))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
return d * pow((h * l), -0.5);
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
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_1
code = d * ((h * l) ** (-0.5d0))
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
return d * Math.pow((h * l), -0.5);
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): return d * math.pow((h * l), -0.5)
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) return Float64(d * (Float64(h * l) ^ -0.5)) end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp = code(d, h, l, M_m, D)
tmp = d * ((h * l) ^ -0.5);
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
d \cdot {\left(h \cdot \ell\right)}^{-0.5}
\end{array}
Initial program 65.0%
Simplified64.9%
associate-*l/65.8%
*-commutative65.8%
associate-*r/66.2%
associate-*l/65.8%
*-commutative65.8%
div-inv65.8%
metadata-eval65.8%
associate-*l*65.8%
Applied egg-rr65.8%
clear-num65.7%
inv-pow65.7%
Applied egg-rr65.7%
Taylor expanded in l around inf 28.4%
*-commutative28.4%
unpow-128.4%
metadata-eval28.4%
pow-sqr28.4%
rem-sqrt-square28.3%
rem-square-sqrt28.2%
fabs-sqr28.2%
rem-square-sqrt28.3%
Simplified28.3%
Final simplification28.3%
herbie shell --seed 2024154
(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)))))