
(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)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (/ D_m d) (* 0.5 M_m))))
(if (<= l -2e-310)
(*
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
(- 1.0 (* 0.5 (* h (* t_0 (/ t_0 l))))))
(*
(/ (sqrt d) (sqrt l))
(*
(/ (sqrt d) (sqrt h))
(+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M_m 2.0) d)) 2.0) -0.5))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (D_m / d) * (0.5 * M_m);
double tmp;
if (l <= -2e-310) {
tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * (1.0 - (0.5 * (h * (t_0 * (t_0 / l)))));
} else {
tmp = (sqrt(d) / sqrt(l)) * ((sqrt(d) / sqrt(h)) * (1.0 + ((h / l) * (pow((D_m * ((M_m / 2.0) / d)), 2.0) * -0.5))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = (d_m / d) * (0.5d0 * m_m)
if (l <= (-2d-310)) then
tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * (1.0d0 - (0.5d0 * (h * (t_0 * (t_0 / l)))))
else
tmp = (sqrt(d) / sqrt(l)) * ((sqrt(d) / sqrt(h)) * (1.0d0 + ((h / l) * (((d_m * ((m_m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (D_m / d) * (0.5 * M_m);
double tmp;
if (l <= -2e-310) {
tmp = ((Math.sqrt(-d) / Math.sqrt(-h)) * Math.sqrt((d / l))) * (1.0 - (0.5 * (h * (t_0 * (t_0 / l)))));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(l)) * ((Math.sqrt(d) / Math.sqrt(h)) * (1.0 + ((h / l) * (Math.pow((D_m * ((M_m / 2.0) / d)), 2.0) * -0.5))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = (D_m / d) * (0.5 * M_m) tmp = 0 if l <= -2e-310: tmp = ((math.sqrt(-d) / math.sqrt(-h)) * math.sqrt((d / l))) * (1.0 - (0.5 * (h * (t_0 * (t_0 / l))))) else: tmp = (math.sqrt(d) / math.sqrt(l)) * ((math.sqrt(d) / math.sqrt(h)) * (1.0 + ((h / l) * (math.pow((D_m * ((M_m / 2.0) / d)), 2.0) * -0.5)))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(D_m / d) * Float64(0.5 * M_m)) tmp = 0.0 if (l <= -2e-310) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_0 * Float64(t_0 / l)))))); else tmp = Float64(Float64(sqrt(d) / sqrt(l)) * Float64(Float64(sqrt(d) / sqrt(h)) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D_m * Float64(Float64(M_m / 2.0) / d)) ^ 2.0) * -0.5))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (D_m / d) * (0.5 * M_m);
tmp = 0.0;
if (l <= -2e-310)
tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * (1.0 - (0.5 * (h * (t_0 * (t_0 / l)))));
else
tmp = (sqrt(d) / sqrt(l)) * ((sqrt(d) / sqrt(h)) * (1.0 + ((h / l) * (((D_m * ((M_m / 2.0) / d)) ^ 2.0) * -0.5))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * M$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2e-310], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D$95$m * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{D\_m}{d} \cdot \left(0.5 \cdot M\_m\right)\\
\mathbf{if}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(D\_m \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2} \cdot -0.5\right)\right)\right)\\
\end{array}
\end{array}
if l < -1.999999999999994e-310Initial program 64.3%
Simplified62.0%
associate-*r/62.2%
frac-times64.4%
associate-/l*62.2%
*-commutative62.2%
Applied egg-rr62.2%
*-commutative62.2%
associate-/l*63.0%
associate-*r/65.3%
*-commutative65.3%
times-frac63.0%
Simplified63.0%
add-sqr-sqrt22.1%
sqrt-div0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
frac-times0.0%
*-commutative0.0%
associate-*r/0.0%
sqrt-div0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
frac-times0.0%
*-commutative0.0%
associate-*r/0.0%
Applied egg-rr65.4%
frac-2neg65.4%
sqrt-div76.9%
Applied egg-rr76.9%
if -1.999999999999994e-310 < l Initial program 63.1%
Simplified63.1%
sqrt-div65.7%
Applied egg-rr65.7%
sqrt-div77.6%
Applied egg-rr77.6%
Final simplification77.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (/ D_m d) (* 0.5 M_m))))
(if (<= l -2e-310)
(*
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
(- 1.0 (* 0.5 (* h (* t_0 (/ t_0 l))))))
(*
d
(/
(fma (* (/ h l) -0.5) (pow (* (/ D_m d) (/ M_m 2.0)) 2.0) 1.0)
(* (sqrt l) (sqrt h)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (D_m / d) * (0.5 * M_m);
double tmp;
if (l <= -2e-310) {
tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * (1.0 - (0.5 * (h * (t_0 * (t_0 / l)))));
} else {
tmp = d * (fma(((h / l) * -0.5), pow(((D_m / d) * (M_m / 2.0)), 2.0), 1.0) / (sqrt(l) * sqrt(h)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(D_m / d) * Float64(0.5 * M_m)) tmp = 0.0 if (l <= -2e-310) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_0 * Float64(t_0 / l)))))); else tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(D_m / d) * Float64(M_m / 2.0)) ^ 2.0), 1.0) / Float64(sqrt(l) * sqrt(h)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * M$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2e-310], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M$95$m / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $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_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{D\_m}{d} \cdot \left(0.5 \cdot M\_m\right)\\
\mathbf{if}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{D\_m}{d} \cdot \frac{M\_m}{2}\right)}^{2}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -1.999999999999994e-310Initial program 64.3%
Simplified62.0%
associate-*r/62.2%
frac-times64.4%
associate-/l*62.2%
*-commutative62.2%
Applied egg-rr62.2%
*-commutative62.2%
associate-/l*63.0%
associate-*r/65.3%
*-commutative65.3%
times-frac63.0%
Simplified63.0%
add-sqr-sqrt22.1%
sqrt-div0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
frac-times0.0%
*-commutative0.0%
associate-*r/0.0%
sqrt-div0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
frac-times0.0%
*-commutative0.0%
associate-*r/0.0%
Applied egg-rr65.4%
frac-2neg65.4%
sqrt-div76.9%
Applied egg-rr76.9%
if -1.999999999999994e-310 < l Initial program 63.1%
Simplified63.8%
Applied egg-rr75.2%
unpow175.2%
associate-*l/78.4%
associate-/l*77.6%
+-commutative77.6%
associate-*r*77.6%
fma-define77.6%
*-commutative77.6%
associate-*r/77.7%
*-commutative77.7%
times-frac77.6%
Simplified77.6%
Final simplification77.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (/ D_m d) (* 0.5 M_m)))
(t_1 (- 1.0 (* 0.5 (* h (* t_0 (/ t_0 l)))))))
(if (<= h -5e-311)
(* t_1 (* (sqrt (/ d h)) (/ (sqrt (- d)) (sqrt (- l)))))
(if (<= h 2.6e+74)
(*
(/ d (* (sqrt l) (sqrt h)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D_m (/ (/ M_m d) 2.0)) 2.0))))
(* t_1 (* (sqrt (/ d l)) (/ (sqrt d) (sqrt h))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (D_m / d) * (0.5 * M_m);
double t_1 = 1.0 - (0.5 * (h * (t_0 * (t_0 / l))));
double tmp;
if (h <= -5e-311) {
tmp = t_1 * (sqrt((d / h)) * (sqrt(-d) / sqrt(-l)));
} else if (h <= 2.6e+74) {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + (((h / l) * -0.5) * pow((D_m * ((M_m / d) / 2.0)), 2.0)));
} else {
tmp = t_1 * (sqrt((d / l)) * (sqrt(d) / sqrt(h)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (d_m / d) * (0.5d0 * m_m)
t_1 = 1.0d0 - (0.5d0 * (h * (t_0 * (t_0 / l))))
if (h <= (-5d-311)) then
tmp = t_1 * (sqrt((d / h)) * (sqrt(-d) / sqrt(-l)))
else if (h <= 2.6d+74) then
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((d_m * ((m_m / d) / 2.0d0)) ** 2.0d0)))
else
tmp = t_1 * (sqrt((d / l)) * (sqrt(d) / sqrt(h)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (D_m / d) * (0.5 * M_m);
double t_1 = 1.0 - (0.5 * (h * (t_0 * (t_0 / l))));
double tmp;
if (h <= -5e-311) {
tmp = t_1 * (Math.sqrt((d / h)) * (Math.sqrt(-d) / Math.sqrt(-l)));
} else if (h <= 2.6e+74) {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 + (((h / l) * -0.5) * Math.pow((D_m * ((M_m / d) / 2.0)), 2.0)));
} else {
tmp = t_1 * (Math.sqrt((d / l)) * (Math.sqrt(d) / Math.sqrt(h)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = (D_m / d) * (0.5 * M_m) t_1 = 1.0 - (0.5 * (h * (t_0 * (t_0 / l)))) tmp = 0 if h <= -5e-311: tmp = t_1 * (math.sqrt((d / h)) * (math.sqrt(-d) / math.sqrt(-l))) elif h <= 2.6e+74: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 + (((h / l) * -0.5) * math.pow((D_m * ((M_m / d) / 2.0)), 2.0))) else: tmp = t_1 * (math.sqrt((d / l)) * (math.sqrt(d) / math.sqrt(h))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(D_m / d) * Float64(0.5 * M_m)) t_1 = Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_0 * Float64(t_0 / l))))) tmp = 0.0 if (h <= -5e-311) tmp = Float64(t_1 * Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))))); elseif (h <= 2.6e+74) tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(Float64(M_m / d) / 2.0)) ^ 2.0)))); else tmp = Float64(t_1 * Float64(sqrt(Float64(d / l)) * Float64(sqrt(d) / sqrt(h)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (D_m / d) * (0.5 * M_m);
t_1 = 1.0 - (0.5 * (h * (t_0 * (t_0 / l))));
tmp = 0.0;
if (h <= -5e-311)
tmp = t_1 * (sqrt((d / h)) * (sqrt(-d) / sqrt(-l)));
elseif (h <= 2.6e+74)
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + (((h / l) * -0.5) * ((D_m * ((M_m / d) / 2.0)) ^ 2.0)));
else
tmp = t_1 * (sqrt((d / l)) * (sqrt(d) / sqrt(h)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * M$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(0.5 * N[(h * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -5e-311], N[(t$95$1 * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.6e+74], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(N[(M$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{D\_m}{d} \cdot \left(0.5 \cdot M\_m\right)\\
t_1 := 1 - 0.5 \cdot \left(h \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\\
\mathbf{if}\;h \leq -5 \cdot 10^{-311}:\\
\;\;\;\;t\_1 \cdot \left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)\\
\mathbf{elif}\;h \leq 2.6 \cdot 10^{+74}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{d}}{2}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\end{array}
\end{array}
if h < -5.00000000000023e-311Initial program 64.3%
Simplified62.0%
associate-*r/62.2%
frac-times64.4%
associate-/l*62.2%
*-commutative62.2%
Applied egg-rr62.2%
*-commutative62.2%
associate-/l*63.0%
associate-*r/65.3%
*-commutative65.3%
times-frac63.0%
Simplified63.0%
add-sqr-sqrt22.1%
sqrt-div0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
frac-times0.0%
*-commutative0.0%
associate-*r/0.0%
sqrt-div0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
frac-times0.0%
*-commutative0.0%
associate-*r/0.0%
Applied egg-rr65.4%
frac-2neg65.4%
sqrt-div72.8%
Applied egg-rr72.8%
if -5.00000000000023e-311 < h < 2.6000000000000001e74Initial program 66.7%
Simplified67.9%
Applied egg-rr83.7%
unpow183.7%
associate-*r*83.7%
*-commutative83.7%
associate-*r/82.5%
*-commutative82.5%
associate-*r/81.3%
associate-*r*81.3%
associate-*r*81.3%
associate-/r*81.3%
Simplified81.3%
if 2.6000000000000001e74 < h Initial program 57.2%
Simplified57.1%
associate-*r/63.4%
frac-times63.4%
associate-/l*63.4%
*-commutative63.4%
Applied egg-rr63.4%
*-commutative63.4%
associate-/l*65.3%
associate-*r/65.4%
*-commutative65.4%
times-frac65.3%
Simplified65.3%
add-sqr-sqrt65.4%
sqrt-div65.4%
sqrt-pow142.9%
metadata-eval42.9%
pow142.9%
*-commutative42.9%
frac-times42.9%
*-commutative42.9%
associate-*r/42.9%
sqrt-div42.9%
sqrt-pow167.3%
metadata-eval67.3%
pow167.3%
*-commutative67.3%
frac-times67.3%
*-commutative67.3%
associate-*r/67.3%
Applied egg-rr67.3%
sqrt-div71.9%
Applied egg-rr71.5%
Final simplification75.2%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1 (* (/ D_m d) (* 0.5 M_m)))
(t_2 (- 1.0 (* 0.5 (* h (* t_1 (/ t_1 l)))))))
(if (<= h -5e-311)
(* (* (/ (sqrt (- d)) (sqrt (- h))) t_0) t_2)
(if (<= h 4e+72)
(*
(/ d (* (sqrt l) (sqrt h)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D_m (/ (/ M_m d) 2.0)) 2.0))))
(* t_2 (* t_0 (/ (sqrt d) (sqrt h))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((d / l));
double t_1 = (D_m / d) * (0.5 * M_m);
double t_2 = 1.0 - (0.5 * (h * (t_1 * (t_1 / l))));
double tmp;
if (h <= -5e-311) {
tmp = ((sqrt(-d) / sqrt(-h)) * t_0) * t_2;
} else if (h <= 4e+72) {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + (((h / l) * -0.5) * pow((D_m * ((M_m / d) / 2.0)), 2.0)));
} else {
tmp = t_2 * (t_0 * (sqrt(d) / sqrt(h)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = (d_m / d) * (0.5d0 * m_m)
t_2 = 1.0d0 - (0.5d0 * (h * (t_1 * (t_1 / l))))
if (h <= (-5d-311)) then
tmp = ((sqrt(-d) / sqrt(-h)) * t_0) * t_2
else if (h <= 4d+72) then
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((d_m * ((m_m / d) / 2.0d0)) ** 2.0d0)))
else
tmp = t_2 * (t_0 * (sqrt(d) / sqrt(h)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt((d / l));
double t_1 = (D_m / d) * (0.5 * M_m);
double t_2 = 1.0 - (0.5 * (h * (t_1 * (t_1 / l))));
double tmp;
if (h <= -5e-311) {
tmp = ((Math.sqrt(-d) / Math.sqrt(-h)) * t_0) * t_2;
} else if (h <= 4e+72) {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 + (((h / l) * -0.5) * Math.pow((D_m * ((M_m / d) / 2.0)), 2.0)));
} else {
tmp = t_2 * (t_0 * (Math.sqrt(d) / Math.sqrt(h)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt((d / l)) t_1 = (D_m / d) * (0.5 * M_m) t_2 = 1.0 - (0.5 * (h * (t_1 * (t_1 / l)))) tmp = 0 if h <= -5e-311: tmp = ((math.sqrt(-d) / math.sqrt(-h)) * t_0) * t_2 elif h <= 4e+72: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 + (((h / l) * -0.5) * math.pow((D_m * ((M_m / d) / 2.0)), 2.0))) else: tmp = t_2 * (t_0 * (math.sqrt(d) / math.sqrt(h))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(d / l)) t_1 = Float64(Float64(D_m / d) * Float64(0.5 * M_m)) t_2 = Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_1 * Float64(t_1 / l))))) tmp = 0.0 if (h <= -5e-311) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0) * t_2); elseif (h <= 4e+72) tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(Float64(M_m / d) / 2.0)) ^ 2.0)))); else tmp = Float64(t_2 * Float64(t_0 * Float64(sqrt(d) / sqrt(h)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt((d / l));
t_1 = (D_m / d) * (0.5 * M_m);
t_2 = 1.0 - (0.5 * (h * (t_1 * (t_1 / l))));
tmp = 0.0;
if (h <= -5e-311)
tmp = ((sqrt(-d) / sqrt(-h)) * t_0) * t_2;
elseif (h <= 4e+72)
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + (((h / l) * -0.5) * ((D_m * ((M_m / d) / 2.0)) ^ 2.0)));
else
tmp = t_2 * (t_0 * (sqrt(d) / sqrt(h)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * M$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(0.5 * N[(h * N[(t$95$1 * N[(t$95$1 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -5e-311], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[h, 4e+72], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(N[(M$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \frac{D\_m}{d} \cdot \left(0.5 \cdot M\_m\right)\\
t_2 := 1 - 0.5 \cdot \left(h \cdot \left(t\_1 \cdot \frac{t\_1}{\ell}\right)\right)\\
\mathbf{if}\;h \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_0\right) \cdot t\_2\\
\mathbf{elif}\;h \leq 4 \cdot 10^{+72}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{d}}{2}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \left(t\_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\end{array}
\end{array}
if h < -5.00000000000023e-311Initial program 64.3%
Simplified62.0%
associate-*r/62.2%
frac-times64.4%
associate-/l*62.2%
*-commutative62.2%
Applied egg-rr62.2%
*-commutative62.2%
associate-/l*63.0%
associate-*r/65.3%
*-commutative65.3%
times-frac63.0%
Simplified63.0%
add-sqr-sqrt22.1%
sqrt-div0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
frac-times0.0%
*-commutative0.0%
associate-*r/0.0%
sqrt-div0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
frac-times0.0%
*-commutative0.0%
associate-*r/0.0%
Applied egg-rr65.4%
frac-2neg65.4%
sqrt-div76.9%
Applied egg-rr76.9%
if -5.00000000000023e-311 < h < 3.99999999999999978e72Initial program 66.7%
Simplified67.9%
Applied egg-rr83.7%
unpow183.7%
associate-*r*83.7%
*-commutative83.7%
associate-*r/82.5%
*-commutative82.5%
associate-*r/81.3%
associate-*r*81.3%
associate-*r*81.3%
associate-/r*81.3%
Simplified81.3%
if 3.99999999999999978e72 < h Initial program 57.2%
Simplified57.1%
associate-*r/63.4%
frac-times63.4%
associate-/l*63.4%
*-commutative63.4%
Applied egg-rr63.4%
*-commutative63.4%
associate-/l*65.3%
associate-*r/65.4%
*-commutative65.4%
times-frac65.3%
Simplified65.3%
add-sqr-sqrt65.4%
sqrt-div65.4%
sqrt-pow142.9%
metadata-eval42.9%
pow142.9%
*-commutative42.9%
frac-times42.9%
*-commutative42.9%
associate-*r/42.9%
sqrt-div42.9%
sqrt-pow167.3%
metadata-eval67.3%
pow167.3%
*-commutative67.3%
frac-times67.3%
*-commutative67.3%
associate-*r/67.3%
Applied egg-rr67.3%
sqrt-div71.9%
Applied egg-rr71.5%
Final simplification77.2%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (/ D_m d) (* 0.5 M_m))))
(if (<= l 2.5e-90)
(*
(- 1.0 (* 0.5 (* h (* t_0 (/ t_0 l)))))
(* (sqrt (/ d h)) (/ 1.0 (sqrt (/ l d)))))
(*
(/ d (* (sqrt l) (sqrt h)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D_m (/ (/ M_m d) 2.0)) 2.0)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (D_m / d) * (0.5 * M_m);
double tmp;
if (l <= 2.5e-90) {
tmp = (1.0 - (0.5 * (h * (t_0 * (t_0 / l))))) * (sqrt((d / h)) * (1.0 / sqrt((l / d))));
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + (((h / l) * -0.5) * pow((D_m * ((M_m / d) / 2.0)), 2.0)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = (d_m / d) * (0.5d0 * m_m)
if (l <= 2.5d-90) then
tmp = (1.0d0 - (0.5d0 * (h * (t_0 * (t_0 / l))))) * (sqrt((d / h)) * (1.0d0 / sqrt((l / d))))
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((d_m * ((m_m / d) / 2.0d0)) ** 2.0d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (D_m / d) * (0.5 * M_m);
double tmp;
if (l <= 2.5e-90) {
tmp = (1.0 - (0.5 * (h * (t_0 * (t_0 / l))))) * (Math.sqrt((d / h)) * (1.0 / Math.sqrt((l / d))));
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 + (((h / l) * -0.5) * Math.pow((D_m * ((M_m / d) / 2.0)), 2.0)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = (D_m / d) * (0.5 * M_m) tmp = 0 if l <= 2.5e-90: tmp = (1.0 - (0.5 * (h * (t_0 * (t_0 / l))))) * (math.sqrt((d / h)) * (1.0 / math.sqrt((l / d)))) else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 + (((h / l) * -0.5) * math.pow((D_m * ((M_m / d) / 2.0)), 2.0))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(D_m / d) * Float64(0.5 * M_m)) tmp = 0.0 if (l <= 2.5e-90) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_0 * Float64(t_0 / l))))) * Float64(sqrt(Float64(d / h)) * Float64(1.0 / sqrt(Float64(l / d))))); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(Float64(M_m / d) / 2.0)) ^ 2.0)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (D_m / d) * (0.5 * M_m);
tmp = 0.0;
if (l <= 2.5e-90)
tmp = (1.0 - (0.5 * (h * (t_0 * (t_0 / l))))) * (sqrt((d / h)) * (1.0 / sqrt((l / d))));
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + (((h / l) * -0.5) * ((D_m * ((M_m / d) / 2.0)) ^ 2.0)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * M$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 2.5e-90], N[(N[(1.0 - N[(0.5 * N[(h * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(N[(M$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{D\_m}{d} \cdot \left(0.5 \cdot M\_m\right)\\
\mathbf{if}\;\ell \leq 2.5 \cdot 10^{-90}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(h \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot \frac{1}{\sqrt{\frac{\ell}{d}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{d}}{2}\right)}^{2}\right)\\
\end{array}
\end{array}
if l < 2.5000000000000001e-90Initial program 68.0%
Simplified66.4%
associate-*r/68.8%
frac-times70.4%
associate-/l*68.8%
*-commutative68.8%
Applied egg-rr68.8%
*-commutative68.8%
associate-/l*69.4%
associate-*r/71.0%
*-commutative71.0%
times-frac69.4%
Simplified69.4%
add-sqr-sqrt39.9%
sqrt-div23.9%
sqrt-pow116.0%
metadata-eval16.0%
pow116.0%
*-commutative16.0%
frac-times16.0%
*-commutative16.0%
associate-*r/16.0%
sqrt-div16.0%
sqrt-pow124.5%
metadata-eval24.5%
pow124.5%
*-commutative24.5%
frac-times24.5%
*-commutative24.5%
associate-*r/24.5%
Applied egg-rr71.7%
clear-num71.7%
sqrt-div71.7%
metadata-eval71.7%
Applied egg-rr71.7%
if 2.5000000000000001e-90 < l Initial program 54.1%
Simplified55.2%
Applied egg-rr69.9%
unpow169.9%
associate-*r*69.9%
*-commutative69.9%
associate-*r/68.8%
*-commutative68.8%
associate-*r/68.8%
associate-*r*68.8%
associate-*r*68.8%
associate-/r*68.8%
Simplified68.8%
Final simplification70.8%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (* l h))))
(if (<= l -5.2e+138)
(/ d (- t_0))
(if (<= l 1.65e-307)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(-
1.0
(*
0.5
(*
h
(* (* (/ D_m d) (* 0.5 M_m)) (* D_m (* 0.5 (/ M_m (* l d)))))))))
(*
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D_m (/ (/ M_m d) 2.0)) 2.0)))
(/ d t_0))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((l * h));
double tmp;
if (l <= -5.2e+138) {
tmp = d / -t_0;
} else if (l <= 1.65e-307) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * (h * (((D_m / d) * (0.5 * M_m)) * (D_m * (0.5 * (M_m / (l * d))))))));
} else {
tmp = (1.0 + (((h / l) * -0.5) * pow((D_m * ((M_m / d) / 2.0)), 2.0))) * (d / t_0);
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((l * h))
if (l <= (-5.2d+138)) then
tmp = d / -t_0
else if (l <= 1.65d-307) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - (0.5d0 * (h * (((d_m / d) * (0.5d0 * m_m)) * (d_m * (0.5d0 * (m_m / (l * d))))))))
else
tmp = (1.0d0 + (((h / l) * (-0.5d0)) * ((d_m * ((m_m / d) / 2.0d0)) ** 2.0d0))) * (d / t_0)
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt((l * h));
double tmp;
if (l <= -5.2e+138) {
tmp = d / -t_0;
} else if (l <= 1.65e-307) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - (0.5 * (h * (((D_m / d) * (0.5 * M_m)) * (D_m * (0.5 * (M_m / (l * d))))))));
} else {
tmp = (1.0 + (((h / l) * -0.5) * Math.pow((D_m * ((M_m / d) / 2.0)), 2.0))) * (d / t_0);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt((l * h)) tmp = 0 if l <= -5.2e+138: tmp = d / -t_0 elif l <= 1.65e-307: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - (0.5 * (h * (((D_m / d) * (0.5 * M_m)) * (D_m * (0.5 * (M_m / (l * d)))))))) else: tmp = (1.0 + (((h / l) * -0.5) * math.pow((D_m * ((M_m / d) / 2.0)), 2.0))) * (d / t_0) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(l * h)) tmp = 0.0 if (l <= -5.2e+138) tmp = Float64(d / Float64(-t_0)); elseif (l <= 1.65e-307) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(0.5 * Float64(h * Float64(Float64(Float64(D_m / d) * Float64(0.5 * M_m)) * Float64(D_m * Float64(0.5 * Float64(M_m / Float64(l * d))))))))); else tmp = Float64(Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(Float64(M_m / d) / 2.0)) ^ 2.0))) * Float64(d / t_0)); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt((l * h));
tmp = 0.0;
if (l <= -5.2e+138)
tmp = d / -t_0;
elseif (l <= 1.65e-307)
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * (h * (((D_m / d) * (0.5 * M_m)) * (D_m * (0.5 * (M_m / (l * d))))))));
else
tmp = (1.0 + (((h / l) * -0.5) * ((D_m * ((M_m / d) / 2.0)) ^ 2.0))) * (d / t_0);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -5.2e+138], N[(d / (-t$95$0)), $MachinePrecision], If[LessEqual[l, 1.65e-307], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * M$95$m), $MachinePrecision]), $MachinePrecision] * N[(D$95$m * N[(0.5 * N[(M$95$m / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(N[(M$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;\ell \leq -5.2 \cdot 10^{+138}:\\
\;\;\;\;\frac{d}{-t\_0}\\
\mathbf{elif}\;\ell \leq 1.65 \cdot 10^{-307}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \left(\left(\frac{D\_m}{d} \cdot \left(0.5 \cdot M\_m\right)\right) \cdot \left(D\_m \cdot \left(0.5 \cdot \frac{M\_m}{\ell \cdot d}\right)\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{d}}{2}\right)}^{2}\right) \cdot \frac{d}{t\_0}\\
\end{array}
\end{array}
if l < -5.2000000000000002e138Initial program 44.9%
Simplified44.5%
associate-*r/37.2%
frac-times37.2%
associate-/l*37.2%
*-commutative37.2%
Applied egg-rr37.2%
*-commutative37.2%
associate-/l*44.6%
associate-*r/45.0%
*-commutative45.0%
times-frac44.6%
Simplified44.6%
add-sqr-sqrt20.7%
sqrt-div0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
frac-times0.0%
*-commutative0.0%
associate-*r/0.0%
sqrt-div0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
frac-times0.0%
*-commutative0.0%
associate-*r/0.0%
Applied egg-rr48.5%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt59.0%
mul-1-neg59.0%
distribute-lft-neg-in59.0%
rem-exp-log56.3%
exp-neg56.3%
unpow1/256.3%
exp-prod56.3%
distribute-lft-neg-out56.3%
exp-neg56.3%
exp-to-pow59.0%
unpow1/259.0%
associate-/l*59.1%
associate-*l/59.1%
*-rgt-identity59.1%
distribute-neg-frac259.1%
Simplified59.1%
if -5.2000000000000002e138 < l < 1.65e-307Initial program 69.2%
Simplified66.5%
associate-*r/68.6%
frac-times71.4%
associate-/l*68.6%
*-commutative68.6%
Applied egg-rr68.6%
*-commutative68.6%
associate-/l*67.8%
associate-*r/70.5%
*-commutative70.5%
times-frac67.8%
Simplified67.8%
add-sqr-sqrt22.5%
sqrt-div0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
frac-times0.0%
*-commutative0.0%
associate-*r/0.0%
sqrt-div0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
frac-times0.0%
*-commutative0.0%
associate-*r/0.0%
Applied egg-rr69.7%
Taylor expanded in D around 0 67.8%
*-commutative67.8%
associate-/l*65.9%
associate-*l*65.9%
Simplified65.9%
if 1.65e-307 < l Initial program 63.1%
Simplified63.8%
Applied egg-rr75.2%
unpow175.2%
associate-*r*75.2%
*-commutative75.2%
associate-*r/74.5%
*-commutative74.5%
associate-*r/73.7%
associate-*r*73.7%
associate-*r*73.7%
associate-/r*73.7%
Simplified73.7%
Taylor expanded in h around 0 63.2%
Final simplification63.8%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (* l h))))
(if (<= l -3.7e+80)
(/ d (- t_0))
(if (<= l 1.2e-69)
(*
(sqrt (* (/ d l) (/ d h)))
(- 1.0 (* 0.5 (* h (/ (pow (* (/ D_m d) (* 0.5 M_m)) 2.0) l)))))
(*
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D_m (/ (/ M_m d) 2.0)) 2.0)))
(/ d t_0))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((l * h));
double tmp;
if (l <= -3.7e+80) {
tmp = d / -t_0;
} else if (l <= 1.2e-69) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 - (0.5 * (h * (pow(((D_m / d) * (0.5 * M_m)), 2.0) / l))));
} else {
tmp = (1.0 + (((h / l) * -0.5) * pow((D_m * ((M_m / d) / 2.0)), 2.0))) * (d / t_0);
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((l * h))
if (l <= (-3.7d+80)) then
tmp = d / -t_0
else if (l <= 1.2d-69) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - (0.5d0 * (h * ((((d_m / d) * (0.5d0 * m_m)) ** 2.0d0) / l))))
else
tmp = (1.0d0 + (((h / l) * (-0.5d0)) * ((d_m * ((m_m / d) / 2.0d0)) ** 2.0d0))) * (d / t_0)
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt((l * h));
double tmp;
if (l <= -3.7e+80) {
tmp = d / -t_0;
} else if (l <= 1.2e-69) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - (0.5 * (h * (Math.pow(((D_m / d) * (0.5 * M_m)), 2.0) / l))));
} else {
tmp = (1.0 + (((h / l) * -0.5) * Math.pow((D_m * ((M_m / d) / 2.0)), 2.0))) * (d / t_0);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt((l * h)) tmp = 0 if l <= -3.7e+80: tmp = d / -t_0 elif l <= 1.2e-69: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - (0.5 * (h * (math.pow(((D_m / d) * (0.5 * M_m)), 2.0) / l)))) else: tmp = (1.0 + (((h / l) * -0.5) * math.pow((D_m * ((M_m / d) / 2.0)), 2.0))) * (d / t_0) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(l * h)) tmp = 0.0 if (l <= -3.7e+80) tmp = Float64(d / Float64(-t_0)); elseif (l <= 1.2e-69) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(Float64(D_m / d) * Float64(0.5 * M_m)) ^ 2.0) / l))))); else tmp = Float64(Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(Float64(M_m / d) / 2.0)) ^ 2.0))) * Float64(d / t_0)); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt((l * h));
tmp = 0.0;
if (l <= -3.7e+80)
tmp = d / -t_0;
elseif (l <= 1.2e-69)
tmp = sqrt(((d / l) * (d / h))) * (1.0 - (0.5 * (h * ((((D_m / d) * (0.5 * M_m)) ^ 2.0) / l))));
else
tmp = (1.0 + (((h / l) * -0.5) * ((D_m * ((M_m / d) / 2.0)) ^ 2.0))) * (d / t_0);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -3.7e+80], N[(d / (-t$95$0)), $MachinePrecision], If[LessEqual[l, 1.2e-69], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * M$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(N[(M$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;\ell \leq -3.7 \cdot 10^{+80}:\\
\;\;\;\;\frac{d}{-t\_0}\\
\mathbf{elif}\;\ell \leq 1.2 \cdot 10^{-69}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\frac{D\_m}{d} \cdot \left(0.5 \cdot M\_m\right)\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{d}}{2}\right)}^{2}\right) \cdot \frac{d}{t\_0}\\
\end{array}
\end{array}
if l < -3.69999999999999996e80Initial program 48.5%
Simplified48.3%
associate-*r/44.5%
frac-times44.5%
associate-/l*44.5%
*-commutative44.5%
Applied egg-rr44.5%
*-commutative44.5%
associate-/l*48.5%
associate-*r/48.8%
*-commutative48.8%
times-frac48.5%
Simplified48.5%
add-sqr-sqrt26.5%
sqrt-div0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
frac-times0.0%
*-commutative0.0%
associate-*r/0.0%
sqrt-div0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
frac-times0.0%
*-commutative0.0%
associate-*r/0.0%
Applied egg-rr54.8%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt58.5%
mul-1-neg58.5%
distribute-lft-neg-in58.5%
rem-exp-log55.3%
exp-neg55.3%
unpow1/255.3%
exp-prod55.3%
distribute-lft-neg-out55.3%
exp-neg55.3%
exp-to-pow58.4%
unpow1/258.4%
associate-/l*58.6%
associate-*l/58.6%
*-rgt-identity58.6%
distribute-neg-frac258.6%
Simplified58.6%
if -3.69999999999999996e80 < l < 1.2000000000000001e-69Initial program 75.7%
Simplified73.6%
associate-*r/78.2%
frac-times80.3%
associate-/l*78.2%
*-commutative78.2%
Applied egg-rr78.2%
*-commutative78.2%
associate-/l*77.6%
associate-*r/79.6%
*-commutative79.6%
times-frac77.6%
Simplified77.6%
add-sqr-sqrt46.1%
sqrt-div34.2%
sqrt-pow123.6%
metadata-eval23.6%
pow123.6%
*-commutative23.6%
frac-times23.6%
*-commutative23.6%
associate-*r/23.6%
sqrt-div23.6%
sqrt-pow134.9%
metadata-eval34.9%
pow134.9%
*-commutative34.9%
frac-times34.9%
*-commutative34.9%
associate-*r/34.9%
Applied egg-rr78.3%
pow178.3%
sqrt-unprod70.7%
associate-*r*70.7%
frac-times69.9%
pow269.9%
*-commutative69.9%
*-un-lft-identity69.9%
Applied egg-rr69.9%
unpow169.9%
associate-*l*69.9%
*-commutative69.9%
Simplified69.9%
if 1.2000000000000001e-69 < l Initial program 52.3%
Simplified53.5%
Applied egg-rr68.7%
unpow168.7%
associate-*r*68.7%
*-commutative68.7%
associate-*r/67.6%
*-commutative67.6%
associate-*r/67.6%
associate-*r*67.6%
associate-*r*67.6%
associate-/r*67.6%
Simplified67.6%
Taylor expanded in h around 0 56.0%
Final simplification63.6%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (* l h))))
(if (<= d -2.4e-158)
(/ d (- t_0))
(if (<= d 9.2e-272)
(* d (pow (pow (* l h) 2.0) -0.25))
(*
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D_m (/ (/ M_m d) 2.0)) 2.0)))
(/ d t_0))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((l * h));
double tmp;
if (d <= -2.4e-158) {
tmp = d / -t_0;
} else if (d <= 9.2e-272) {
tmp = d * pow(pow((l * h), 2.0), -0.25);
} else {
tmp = (1.0 + (((h / l) * -0.5) * pow((D_m * ((M_m / d) / 2.0)), 2.0))) * (d / t_0);
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((l * h))
if (d <= (-2.4d-158)) then
tmp = d / -t_0
else if (d <= 9.2d-272) then
tmp = d * (((l * h) ** 2.0d0) ** (-0.25d0))
else
tmp = (1.0d0 + (((h / l) * (-0.5d0)) * ((d_m * ((m_m / d) / 2.0d0)) ** 2.0d0))) * (d / t_0)
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt((l * h));
double tmp;
if (d <= -2.4e-158) {
tmp = d / -t_0;
} else if (d <= 9.2e-272) {
tmp = d * Math.pow(Math.pow((l * h), 2.0), -0.25);
} else {
tmp = (1.0 + (((h / l) * -0.5) * Math.pow((D_m * ((M_m / d) / 2.0)), 2.0))) * (d / t_0);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt((l * h)) tmp = 0 if d <= -2.4e-158: tmp = d / -t_0 elif d <= 9.2e-272: tmp = d * math.pow(math.pow((l * h), 2.0), -0.25) else: tmp = (1.0 + (((h / l) * -0.5) * math.pow((D_m * ((M_m / d) / 2.0)), 2.0))) * (d / t_0) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(l * h)) tmp = 0.0 if (d <= -2.4e-158) tmp = Float64(d / Float64(-t_0)); elseif (d <= 9.2e-272) tmp = Float64(d * ((Float64(l * h) ^ 2.0) ^ -0.25)); else tmp = Float64(Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(Float64(M_m / d) / 2.0)) ^ 2.0))) * Float64(d / t_0)); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt((l * h));
tmp = 0.0;
if (d <= -2.4e-158)
tmp = d / -t_0;
elseif (d <= 9.2e-272)
tmp = d * (((l * h) ^ 2.0) ^ -0.25);
else
tmp = (1.0 + (((h / l) * -0.5) * ((D_m * ((M_m / d) / 2.0)) ^ 2.0))) * (d / t_0);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -2.4e-158], N[(d / (-t$95$0)), $MachinePrecision], If[LessEqual[d, 9.2e-272], N[(d * N[Power[N[Power[N[(l * h), $MachinePrecision], 2.0], $MachinePrecision], -0.25], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(N[(M$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;d \leq -2.4 \cdot 10^{-158}:\\
\;\;\;\;\frac{d}{-t\_0}\\
\mathbf{elif}\;d \leq 9.2 \cdot 10^{-272}:\\
\;\;\;\;d \cdot {\left({\left(\ell \cdot h\right)}^{2}\right)}^{-0.25}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{d}}{2}\right)}^{2}\right) \cdot \frac{d}{t\_0}\\
\end{array}
\end{array}
if d < -2.40000000000000007e-158Initial program 74.6%
Simplified71.4%
associate-*r/71.6%
frac-times74.7%
associate-/l*71.6%
*-commutative71.6%
Applied egg-rr71.6%
*-commutative71.6%
associate-/l*73.8%
associate-*r/77.0%
*-commutative77.0%
times-frac73.8%
Simplified73.8%
add-sqr-sqrt30.4%
sqrt-div0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
frac-times0.0%
*-commutative0.0%
associate-*r/0.0%
sqrt-div0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
frac-times0.0%
*-commutative0.0%
associate-*r/0.0%
Applied egg-rr76.0%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt50.5%
mul-1-neg50.5%
distribute-lft-neg-in50.5%
rem-exp-log47.9%
exp-neg47.9%
unpow1/247.9%
exp-prod47.9%
distribute-lft-neg-out47.9%
exp-neg47.9%
exp-to-pow50.4%
unpow1/250.4%
associate-/l*50.6%
associate-*l/50.6%
*-rgt-identity50.6%
distribute-neg-frac250.6%
Simplified50.6%
if -2.40000000000000007e-158 < d < 9.19999999999999955e-272Initial program 36.1%
Simplified36.1%
Taylor expanded in d around inf 15.9%
add-cbrt-cube22.3%
pow1/322.3%
add-sqr-sqrt22.3%
pow122.3%
pow1/222.3%
pow-prod-up22.3%
associate-/r*22.3%
metadata-eval22.3%
Applied egg-rr22.3%
pow-pow15.9%
div-inv15.9%
metadata-eval15.9%
unpow-prod-down2.5%
pow1/22.5%
Applied egg-rr2.5%
unpow1/22.5%
Simplified2.5%
pow1/22.5%
pow1/22.5%
inv-pow2.5%
pow-pow2.5%
metadata-eval2.5%
inv-pow2.5%
pow-pow2.5%
metadata-eval2.5%
unpow-prod-down15.9%
sqr-pow15.9%
pow-prod-down24.5%
pow224.5%
*-commutative24.5%
metadata-eval24.5%
Applied egg-rr24.5%
if 9.19999999999999955e-272 < d Initial program 65.9%
Simplified66.6%
Applied egg-rr78.6%
unpow178.6%
associate-*r*78.6%
*-commutative78.6%
associate-*r/77.9%
*-commutative77.9%
associate-*r/77.1%
associate-*r*77.1%
associate-*r*77.1%
associate-/r*77.1%
Simplified77.1%
Taylor expanded in h around 0 66.7%
Final simplification53.7%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (/ D_m d) (* 0.5 M_m))))
(*
(- 1.0 (* 0.5 (* h (* t_0 (/ t_0 l)))))
(* (sqrt (/ d l)) (sqrt (/ d h))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (D_m / d) * (0.5 * M_m);
return (1.0 - (0.5 * (h * (t_0 * (t_0 / l))))) * (sqrt((d / l)) * sqrt((d / h)));
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
t_0 = (d_m / d) * (0.5d0 * m_m)
code = (1.0d0 - (0.5d0 * (h * (t_0 * (t_0 / l))))) * (sqrt((d / l)) * sqrt((d / h)))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (D_m / d) * (0.5 * M_m);
return (1.0 - (0.5 * (h * (t_0 * (t_0 / l))))) * (Math.sqrt((d / l)) * Math.sqrt((d / h)));
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = (D_m / d) * (0.5 * M_m) return (1.0 - (0.5 * (h * (t_0 * (t_0 / l))))) * (math.sqrt((d / l)) * math.sqrt((d / h)))
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(D_m / d) * Float64(0.5 * M_m)) return Float64(Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_0 * Float64(t_0 / l))))) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)))) end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp = code(d, h, l, M_m, D_m)
t_0 = (D_m / d) * (0.5 * M_m);
tmp = (1.0 - (0.5 * (h * (t_0 * (t_0 / l))))) * (sqrt((d / l)) * sqrt((d / h)));
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * M$95$m), $MachinePrecision]), $MachinePrecision]}, N[(N[(1.0 - N[(0.5 * N[(h * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{D\_m}{d} \cdot \left(0.5 \cdot M\_m\right)\\
\left(1 - 0.5 \cdot \left(h \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)
\end{array}
\end{array}
Initial program 63.7%
Simplified62.9%
associate-*r/64.3%
frac-times65.0%
associate-/l*64.3%
*-commutative64.3%
Applied egg-rr64.3%
*-commutative64.3%
associate-/l*65.1%
associate-*r/65.8%
*-commutative65.8%
times-frac65.1%
Simplified65.1%
add-sqr-sqrt44.8%
sqrt-div33.8%
sqrt-pow125.1%
metadata-eval25.1%
pow125.1%
*-commutative25.1%
frac-times25.1%
*-commutative25.1%
associate-*r/25.1%
sqrt-div25.1%
sqrt-pow134.2%
metadata-eval34.2%
pow134.2%
*-commutative34.2%
frac-times33.8%
*-commutative33.8%
associate-*r/34.2%
Applied egg-rr66.6%
Final simplification66.6%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -2e-158)
(/ d (- (sqrt (* l h))))
(if (<= d -5e-310)
(* d (pow (pow (* l h) 2.0) -0.25))
(* d (* (sqrt (/ 1.0 h)) (sqrt (/ 1.0 l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -2e-158) {
tmp = d / -sqrt((l * h));
} else if (d <= -5e-310) {
tmp = d * pow(pow((l * h), 2.0), -0.25);
} else {
tmp = d * (sqrt((1.0 / h)) * sqrt((1.0 / l)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (d <= (-2d-158)) then
tmp = d / -sqrt((l * h))
else if (d <= (-5d-310)) then
tmp = d * (((l * h) ** 2.0d0) ** (-0.25d0))
else
tmp = d * (sqrt((1.0d0 / h)) * sqrt((1.0d0 / l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -2e-158) {
tmp = d / -Math.sqrt((l * h));
} else if (d <= -5e-310) {
tmp = d * Math.pow(Math.pow((l * h), 2.0), -0.25);
} else {
tmp = d * (Math.sqrt((1.0 / h)) * Math.sqrt((1.0 / l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if d <= -2e-158: tmp = d / -math.sqrt((l * h)) elif d <= -5e-310: tmp = d * math.pow(math.pow((l * h), 2.0), -0.25) else: tmp = d * (math.sqrt((1.0 / h)) * math.sqrt((1.0 / l))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -2e-158) tmp = Float64(d / Float64(-sqrt(Float64(l * h)))); elseif (d <= -5e-310) tmp = Float64(d * ((Float64(l * h) ^ 2.0) ^ -0.25)); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) * sqrt(Float64(1.0 / l)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (d <= -2e-158)
tmp = d / -sqrt((l * h));
elseif (d <= -5e-310)
tmp = d * (((l * h) ^ 2.0) ^ -0.25);
else
tmp = d * (sqrt((1.0 / h)) * sqrt((1.0 / l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -2e-158], N[(d / (-N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Power[N[Power[N[(l * h), $MachinePrecision], 2.0], $MachinePrecision], -0.25], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2 \cdot 10^{-158}:\\
\;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot {\left({\left(\ell \cdot h\right)}^{2}\right)}^{-0.25}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left(\sqrt{\frac{1}{h}} \cdot \sqrt{\frac{1}{\ell}}\right)\\
\end{array}
\end{array}
if d < -2.00000000000000013e-158Initial program 74.6%
Simplified71.4%
associate-*r/71.6%
frac-times74.7%
associate-/l*71.6%
*-commutative71.6%
Applied egg-rr71.6%
*-commutative71.6%
associate-/l*73.8%
associate-*r/77.0%
*-commutative77.0%
times-frac73.8%
Simplified73.8%
add-sqr-sqrt30.4%
sqrt-div0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
frac-times0.0%
*-commutative0.0%
associate-*r/0.0%
sqrt-div0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
frac-times0.0%
*-commutative0.0%
associate-*r/0.0%
Applied egg-rr76.0%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt50.5%
mul-1-neg50.5%
distribute-lft-neg-in50.5%
rem-exp-log47.9%
exp-neg47.9%
unpow1/247.9%
exp-prod47.9%
distribute-lft-neg-out47.9%
exp-neg47.9%
exp-to-pow50.4%
unpow1/250.4%
associate-/l*50.6%
associate-*l/50.6%
*-rgt-identity50.6%
distribute-neg-frac250.6%
Simplified50.6%
if -2.00000000000000013e-158 < d < -4.999999999999985e-310Initial program 40.0%
Simplified40.0%
Taylor expanded in d around inf 18.3%
add-cbrt-cube26.0%
pow1/326.0%
add-sqr-sqrt26.0%
pow126.0%
pow1/226.0%
pow-prod-up26.0%
associate-/r*26.0%
metadata-eval26.0%
Applied egg-rr26.0%
pow-pow18.3%
div-inv18.3%
metadata-eval18.3%
unpow-prod-down0.0%
pow1/20.0%
Applied egg-rr0.0%
unpow1/20.0%
Simplified0.0%
pow1/20.0%
pow1/20.0%
inv-pow0.0%
pow-pow0.0%
metadata-eval0.0%
inv-pow0.0%
pow-pow0.0%
metadata-eval0.0%
unpow-prod-down18.3%
sqr-pow18.3%
pow-prod-down28.6%
pow228.6%
*-commutative28.6%
metadata-eval28.6%
Applied egg-rr28.6%
if -4.999999999999985e-310 < d Initial program 63.1%
Simplified63.8%
Taylor expanded in d around inf 35.9%
add-cbrt-cube31.4%
pow1/329.9%
add-sqr-sqrt29.9%
pow129.9%
pow1/229.9%
pow-prod-up29.9%
associate-/r*29.9%
metadata-eval29.9%
Applied egg-rr29.9%
pow-pow37.2%
div-inv37.2%
metadata-eval37.2%
unpow-prod-down44.6%
pow1/244.6%
Applied egg-rr44.6%
unpow1/244.6%
Simplified44.6%
Final simplification44.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -7.6e-153)
(/ d (- (sqrt (* l h))))
(if (<= d -5e-310)
(* d (pow (pow (* l h) 2.0) -0.25))
(* d (* (pow l -0.5) (pow h -0.5))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -7.6e-153) {
tmp = d / -sqrt((l * h));
} else if (d <= -5e-310) {
tmp = d * pow(pow((l * h), 2.0), -0.25);
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (d <= (-7.6d-153)) then
tmp = d / -sqrt((l * h))
else if (d <= (-5d-310)) then
tmp = d * (((l * h) ** 2.0d0) ** (-0.25d0))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -7.6e-153) {
tmp = d / -Math.sqrt((l * h));
} else if (d <= -5e-310) {
tmp = d * Math.pow(Math.pow((l * h), 2.0), -0.25);
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if d <= -7.6e-153: tmp = d / -math.sqrt((l * h)) elif d <= -5e-310: tmp = d * math.pow(math.pow((l * h), 2.0), -0.25) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -7.6e-153) tmp = Float64(d / Float64(-sqrt(Float64(l * h)))); elseif (d <= -5e-310) tmp = Float64(d * ((Float64(l * h) ^ 2.0) ^ -0.25)); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (d <= -7.6e-153)
tmp = d / -sqrt((l * h));
elseif (d <= -5e-310)
tmp = d * (((l * h) ^ 2.0) ^ -0.25);
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -7.6e-153], N[(d / (-N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Power[N[Power[N[(l * h), $MachinePrecision], 2.0], $MachinePrecision], -0.25], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -7.6 \cdot 10^{-153}:\\
\;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot {\left({\left(\ell \cdot h\right)}^{2}\right)}^{-0.25}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -7.60000000000000046e-153Initial program 74.6%
Simplified71.4%
associate-*r/71.6%
frac-times74.7%
associate-/l*71.6%
*-commutative71.6%
Applied egg-rr71.6%
*-commutative71.6%
associate-/l*73.8%
associate-*r/77.0%
*-commutative77.0%
times-frac73.8%
Simplified73.8%
add-sqr-sqrt30.4%
sqrt-div0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
frac-times0.0%
*-commutative0.0%
associate-*r/0.0%
sqrt-div0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
frac-times0.0%
*-commutative0.0%
associate-*r/0.0%
Applied egg-rr76.0%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt50.5%
mul-1-neg50.5%
distribute-lft-neg-in50.5%
rem-exp-log47.9%
exp-neg47.9%
unpow1/247.9%
exp-prod47.9%
distribute-lft-neg-out47.9%
exp-neg47.9%
exp-to-pow50.4%
unpow1/250.4%
associate-/l*50.6%
associate-*l/50.6%
*-rgt-identity50.6%
distribute-neg-frac250.6%
Simplified50.6%
if -7.60000000000000046e-153 < d < -4.999999999999985e-310Initial program 40.0%
Simplified40.0%
Taylor expanded in d around inf 18.3%
add-cbrt-cube26.0%
pow1/326.0%
add-sqr-sqrt26.0%
pow126.0%
pow1/226.0%
pow-prod-up26.0%
associate-/r*26.0%
metadata-eval26.0%
Applied egg-rr26.0%
pow-pow18.3%
div-inv18.3%
metadata-eval18.3%
unpow-prod-down0.0%
pow1/20.0%
Applied egg-rr0.0%
unpow1/20.0%
Simplified0.0%
pow1/20.0%
pow1/20.0%
inv-pow0.0%
pow-pow0.0%
metadata-eval0.0%
inv-pow0.0%
pow-pow0.0%
metadata-eval0.0%
unpow-prod-down18.3%
sqr-pow18.3%
pow-prod-down28.6%
pow228.6%
*-commutative28.6%
metadata-eval28.6%
Applied egg-rr28.6%
if -4.999999999999985e-310 < d Initial program 63.1%
Simplified63.8%
Applied egg-rr40.8%
Taylor expanded in d around inf 35.9%
unpow-135.9%
metadata-eval35.9%
pow-sqr35.9%
rem-sqrt-square36.3%
rem-square-sqrt36.2%
fabs-sqr36.2%
rem-square-sqrt36.3%
Simplified36.3%
*-commutative36.3%
unpow-prod-down44.6%
Applied egg-rr44.6%
Final simplification44.3%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= h -5e-311) (/ d (- (sqrt (* l h)))) (* d (* (pow l -0.5) (pow h -0.5)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (h <= -5e-311) {
tmp = d / -sqrt((l * h));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (h <= (-5d-311)) then
tmp = d / -sqrt((l * h))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (h <= -5e-311) {
tmp = d / -Math.sqrt((l * h));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if h <= -5e-311: tmp = d / -math.sqrt((l * h)) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (h <= -5e-311) tmp = Float64(d / Float64(-sqrt(Float64(l * h)))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (h <= -5e-311)
tmp = d / -sqrt((l * h));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[h, -5e-311], N[(d / (-N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if h < -5.00000000000023e-311Initial program 64.3%
Simplified62.0%
associate-*r/62.2%
frac-times64.4%
associate-/l*62.2%
*-commutative62.2%
Applied egg-rr62.2%
*-commutative62.2%
associate-/l*63.0%
associate-*r/65.3%
*-commutative65.3%
times-frac63.0%
Simplified63.0%
add-sqr-sqrt22.1%
sqrt-div0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
frac-times0.0%
*-commutative0.0%
associate-*r/0.0%
sqrt-div0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
frac-times0.0%
*-commutative0.0%
associate-*r/0.0%
Applied egg-rr65.4%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt40.5%
mul-1-neg40.5%
distribute-lft-neg-in40.5%
rem-exp-log38.5%
exp-neg38.5%
unpow1/238.5%
exp-prod38.5%
distribute-lft-neg-out38.5%
exp-neg38.5%
exp-to-pow40.4%
unpow1/240.4%
associate-/l*40.5%
associate-*l/40.5%
*-rgt-identity40.5%
distribute-neg-frac240.5%
Simplified40.5%
if -5.00000000000023e-311 < h Initial program 63.1%
Simplified63.8%
Applied egg-rr40.8%
Taylor expanded in d around inf 35.9%
unpow-135.9%
metadata-eval35.9%
pow-sqr35.9%
rem-sqrt-square36.3%
rem-square-sqrt36.2%
fabs-sqr36.2%
rem-square-sqrt36.3%
Simplified36.3%
*-commutative36.3%
unpow-prod-down44.6%
Applied egg-rr44.6%
Final simplification42.6%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= h -5e-311) (/ d (- (sqrt (* l h)))) (/ d (* (sqrt l) (sqrt h)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (h <= -5e-311) {
tmp = d / -sqrt((l * h));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (h <= (-5d-311)) then
tmp = d / -sqrt((l * h))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (h <= -5e-311) {
tmp = d / -Math.sqrt((l * h));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if h <= -5e-311: tmp = d / -math.sqrt((l * h)) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (h <= -5e-311) tmp = Float64(d / Float64(-sqrt(Float64(l * h)))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (h <= -5e-311)
tmp = d / -sqrt((l * h));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[h, -5e-311], N[(d / (-N[Sqrt[N[(l * h), $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_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if h < -5.00000000000023e-311Initial program 64.3%
Simplified62.0%
associate-*r/62.2%
frac-times64.4%
associate-/l*62.2%
*-commutative62.2%
Applied egg-rr62.2%
*-commutative62.2%
associate-/l*63.0%
associate-*r/65.3%
*-commutative65.3%
times-frac63.0%
Simplified63.0%
add-sqr-sqrt22.1%
sqrt-div0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
frac-times0.0%
*-commutative0.0%
associate-*r/0.0%
sqrt-div0.0%
sqrt-pow10.0%
metadata-eval0.0%
pow10.0%
*-commutative0.0%
frac-times0.0%
*-commutative0.0%
associate-*r/0.0%
Applied egg-rr65.4%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt40.5%
mul-1-neg40.5%
distribute-lft-neg-in40.5%
rem-exp-log38.5%
exp-neg38.5%
unpow1/238.5%
exp-prod38.5%
distribute-lft-neg-out38.5%
exp-neg38.5%
exp-to-pow40.4%
unpow1/240.4%
associate-/l*40.5%
associate-*l/40.5%
*-rgt-identity40.5%
distribute-neg-frac240.5%
Simplified40.5%
if -5.00000000000023e-311 < h Initial program 63.1%
Simplified63.8%
Taylor expanded in d around inf 35.9%
sqrt-div36.3%
metadata-eval36.3%
sqrt-unprod44.5%
div-inv44.6%
sqrt-unprod36.4%
Applied egg-rr36.4%
sqrt-prod44.6%
*-commutative44.6%
Applied egg-rr44.6%
Final simplification42.6%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= l 2.25e-204) (/ d (- (sqrt (* l h)))) (* d (sqrt (/ (/ 1.0 h) l)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 2.25e-204) {
tmp = d / -sqrt((l * h));
} else {
tmp = d * sqrt(((1.0 / h) / l));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= 2.25d-204) then
tmp = d / -sqrt((l * h))
else
tmp = d * sqrt(((1.0d0 / h) / l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 2.25e-204) {
tmp = d / -Math.sqrt((l * h));
} else {
tmp = d * Math.sqrt(((1.0 / h) / l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= 2.25e-204: tmp = d / -math.sqrt((l * h)) else: tmp = d * math.sqrt(((1.0 / h) / l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= 2.25e-204) tmp = Float64(d / Float64(-sqrt(Float64(l * h)))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= 2.25e-204)
tmp = d / -sqrt((l * h));
else
tmp = d * sqrt(((1.0 / h) / l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, 2.25e-204], N[(d / (-N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.25 \cdot 10^{-204}:\\
\;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if l < 2.24999999999999987e-204Initial program 67.1%
Simplified65.2%
associate-*r/66.1%
frac-times67.9%
associate-/l*66.1%
*-commutative66.1%
Applied egg-rr66.1%
*-commutative66.1%
associate-/l*66.8%
associate-*r/68.6%
*-commutative68.6%
times-frac66.8%
Simplified66.8%
add-sqr-sqrt32.1%
sqrt-div13.4%
sqrt-pow18.0%
metadata-eval8.0%
pow18.0%
*-commutative8.0%
frac-times8.0%
*-commutative8.0%
associate-*r/8.0%
sqrt-div8.0%
sqrt-pow113.4%
metadata-eval13.4%
pow113.4%
*-commutative13.4%
frac-times13.4%
*-commutative13.4%
associate-*r/13.4%
Applied egg-rr68.7%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt41.1%
mul-1-neg41.1%
distribute-lft-neg-in41.1%
rem-exp-log39.4%
exp-neg39.4%
unpow1/239.4%
exp-prod39.4%
distribute-lft-neg-out39.4%
exp-neg39.4%
exp-to-pow41.0%
unpow1/241.0%
associate-/l*41.1%
associate-*l/41.1%
*-rgt-identity41.1%
distribute-neg-frac241.1%
Simplified41.1%
if 2.24999999999999987e-204 < l Initial program 58.8%
Simplified59.6%
Taylor expanded in d around inf 38.8%
associate-/r*40.4%
Simplified40.4%
Final simplification40.8%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= l 3.1e-203) (/ d (- (sqrt (* l h)))) (* d (sqrt (/ (/ 1.0 l) h)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 3.1e-203) {
tmp = d / -sqrt((l * h));
} else {
tmp = d * sqrt(((1.0 / l) / h));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= 3.1d-203) then
tmp = d / -sqrt((l * h))
else
tmp = d * sqrt(((1.0d0 / l) / h))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 3.1e-203) {
tmp = d / -Math.sqrt((l * h));
} else {
tmp = d * Math.sqrt(((1.0 / l) / h));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= 3.1e-203: tmp = d / -math.sqrt((l * h)) else: tmp = d * math.sqrt(((1.0 / l) / h)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= 3.1e-203) tmp = Float64(d / Float64(-sqrt(Float64(l * h)))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= 3.1e-203)
tmp = d / -sqrt((l * h));
else
tmp = d * sqrt(((1.0 / l) / h));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, 3.1e-203], N[(d / (-N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 3.1 \cdot 10^{-203}:\\
\;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\end{array}
\end{array}
if l < 3.09999999999999977e-203Initial program 67.1%
Simplified65.2%
associate-*r/66.1%
frac-times67.9%
associate-/l*66.1%
*-commutative66.1%
Applied egg-rr66.1%
*-commutative66.1%
associate-/l*66.8%
associate-*r/68.6%
*-commutative68.6%
times-frac66.8%
Simplified66.8%
add-sqr-sqrt32.1%
sqrt-div13.4%
sqrt-pow18.0%
metadata-eval8.0%
pow18.0%
*-commutative8.0%
frac-times8.0%
*-commutative8.0%
associate-*r/8.0%
sqrt-div8.0%
sqrt-pow113.4%
metadata-eval13.4%
pow113.4%
*-commutative13.4%
frac-times13.4%
*-commutative13.4%
associate-*r/13.4%
Applied egg-rr68.7%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt41.1%
mul-1-neg41.1%
distribute-lft-neg-in41.1%
rem-exp-log39.4%
exp-neg39.4%
unpow1/239.4%
exp-prod39.4%
distribute-lft-neg-out39.4%
exp-neg39.4%
exp-to-pow41.0%
unpow1/241.0%
associate-/l*41.1%
associate-*l/41.1%
*-rgt-identity41.1%
distribute-neg-frac241.1%
Simplified41.1%
if 3.09999999999999977e-203 < l Initial program 58.8%
Simplified59.6%
Taylor expanded in d around inf 38.8%
*-un-lft-identity38.8%
associate-/r*40.4%
Applied egg-rr40.4%
*-lft-identity40.4%
associate-/l/38.8%
associate-/r*40.4%
Simplified40.4%
Final simplification40.8%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (let* ((t_0 (sqrt (* l h)))) (if (<= l 1.15e-204) (/ d (- t_0)) (/ d t_0))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((l * h));
double tmp;
if (l <= 1.15e-204) {
tmp = d / -t_0;
} else {
tmp = d / t_0;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((l * h))
if (l <= 1.15d-204) then
tmp = d / -t_0
else
tmp = d / t_0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt((l * h));
double tmp;
if (l <= 1.15e-204) {
tmp = d / -t_0;
} else {
tmp = d / t_0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt((l * h)) tmp = 0 if l <= 1.15e-204: tmp = d / -t_0 else: tmp = d / t_0 return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(l * h)) tmp = 0.0 if (l <= 1.15e-204) tmp = Float64(d / Float64(-t_0)); else tmp = Float64(d / t_0); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt((l * h));
tmp = 0.0;
if (l <= 1.15e-204)
tmp = d / -t_0;
else
tmp = d / t_0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, 1.15e-204], N[(d / (-t$95$0)), $MachinePrecision], N[(d / t$95$0), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;\ell \leq 1.15 \cdot 10^{-204}:\\
\;\;\;\;\frac{d}{-t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_0}\\
\end{array}
\end{array}
if l < 1.15e-204Initial program 67.1%
Simplified65.2%
associate-*r/66.1%
frac-times67.9%
associate-/l*66.1%
*-commutative66.1%
Applied egg-rr66.1%
*-commutative66.1%
associate-/l*66.8%
associate-*r/68.6%
*-commutative68.6%
times-frac66.8%
Simplified66.8%
add-sqr-sqrt32.1%
sqrt-div13.4%
sqrt-pow18.0%
metadata-eval8.0%
pow18.0%
*-commutative8.0%
frac-times8.0%
*-commutative8.0%
associate-*r/8.0%
sqrt-div8.0%
sqrt-pow113.4%
metadata-eval13.4%
pow113.4%
*-commutative13.4%
frac-times13.4%
*-commutative13.4%
associate-*r/13.4%
Applied egg-rr68.7%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt41.1%
mul-1-neg41.1%
distribute-lft-neg-in41.1%
rem-exp-log39.4%
exp-neg39.4%
unpow1/239.4%
exp-prod39.4%
distribute-lft-neg-out39.4%
exp-neg39.4%
exp-to-pow41.0%
unpow1/241.0%
associate-/l*41.1%
associate-*l/41.1%
*-rgt-identity41.1%
distribute-neg-frac241.1%
Simplified41.1%
if 1.15e-204 < l Initial program 58.8%
Simplified59.6%
Taylor expanded in d around inf 38.8%
sqrt-div39.3%
metadata-eval39.3%
sqrt-unprod47.6%
div-inv47.6%
sqrt-unprod39.4%
Applied egg-rr39.4%
Final simplification40.4%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (/ d (sqrt (* l h))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
return d / sqrt((l * h));
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
code = d / sqrt((l * h))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
return d / Math.sqrt((l * h));
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): return d / math.sqrt((l * h))
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) return Float64(d / sqrt(Float64(l * h))) end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp = code(d, h, l, M_m, D_m)
tmp = d / sqrt((l * h));
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 63.7%
Simplified62.9%
Taylor expanded in d around inf 23.6%
sqrt-div23.8%
metadata-eval23.8%
sqrt-unprod22.4%
div-inv22.5%
sqrt-unprod23.8%
Applied egg-rr23.8%
Final simplification23.8%
herbie shell --seed 2024076
(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)))))