
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (- d))))
(if (<= h -7.5e+110)
(*
(/ 1.0 (/ (sqrt (- h)) t_0))
(*
(/ 1.0 (sqrt (/ l d)))
(- 1.0 (* 0.5 (* (pow (* (/ M 2.0) (/ D d)) 2.0) (/ h l))))))
(if (<= h -2e-310)
(*
(sqrt (/ d h))
(*
(/ t_0 (sqrt (- l)))
(- 1.0 (* 0.5 (pow (* (* 0.5 (/ D (/ d M))) (sqrt (/ h l))) 2.0)))))
(*
(fma (pow (* D (* -0.5 (/ M d))) 2.0) (* (/ h l) -0.5) 1.0)
(/ d (* (sqrt l) (sqrt h))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(-d);
double tmp;
if (h <= -7.5e+110) {
tmp = (1.0 / (sqrt(-h) / t_0)) * ((1.0 / sqrt((l / d))) * (1.0 - (0.5 * (pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))));
} else if (h <= -2e-310) {
tmp = sqrt((d / h)) * ((t_0 / sqrt(-l)) * (1.0 - (0.5 * pow(((0.5 * (D / (d / M))) * sqrt((h / l))), 2.0))));
} else {
tmp = fma(pow((D * (-0.5 * (M / d))), 2.0), ((h / l) * -0.5), 1.0) * (d / (sqrt(l) * sqrt(h)));
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(-d)) tmp = 0.0 if (h <= -7.5e+110) tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(-h)) / t_0)) * Float64(Float64(1.0 / sqrt(Float64(l / d))) * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(h / l)))))); elseif (h <= -2e-310) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(1.0 - Float64(0.5 * (Float64(Float64(0.5 * Float64(D / Float64(d / M))) * sqrt(Float64(h / l))) ^ 2.0))))); else tmp = Float64(fma((Float64(D * Float64(-0.5 * Float64(M / d))) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0) * Float64(d / Float64(sqrt(l) * sqrt(h)))); end return tmp end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[h, -7.5e+110], N[(N[(1.0 / N[(N[Sqrt[(-h)], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(N[(0.5 * N[(D / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[N[(D * N[(-0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;h \leq -7.5 \cdot 10^{+110}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{-h}}{t_0}} \cdot \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t_0}{\sqrt{-\ell}} \cdot \left(1 - 0.5 \cdot {\left(\left(0.5 \cdot \frac{D}{\frac{d}{M}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left({\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right) \cdot \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if h < -7.5e110Initial program 54.5%
Simplified60.0%
clear-num60.0%
sqrt-div59.9%
metadata-eval59.9%
Applied egg-rr59.9%
clear-num60.0%
sqrt-div60.2%
metadata-eval60.2%
Applied egg-rr60.2%
frac-2neg60.2%
sqrt-div77.5%
Applied egg-rr77.5%
if -7.5e110 < h < -1.999999999999994e-310Initial program 65.3%
Simplified62.8%
add-sqr-sqrt62.7%
pow262.7%
sqrt-prod62.7%
unpow262.7%
sqrt-prod26.7%
add-sqr-sqrt64.2%
div-inv64.2%
metadata-eval64.2%
Applied egg-rr64.2%
Taylor expanded in M around 0 66.8%
associate-/l*65.3%
Simplified65.3%
frac-2neg65.3%
sqrt-div75.6%
Applied egg-rr75.6%
if -1.999999999999994e-310 < h Initial program 66.6%
Simplified66.7%
pow166.7%
Applied egg-rr82.0%
Final simplification79.4%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= h -2e-310)
(*
(/ 1.0 (/ (sqrt (- h)) (sqrt (- d))))
(*
(/ 1.0 (sqrt (/ l d)))
(- 1.0 (* 0.5 (* (pow (* (/ M 2.0) (/ D d)) 2.0) (/ h l))))))
(*
(fma (pow (* (/ M d) (* D -0.5)) 2.0) (* (/ h l) -0.5) 1.0)
(/ (/ d (sqrt l)) (sqrt h)))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -2e-310) {
tmp = (1.0 / (sqrt(-h) / sqrt(-d))) * ((1.0 / sqrt((l / d))) * (1.0 - (0.5 * (pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))));
} else {
tmp = fma(pow(((M / d) * (D * -0.5)), 2.0), ((h / l) * -0.5), 1.0) * ((d / sqrt(l)) / sqrt(h));
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= -2e-310) tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(-h)) / sqrt(Float64(-d)))) * Float64(Float64(1.0 / sqrt(Float64(l / d))) * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(h / l)))))); else tmp = Float64(fma((Float64(Float64(M / d) * Float64(D * -0.5)) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0) * Float64(Float64(d / sqrt(l)) / sqrt(h))); end return tmp end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, -2e-310], N[(N[(1.0 / N[(N[Sqrt[(-h)], $MachinePrecision] / N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[N[(N[(M / d), $MachinePrecision] * N[(D * -0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{-h}}{\sqrt{-d}}} \cdot \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left({\left(\frac{M}{d} \cdot \left(D \cdot -0.5\right)\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right) \cdot \frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if h < -1.999999999999994e-310Initial program 61.9%
Simplified61.9%
clear-num61.9%
sqrt-div61.9%
metadata-eval61.9%
Applied egg-rr61.9%
clear-num61.4%
sqrt-div62.2%
metadata-eval62.2%
Applied egg-rr62.2%
frac-2neg62.2%
sqrt-div73.4%
Applied egg-rr73.4%
if -1.999999999999994e-310 < h Initial program 66.6%
Simplified66.7%
expm1-log1p-u35.1%
expm1-udef23.5%
Applied egg-rr28.8%
expm1-def45.5%
expm1-log1p82.0%
associate-/r*81.0%
associate-*r*81.0%
Simplified81.0%
Final simplification77.7%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= h -2e-310)
(*
(/ 1.0 (/ (sqrt (- h)) (sqrt (- d))))
(*
(/ 1.0 (sqrt (/ l d)))
(- 1.0 (* 0.5 (* (pow (* (/ M 2.0) (/ D d)) 2.0) (/ h l))))))
(*
(fma (pow (* D (* -0.5 (/ M d))) 2.0) (* (/ h l) -0.5) 1.0)
(/ d (* (sqrt l) (sqrt h))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -2e-310) {
tmp = (1.0 / (sqrt(-h) / sqrt(-d))) * ((1.0 / sqrt((l / d))) * (1.0 - (0.5 * (pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))));
} else {
tmp = fma(pow((D * (-0.5 * (M / d))), 2.0), ((h / l) * -0.5), 1.0) * (d / (sqrt(l) * sqrt(h)));
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= -2e-310) tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(-h)) / sqrt(Float64(-d)))) * Float64(Float64(1.0 / sqrt(Float64(l / d))) * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(h / l)))))); else tmp = Float64(fma((Float64(D * Float64(-0.5 * Float64(M / d))) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0) * Float64(d / Float64(sqrt(l) * sqrt(h)))); end return tmp end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, -2e-310], N[(N[(1.0 / N[(N[Sqrt[(-h)], $MachinePrecision] / N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[N[(D * N[(-0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{-h}}{\sqrt{-d}}} \cdot \left(\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left({\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right) \cdot \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if h < -1.999999999999994e-310Initial program 61.9%
Simplified61.9%
clear-num61.9%
sqrt-div61.9%
metadata-eval61.9%
Applied egg-rr61.9%
clear-num61.4%
sqrt-div62.2%
metadata-eval62.2%
Applied egg-rr62.2%
frac-2neg62.2%
sqrt-div73.4%
Applied egg-rr73.4%
if -1.999999999999994e-310 < h Initial program 66.6%
Simplified66.7%
pow166.7%
Applied egg-rr82.0%
Final simplification78.2%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d -5e-310)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(*
(- 1.0 (* 0.5 (* (pow (* (/ M 2.0) (/ D d)) 2.0) (/ h l))))
(sqrt (/ d l))))
(*
(fma (pow (* (/ M d) (* D -0.5)) 2.0) (* (/ h l) -0.5) 1.0)
(/ (/ d (sqrt l)) (sqrt h)))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -5e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * ((1.0 - (0.5 * (pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) * sqrt((d / l)));
} else {
tmp = fma(pow(((M / d) * (D * -0.5)), 2.0), ((h / l) * -0.5), 1.0) * ((d / sqrt(l)) / sqrt(h));
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -5e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(h / l)))) * sqrt(Float64(d / l)))); else tmp = Float64(fma((Float64(Float64(M / d) * Float64(D * -0.5)) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0) * Float64(Float64(d / sqrt(l)) / sqrt(h))); end return tmp end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -5e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[N[(N[(M / d), $MachinePrecision] * N[(D * -0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left({\left(\frac{M}{d} \cdot \left(D \cdot -0.5\right)\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right) \cdot \frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -4.999999999999985e-310Initial program 61.9%
Simplified61.9%
frac-2neg61.9%
sqrt-div73.1%
Applied egg-rr73.1%
if -4.999999999999985e-310 < d Initial program 66.6%
Simplified66.7%
expm1-log1p-u35.1%
expm1-udef23.5%
Applied egg-rr28.8%
expm1-def45.5%
expm1-log1p82.0%
associate-/r*81.0%
associate-*r*81.0%
Simplified81.0%
Final simplification77.5%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= h 3.4e-282)
(*
(sqrt (/ d h))
(*
(- 1.0 (* 0.5 (pow (* (* 0.5 (/ D (/ d M))) (sqrt (/ h l))) 2.0)))
(sqrt (/ d l))))
(*
(/ d (* (sqrt l) (sqrt h)))
(- 1.0 (* (/ h l) (* 0.5 (pow (* (/ D d) (* 0.5 M)) 2.0)))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 3.4e-282) {
tmp = sqrt((d / h)) * ((1.0 - (0.5 * pow(((0.5 * (D / (d / M))) * sqrt((h / l))), 2.0))) * sqrt((d / l)));
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - ((h / l) * (0.5 * pow(((D / d) * (0.5 * M)), 2.0))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (h <= 3.4d-282) then
tmp = sqrt((d / h)) * ((1.0d0 - (0.5d0 * (((0.5d0 * (d_1 / (d / m))) * sqrt((h / l))) ** 2.0d0))) * sqrt((d / l)))
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 - ((h / l) * (0.5d0 * (((d_1 / d) * (0.5d0 * m)) ** 2.0d0))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 3.4e-282) {
tmp = Math.sqrt((d / h)) * ((1.0 - (0.5 * Math.pow(((0.5 * (D / (d / M))) * Math.sqrt((h / l))), 2.0))) * Math.sqrt((d / l)));
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 - ((h / l) * (0.5 * Math.pow(((D / d) * (0.5 * M)), 2.0))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if h <= 3.4e-282: tmp = math.sqrt((d / h)) * ((1.0 - (0.5 * math.pow(((0.5 * (D / (d / M))) * math.sqrt((h / l))), 2.0))) * math.sqrt((d / l))) else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 - ((h / l) * (0.5 * math.pow(((D / d) * (0.5 * M)), 2.0)))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= 3.4e-282) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(1.0 - Float64(0.5 * (Float64(Float64(0.5 * Float64(D / Float64(d / M))) * sqrt(Float64(h / l))) ^ 2.0))) * sqrt(Float64(d / l)))); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(D / d) * Float64(0.5 * M)) ^ 2.0))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (h <= 3.4e-282)
tmp = sqrt((d / h)) * ((1.0 - (0.5 * (((0.5 * (D / (d / M))) * sqrt((h / l))) ^ 2.0))) * sqrt((d / l)));
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - ((h / l) * (0.5 * (((D / d) * (0.5 * M)) ^ 2.0))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, 3.4e-282], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 - N[(0.5 * N[Power[N[(N[(0.5 * N[(D / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq 3.4 \cdot 10^{-282}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\left(1 - 0.5 \cdot {\left(\left(0.5 \cdot \frac{D}{\frac{d}{M}}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if h < 3.39999999999999999e-282Initial program 62.1%
Simplified62.1%
add-sqr-sqrt62.1%
pow262.1%
sqrt-prod62.1%
unpow262.1%
sqrt-prod33.5%
add-sqr-sqrt64.0%
div-inv64.0%
metadata-eval64.0%
Applied egg-rr64.0%
Taylor expanded in M around 0 64.8%
associate-/l*63.8%
Simplified63.8%
if 3.39999999999999999e-282 < h Initial program 66.7%
pow166.7%
Applied egg-rr81.3%
Final simplification73.2%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ h l) -0.5)))
(if (<= h 2.2e-286)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(+ 1.0 (* (pow (* D (* -0.5 (/ M d))) 2.0) t_0)))
(*
(fma (pow (* (/ M d) (* D -0.5)) 2.0) t_0 1.0)
(/ (/ d (sqrt l)) (sqrt h))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (h / l) * -0.5;
double tmp;
if (h <= 2.2e-286) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 + (pow((D * (-0.5 * (M / d))), 2.0) * t_0));
} else {
tmp = fma(pow(((M / d) * (D * -0.5)), 2.0), t_0, 1.0) * ((d / sqrt(l)) / sqrt(h));
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(h / l) * -0.5) tmp = 0.0 if (h <= 2.2e-286) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 + Float64((Float64(D * Float64(-0.5 * Float64(M / d))) ^ 2.0) * t_0))); else tmp = Float64(fma((Float64(Float64(M / d) * Float64(D * -0.5)) ^ 2.0), t_0, 1.0) * Float64(Float64(d / sqrt(l)) / sqrt(h))); end return tmp end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]}, If[LessEqual[h, 2.2e-286], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[Power[N[(D * N[(-0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[N[(N[(M / d), $MachinePrecision] * N[(D * -0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision] * N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \frac{h}{\ell} \cdot -0.5\\
\mathbf{if}\;h \leq 2.2 \cdot 10^{-286}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 + {\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot t_0\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left({\left(\frac{M}{d} \cdot \left(D \cdot -0.5\right)\right)}^{2}, t_0, 1\right) \cdot \frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if h < 2.1999999999999999e-286Initial program 61.8%
Simplified61.8%
fma-udef61.8%
*-commutative61.8%
*-un-lft-identity61.8%
times-frac61.8%
metadata-eval61.8%
*-commutative61.8%
Applied egg-rr61.8%
if 2.1999999999999999e-286 < h Initial program 66.9%
Simplified67.0%
expm1-log1p-u34.3%
expm1-udef23.3%
Applied egg-rr28.7%
expm1-def45.0%
expm1-log1p82.8%
associate-/r*81.8%
associate-*r*81.8%
Simplified81.8%
Final simplification72.7%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d -6.7e-136)
(* (sqrt (/ d h)) (/ (sqrt (- d)) (sqrt (- l))))
(if (<= d -5e-310)
(* d (log (exp (pow (* h l) -0.5))))
(*
(/ (/ d (sqrt l)) (sqrt h))
(- 1.0 (* 0.5 (* (/ h l) (pow (* M (* 0.5 (/ D d))) 2.0))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -6.7e-136) {
tmp = sqrt((d / h)) * (sqrt(-d) / sqrt(-l));
} else if (d <= -5e-310) {
tmp = d * log(exp(pow((h * l), -0.5)));
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (d <= (-6.7d-136)) then
tmp = sqrt((d / h)) * (sqrt(-d) / sqrt(-l))
else if (d <= (-5d-310)) then
tmp = d * log(exp(((h * l) ** (-0.5d0))))
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0d0 - (0.5d0 * ((h / l) * ((m * (0.5d0 * (d_1 / d))) ** 2.0d0))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -6.7e-136) {
tmp = Math.sqrt((d / h)) * (Math.sqrt(-d) / Math.sqrt(-l));
} else if (d <= -5e-310) {
tmp = d * Math.log(Math.exp(Math.pow((h * l), -0.5)));
} else {
tmp = ((d / Math.sqrt(l)) / Math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * Math.pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= -6.7e-136: tmp = math.sqrt((d / h)) * (math.sqrt(-d) / math.sqrt(-l)) elif d <= -5e-310: tmp = d * math.log(math.exp(math.pow((h * l), -0.5))) else: tmp = ((d / math.sqrt(l)) / math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * math.pow((M * (0.5 * (D / d))), 2.0)))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -6.7e-136) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))); elseif (d <= -5e-310) tmp = Float64(d * log(exp((Float64(h * l) ^ -0.5)))); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= -6.7e-136)
tmp = sqrt((d / h)) * (sqrt(-d) / sqrt(-l));
elseif (d <= -5e-310)
tmp = d * log(exp(((h * l) ^ -0.5)));
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * ((M * (0.5 * (D / d))) ^ 2.0))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -6.7e-136], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Log[N[Exp[N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -6.7 \cdot 10^{-136}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \log \left(e^{{\left(h \cdot \ell\right)}^{-0.5}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if d < -6.6999999999999998e-136Initial program 70.1%
Simplified71.3%
Taylor expanded in M around 0 47.3%
frac-2neg72.5%
sqrt-div80.0%
Applied egg-rr56.2%
if -6.6999999999999998e-136 < d < -4.999999999999985e-310Initial program 46.1%
add-sqr-sqrt46.0%
pow246.0%
Applied egg-rr44.2%
Taylor expanded in d around inf 11.2%
unpow1/211.2%
metadata-eval11.2%
pow-sqr11.2%
pow-sqr11.2%
metadata-eval11.2%
unpow1/211.2%
unpow-111.2%
sqr-pow11.2%
rem-sqrt-square11.2%
metadata-eval11.2%
sqr-pow11.2%
fabs-sqr11.2%
sqr-pow11.2%
Simplified11.2%
add-log-exp28.6%
Applied egg-rr28.6%
if -4.999999999999985e-310 < d Initial program 66.6%
Applied egg-rr28.5%
expm1-def44.1%
expm1-log1p80.6%
associate-/r*80.1%
associate-*r*80.1%
*-commutative80.1%
associate-*l*80.1%
Simplified80.1%
Final simplification65.5%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= h 2.2e-286)
(*
(sqrt (/ d h))
(*
(- 1.0 (* 0.5 (* (pow (* (/ M 2.0) (/ D d)) 2.0) (/ h l))))
(sqrt (/ d l))))
(*
(/ (/ d (sqrt l)) (sqrt h))
(- 1.0 (* 0.5 (* (/ h l) (pow (* M (* 0.5 (/ D d))) 2.0)))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 2.2e-286) {
tmp = sqrt((d / h)) * ((1.0 - (0.5 * (pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) * sqrt((d / l)));
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (h <= 2.2d-286) then
tmp = sqrt((d / h)) * ((1.0d0 - (0.5d0 * ((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (h / l)))) * sqrt((d / l)))
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0d0 - (0.5d0 * ((h / l) * ((m * (0.5d0 * (d_1 / d))) ** 2.0d0))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 2.2e-286) {
tmp = Math.sqrt((d / h)) * ((1.0 - (0.5 * (Math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) * Math.sqrt((d / l)));
} else {
tmp = ((d / Math.sqrt(l)) / Math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * Math.pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if h <= 2.2e-286: tmp = math.sqrt((d / h)) * ((1.0 - (0.5 * (math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))) * math.sqrt((d / l))) else: tmp = ((d / math.sqrt(l)) / math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * math.pow((M * (0.5 * (D / d))), 2.0)))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= 2.2e-286) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(h / l)))) * sqrt(Float64(d / l)))); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (h <= 2.2e-286)
tmp = sqrt((d / h)) * ((1.0 - (0.5 * ((((M / 2.0) * (D / d)) ^ 2.0) * (h / l)))) * sqrt((d / l)));
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * ((M * (0.5 * (D / d))) ^ 2.0))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, 2.2e-286], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq 2.2 \cdot 10^{-286}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if h < 2.1999999999999999e-286Initial program 61.8%
Simplified61.8%
if 2.1999999999999999e-286 < h Initial program 66.9%
Applied egg-rr28.4%
expm1-def43.6%
expm1-log1p81.4%
associate-/r*80.8%
associate-*r*80.8%
*-commutative80.8%
associate-*l*80.8%
Simplified80.8%
Final simplification72.2%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= h 1.25e-281)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(- 1.0 (* 0.5 (* (/ h l) (pow (/ D (* d (/ 2.0 M))) 2.0))))))
(*
(/ (/ d (sqrt l)) (sqrt h))
(- 1.0 (* 0.5 (* (/ h l) (pow (* M (* 0.5 (/ D d))) 2.0)))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 1.25e-281) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * pow((D / (d * (2.0 / M))), 2.0)))));
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (h <= 1.25d-281) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * ((h / l) * ((d_1 / (d * (2.0d0 / m))) ** 2.0d0)))))
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0d0 - (0.5d0 * ((h / l) * ((m * (0.5d0 * (d_1 / d))) ** 2.0d0))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 1.25e-281) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * Math.pow((D / (d * (2.0 / M))), 2.0)))));
} else {
tmp = ((d / Math.sqrt(l)) / Math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * Math.pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if h <= 1.25e-281: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * math.pow((D / (d * (2.0 / M))), 2.0))))) else: tmp = ((d / math.sqrt(l)) / math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * math.pow((M * (0.5 * (D / d))), 2.0)))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= 1.25e-281) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(D / Float64(d * Float64(2.0 / M))) ^ 2.0)))))); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (h <= 1.25e-281)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * ((D / (d * (2.0 / M))) ^ 2.0)))));
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * ((M * (0.5 * (D / d))) ^ 2.0))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, 1.25e-281], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D / N[(d * N[(2.0 / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq 1.25 \cdot 10^{-281}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d \cdot \frac{2}{M}}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if h < 1.2499999999999999e-281Initial program 62.1%
Simplified62.1%
clear-num62.1%
frac-times61.3%
*-un-lft-identity61.3%
Applied egg-rr61.3%
if 1.2499999999999999e-281 < h Initial program 66.7%
Applied egg-rr28.6%
expm1-def43.9%
expm1-log1p81.3%
associate-/r*80.7%
associate-*r*80.7%
*-commutative80.7%
associate-*l*80.7%
Simplified80.7%
Final simplification71.8%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= h 3.3e-282)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(+ 1.0 (* (pow (* D (* -0.5 (/ M d))) 2.0) (* (/ h l) -0.5))))
(*
(/ (/ d (sqrt l)) (sqrt h))
(- 1.0 (* 0.5 (* (/ h l) (pow (* M (* 0.5 (/ D d))) 2.0)))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 3.3e-282) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 + (pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (h <= 3.3d-282) then
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0d0 + (((d_1 * ((-0.5d0) * (m / d))) ** 2.0d0) * ((h / l) * (-0.5d0))))
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0d0 - (0.5d0 * ((h / l) * ((m * (0.5d0 * (d_1 / d))) ** 2.0d0))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 3.3e-282) {
tmp = (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 + (Math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
} else {
tmp = ((d / Math.sqrt(l)) / Math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * Math.pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if h <= 3.3e-282: tmp = (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 + (math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5))) else: tmp = ((d / math.sqrt(l)) / math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * math.pow((M * (0.5 * (D / d))), 2.0)))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= 3.3e-282) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 + Float64((Float64(D * Float64(-0.5 * Float64(M / d))) ^ 2.0) * Float64(Float64(h / l) * -0.5)))); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (h <= 3.3e-282)
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 + (((D * (-0.5 * (M / d))) ^ 2.0) * ((h / l) * -0.5)));
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * ((M * (0.5 * (D / d))) ^ 2.0))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, 3.3e-282], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[Power[N[(D * N[(-0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq 3.3 \cdot 10^{-282}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 + {\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if h < 3.3e-282Initial program 62.1%
Simplified61.3%
fma-udef61.3%
*-commutative61.3%
*-un-lft-identity61.3%
times-frac61.3%
metadata-eval61.3%
*-commutative61.3%
Applied egg-rr61.3%
if 3.3e-282 < h Initial program 66.7%
Applied egg-rr28.6%
expm1-def43.9%
expm1-log1p81.3%
associate-/r*80.7%
associate-*r*80.7%
*-commutative80.7%
associate-*l*80.7%
Simplified80.7%
Final simplification71.8%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= h 5e-282)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(+ 1.0 (* (pow (* D (* -0.5 (/ M d))) 2.0) (* (/ h l) -0.5))))
(*
(/ d (* (sqrt l) (sqrt h)))
(- 1.0 (* (/ h l) (* 0.5 (pow (* (/ D d) (* 0.5 M)) 2.0)))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 5e-282) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 + (pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - ((h / l) * (0.5 * pow(((D / d) * (0.5 * M)), 2.0))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (h <= 5d-282) then
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0d0 + (((d_1 * ((-0.5d0) * (m / d))) ** 2.0d0) * ((h / l) * (-0.5d0))))
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 - ((h / l) * (0.5d0 * (((d_1 / d) * (0.5d0 * m)) ** 2.0d0))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 5e-282) {
tmp = (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 + (Math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 - ((h / l) * (0.5 * Math.pow(((D / d) * (0.5 * M)), 2.0))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if h <= 5e-282: tmp = (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 + (math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5))) else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 - ((h / l) * (0.5 * math.pow(((D / d) * (0.5 * M)), 2.0)))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= 5e-282) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 + Float64((Float64(D * Float64(-0.5 * Float64(M / d))) ^ 2.0) * Float64(Float64(h / l) * -0.5)))); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(D / d) * Float64(0.5 * M)) ^ 2.0))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (h <= 5e-282)
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 + (((D * (-0.5 * (M / d))) ^ 2.0) * ((h / l) * -0.5)));
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - ((h / l) * (0.5 * (((D / d) * (0.5 * M)) ^ 2.0))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, 5e-282], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[Power[N[(D * N[(-0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq 5 \cdot 10^{-282}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 + {\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if h < 5.0000000000000001e-282Initial program 62.1%
Simplified61.3%
fma-udef61.3%
*-commutative61.3%
*-un-lft-identity61.3%
times-frac61.3%
metadata-eval61.3%
*-commutative61.3%
Applied egg-rr61.3%
if 5.0000000000000001e-282 < h Initial program 66.7%
pow166.7%
Applied egg-rr81.3%
Final simplification72.1%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d -8.4e-139)
(* (sqrt (/ d h)) (/ (sqrt (- d)) (sqrt (- l))))
(if (<= d -5e-310)
(* d (log (exp (pow (* h l) -0.5))))
(* d (* (pow l -0.5) (sqrt (/ 1.0 h)))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -8.4e-139) {
tmp = sqrt((d / h)) * (sqrt(-d) / sqrt(-l));
} else if (d <= -5e-310) {
tmp = d * log(exp(pow((h * l), -0.5)));
} else {
tmp = d * (pow(l, -0.5) * sqrt((1.0 / h)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (d <= (-8.4d-139)) then
tmp = sqrt((d / h)) * (sqrt(-d) / sqrt(-l))
else if (d <= (-5d-310)) then
tmp = d * log(exp(((h * l) ** (-0.5d0))))
else
tmp = d * ((l ** (-0.5d0)) * sqrt((1.0d0 / h)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -8.4e-139) {
tmp = Math.sqrt((d / h)) * (Math.sqrt(-d) / Math.sqrt(-l));
} else if (d <= -5e-310) {
tmp = d * Math.log(Math.exp(Math.pow((h * l), -0.5)));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.sqrt((1.0 / h)));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= -8.4e-139: tmp = math.sqrt((d / h)) * (math.sqrt(-d) / math.sqrt(-l)) elif d <= -5e-310: tmp = d * math.log(math.exp(math.pow((h * l), -0.5))) else: tmp = d * (math.pow(l, -0.5) * math.sqrt((1.0 / h))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -8.4e-139) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))); elseif (d <= -5e-310) tmp = Float64(d * log(exp((Float64(h * l) ^ -0.5)))); else tmp = Float64(d * Float64((l ^ -0.5) * sqrt(Float64(1.0 / h)))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= -8.4e-139)
tmp = sqrt((d / h)) * (sqrt(-d) / sqrt(-l));
elseif (d <= -5e-310)
tmp = d * log(exp(((h * l) ^ -0.5)));
else
tmp = d * ((l ^ -0.5) * sqrt((1.0 / h)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -8.4e-139], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Log[N[Exp[N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -8.4 \cdot 10^{-139}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \log \left(e^{{\left(h \cdot \ell\right)}^{-0.5}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot \sqrt{\frac{1}{h}}\right)\\
\end{array}
\end{array}
if d < -8.40000000000000033e-139Initial program 70.1%
Simplified71.3%
Taylor expanded in M around 0 47.3%
frac-2neg72.5%
sqrt-div80.0%
Applied egg-rr56.2%
if -8.40000000000000033e-139 < d < -4.999999999999985e-310Initial program 46.1%
add-sqr-sqrt46.0%
pow246.0%
Applied egg-rr44.2%
Taylor expanded in d around inf 11.2%
unpow1/211.2%
metadata-eval11.2%
pow-sqr11.2%
pow-sqr11.2%
metadata-eval11.2%
unpow1/211.2%
unpow-111.2%
sqr-pow11.2%
rem-sqrt-square11.2%
metadata-eval11.2%
sqr-pow11.2%
fabs-sqr11.2%
sqr-pow11.2%
Simplified11.2%
add-log-exp28.6%
Applied egg-rr28.6%
if -4.999999999999985e-310 < d Initial program 66.6%
Simplified66.7%
Taylor expanded in d around inf 38.6%
*-commutative38.6%
associate-/r*39.4%
Simplified39.4%
pow1/239.4%
div-inv39.4%
metadata-eval39.4%
unpow-prod-down48.4%
metadata-eval48.4%
pow1/248.4%
inv-pow48.4%
sqrt-pow148.5%
metadata-eval48.5%
metadata-eval48.5%
Applied egg-rr48.5%
unpow1/248.5%
Simplified48.5%
Final simplification47.7%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d -4.5e-133)
(* (/ 1.0 (sqrt (/ l d))) (sqrt (/ d h)))
(if (<= d -5e-310)
(* d (log (exp (pow (* h l) -0.5))))
(* d (* (pow l -0.5) (sqrt (/ 1.0 h)))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -4.5e-133) {
tmp = (1.0 / sqrt((l / d))) * sqrt((d / h));
} else if (d <= -5e-310) {
tmp = d * log(exp(pow((h * l), -0.5)));
} else {
tmp = d * (pow(l, -0.5) * sqrt((1.0 / h)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (d <= (-4.5d-133)) then
tmp = (1.0d0 / sqrt((l / d))) * sqrt((d / h))
else if (d <= (-5d-310)) then
tmp = d * log(exp(((h * l) ** (-0.5d0))))
else
tmp = d * ((l ** (-0.5d0)) * sqrt((1.0d0 / h)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -4.5e-133) {
tmp = (1.0 / Math.sqrt((l / d))) * Math.sqrt((d / h));
} else if (d <= -5e-310) {
tmp = d * Math.log(Math.exp(Math.pow((h * l), -0.5)));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.sqrt((1.0 / h)));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= -4.5e-133: tmp = (1.0 / math.sqrt((l / d))) * math.sqrt((d / h)) elif d <= -5e-310: tmp = d * math.log(math.exp(math.pow((h * l), -0.5))) else: tmp = d * (math.pow(l, -0.5) * math.sqrt((1.0 / h))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -4.5e-133) tmp = Float64(Float64(1.0 / sqrt(Float64(l / d))) * sqrt(Float64(d / h))); elseif (d <= -5e-310) tmp = Float64(d * log(exp((Float64(h * l) ^ -0.5)))); else tmp = Float64(d * Float64((l ^ -0.5) * sqrt(Float64(1.0 / h)))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= -4.5e-133)
tmp = (1.0 / sqrt((l / d))) * sqrt((d / h));
elseif (d <= -5e-310)
tmp = d * log(exp(((h * l) ^ -0.5)));
else
tmp = d * ((l ^ -0.5) * sqrt((1.0 / h)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -4.5e-133], N[(N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Log[N[Exp[N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -4.5 \cdot 10^{-133}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \log \left(e^{{\left(h \cdot \ell\right)}^{-0.5}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot \sqrt{\frac{1}{h}}\right)\\
\end{array}
\end{array}
if d < -4.50000000000000009e-133Initial program 70.1%
Simplified71.3%
Taylor expanded in M around 0 47.3%
clear-num71.3%
sqrt-div72.5%
metadata-eval72.5%
Applied egg-rr48.5%
if -4.50000000000000009e-133 < d < -4.999999999999985e-310Initial program 46.1%
add-sqr-sqrt46.0%
pow246.0%
Applied egg-rr44.2%
Taylor expanded in d around inf 11.2%
unpow1/211.2%
metadata-eval11.2%
pow-sqr11.2%
pow-sqr11.2%
metadata-eval11.2%
unpow1/211.2%
unpow-111.2%
sqr-pow11.2%
rem-sqrt-square11.2%
metadata-eval11.2%
sqr-pow11.2%
fabs-sqr11.2%
sqr-pow11.2%
Simplified11.2%
add-log-exp28.6%
Applied egg-rr28.6%
if -4.999999999999985e-310 < d Initial program 66.6%
Simplified66.7%
Taylor expanded in d around inf 38.6%
*-commutative38.6%
associate-/r*39.4%
Simplified39.4%
pow1/239.4%
div-inv39.4%
metadata-eval39.4%
unpow-prod-down48.4%
metadata-eval48.4%
pow1/248.4%
inv-pow48.4%
sqrt-pow148.5%
metadata-eval48.5%
metadata-eval48.5%
Applied egg-rr48.5%
unpow1/248.5%
Simplified48.5%
Final simplification45.5%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d -2.35e-135)
(sqrt (/ (pow d 2.0) (* h l)))
(if (<= d -5e-310)
(* d (cbrt (pow (/ 1.0 (* h l)) 1.5)))
(* d (/ (pow l -0.5) (sqrt h))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -2.35e-135) {
tmp = sqrt((pow(d, 2.0) / (h * l)));
} else if (d <= -5e-310) {
tmp = d * cbrt(pow((1.0 / (h * l)), 1.5));
} else {
tmp = d * (pow(l, -0.5) / sqrt(h));
}
return tmp;
}
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -2.35e-135) {
tmp = Math.sqrt((Math.pow(d, 2.0) / (h * l)));
} else if (d <= -5e-310) {
tmp = d * Math.cbrt(Math.pow((1.0 / (h * l)), 1.5));
} else {
tmp = d * (Math.pow(l, -0.5) / Math.sqrt(h));
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -2.35e-135) tmp = sqrt(Float64((d ^ 2.0) / Float64(h * l))); elseif (d <= -5e-310) tmp = Float64(d * cbrt((Float64(1.0 / Float64(h * l)) ^ 1.5))); else tmp = Float64(d * Float64((l ^ -0.5) / sqrt(h))); end return tmp end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -2.35e-135], N[Sqrt[N[(N[Power[d, 2.0], $MachinePrecision] / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Power[N[Power[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.35 \cdot 10^{-135}:\\
\;\;\;\;\sqrt{\frac{{d}^{2}}{h \cdot \ell}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt[3]{{\left(\frac{1}{h \cdot \ell}\right)}^{1.5}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{\ell}^{-0.5}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -2.34999999999999988e-135Initial program 70.1%
Simplified71.3%
Taylor expanded in d around inf 9.0%
*-commutative9.0%
associate-/r*9.0%
Simplified9.0%
add-sqr-sqrt2.1%
sqrt-unprod27.8%
*-commutative27.8%
*-commutative27.8%
swap-sqr23.8%
add-sqr-sqrt23.8%
associate-/l/23.0%
pow223.0%
Applied egg-rr23.0%
associate-*l/23.0%
*-lft-identity23.0%
Simplified23.0%
if -2.34999999999999988e-135 < d < -4.999999999999985e-310Initial program 46.1%
Simplified43.7%
Taylor expanded in d around inf 11.2%
*-commutative11.2%
associate-/r*11.2%
Simplified11.2%
add-cbrt-cube16.1%
pow1/316.1%
add-sqr-sqrt16.1%
pow116.1%
pow1/216.1%
metadata-eval16.1%
pow-prod-up16.1%
associate-/l/16.1%
metadata-eval16.1%
metadata-eval16.1%
Applied egg-rr16.1%
unpow1/316.1%
Simplified16.1%
if -4.999999999999985e-310 < d Initial program 66.6%
Simplified66.7%
Taylor expanded in d around inf 38.6%
*-commutative38.6%
associate-/r*39.4%
Simplified39.4%
expm1-log1p-u38.7%
expm1-udef23.8%
sqrt-div27.4%
inv-pow27.4%
sqrt-pow127.4%
metadata-eval27.4%
Applied egg-rr27.4%
expm1-def47.5%
expm1-log1p48.5%
Simplified48.5%
Final simplification36.3%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d -2.8e-133)
(sqrt (/ (pow d 2.0) (* h l)))
(if (<= d -5e-310)
(* d (cbrt (pow (/ 1.0 (* h l)) 1.5)))
(* d (* (pow l -0.5) (sqrt (/ 1.0 h)))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -2.8e-133) {
tmp = sqrt((pow(d, 2.0) / (h * l)));
} else if (d <= -5e-310) {
tmp = d * cbrt(pow((1.0 / (h * l)), 1.5));
} else {
tmp = d * (pow(l, -0.5) * sqrt((1.0 / h)));
}
return tmp;
}
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -2.8e-133) {
tmp = Math.sqrt((Math.pow(d, 2.0) / (h * l)));
} else if (d <= -5e-310) {
tmp = d * Math.cbrt(Math.pow((1.0 / (h * l)), 1.5));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.sqrt((1.0 / h)));
}
return tmp;
}
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -2.8e-133) tmp = sqrt(Float64((d ^ 2.0) / Float64(h * l))); elseif (d <= -5e-310) tmp = Float64(d * cbrt((Float64(1.0 / Float64(h * l)) ^ 1.5))); else tmp = Float64(d * Float64((l ^ -0.5) * sqrt(Float64(1.0 / h)))); end return tmp end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -2.8e-133], N[Sqrt[N[(N[Power[d, 2.0], $MachinePrecision] / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Power[N[Power[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.8 \cdot 10^{-133}:\\
\;\;\;\;\sqrt{\frac{{d}^{2}}{h \cdot \ell}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt[3]{{\left(\frac{1}{h \cdot \ell}\right)}^{1.5}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot \sqrt{\frac{1}{h}}\right)\\
\end{array}
\end{array}
if d < -2.7999999999999999e-133Initial program 70.1%
Simplified71.3%
Taylor expanded in d around inf 9.0%
*-commutative9.0%
associate-/r*9.0%
Simplified9.0%
add-sqr-sqrt2.1%
sqrt-unprod27.8%
*-commutative27.8%
*-commutative27.8%
swap-sqr23.8%
add-sqr-sqrt23.8%
associate-/l/23.0%
pow223.0%
Applied egg-rr23.0%
associate-*l/23.0%
*-lft-identity23.0%
Simplified23.0%
if -2.7999999999999999e-133 < d < -4.999999999999985e-310Initial program 46.1%
Simplified43.7%
Taylor expanded in d around inf 11.2%
*-commutative11.2%
associate-/r*11.2%
Simplified11.2%
add-cbrt-cube16.1%
pow1/316.1%
add-sqr-sqrt16.1%
pow116.1%
pow1/216.1%
metadata-eval16.1%
pow-prod-up16.1%
associate-/l/16.1%
metadata-eval16.1%
metadata-eval16.1%
Applied egg-rr16.1%
unpow1/316.1%
Simplified16.1%
if -4.999999999999985e-310 < d Initial program 66.6%
Simplified66.7%
Taylor expanded in d around inf 38.6%
*-commutative38.6%
associate-/r*39.4%
Simplified39.4%
pow1/239.4%
div-inv39.4%
metadata-eval39.4%
unpow-prod-down48.4%
metadata-eval48.4%
pow1/248.4%
inv-pow48.4%
sqrt-pow148.5%
metadata-eval48.5%
metadata-eval48.5%
Applied egg-rr48.5%
unpow1/248.5%
Simplified48.5%
Final simplification36.3%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= h 3.6e-298) (* (/ 1.0 (sqrt (/ l d))) (sqrt (/ d h))) (* d (* (pow l -0.5) (sqrt (/ 1.0 h))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 3.6e-298) {
tmp = (1.0 / sqrt((l / d))) * sqrt((d / h));
} else {
tmp = d * (pow(l, -0.5) * sqrt((1.0 / h)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (h <= 3.6d-298) then
tmp = (1.0d0 / sqrt((l / d))) * sqrt((d / h))
else
tmp = d * ((l ** (-0.5d0)) * sqrt((1.0d0 / h)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 3.6e-298) {
tmp = (1.0 / Math.sqrt((l / d))) * Math.sqrt((d / h));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.sqrt((1.0 / h)));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if h <= 3.6e-298: tmp = (1.0 / math.sqrt((l / d))) * math.sqrt((d / h)) else: tmp = d * (math.pow(l, -0.5) * math.sqrt((1.0 / h))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= 3.6e-298) tmp = Float64(Float64(1.0 / sqrt(Float64(l / d))) * sqrt(Float64(d / h))); else tmp = Float64(d * Float64((l ^ -0.5) * sqrt(Float64(1.0 / h)))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (h <= 3.6e-298)
tmp = (1.0 / sqrt((l / d))) * sqrt((d / h));
else
tmp = d * ((l ^ -0.5) * sqrt((1.0 / h)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, 3.6e-298], N[(N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq 3.6 \cdot 10^{-298}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{\ell}{d}}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot \sqrt{\frac{1}{h}}\right)\\
\end{array}
\end{array}
if h < 3.60000000000000002e-298Initial program 62.3%
Simplified62.3%
Taylor expanded in M around 0 36.5%
clear-num61.7%
sqrt-div62.5%
metadata-eval62.5%
Applied egg-rr36.9%
if 3.60000000000000002e-298 < h Initial program 66.4%
Simplified66.5%
Taylor expanded in d around inf 38.8%
*-commutative38.8%
associate-/r*39.6%
Simplified39.6%
pow1/239.6%
div-inv39.6%
metadata-eval39.6%
unpow-prod-down48.1%
metadata-eval48.1%
pow1/248.1%
inv-pow48.1%
sqrt-pow148.1%
metadata-eval48.1%
metadata-eval48.1%
Applied egg-rr48.1%
unpow1/248.1%
Simplified48.1%
Final simplification43.2%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= h 3.6e-298) (* (sqrt (/ d h)) (sqrt (/ d l))) (* d (* (pow l -0.5) (sqrt (/ 1.0 h))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 3.6e-298) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = d * (pow(l, -0.5) * sqrt((1.0 / h)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (h <= 3.6d-298) then
tmp = sqrt((d / h)) * sqrt((d / l))
else
tmp = d * ((l ** (-0.5d0)) * sqrt((1.0d0 / h)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 3.6e-298) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.sqrt((1.0 / h)));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if h <= 3.6e-298: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) else: tmp = d * (math.pow(l, -0.5) * math.sqrt((1.0 / h))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= 3.6e-298) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = Float64(d * Float64((l ^ -0.5) * sqrt(Float64(1.0 / h)))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (h <= 3.6e-298)
tmp = sqrt((d / h)) * sqrt((d / l));
else
tmp = d * ((l ^ -0.5) * sqrt((1.0 / h)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, 3.6e-298], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq 3.6 \cdot 10^{-298}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot \sqrt{\frac{1}{h}}\right)\\
\end{array}
\end{array}
if h < 3.60000000000000002e-298Initial program 62.3%
Simplified62.3%
Taylor expanded in M around 0 36.5%
if 3.60000000000000002e-298 < h Initial program 66.4%
Simplified66.5%
Taylor expanded in d around inf 38.8%
*-commutative38.8%
associate-/r*39.6%
Simplified39.6%
pow1/239.6%
div-inv39.6%
metadata-eval39.6%
unpow-prod-down48.1%
metadata-eval48.1%
pow1/248.1%
inv-pow48.1%
sqrt-pow148.1%
metadata-eval48.1%
metadata-eval48.1%
Applied egg-rr48.1%
unpow1/248.1%
Simplified48.1%
Final simplification43.0%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= d -2.45e-138) (sqrt (/ (pow d 2.0) (* h l))) (* d (sqrt (/ (/ 1.0 l) h)))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -2.45e-138) {
tmp = sqrt((pow(d, 2.0) / (h * l)));
} else {
tmp = d * sqrt(((1.0 / l) / h));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (d <= (-2.45d-138)) then
tmp = sqrt(((d ** 2.0d0) / (h * l)))
else
tmp = d * sqrt(((1.0d0 / l) / h))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -2.45e-138) {
tmp = Math.sqrt((Math.pow(d, 2.0) / (h * l)));
} else {
tmp = d * Math.sqrt(((1.0 / l) / h));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= -2.45e-138: tmp = math.sqrt((math.pow(d, 2.0) / (h * l))) else: tmp = d * math.sqrt(((1.0 / l) / h)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -2.45e-138) tmp = sqrt(Float64((d ^ 2.0) / Float64(h * l))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= -2.45e-138)
tmp = sqrt(((d ^ 2.0) / (h * l)));
else
tmp = d * sqrt(((1.0 / l) / h));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -2.45e-138], N[Sqrt[N[(N[Power[d, 2.0], $MachinePrecision] / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.45 \cdot 10^{-138}:\\
\;\;\;\;\sqrt{\frac{{d}^{2}}{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\end{array}
\end{array}
if d < -2.45000000000000008e-138Initial program 70.1%
Simplified71.3%
Taylor expanded in d around inf 9.0%
*-commutative9.0%
associate-/r*9.0%
Simplified9.0%
add-sqr-sqrt2.1%
sqrt-unprod27.8%
*-commutative27.8%
*-commutative27.8%
swap-sqr23.8%
add-sqr-sqrt23.8%
associate-/l/23.0%
pow223.0%
Applied egg-rr23.0%
associate-*l/23.0%
*-lft-identity23.0%
Simplified23.0%
if -2.45000000000000008e-138 < d Initial program 62.3%
Simplified61.9%
Taylor expanded in d around inf 32.9%
*-commutative32.9%
associate-/r*33.5%
Simplified33.5%
Final simplification30.5%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= d 2.9e-297) (sqrt (/ (pow d 2.0) (* h l))) (* d (/ (pow l -0.5) (sqrt h)))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 2.9e-297) {
tmp = sqrt((pow(d, 2.0) / (h * l)));
} else {
tmp = d * (pow(l, -0.5) / sqrt(h));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (d <= 2.9d-297) then
tmp = sqrt(((d ** 2.0d0) / (h * l)))
else
tmp = d * ((l ** (-0.5d0)) / sqrt(h))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 2.9e-297) {
tmp = Math.sqrt((Math.pow(d, 2.0) / (h * l)));
} else {
tmp = d * (Math.pow(l, -0.5) / Math.sqrt(h));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= 2.9e-297: tmp = math.sqrt((math.pow(d, 2.0) / (h * l))) else: tmp = d * (math.pow(l, -0.5) / math.sqrt(h)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= 2.9e-297) tmp = sqrt(Float64((d ^ 2.0) / Float64(h * l))); else tmp = Float64(d * Float64((l ^ -0.5) / sqrt(h))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= 2.9e-297)
tmp = sqrt(((d ^ 2.0) / (h * l)));
else
tmp = d * ((l ^ -0.5) / sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, 2.9e-297], N[Sqrt[N[(N[Power[d, 2.0], $MachinePrecision] / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 2.9 \cdot 10^{-297}:\\
\;\;\;\;\sqrt{\frac{{d}^{2}}{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{\ell}^{-0.5}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < 2.89999999999999989e-297Initial program 62.4%
Simplified62.4%
Taylor expanded in d around inf 10.3%
*-commutative10.3%
associate-/r*10.3%
Simplified10.3%
add-sqr-sqrt3.3%
sqrt-unprod21.2%
*-commutative21.2%
*-commutative21.2%
swap-sqr17.8%
add-sqr-sqrt17.8%
associate-/l/17.3%
pow217.3%
Applied egg-rr17.3%
associate-*l/17.3%
*-lft-identity17.3%
Simplified17.3%
if 2.89999999999999989e-297 < d Initial program 66.4%
Simplified66.5%
Taylor expanded in d around inf 39.0%
*-commutative39.0%
associate-/r*39.8%
Simplified39.8%
expm1-log1p-u39.1%
expm1-udef23.8%
sqrt-div27.5%
inv-pow27.5%
sqrt-pow127.5%
metadata-eval27.5%
Applied egg-rr27.5%
expm1-def48.1%
expm1-log1p49.1%
Simplified49.1%
Final simplification34.7%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (* d (sqrt (/ (/ 1.0 l) h))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * sqrt(((1.0 / l) / h));
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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 * sqrt(((1.0d0 / l) / h))
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d * Math.sqrt(((1.0 / l) / h));
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.sqrt(((1.0 / l) / h))
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * sqrt(((1.0 / l) / h));
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}
\end{array}
Initial program 64.6%
Simplified64.6%
Taylor expanded in d around inf 26.0%
*-commutative26.0%
associate-/r*26.4%
Simplified26.4%
Final simplification26.4%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (* d (pow (* h l) -0.5)))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * pow((h * l), -0.5);
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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 * l) ** (-0.5d0))
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d * Math.pow((h * l), -0.5);
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.pow((h * l), -0.5)
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * (Float64(h * l) ^ -0.5)) end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * ((h * l) ^ -0.5);
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot {\left(h \cdot \ell\right)}^{-0.5}
\end{array}
Initial program 64.6%
add-sqr-sqrt64.6%
pow264.6%
Applied egg-rr66.1%
Taylor expanded in d around inf 26.0%
unpow1/226.0%
metadata-eval26.0%
pow-sqr26.0%
pow-sqr26.0%
metadata-eval26.0%
unpow1/226.0%
unpow-126.0%
sqr-pow26.0%
rem-sqrt-square26.1%
metadata-eval26.1%
sqr-pow26.1%
fabs-sqr26.1%
sqr-pow26.1%
Simplified26.1%
Final simplification26.1%
herbie shell --seed 2023298
(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)))))