
(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 20 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 (sqrt (- d))))
(if (<= l -2e-310)
(*
(/ t_0 (sqrt (- l)))
(*
(/ t_0 (sqrt (- h)))
(+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M_m 2.0) d)) 2.0) -0.5)))))
(*
d
(/
(fma h (* -0.5 (/ (pow (* M_m (/ (/ D d) 2.0)) 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);
double tmp;
if (l <= -2e-310) {
tmp = (t_0 / sqrt(-l)) * ((t_0 / sqrt(-h)) * (1.0 + ((h / l) * (pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))));
} else {
tmp = d * (fma(h, (-0.5 * (pow((M_m * ((D / d) / 2.0)), 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 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -2e-310) tmp = Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5))))); else tmp = Float64(d * Float64(fma(h, Float64(-0.5 * Float64((Float64(M_m * Float64(Float64(D / d) / 2.0)) ^ 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[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -2e-310], N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(h * N[(-0.5 * N[(N[Power[N[(M$95$m * N[(N[(D / d), $MachinePrecision] / 2.0), $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{-d}\\
\mathbf{if}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-\ell}} \cdot \left(\frac{t\_0}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, -0.5 \cdot \frac{{\left(M\_m \cdot \frac{\frac{D}{d}}{2}\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -1.999999999999994e-310Initial program 69.3%
Simplified69.2%
frac-2neg69.2%
sqrt-div74.2%
Applied egg-rr74.2%
frac-2neg74.2%
sqrt-div79.8%
Applied egg-rr79.8%
if -1.999999999999994e-310 < l Initial program 67.0%
Simplified66.2%
Applied egg-rr66.7%
distribute-rgt1-in76.4%
+-commutative76.4%
associate-*r/83.8%
*-commutative83.8%
associate-/l*83.1%
Simplified92.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
(if (<= h -2e-310)
(*
(- 1.0 (* 0.5 (pow (* (* M_m (* (/ D d) 0.5)) (sqrt (/ h l))) 2.0)))
(* (/ (sqrt (- d)) (sqrt (- l))) (sqrt (/ d h))))
(*
d
(/
(fma h (* -0.5 (/ (pow (* M_m (/ (/ D d) 2.0)) 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 (h <= -2e-310) {
tmp = (1.0 - (0.5 * pow(((M_m * ((D / d) * 0.5)) * sqrt((h / l))), 2.0))) * ((sqrt(-d) / sqrt(-l)) * sqrt((d / h)));
} else {
tmp = d * (fma(h, (-0.5 * (pow((M_m * ((D / d) / 2.0)), 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 (h <= -2e-310) tmp = Float64(Float64(1.0 - Float64(0.5 * (Float64(Float64(M_m * Float64(Float64(D / d) * 0.5)) * sqrt(Float64(h / l))) ^ 2.0))) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * sqrt(Float64(d / h)))); else tmp = Float64(d * Float64(fma(h, Float64(-0.5 * Float64((Float64(M_m * Float64(Float64(D / d) / 2.0)) ^ 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[h, -2e-310], N[(N[(1.0 - N[(0.5 * N[Power[N[(N[(M$95$m * N[(N[(D / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(h * N[(-0.5 * N[(N[Power[N[(M$95$m * N[(N[(D / d), $MachinePrecision] / 2.0), $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}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(1 - 0.5 \cdot {\left(\left(M\_m \cdot \left(\frac{D}{d} \cdot 0.5\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, -0.5 \cdot \frac{{\left(M\_m \cdot \frac{\frac{D}{d}}{2}\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if h < -1.999999999999994e-310Initial program 69.3%
Simplified69.3%
add-sqr-sqrt69.3%
pow269.3%
sqrt-prod69.3%
sqrt-pow173.3%
metadata-eval73.3%
frac-times72.7%
pow172.7%
associate-/l*73.3%
*-un-lft-identity73.3%
times-frac73.3%
metadata-eval73.3%
Applied egg-rr73.3%
frac-2neg74.2%
sqrt-div79.8%
Applied egg-rr79.1%
if -1.999999999999994e-310 < h Initial program 67.0%
Simplified66.2%
Applied egg-rr66.7%
distribute-rgt1-in76.4%
+-commutative76.4%
associate-*r/83.8%
*-commutative83.8%
associate-/l*83.1%
Simplified92.0%
Final simplification85.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
(let* ((t_0 (sqrt (- d))))
(if (<= l -5e+66)
(*
(* t_0 (pow (- l) -0.5))
(*
(+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M_m 2.0) d)) 2.0) -0.5)))
(sqrt (/ d h))))
(if (<= l -2e-310)
(*
(sqrt (/ d l))
(*
(/ t_0 (sqrt (- h)))
(+ 1.0 (/ (* h (* -0.5 (pow (* M_m (* (/ D d) 0.5)) 2.0))) l))))
(*
d
(/
(fma h (* -0.5 (/ (pow (* M_m (/ (/ D d) 2.0)) 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);
double tmp;
if (l <= -5e+66) {
tmp = (t_0 * pow(-l, -0.5)) * ((1.0 + ((h / l) * (pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5))) * sqrt((d / h)));
} else if (l <= -2e-310) {
tmp = sqrt((d / l)) * ((t_0 / sqrt(-h)) * (1.0 + ((h * (-0.5 * pow((M_m * ((D / d) * 0.5)), 2.0))) / l)));
} else {
tmp = d * (fma(h, (-0.5 * (pow((M_m * ((D / d) / 2.0)), 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 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -5e+66) tmp = Float64(Float64(t_0 * (Float64(-l) ^ -0.5)) * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5))) * sqrt(Float64(d / h)))); elseif (l <= -2e-310) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(M_m * Float64(Float64(D / d) * 0.5)) ^ 2.0))) / l)))); else tmp = Float64(d * Float64(fma(h, Float64(-0.5 * Float64((Float64(M_m * Float64(Float64(D / d) / 2.0)) ^ 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[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -5e+66], N[(N[(t$95$0 * N[Power[(-l), -0.5], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * 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, -2e-310], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(M$95$m * N[(N[(D / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(h * N[(-0.5 * N[(N[Power[N[(M$95$m * N[(N[(D / d), $MachinePrecision] / 2.0), $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{-d}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{+66}:\\
\;\;\;\;\left(t\_0 \cdot {\left(-\ell\right)}^{-0.5}\right) \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\right) \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\frac{t\_0}{\sqrt{-h}} \cdot \left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(M\_m \cdot \left(\frac{D}{d} \cdot 0.5\right)\right)}^{2}\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, -0.5 \cdot \frac{{\left(M\_m \cdot \frac{\frac{D}{d}}{2}\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -4.99999999999999991e66Initial program 57.9%
Simplified57.4%
frac-2neg61.1%
sqrt-div73.0%
Applied egg-rr63.3%
div-inv63.3%
pow1/263.3%
pow-flip63.3%
metadata-eval63.3%
Applied egg-rr63.3%
if -4.99999999999999991e66 < l < -1.999999999999994e-310Initial program 75.9%
Simplified75.9%
frac-2neg75.9%
sqrt-div81.7%
Applied egg-rr81.7%
Applied egg-rr83.0%
if -1.999999999999994e-310 < l Initial program 67.0%
Simplified66.2%
Applied egg-rr66.7%
distribute-rgt1-in76.4%
+-commutative76.4%
associate-*r/83.8%
*-commutative83.8%
associate-/l*83.1%
Simplified92.0%
Final simplification83.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 -5e-311)
(*
(sqrt (/ d l))
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (/ (* h (* -0.5 (pow (* M_m (* (/ D d) 0.5)) 2.0))) l))))
(*
d
(/
(fma h (* -0.5 (/ (pow (* M_m (/ (/ D d) 2.0)) 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 <= -5e-311) {
tmp = sqrt((d / l)) * ((sqrt(-d) / sqrt(-h)) * (1.0 + ((h * (-0.5 * pow((M_m * ((D / d) * 0.5)), 2.0))) / l)));
} else {
tmp = d * (fma(h, (-0.5 * (pow((M_m * ((D / d) / 2.0)), 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 <= -5e-311) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(M_m * Float64(Float64(D / d) * 0.5)) ^ 2.0))) / l)))); else tmp = Float64(d * Float64(fma(h, Float64(-0.5 * Float64((Float64(M_m * Float64(Float64(D / d) / 2.0)) ^ 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, -5e-311], 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[N[(M$95$m * N[(N[(D / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(h * N[(-0.5 * N[(N[Power[N[(M$95$m * N[(N[(D / d), $MachinePrecision] / 2.0), $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 -5 \cdot 10^{-311}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(M\_m \cdot \left(\frac{D}{d} \cdot 0.5\right)\right)}^{2}\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, -0.5 \cdot \frac{{\left(M\_m \cdot \frac{\frac{D}{d}}{2}\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -5.00000000000023e-311Initial program 69.3%
Simplified69.2%
frac-2neg69.2%
sqrt-div74.2%
Applied egg-rr74.2%
Applied egg-rr75.2%
if -5.00000000000023e-311 < d Initial program 67.0%
Simplified66.2%
Applied egg-rr66.7%
distribute-rgt1-in76.4%
+-commutative76.4%
associate-*r/83.8%
*-commutative83.8%
associate-/l*83.1%
Simplified92.0%
Final simplification83.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
(if (<= d -5e-311)
(*
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M_m 2.0) d)) 2.0) -0.5))))
(sqrt (/ d l)))
(*
d
(/
(fma h (* -0.5 (/ (pow (* M_m (/ (/ D d) 2.0)) 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 <= -5e-311) {
tmp = ((sqrt(-d) / sqrt(-h)) * (1.0 + ((h / l) * (pow((D * ((M_m / 2.0) / d)), 2.0) * -0.5)))) * sqrt((d / l));
} else {
tmp = d * (fma(h, (-0.5 * (pow((M_m * ((D / d) / 2.0)), 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 <= -5e-311) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5)))) * sqrt(Float64(d / l))); else tmp = Float64(d * Float64(fma(h, Float64(-0.5 * Float64((Float64(M_m * Float64(Float64(D / d) / 2.0)) ^ 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, -5e-311], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(h * N[(-0.5 * N[(N[Power[N[(M$95$m * N[(N[(D / d), $MachinePrecision] / 2.0), $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 -5 \cdot 10^{-311}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\right)\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, -0.5 \cdot \frac{{\left(M\_m \cdot \frac{\frac{D}{d}}{2}\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -5.00000000000023e-311Initial program 69.3%
Simplified69.2%
frac-2neg69.2%
sqrt-div74.2%
Applied egg-rr74.2%
if -5.00000000000023e-311 < d Initial program 67.0%
Simplified66.2%
Applied egg-rr66.7%
distribute-rgt1-in76.4%
+-commutative76.4%
associate-*r/83.8%
*-commutative83.8%
associate-/l*83.1%
Simplified92.0%
Final simplification82.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 -1.75e+160)
(* (/ (sqrt (- d)) (sqrt (- l))) (sqrt (/ d h)))
(if (<= l -2e-310)
(*
(/ d (sqrt (* l h)))
(+ (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D d)) 2.0))) -1.0))
(*
d
(/
(fma h (* -0.5 (/ (pow (* M_m (/ (/ D d) 2.0)) 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 (l <= -1.75e+160) {
tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h));
} else if (l <= -2e-310) {
tmp = (d / sqrt((l * h))) * ((0.5 * ((h / l) * pow(((M_m / 2.0) * (D / d)), 2.0))) + -1.0);
} else {
tmp = d * (fma(h, (-0.5 * (pow((M_m * ((D / d) / 2.0)), 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 (l <= -1.75e+160) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * sqrt(Float64(d / h))); elseif (l <= -2e-310) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0))) + -1.0)); else tmp = Float64(d * Float64(fma(h, Float64(-0.5 * Float64((Float64(M_m * Float64(Float64(D / d) / 2.0)) ^ 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[l, -1.75e+160], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-310], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(h * N[(-0.5 * N[(N[Power[N[(M$95$m * N[(N[(D / d), $MachinePrecision] / 2.0), $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}\;\ell \leq -1.75 \cdot 10^{+160}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, -0.5 \cdot \frac{{\left(M\_m \cdot \frac{\frac{D}{d}}{2}\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -1.75000000000000013e160Initial program 51.6%
Simplified51.3%
frac-2neg54.2%
sqrt-div66.4%
Applied egg-rr53.9%
Taylor expanded in d around inf 57.6%
if -1.75000000000000013e160 < l < -1.999999999999994e-310Initial program 74.5%
Simplified74.5%
sqrt-unprod65.0%
pow1/265.0%
frac-times50.4%
pow250.4%
Applied egg-rr50.4%
unpow1/250.4%
*-commutative50.4%
Simplified50.4%
sqrt-div52.4%
*-commutative52.4%
Applied egg-rr52.4%
unpow252.4%
sqr-neg52.4%
rem-sqrt-square82.0%
rem-square-sqrt81.8%
fabs-sqr81.8%
rem-square-sqrt82.0%
Simplified82.0%
if -1.999999999999994e-310 < l Initial program 67.0%
Simplified66.2%
Applied egg-rr66.7%
distribute-rgt1-in76.4%
+-commutative76.4%
associate-*r/83.8%
*-commutative83.8%
associate-/l*83.1%
Simplified92.0%
Final simplification84.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 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D d)) 2.0)))))
(if (<= l -1.65e+164)
(* (/ (sqrt (- d)) (sqrt (- l))) (sqrt (/ d h)))
(if (<= l -2e-310)
(* (/ d (sqrt (* l h))) (+ t_0 -1.0))
(* (- 1.0 t_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 = 0.5 * ((h / l) * pow(((M_m / 2.0) * (D / d)), 2.0));
double tmp;
if (l <= -1.65e+164) {
tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h));
} else if (l <= -2e-310) {
tmp = (d / sqrt((l * h))) * (t_0 + -1.0);
} else {
tmp = (1.0 - t_0) * (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 = 0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_1 / d)) ** 2.0d0))
if (l <= (-1.65d+164)) then
tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h))
else if (l <= (-2d-310)) then
tmp = (d / sqrt((l * h))) * (t_0 + (-1.0d0))
else
tmp = (1.0d0 - t_0) * (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 = 0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D / d)), 2.0));
double tmp;
if (l <= -1.65e+164) {
tmp = (Math.sqrt(-d) / Math.sqrt(-l)) * Math.sqrt((d / h));
} else if (l <= -2e-310) {
tmp = (d / Math.sqrt((l * h))) * (t_0 + -1.0);
} else {
tmp = (1.0 - t_0) * (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 = 0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D / d)), 2.0)) tmp = 0 if l <= -1.65e+164: tmp = (math.sqrt(-d) / math.sqrt(-l)) * math.sqrt((d / h)) elif l <= -2e-310: tmp = (d / math.sqrt((l * h))) * (t_0 + -1.0) else: tmp = (1.0 - t_0) * (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(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0))) tmp = 0.0 if (l <= -1.65e+164) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * sqrt(Float64(d / h))); elseif (l <= -2e-310) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(t_0 + -1.0)); else tmp = Float64(Float64(1.0 - t_0) * 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 = 0.5 * ((h / l) * (((M_m / 2.0) * (D / d)) ^ 2.0));
tmp = 0.0;
if (l <= -1.65e+164)
tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h));
elseif (l <= -2e-310)
tmp = (d / sqrt((l * h))) * (t_0 + -1.0);
else
tmp = (1.0 - t_0) * (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[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.65e+164], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-310], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$0), $MachinePrecision] * N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right)\\
\mathbf{if}\;\ell \leq -1.65 \cdot 10^{+164}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(t\_0 + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\_0\right) \cdot \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -1.64999999999999998e164Initial program 51.6%
Simplified51.3%
frac-2neg54.2%
sqrt-div66.4%
Applied egg-rr53.9%
Taylor expanded in d around inf 57.6%
if -1.64999999999999998e164 < l < -1.999999999999994e-310Initial program 74.5%
Simplified74.5%
sqrt-unprod65.0%
pow1/265.0%
frac-times50.4%
pow250.4%
Applied egg-rr50.4%
unpow1/250.4%
*-commutative50.4%
Simplified50.4%
sqrt-div52.4%
*-commutative52.4%
Applied egg-rr52.4%
unpow252.4%
sqr-neg52.4%
rem-sqrt-square82.0%
rem-square-sqrt81.8%
fabs-sqr81.8%
rem-square-sqrt82.0%
Simplified82.0%
if -1.999999999999994e-310 < l Initial program 67.0%
Simplified66.2%
*-commutative66.2%
sqrt-div70.8%
sqrt-div76.3%
frac-times76.3%
add-sqr-sqrt76.4%
Applied egg-rr76.4%
Final simplification76.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 (<= l -5.2e+159)
(* (/ (sqrt (- d)) (sqrt (- l))) (sqrt (/ d h)))
(if (<= l -2e-310)
(*
(/ d (sqrt (* l h)))
(+ (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D d)) 2.0))) -1.0))
(*
(+ 1.0 (* (pow (* (* D M_m) (/ 0.5 d)) 2.0) (* (/ h l) -0.5)))
(/ (/ d (sqrt h)) (sqrt 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 (l <= -5.2e+159) {
tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h));
} else if (l <= -2e-310) {
tmp = (d / sqrt((l * h))) * ((0.5 * ((h / l) * pow(((M_m / 2.0) * (D / d)), 2.0))) + -1.0);
} else {
tmp = (1.0 + (pow(((D * M_m) * (0.5 / d)), 2.0) * ((h / l) * -0.5))) * ((d / sqrt(h)) / sqrt(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 (l <= (-5.2d+159)) then
tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h))
else if (l <= (-2d-310)) then
tmp = (d / sqrt((l * h))) * ((0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_1 / d)) ** 2.0d0))) + (-1.0d0))
else
tmp = (1.0d0 + ((((d_1 * m_m) * (0.5d0 / d)) ** 2.0d0) * ((h / l) * (-0.5d0)))) * ((d / sqrt(h)) / sqrt(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 (l <= -5.2e+159) {
tmp = (Math.sqrt(-d) / Math.sqrt(-l)) * Math.sqrt((d / h));
} else if (l <= -2e-310) {
tmp = (d / Math.sqrt((l * h))) * ((0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D / d)), 2.0))) + -1.0);
} else {
tmp = (1.0 + (Math.pow(((D * M_m) * (0.5 / d)), 2.0) * ((h / l) * -0.5))) * ((d / Math.sqrt(h)) / Math.sqrt(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 l <= -5.2e+159: tmp = (math.sqrt(-d) / math.sqrt(-l)) * math.sqrt((d / h)) elif l <= -2e-310: tmp = (d / math.sqrt((l * h))) * ((0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D / d)), 2.0))) + -1.0) else: tmp = (1.0 + (math.pow(((D * M_m) * (0.5 / d)), 2.0) * ((h / l) * -0.5))) * ((d / math.sqrt(h)) / math.sqrt(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 (l <= -5.2e+159) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * sqrt(Float64(d / h))); elseif (l <= -2e-310) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0))) + -1.0)); else tmp = Float64(Float64(1.0 + Float64((Float64(Float64(D * M_m) * Float64(0.5 / d)) ^ 2.0) * Float64(Float64(h / l) * -0.5))) * Float64(Float64(d / sqrt(h)) / sqrt(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 (l <= -5.2e+159)
tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h));
elseif (l <= -2e-310)
tmp = (d / sqrt((l * h))) * ((0.5 * ((h / l) * (((M_m / 2.0) * (D / d)) ^ 2.0))) + -1.0);
else
tmp = (1.0 + ((((D * M_m) * (0.5 / d)) ^ 2.0) * ((h / l) * -0.5))) * ((d / sqrt(h)) / sqrt(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[l, -5.2e+159], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-310], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[Power[N[(N[(D * M$95$m), $MachinePrecision] * N[(0.5 / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[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}\;\ell \leq -5.2 \cdot 10^{+159}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + {\left(\left(D \cdot M\_m\right) \cdot \frac{0.5}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right) \cdot \frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -5.2000000000000001e159Initial program 51.6%
Simplified51.3%
frac-2neg54.2%
sqrt-div66.4%
Applied egg-rr53.9%
Taylor expanded in d around inf 57.6%
if -5.2000000000000001e159 < l < -1.999999999999994e-310Initial program 74.5%
Simplified74.5%
sqrt-unprod65.0%
pow1/265.0%
frac-times50.4%
pow250.4%
Applied egg-rr50.4%
unpow1/250.4%
*-commutative50.4%
Simplified50.4%
sqrt-div52.4%
*-commutative52.4%
Applied egg-rr52.4%
unpow252.4%
sqr-neg52.4%
rem-sqrt-square82.0%
rem-square-sqrt81.8%
fabs-sqr81.8%
rem-square-sqrt82.0%
Simplified82.0%
if -1.999999999999994e-310 < l Initial program 67.0%
Simplified66.2%
Applied egg-rr66.7%
distribute-rgt1-in76.4%
+-commutative76.4%
associate-*r*76.4%
associate-*r*76.4%
associate-/l*77.2%
*-commutative77.2%
associate-*r*77.2%
associate-/l*77.1%
associate-/l/75.5%
Simplified75.5%
Final simplification76.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
(if (<= d -6e-308)
(*
(/ d (sqrt (* l h)))
(+ (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D d)) 2.0))) -1.0))
(if (<= d 3.2e-181)
(* d (log (exp (- (pow (* l h) -0.5)))))
(if (<= d 5.5e+120)
(*
(sqrt (/ (* d d) (* l h)))
(- 1.0 (* 0.5 (/ (* h (pow (* M_m (* (/ D d) 0.5)) 2.0)) l))))
(* d (* (pow l -0.5) (pow h -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 (d <= -6e-308) {
tmp = (d / sqrt((l * h))) * ((0.5 * ((h / l) * pow(((M_m / 2.0) * (D / d)), 2.0))) + -1.0);
} else if (d <= 3.2e-181) {
tmp = d * log(exp(-pow((l * h), -0.5)));
} else if (d <= 5.5e+120) {
tmp = sqrt(((d * d) / (l * h))) * (1.0 - (0.5 * ((h * pow((M_m * ((D / d) * 0.5)), 2.0)) / l)));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -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 (d <= (-6d-308)) then
tmp = (d / sqrt((l * h))) * ((0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_1 / d)) ** 2.0d0))) + (-1.0d0))
else if (d <= 3.2d-181) then
tmp = d * log(exp(-((l * h) ** (-0.5d0))))
else if (d <= 5.5d+120) then
tmp = sqrt(((d * d) / (l * h))) * (1.0d0 - (0.5d0 * ((h * ((m_m * ((d_1 / d) * 0.5d0)) ** 2.0d0)) / l)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-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 (d <= -6e-308) {
tmp = (d / Math.sqrt((l * h))) * ((0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D / d)), 2.0))) + -1.0);
} else if (d <= 3.2e-181) {
tmp = d * Math.log(Math.exp(-Math.pow((l * h), -0.5)));
} else if (d <= 5.5e+120) {
tmp = Math.sqrt(((d * d) / (l * h))) * (1.0 - (0.5 * ((h * Math.pow((M_m * ((D / d) * 0.5)), 2.0)) / l)));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -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 d <= -6e-308: tmp = (d / math.sqrt((l * h))) * ((0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D / d)), 2.0))) + -1.0) elif d <= 3.2e-181: tmp = d * math.log(math.exp(-math.pow((l * h), -0.5))) elif d <= 5.5e+120: tmp = math.sqrt(((d * d) / (l * h))) * (1.0 - (0.5 * ((h * math.pow((M_m * ((D / d) * 0.5)), 2.0)) / l))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -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 (d <= -6e-308) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0))) + -1.0)); elseif (d <= 3.2e-181) tmp = Float64(d * log(exp(Float64(-(Float64(l * h) ^ -0.5))))); elseif (d <= 5.5e+120) tmp = Float64(sqrt(Float64(Float64(d * d) / Float64(l * h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(Float64(D / d) * 0.5)) ^ 2.0)) / l)))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -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 (d <= -6e-308)
tmp = (d / sqrt((l * h))) * ((0.5 * ((h / l) * (((M_m / 2.0) * (D / d)) ^ 2.0))) + -1.0);
elseif (d <= 3.2e-181)
tmp = d * log(exp(-((l * h) ^ -0.5)));
elseif (d <= 5.5e+120)
tmp = sqrt(((d * d) / (l * h))) * (1.0 - (0.5 * ((h * ((M_m * ((D / d) * 0.5)) ^ 2.0)) / l)));
else
tmp = d * ((l ^ -0.5) * (h ^ -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[d, -6e-308], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.2e-181], N[(d * N[Log[N[Exp[(-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.5e+120], N[(N[Sqrt[N[(N[(d * d), $MachinePrecision] / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(N[(D / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -6 \cdot 10^{-308}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right) + -1\right)\\
\mathbf{elif}\;d \leq 3.2 \cdot 10^{-181}:\\
\;\;\;\;d \cdot \log \left(e^{-{\left(\ell \cdot h\right)}^{-0.5}}\right)\\
\mathbf{elif}\;d \leq 5.5 \cdot 10^{+120}:\\
\;\;\;\;\sqrt{\frac{d \cdot d}{\ell \cdot h}} \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \left(\frac{D}{d} \cdot 0.5\right)\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -6.00000000000000044e-308Initial program 69.9%
Simplified69.8%
sqrt-unprod61.0%
pow1/261.0%
frac-times44.3%
pow244.3%
Applied egg-rr44.3%
unpow1/244.3%
*-commutative44.3%
Simplified44.3%
sqrt-div46.6%
*-commutative46.6%
Applied egg-rr46.6%
unpow246.6%
sqr-neg46.6%
rem-sqrt-square71.2%
rem-square-sqrt71.0%
fabs-sqr71.0%
rem-square-sqrt71.2%
Simplified71.2%
if -6.00000000000000044e-308 < d < 3.2000000000000002e-181Initial program 40.1%
Simplified37.0%
Taylor expanded in d around inf 12.9%
*-commutative12.9%
Simplified12.9%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt16.5%
unpow-116.5%
metadata-eval16.5%
pow-sqr16.5%
rem-sqrt-square16.5%
rem-square-sqrt16.5%
fabs-sqr16.5%
rem-square-sqrt16.5%
mul-1-neg16.5%
Simplified16.5%
add-log-exp43.9%
Applied egg-rr43.9%
if 3.2000000000000002e-181 < d < 5.50000000000000003e120Initial program 79.7%
Simplified78.0%
sqrt-unprod68.6%
pow1/268.6%
frac-times65.8%
pow265.8%
Applied egg-rr65.8%
unpow1/265.8%
*-commutative65.8%
Simplified65.8%
unpow265.8%
Applied egg-rr65.8%
associate-*r/70.9%
frac-times70.9%
associate-/l*70.9%
*-un-lft-identity70.9%
times-frac70.9%
metadata-eval70.9%
Applied egg-rr70.9%
if 5.50000000000000003e120 < d Initial program 68.5%
Simplified71.4%
Taylor expanded in d around inf 73.4%
*-commutative73.4%
Simplified73.4%
Taylor expanded in l around 0 73.4%
unpow-173.4%
metadata-eval73.4%
pow-sqr73.5%
rem-sqrt-square73.5%
rem-square-sqrt73.4%
fabs-sqr73.4%
rem-square-sqrt73.5%
Simplified73.5%
*-commutative73.5%
unpow-prod-down79.2%
Applied egg-rr79.2%
Final simplification68.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 -5.4e+158)
(* (/ (sqrt (- d)) (sqrt (- l))) (sqrt (/ d h)))
(if (<= l -3e-267)
(*
(/ d (sqrt (* l h)))
(+ (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D d)) 2.0))) -1.0))
(if (<= l 28500.0)
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* (/ D d) (* M_m 0.5)) 2.0))))
(* d (* (pow l -0.5) (pow h -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 <= -5.4e+158) {
tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h));
} else if (l <= -3e-267) {
tmp = (d / sqrt((l * h))) * ((0.5 * ((h / l) * pow(((M_m / 2.0) * (D / d)), 2.0))) + -1.0);
} else if (l <= 28500.0) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (((h / l) * -0.5) * pow(((D / d) * (M_m * 0.5)), 2.0)));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -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 <= (-5.4d+158)) then
tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h))
else if (l <= (-3d-267)) then
tmp = (d / sqrt((l * h))) * ((0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_1 / d)) ** 2.0d0))) + (-1.0d0))
else if (l <= 28500.0d0) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + (((h / l) * (-0.5d0)) * (((d_1 / d) * (m_m * 0.5d0)) ** 2.0d0)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-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 <= -5.4e+158) {
tmp = (Math.sqrt(-d) / Math.sqrt(-l)) * Math.sqrt((d / h));
} else if (l <= -3e-267) {
tmp = (d / Math.sqrt((l * h))) * ((0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D / d)), 2.0))) + -1.0);
} else if (l <= 28500.0) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (((h / l) * -0.5) * Math.pow(((D / d) * (M_m * 0.5)), 2.0)));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -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 <= -5.4e+158: tmp = (math.sqrt(-d) / math.sqrt(-l)) * math.sqrt((d / h)) elif l <= -3e-267: tmp = (d / math.sqrt((l * h))) * ((0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D / d)), 2.0))) + -1.0) elif l <= 28500.0: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (((h / l) * -0.5) * math.pow(((D / d) * (M_m * 0.5)), 2.0))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -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 <= -5.4e+158) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * sqrt(Float64(d / h))); elseif (l <= -3e-267) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0))) + -1.0)); elseif (l <= 28500.0) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0)))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -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 <= -5.4e+158)
tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h));
elseif (l <= -3e-267)
tmp = (d / sqrt((l * h))) * ((0.5 * ((h / l) * (((M_m / 2.0) * (D / d)) ^ 2.0))) + -1.0);
elseif (l <= 28500.0)
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (((h / l) * -0.5) * (((D / d) * (M_m * 0.5)) ^ 2.0)));
else
tmp = d * ((l ^ -0.5) * (h ^ -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, -5.4e+158], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -3e-267], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 28500.0], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.4 \cdot 10^{+158}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;\ell \leq -3 \cdot 10^{-267}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right) + -1\right)\\
\mathbf{elif}\;\ell \leq 28500:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -5.39999999999999957e158Initial program 51.6%
Simplified51.3%
frac-2neg54.2%
sqrt-div66.4%
Applied egg-rr53.9%
Taylor expanded in d around inf 57.6%
if -5.39999999999999957e158 < l < -3e-267Initial program 72.2%
Simplified72.2%
sqrt-unprod61.5%
pow1/261.5%
frac-times48.3%
pow248.3%
Applied egg-rr48.3%
unpow1/248.3%
*-commutative48.3%
Simplified48.3%
sqrt-div50.5%
*-commutative50.5%
Applied egg-rr50.5%
unpow250.5%
sqr-neg50.5%
rem-sqrt-square80.8%
rem-square-sqrt80.5%
fabs-sqr80.5%
rem-square-sqrt80.8%
Simplified80.8%
if -3e-267 < l < 28500Initial program 74.9%
Simplified72.6%
add-sqr-sqrt72.6%
pow272.6%
sqrt-prod72.6%
sqrt-pow172.7%
metadata-eval72.7%
frac-times75.0%
pow175.0%
associate-/l*72.7%
*-un-lft-identity72.7%
times-frac72.7%
metadata-eval72.7%
Applied egg-rr72.7%
pow172.7%
Applied egg-rr65.2%
unpow165.2%
associate-*r*65.2%
Simplified65.2%
if 28500 < l Initial program 59.1%
Simplified61.1%
Taylor expanded in d around inf 51.4%
*-commutative51.4%
Simplified51.4%
Taylor expanded in l around 0 51.4%
unpow-151.4%
metadata-eval51.4%
pow-sqr51.4%
rem-sqrt-square51.4%
rem-square-sqrt51.2%
fabs-sqr51.2%
rem-square-sqrt51.4%
Simplified51.4%
*-commutative51.4%
unpow-prod-down60.8%
Applied egg-rr60.8%
Final simplification68.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
(if (<= h -5.8e-209)
(*
(/ d (sqrt (* l h)))
(+ (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D d)) 2.0))) -1.0))
(if (<= h 1.3e+90)
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* (/ D d) (* M_m 0.5)) 2.0))))
(* d (* (pow l -0.5) (pow h -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 (h <= -5.8e-209) {
tmp = (d / sqrt((l * h))) * ((0.5 * ((h / l) * pow(((M_m / 2.0) * (D / d)), 2.0))) + -1.0);
} else if (h <= 1.3e+90) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (((h / l) * -0.5) * pow(((D / d) * (M_m * 0.5)), 2.0)));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -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 (h <= (-5.8d-209)) then
tmp = (d / sqrt((l * h))) * ((0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_1 / d)) ** 2.0d0))) + (-1.0d0))
else if (h <= 1.3d+90) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + (((h / l) * (-0.5d0)) * (((d_1 / d) * (m_m * 0.5d0)) ** 2.0d0)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-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 (h <= -5.8e-209) {
tmp = (d / Math.sqrt((l * h))) * ((0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D / d)), 2.0))) + -1.0);
} else if (h <= 1.3e+90) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (((h / l) * -0.5) * Math.pow(((D / d) * (M_m * 0.5)), 2.0)));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -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 h <= -5.8e-209: tmp = (d / math.sqrt((l * h))) * ((0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D / d)), 2.0))) + -1.0) elif h <= 1.3e+90: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (((h / l) * -0.5) * math.pow(((D / d) * (M_m * 0.5)), 2.0))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -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 (h <= -5.8e-209) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0))) + -1.0)); elseif (h <= 1.3e+90) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(Float64(D / d) * Float64(M_m * 0.5)) ^ 2.0)))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -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 (h <= -5.8e-209)
tmp = (d / sqrt((l * h))) * ((0.5 * ((h / l) * (((M_m / 2.0) * (D / d)) ^ 2.0))) + -1.0);
elseif (h <= 1.3e+90)
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (((h / l) * -0.5) * (((D / d) * (M_m * 0.5)) ^ 2.0)));
else
tmp = d * ((l ^ -0.5) * (h ^ -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[h, -5.8e-209], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 1.3e+90], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -5.8 \cdot 10^{-209}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right) + -1\right)\\
\mathbf{elif}\;h \leq 1.3 \cdot 10^{+90}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(\frac{D}{d} \cdot \left(M\_m \cdot 0.5\right)\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if h < -5.80000000000000052e-209Initial program 70.1%
Simplified70.0%
sqrt-unprod59.2%
pow1/259.2%
frac-times44.1%
pow244.1%
Applied egg-rr44.1%
unpow1/244.1%
*-commutative44.1%
Simplified44.1%
sqrt-div47.0%
*-commutative47.0%
Applied egg-rr47.0%
unpow247.0%
sqr-neg47.0%
rem-sqrt-square72.7%
rem-square-sqrt72.5%
fabs-sqr72.5%
rem-square-sqrt72.7%
Simplified72.7%
if -5.80000000000000052e-209 < h < 1.2999999999999999e90Initial program 77.3%
Simplified75.4%
add-sqr-sqrt75.4%
pow275.4%
sqrt-prod75.4%
sqrt-pow178.0%
metadata-eval78.0%
frac-times79.1%
pow179.1%
associate-/l*78.0%
*-un-lft-identity78.0%
times-frac78.0%
metadata-eval78.0%
Applied egg-rr78.0%
pow178.0%
Applied egg-rr66.7%
unpow166.7%
associate-*r*66.7%
Simplified66.7%
if 1.2999999999999999e90 < h Initial program 40.3%
Simplified42.6%
Taylor expanded in d around inf 45.5%
*-commutative45.5%
Simplified45.5%
Taylor expanded in l around 0 45.5%
unpow-145.5%
metadata-eval45.5%
pow-sqr45.6%
rem-sqrt-square45.6%
rem-square-sqrt45.5%
fabs-sqr45.5%
rem-square-sqrt45.6%
Simplified45.6%
*-commutative45.6%
unpow-prod-down54.5%
Applied egg-rr54.5%
Final simplification67.2%
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 -1.35e+161)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= l -2e-310)
(*
(/ d (sqrt (* l h)))
(+ (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D d)) 2.0))) -1.0))
(* d (* (pow l -0.5) (pow h -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 <= -1.35e+161) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (l <= -2e-310) {
tmp = (d / sqrt((l * h))) * ((0.5 * ((h / l) * pow(((M_m / 2.0) * (D / d)), 2.0))) + -1.0);
} else {
tmp = d * (pow(l, -0.5) * pow(h, -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 <= (-1.35d+161)) then
tmp = sqrt((d / h)) * sqrt((d / l))
else if (l <= (-2d-310)) then
tmp = (d / sqrt((l * h))) * ((0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_1 / d)) ** 2.0d0))) + (-1.0d0))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-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 <= -1.35e+161) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (l <= -2e-310) {
tmp = (d / Math.sqrt((l * h))) * ((0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D / d)), 2.0))) + -1.0);
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -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 <= -1.35e+161: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) elif l <= -2e-310: tmp = (d / math.sqrt((l * h))) * ((0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D / d)), 2.0))) + -1.0) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -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 <= -1.35e+161) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (l <= -2e-310) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0))) + -1.0)); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -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 <= -1.35e+161)
tmp = sqrt((d / h)) * sqrt((d / l));
elseif (l <= -2e-310)
tmp = (d / sqrt((l * h))) * ((0.5 * ((h / l) * (((M_m / 2.0) * (D / d)) ^ 2.0))) + -1.0);
else
tmp = d * ((l ^ -0.5) * (h ^ -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, -1.35e+161], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-310], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.35 \cdot 10^{+161}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2}\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -1.3499999999999999e161Initial program 51.6%
Simplified51.3%
frac-2neg51.3%
sqrt-div54.2%
Applied egg-rr54.2%
Taylor expanded in d around inf 49.0%
if -1.3499999999999999e161 < l < -1.999999999999994e-310Initial program 74.5%
Simplified74.5%
sqrt-unprod65.0%
pow1/265.0%
frac-times50.4%
pow250.4%
Applied egg-rr50.4%
unpow1/250.4%
*-commutative50.4%
Simplified50.4%
sqrt-div52.4%
*-commutative52.4%
Applied egg-rr52.4%
unpow252.4%
sqr-neg52.4%
rem-sqrt-square82.0%
rem-square-sqrt81.8%
fabs-sqr81.8%
rem-square-sqrt82.0%
Simplified82.0%
if -1.999999999999994e-310 < l Initial program 67.0%
Simplified66.2%
Taylor expanded in d around inf 43.2%
*-commutative43.2%
Simplified43.2%
Taylor expanded in l around 0 43.2%
unpow-143.2%
metadata-eval43.2%
pow-sqr43.2%
rem-sqrt-square43.2%
rem-square-sqrt43.1%
fabs-sqr43.1%
rem-square-sqrt43.2%
Simplified43.2%
*-commutative43.2%
unpow-prod-down47.9%
Applied egg-rr47.9%
Final simplification61.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 (<= l -1.05e-183)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= l -2e-310)
(* d (cbrt (pow (/ 1.0 (* l h)) 1.5)))
(* d (* (pow l -0.5) (pow h -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 <= -1.05e-183) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (l <= -2e-310) {
tmp = d * cbrt(pow((1.0 / (l * h)), 1.5));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
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 <= -1.05e-183) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (l <= -2e-310) {
tmp = d * Math.cbrt(Math.pow((1.0 / (l * h)), 1.5));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -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 <= -1.05e-183) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (l <= -2e-310) tmp = Float64(d * cbrt((Float64(1.0 / Float64(l * h)) ^ 1.5))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); 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[l, -1.05e-183], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-310], N[(d * N[Power[N[Power[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.05 \cdot 10^{-183}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt[3]{{\left(\frac{1}{\ell \cdot h}\right)}^{1.5}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -1.0500000000000001e-183Initial program 65.8%
Simplified65.6%
frac-2neg65.6%
sqrt-div71.8%
Applied egg-rr71.8%
Taylor expanded in d around inf 43.6%
if -1.0500000000000001e-183 < l < -1.999999999999994e-310Initial program 84.4%
Simplified84.4%
Taylor expanded in d around inf 45.3%
*-commutative45.3%
Simplified45.3%
add-cbrt-cube56.8%
pow1/356.8%
add-sqr-sqrt56.8%
pow156.8%
pow1/256.8%
pow-prod-up56.8%
associate-/r*56.8%
metadata-eval56.8%
Applied egg-rr56.8%
unpow1/356.8%
associate-/l/56.8%
Simplified56.8%
if -1.999999999999994e-310 < l Initial program 67.0%
Simplified66.2%
Taylor expanded in d around inf 43.2%
*-commutative43.2%
Simplified43.2%
Taylor expanded in l around 0 43.2%
unpow-143.2%
metadata-eval43.2%
pow-sqr43.2%
rem-sqrt-square43.2%
rem-square-sqrt43.1%
fabs-sqr43.1%
rem-square-sqrt43.2%
Simplified43.2%
*-commutative43.2%
unpow-prod-down47.9%
Applied egg-rr47.9%
Final simplification47.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
(if (<= l -5.6e-185)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= l 6.5e-284)
(* d (sqrt (/ (/ 1.0 l) h)))
(* d (* (pow l -0.5) (pow h -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 <= -5.6e-185) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (l <= 6.5e-284) {
tmp = d * sqrt(((1.0 / l) / h));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -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 <= (-5.6d-185)) then
tmp = sqrt((d / h)) * sqrt((d / l))
else if (l <= 6.5d-284) then
tmp = d * sqrt(((1.0d0 / l) / h))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-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 <= -5.6e-185) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (l <= 6.5e-284) {
tmp = d * Math.sqrt(((1.0 / l) / h));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -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 <= -5.6e-185: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) elif l <= 6.5e-284: tmp = d * math.sqrt(((1.0 / l) / h)) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -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 <= -5.6e-185) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (l <= 6.5e-284) tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -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 <= -5.6e-185)
tmp = sqrt((d / h)) * sqrt((d / l));
elseif (l <= 6.5e-284)
tmp = d * sqrt(((1.0 / l) / h));
else
tmp = d * ((l ^ -0.5) * (h ^ -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, -5.6e-185], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.5e-284], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.6 \cdot 10^{-185}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq 6.5 \cdot 10^{-284}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -5.59999999999999983e-185Initial program 65.8%
Simplified65.6%
frac-2neg65.6%
sqrt-div71.8%
Applied egg-rr71.8%
Taylor expanded in d around inf 43.6%
if -5.59999999999999983e-185 < l < 6.5000000000000003e-284Initial program 77.7%
Simplified77.7%
Taylor expanded in d around inf 46.2%
*-commutative46.2%
Simplified46.2%
Taylor expanded in l around 0 46.2%
associate-/l/46.3%
Simplified46.3%
if 6.5000000000000003e-284 < l Initial program 67.9%
Simplified67.1%
Taylor expanded in d around inf 42.9%
*-commutative42.9%
Simplified42.9%
Taylor expanded in l around 0 42.9%
unpow-142.9%
metadata-eval42.9%
pow-sqr42.8%
rem-sqrt-square42.8%
rem-square-sqrt42.7%
fabs-sqr42.7%
rem-square-sqrt42.8%
Simplified42.8%
*-commutative42.8%
unpow-prod-down47.8%
Applied egg-rr47.8%
Final simplification45.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 (if (<= M_m 9e-82) (* (sqrt (/ d h)) (sqrt (/ d l))) (* d (sqrt (/ 1.0 (+ -1.0 (fma h l 1.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 tmp;
if (M_m <= 9e-82) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = d * sqrt((1.0 / (-1.0 + fma(h, l, 1.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) tmp = 0.0 if (M_m <= 9e-82) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = Float64(d * sqrt(Float64(1.0 / Float64(-1.0 + fma(h, l, 1.0))))); 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[M$95$m, 9e-82], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(-1.0 + N[(h * l + 1.0), $MachinePrecision]), $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}\;M\_m \leq 9 \cdot 10^{-82}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{-1 + \mathsf{fma}\left(h, \ell, 1\right)}}\\
\end{array}
\end{array}
if M < 8.9999999999999997e-82Initial program 72.7%
Simplified73.2%
frac-2neg73.2%
sqrt-div39.7%
Applied egg-rr39.7%
Taylor expanded in d around inf 45.0%
if 8.9999999999999997e-82 < M Initial program 59.4%
Simplified59.4%
Taylor expanded in d around inf 21.4%
*-commutative21.4%
Simplified21.4%
expm1-log1p-u20.9%
expm1-undefine21.4%
*-commutative21.4%
Applied egg-rr21.4%
sub-neg21.4%
metadata-eval21.4%
+-commutative21.4%
log1p-undefine21.4%
rem-exp-log21.8%
+-commutative21.8%
fma-define21.8%
Simplified21.8%
Final simplification37.2%
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.3e-265) (* d (- (pow (* l h) -0.5))) (* d (* (pow l -0.5) (pow h -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 (d <= 1.3e-265) {
tmp = d * -pow((l * h), -0.5);
} else {
tmp = d * (pow(l, -0.5) * pow(h, -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 (d <= 1.3d-265) then
tmp = d * -((l * h) ** (-0.5d0))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-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 (d <= 1.3e-265) {
tmp = d * -Math.pow((l * h), -0.5);
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -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 d <= 1.3e-265: tmp = d * -math.pow((l * h), -0.5) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -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 (d <= 1.3e-265) tmp = Float64(d * Float64(-(Float64(l * h) ^ -0.5))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -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 (d <= 1.3e-265)
tmp = d * -((l * h) ^ -0.5);
else
tmp = d * ((l ^ -0.5) * (h ^ -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[d, 1.3e-265], N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.3 \cdot 10^{-265}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < 1.30000000000000005e-265Initial program 66.9%
Simplified66.2%
Taylor expanded in d around inf 12.9%
*-commutative12.9%
Simplified12.9%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt38.1%
unpow-138.1%
metadata-eval38.1%
pow-sqr38.2%
rem-sqrt-square38.2%
rem-square-sqrt38.0%
fabs-sqr38.0%
rem-square-sqrt38.2%
mul-1-neg38.2%
Simplified38.2%
if 1.30000000000000005e-265 < d Initial program 69.9%
Simplified69.9%
Taylor expanded in d around inf 46.3%
*-commutative46.3%
Simplified46.3%
Taylor expanded in l around 0 46.3%
unpow-146.3%
metadata-eval46.3%
pow-sqr46.3%
rem-sqrt-square46.3%
rem-square-sqrt46.2%
fabs-sqr46.2%
rem-square-sqrt46.3%
Simplified46.3%
*-commutative46.3%
unpow-prod-down51.3%
Applied egg-rr51.3%
Final simplification44.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 (if (<= l -1.25e-185) (* d (- (pow (* l h) -0.5))) (* d (sqrt (/ (/ 1.0 l) 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 <= -1.25e-185) {
tmp = d * -pow((l * h), -0.5);
} else {
tmp = d * sqrt(((1.0 / l) / 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 <= (-1.25d-185)) 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);
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 <= -1.25e-185) {
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, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -1.25e-185: tmp = d * -math.pow((l * h), -0.5) else: tmp = d * math.sqrt(((1.0 / l) / 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 <= -1.25e-185) 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, 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 <= -1.25e-185)
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] 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, -1.25e-185], 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, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.25 \cdot 10^{-185}:\\
\;\;\;\;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 < -1.2500000000000001e-185Initial program 65.8%
Simplified65.8%
Taylor expanded in d around inf 5.5%
*-commutative5.5%
Simplified5.5%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt42.3%
unpow-142.3%
metadata-eval42.3%
pow-sqr42.3%
rem-sqrt-square42.3%
rem-square-sqrt42.1%
fabs-sqr42.1%
rem-square-sqrt42.3%
mul-1-neg42.3%
Simplified42.3%
if -1.2500000000000001e-185 < l Initial program 70.0%
Simplified69.3%
Taylor expanded in d around inf 43.6%
*-commutative43.6%
Simplified43.6%
Taylor expanded in l around 0 43.6%
associate-/l/43.6%
Simplified43.6%
Final simplification43.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 (if (<= l -3e-185) (* d (- (pow (* l h) -0.5))) (* d (sqrt (/ 1.0 (* l 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 <= -3e-185) {
tmp = d * -pow((l * h), -0.5);
} else {
tmp = d * sqrt((1.0 / (l * 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 <= (-3d-185)) 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);
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 <= -3e-185) {
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, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if l <= -3e-185: tmp = d * -math.pow((l * h), -0.5) else: tmp = d * math.sqrt((1.0 / (l * 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 <= -3e-185) tmp = Float64(d * Float64(-(Float64(l * h) ^ -0.5))); else tmp = Float64(d * sqrt(Float64(1.0 / Float64(l * 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 <= -3e-185)
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] 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, -3e-185], N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(l * 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}\;\ell \leq -3 \cdot 10^{-185}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\end{array}
\end{array}
if l < -3.0000000000000003e-185Initial program 65.8%
Simplified65.8%
Taylor expanded in d around inf 5.5%
*-commutative5.5%
Simplified5.5%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt42.3%
unpow-142.3%
metadata-eval42.3%
pow-sqr42.3%
rem-sqrt-square42.3%
rem-square-sqrt42.1%
fabs-sqr42.1%
rem-square-sqrt42.3%
mul-1-neg42.3%
Simplified42.3%
if -3.0000000000000003e-185 < l Initial program 70.0%
Simplified69.3%
Taylor expanded in d around inf 43.6%
*-commutative43.6%
Simplified43.6%
Final simplification43.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 (* l h) -0.5))) (if (<= l -1.15e-232) (* 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((l * h), -0.5);
double tmp;
if (l <= -1.15e-232) {
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 = (l * h) ** (-0.5d0)
if (l <= (-1.15d-232)) 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((l * h), -0.5);
double tmp;
if (l <= -1.15e-232) {
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((l * h), -0.5) tmp = 0 if l <= -1.15e-232: 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(l * h) ^ -0.5 tmp = 0.0 if (l <= -1.15e-232) 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 = (l * h) ^ -0.5;
tmp = 0.0;
if (l <= -1.15e-232)
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[(l * h), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[l, -1.15e-232], 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(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -1.15 \cdot 10^{-232}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
\end{array}
if l < -1.15e-232Initial program 67.0%
Simplified67.0%
Taylor expanded in d around inf 8.5%
*-commutative8.5%
Simplified8.5%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt42.2%
unpow-142.2%
metadata-eval42.2%
pow-sqr42.2%
rem-sqrt-square42.2%
rem-square-sqrt42.0%
fabs-sqr42.0%
rem-square-sqrt42.2%
mul-1-neg42.2%
Simplified42.2%
if -1.15e-232 < l Initial program 69.2%
Simplified68.5%
Taylor expanded in d around inf 43.8%
*-commutative43.8%
Simplified43.8%
Taylor expanded in l around 0 43.8%
unpow-143.8%
metadata-eval43.8%
pow-sqr43.7%
rem-sqrt-square43.7%
rem-square-sqrt43.6%
fabs-sqr43.6%
rem-square-sqrt43.7%
Simplified43.7%
Final simplification43.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 (* d (pow (* l h) -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((l * h), -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 * ((l * h) ** (-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((l * h), -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((l * h), -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(l * h) ^ -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 * ((l * h) ^ -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[(l * h), $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(\ell \cdot h\right)}^{-0.5}
\end{array}
Initial program 68.2%
Simplified67.8%
Taylor expanded in d around inf 27.6%
*-commutative27.6%
Simplified27.6%
Taylor expanded in l around 0 27.6%
unpow-127.6%
metadata-eval27.6%
pow-sqr27.6%
rem-sqrt-square26.9%
rem-square-sqrt26.8%
fabs-sqr26.8%
rem-square-sqrt26.9%
Simplified26.9%
Final simplification26.9%
herbie shell --seed 2024113
(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)))))