
(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 14 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: d, h, l, 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) (sqrt l)))
(t_1
(-
1.0
(*
(/ (* (* (/ D d) M) 0.5) l)
(* 0.5 (* (* (* 0.5 (/ D d)) M) h))))))
(if (<= d -5e-310)
(* (* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l))) t_1)
(if (<= d 7.8e-116)
(/
(*
(* (fma (* -0.5 (/ h l)) (pow (/ (* d 2.0) (* M D)) -2.0) 1.0) t_0)
(sqrt d))
(sqrt h))
(* (* (pow (/ d h) (pow 2.0 -1.0)) t_0) t_1)))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(d) / sqrt(l);
double t_1 = 1.0 - (((((D / d) * M) * 0.5) / l) * (0.5 * (((0.5 * (D / d)) * M) * h)));
double tmp;
if (d <= -5e-310) {
tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * t_1;
} else if (d <= 7.8e-116) {
tmp = ((fma((-0.5 * (h / l)), pow(((d * 2.0) / (M * D)), -2.0), 1.0) * t_0) * sqrt(d)) / sqrt(h);
} else {
tmp = (pow((d / h), pow(2.0, -1.0)) * t_0) * t_1;
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(d) / sqrt(l)) t_1 = Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D / d) * M) * 0.5) / l) * Float64(0.5 * Float64(Float64(Float64(0.5 * Float64(D / d)) * M) * h)))) tmp = 0.0 if (d <= -5e-310) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))) * t_1); elseif (d <= 7.8e-116) tmp = Float64(Float64(Float64(fma(Float64(-0.5 * Float64(h / l)), (Float64(Float64(d * 2.0) / Float64(M * D)) ^ -2.0), 1.0) * t_0) * sqrt(d)) / sqrt(h)); else tmp = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * t_0) * t_1); end return tmp end
NOTE: d, h, l, 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[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(N[(N[(N[(N[(D / d), $MachinePrecision] * M), $MachinePrecision] * 0.5), $MachinePrecision] / l), $MachinePrecision] * N[(0.5 * N[(N[(N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -5e-310], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[d, 7.8e-116], N[(N[(N[(N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(d * 2.0), $MachinePrecision] / N[(M * D), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \frac{\sqrt{d}}{\sqrt{\ell}}\\
t_1 := 1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\\
\mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot t\_1\\
\mathbf{elif}\;d \leq 7.8 \cdot 10^{-116}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, {\left(\frac{d \cdot 2}{M \cdot D}\right)}^{-2}, 1\right) \cdot t\_0\right) \cdot \sqrt{d}}{\sqrt{h}}\\
\mathbf{else}:\\
\;\;\;\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot t\_0\right) \cdot t\_1\\
\end{array}
\end{array}
if d < -4.999999999999985e-310Initial program 70.0%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites68.0%
lift-/.f64N/A
div-invN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-pow.f64N/A
unpow-1N/A
remove-double-divN/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
div-invN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.7%
lift-/.f64N/A
metadata-eval69.7
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6469.7
Applied rewrites69.7%
lift-/.f64N/A
metadata-eval69.7
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6480.8
Applied rewrites80.8%
if -4.999999999999985e-310 < d < 7.8000000000000001e-116Initial program 35.3%
Applied rewrites53.0%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6453.1
Applied rewrites53.1%
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f6468.1
Applied rewrites68.1%
if 7.8000000000000001e-116 < d Initial program 77.5%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites86.4%
lift-/.f64N/A
div-invN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-pow.f64N/A
unpow-1N/A
remove-double-divN/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
div-invN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites87.4%
lift-/.f64N/A
metadata-eval87.4
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
pow1/2N/A
lower-/.f64N/A
pow1/2N/A
lower-sqrt.f6492.9
Applied rewrites92.9%
Final simplification83.5%
NOTE: d, h, l, 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 l))) (t_1 (* (/ D d) M)))
(if (<= d -5e-310)
(*
(* (/ (sqrt (- d)) (sqrt (- h))) t_0)
(- 1.0 (* (/ (* t_1 0.5) l) (* 0.5 (* (* (* 0.5 (/ D d)) M) h)))))
(if (<= d 6.8e-164)
(/
(*
(*
(fma (* -0.5 (/ h l)) (pow (/ (* d 2.0) (* M D)) -2.0) 1.0)
(/ (sqrt d) (sqrt l)))
(sqrt d))
(sqrt h))
(/
(*
(* (fma (* (/ (* t_1 -0.5) l) (* (/ M d) (* 0.25 D))) h 1.0) t_0)
(sqrt d))
(sqrt h))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = (D / d) * M;
double tmp;
if (d <= -5e-310) {
tmp = ((sqrt(-d) / sqrt(-h)) * t_0) * (1.0 - (((t_1 * 0.5) / l) * (0.5 * (((0.5 * (D / d)) * M) * h))));
} else if (d <= 6.8e-164) {
tmp = ((fma((-0.5 * (h / l)), pow(((d * 2.0) / (M * D)), -2.0), 1.0) * (sqrt(d) / sqrt(l))) * sqrt(d)) / sqrt(h);
} else {
tmp = ((fma((((t_1 * -0.5) / l) * ((M / d) * (0.25 * D))), h, 1.0) * t_0) * sqrt(d)) / sqrt(h);
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(Float64(D / d) * M) tmp = 0.0 if (d <= -5e-310) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0) * Float64(1.0 - Float64(Float64(Float64(t_1 * 0.5) / l) * Float64(0.5 * Float64(Float64(Float64(0.5 * Float64(D / d)) * M) * h))))); elseif (d <= 6.8e-164) tmp = Float64(Float64(Float64(fma(Float64(-0.5 * Float64(h / l)), (Float64(Float64(d * 2.0) / Float64(M * D)) ^ -2.0), 1.0) * Float64(sqrt(d) / sqrt(l))) * sqrt(d)) / sqrt(h)); else tmp = Float64(Float64(Float64(fma(Float64(Float64(Float64(t_1 * -0.5) / l) * Float64(Float64(M / d) * Float64(0.25 * D))), h, 1.0) * t_0) * sqrt(d)) / sqrt(h)); end return tmp end
NOTE: d, h, l, 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[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(D / d), $MachinePrecision] * M), $MachinePrecision]}, If[LessEqual[d, -5e-310], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(N[(t$95$1 * 0.5), $MachinePrecision] / l), $MachinePrecision] * N[(0.5 * N[(N[(N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6.8e-164], N[(N[(N[(N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(d * 2.0), $MachinePrecision] / N[(M * D), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(N[(t$95$1 * -0.5), $MachinePrecision] / l), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(0.25 * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \frac{D}{d} \cdot M\\
\mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_0\right) \cdot \left(1 - \frac{t\_1 \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right)\\
\mathbf{elif}\;d \leq 6.8 \cdot 10^{-164}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, {\left(\frac{d \cdot 2}{M \cdot D}\right)}^{-2}, 1\right) \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot \sqrt{d}}{\sqrt{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{t\_1 \cdot -0.5}{\ell} \cdot \left(\frac{M}{d} \cdot \left(0.25 \cdot D\right)\right), h, 1\right) \cdot t\_0\right) \cdot \sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -4.999999999999985e-310Initial program 70.0%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites68.0%
lift-/.f64N/A
div-invN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-pow.f64N/A
unpow-1N/A
remove-double-divN/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
div-invN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.7%
lift-/.f64N/A
metadata-eval69.7
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6469.7
Applied rewrites69.7%
lift-/.f64N/A
metadata-eval69.7
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6480.8
Applied rewrites80.8%
if -4.999999999999985e-310 < d < 6.8e-164Initial program 29.4%
Applied rewrites47.8%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6447.9
Applied rewrites47.9%
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f6467.0
Applied rewrites67.0%
if 6.8e-164 < d Initial program 76.0%
Applied rewrites79.1%
Applied rewrites87.2%
NOTE: d, h, l, 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 l))) (t_1 (* (/ D d) M)))
(if (<= h -4e-310)
(*
(* (/ (sqrt (- d)) (sqrt (- h))) t_0)
(- 1.0 (* (/ (* t_1 0.5) l) (* 0.5 (* (* (* 0.5 (/ D d)) M) h)))))
(/
(*
(* (fma (/ (* t_1 -0.5) l) (* (* (/ M d) h) (* 0.25 D)) 1.0) t_0)
(sqrt d))
(sqrt h)))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = (D / d) * M;
double tmp;
if (h <= -4e-310) {
tmp = ((sqrt(-d) / sqrt(-h)) * t_0) * (1.0 - (((t_1 * 0.5) / l) * (0.5 * (((0.5 * (D / d)) * M) * h))));
} else {
tmp = ((fma(((t_1 * -0.5) / l), (((M / d) * h) * (0.25 * D)), 1.0) * t_0) * sqrt(d)) / sqrt(h);
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(Float64(D / d) * M) tmp = 0.0 if (h <= -4e-310) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0) * Float64(1.0 - Float64(Float64(Float64(t_1 * 0.5) / l) * Float64(0.5 * Float64(Float64(Float64(0.5 * Float64(D / d)) * M) * h))))); else tmp = Float64(Float64(Float64(fma(Float64(Float64(t_1 * -0.5) / l), Float64(Float64(Float64(M / d) * h) * Float64(0.25 * D)), 1.0) * t_0) * sqrt(d)) / sqrt(h)); end return tmp end
NOTE: d, h, l, 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[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(D / d), $MachinePrecision] * M), $MachinePrecision]}, If[LessEqual[h, -4e-310], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(N[(t$95$1 * 0.5), $MachinePrecision] / l), $MachinePrecision] * N[(0.5 * N[(N[(N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(t$95$1 * -0.5), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(M / d), $MachinePrecision] * h), $MachinePrecision] * N[(0.25 * D), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \frac{D}{d} \cdot M\\
\mathbf{if}\;h \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_0\right) \cdot \left(1 - \frac{t\_1 \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{t\_1 \cdot -0.5}{\ell}, \left(\frac{M}{d} \cdot h\right) \cdot \left(0.25 \cdot D\right), 1\right) \cdot t\_0\right) \cdot \sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if h < -3.999999999999988e-310Initial program 70.0%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites68.0%
lift-/.f64N/A
div-invN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-pow.f64N/A
unpow-1N/A
remove-double-divN/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
div-invN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.7%
lift-/.f64N/A
metadata-eval69.7
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6469.7
Applied rewrites69.7%
lift-/.f64N/A
metadata-eval69.7
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6480.8
Applied rewrites80.8%
if -3.999999999999988e-310 < h Initial program 66.3%
Applied rewrites72.6%
Applied rewrites78.1%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* M (* (/ D d) 0.5))))
(if (<= h -4e-310)
(/
(*
(* (fma (* (* (/ h l) -0.5) t_0) t_0 1.0) (sqrt (/ d h)))
(sqrt (- d)))
(sqrt (- l)))
(/
(*
(*
(fma (/ (* (* (/ D d) M) -0.5) l) (* (* (/ M d) h) (* 0.25 D)) 1.0)
(sqrt (/ d l)))
(sqrt d))
(sqrt h)))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = M * ((D / d) * 0.5);
double tmp;
if (h <= -4e-310) {
tmp = ((fma((((h / l) * -0.5) * t_0), t_0, 1.0) * sqrt((d / h))) * sqrt(-d)) / sqrt(-l);
} else {
tmp = ((fma(((((D / d) * M) * -0.5) / l), (((M / d) * h) * (0.25 * D)), 1.0) * sqrt((d / l))) * sqrt(d)) / sqrt(h);
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(M * Float64(Float64(D / d) * 0.5)) tmp = 0.0 if (h <= -4e-310) tmp = Float64(Float64(Float64(fma(Float64(Float64(Float64(h / l) * -0.5) * t_0), t_0, 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(-d))) / sqrt(Float64(-l))); else tmp = Float64(Float64(Float64(fma(Float64(Float64(Float64(Float64(D / d) * M) * -0.5) / l), Float64(Float64(Float64(M / d) * h) * Float64(0.25 * D)), 1.0) * sqrt(Float64(d / l))) * sqrt(d)) / sqrt(h)); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(M * N[(N[(D / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -4e-310], N[(N[(N[(N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(N[(N[(D / d), $MachinePrecision] * M), $MachinePrecision] * -0.5), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(M / d), $MachinePrecision] * h), $MachinePrecision] * N[(0.25 * D), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := M \cdot \left(\frac{D}{d} \cdot 0.5\right)\\
\mathbf{if}\;h \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\left(\frac{h}{\ell} \cdot -0.5\right) \cdot t\_0, t\_0, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{\left(\frac{D}{d} \cdot M\right) \cdot -0.5}{\ell}, \left(\frac{M}{d} \cdot h\right) \cdot \left(0.25 \cdot D\right), 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if h < -3.999999999999988e-310Initial program 70.0%
Applied rewrites71.3%
lift-fma.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow-powN/A
inv-powN/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
clear-numN/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites71.3%
if -3.999999999999988e-310 < h Initial program 66.3%
Applied rewrites72.6%
Applied rewrites78.1%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ D d) M)) (t_1 (sqrt (/ d l))))
(if (<= l 3.6e-161)
(*
(* (sqrt (/ d h)) t_1)
(- 1.0 (* (/ (* t_0 0.5) l) (* 0.5 (* (* (* 0.5 (/ D d)) M) h)))))
(/
(*
(* (fma (/ (* t_0 -0.5) l) (* (* (/ M d) h) (* 0.25 D)) 1.0) t_1)
(sqrt d))
(sqrt h)))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (D / d) * M;
double t_1 = sqrt((d / l));
double tmp;
if (l <= 3.6e-161) {
tmp = (sqrt((d / h)) * t_1) * (1.0 - (((t_0 * 0.5) / l) * (0.5 * (((0.5 * (D / d)) * M) * h))));
} else {
tmp = ((fma(((t_0 * -0.5) / l), (((M / d) * h) * (0.25 * D)), 1.0) * t_1) * sqrt(d)) / sqrt(h);
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(D / d) * M) t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= 3.6e-161) tmp = Float64(Float64(sqrt(Float64(d / h)) * t_1) * Float64(1.0 - Float64(Float64(Float64(t_0 * 0.5) / l) * Float64(0.5 * Float64(Float64(Float64(0.5 * Float64(D / d)) * M) * h))))); else tmp = Float64(Float64(Float64(fma(Float64(Float64(t_0 * -0.5) / l), Float64(Float64(Float64(M / d) * h) * Float64(0.25 * D)), 1.0) * t_1) * sqrt(d)) / sqrt(h)); end return tmp end
NOTE: d, h, l, 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[(D / d), $MachinePrecision] * M), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, 3.6e-161], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision] * N[(1.0 - N[(N[(N[(t$95$0 * 0.5), $MachinePrecision] / l), $MachinePrecision] * N[(0.5 * N[(N[(N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(t$95$0 * -0.5), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(M / d), $MachinePrecision] * h), $MachinePrecision] * N[(0.25 * D), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \frac{D}{d} \cdot M\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq 3.6 \cdot 10^{-161}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot t\_1\right) \cdot \left(1 - \frac{t\_0 \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{t\_0 \cdot -0.5}{\ell}, \left(\frac{M}{d} \cdot h\right) \cdot \left(0.25 \cdot D\right), 1\right) \cdot t\_1\right) \cdot \sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < 3.60000000000000018e-161Initial program 68.6%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites70.2%
lift-/.f64N/A
div-invN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-pow.f64N/A
unpow-1N/A
remove-double-divN/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
div-invN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites72.2%
lift-/.f64N/A
metadata-eval72.2
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6472.2
Applied rewrites72.2%
lift-/.f64N/A
metadata-eval72.2
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6472.2
Applied rewrites72.2%
if 3.60000000000000018e-161 < l Initial program 67.6%
Applied rewrites74.9%
Applied rewrites77.9%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ D d) M)) (t_1 (sqrt (/ d l))))
(if (<= l 4.8e-164)
(*
(* (sqrt (/ d h)) t_1)
(- 1.0 (* (/ (* t_0 0.5) l) (* 0.5 (* (* (* 0.5 (/ D d)) M) h)))))
(/
(*
(* (fma (* (/ (* t_0 -0.5) l) (* (/ M d) (* 0.25 D))) h 1.0) t_1)
(sqrt d))
(sqrt h)))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (D / d) * M;
double t_1 = sqrt((d / l));
double tmp;
if (l <= 4.8e-164) {
tmp = (sqrt((d / h)) * t_1) * (1.0 - (((t_0 * 0.5) / l) * (0.5 * (((0.5 * (D / d)) * M) * h))));
} else {
tmp = ((fma((((t_0 * -0.5) / l) * ((M / d) * (0.25 * D))), h, 1.0) * t_1) * sqrt(d)) / sqrt(h);
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(D / d) * M) t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= 4.8e-164) tmp = Float64(Float64(sqrt(Float64(d / h)) * t_1) * Float64(1.0 - Float64(Float64(Float64(t_0 * 0.5) / l) * Float64(0.5 * Float64(Float64(Float64(0.5 * Float64(D / d)) * M) * h))))); else tmp = Float64(Float64(Float64(fma(Float64(Float64(Float64(t_0 * -0.5) / l) * Float64(Float64(M / d) * Float64(0.25 * D))), h, 1.0) * t_1) * sqrt(d)) / sqrt(h)); end return tmp end
NOTE: d, h, l, 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[(D / d), $MachinePrecision] * M), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, 4.8e-164], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision] * N[(1.0 - N[(N[(N[(t$95$0 * 0.5), $MachinePrecision] / l), $MachinePrecision] * N[(0.5 * N[(N[(N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(N[(t$95$0 * -0.5), $MachinePrecision] / l), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(0.25 * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \frac{D}{d} \cdot M\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq 4.8 \cdot 10^{-164}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot t\_1\right) \cdot \left(1 - \frac{t\_0 \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{t\_0 \cdot -0.5}{\ell} \cdot \left(\frac{M}{d} \cdot \left(0.25 \cdot D\right)\right), h, 1\right) \cdot t\_1\right) \cdot \sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < 4.79999999999999966e-164Initial program 68.4%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites70.0%
lift-/.f64N/A
div-invN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-pow.f64N/A
unpow-1N/A
remove-double-divN/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
div-invN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites72.0%
lift-/.f64N/A
metadata-eval72.0
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6472.0
Applied rewrites72.0%
lift-/.f64N/A
metadata-eval72.0
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6472.0
Applied rewrites72.0%
if 4.79999999999999966e-164 < l Initial program 67.9%
Applied rewrites75.2%
Applied rewrites77.2%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -6.6e-164)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= l -5e-310)
(/ d (sqrt (* h (/ (* (- l) l) l))))
(if (<= l 2.15e+77)
(*
(/ d (sqrt (* l h)))
(fma (/ -0.125 (* l d)) (* (* h (/ (* M M) d)) (* D D)) 1.0))
(/ d (* (sqrt l) (sqrt h)))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -6.6e-164) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (l <= -5e-310) {
tmp = d / sqrt((h * ((-l * l) / l)));
} else if (l <= 2.15e+77) {
tmp = (d / sqrt((l * h))) * fma((-0.125 / (l * d)), ((h * ((M * M) / d)) * (D * D)), 1.0);
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -6.6e-164) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (l <= -5e-310) tmp = Float64(d / sqrt(Float64(h * Float64(Float64(Float64(-l) * l) / l)))); elseif (l <= 2.15e+77) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * fma(Float64(-0.125 / Float64(l * d)), Float64(Float64(h * Float64(Float64(M * M) / d)) * Float64(D * D)), 1.0)); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -6.6e-164], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(d / N[Sqrt[N[(h * N[(N[((-l) * l), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.15e+77], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(-0.125 / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(N[(M * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.6 \cdot 10^{-164}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \frac{\left(-\ell\right) \cdot \ell}{\ell}}}\\
\mathbf{elif}\;\ell \leq 2.15 \cdot 10^{+77}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{-0.125}{\ell \cdot d}, \left(h \cdot \frac{M \cdot M}{d}\right) \cdot \left(D \cdot D\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -6.6e-164Initial program 71.5%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6444.6
Applied rewrites44.6%
if -6.6e-164 < l < -4.999999999999985e-310Initial program 66.0%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6422.0
Applied rewrites22.0%
Applied rewrites22.0%
Applied rewrites8.6%
Applied rewrites66.2%
if -4.999999999999985e-310 < l < 2.14999999999999996e77Initial program 70.0%
Taylor expanded in d around 0
Applied rewrites53.1%
Applied rewrites68.0%
Taylor expanded in d around 0
div-subN/A
*-inversesN/A
associate-/l*N/A
associate-/r*N/A
*-commutativeN/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
Applied rewrites66.8%
if 2.14999999999999996e77 < l Initial program 59.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6447.7
Applied rewrites47.7%
Applied rewrites47.8%
Applied rewrites57.7%
Final simplification49.2%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -6.6e-164)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= l -5e-310)
(/ d (sqrt (* h (/ (* (- l) l) l))))
(/ d (* (sqrt l) (sqrt h))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -6.6e-164) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (l <= -5e-310) {
tmp = d / sqrt((h * ((-l * l) / l)));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
NOTE: d, h, l, 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 (l <= (-6.6d-164)) then
tmp = -d * sqrt(((l * h) ** (-1.0d0)))
else if (l <= (-5d-310)) then
tmp = d / sqrt((h * ((-l * l) / l)))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -6.6e-164) {
tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
} else if (l <= -5e-310) {
tmp = d / Math.sqrt((h * ((-l * l) / l)));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -6.6e-164: tmp = -d * math.sqrt(math.pow((l * h), -1.0)) elif l <= -5e-310: tmp = d / math.sqrt((h * ((-l * l) / l))) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -6.6e-164) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (l <= -5e-310) tmp = Float64(d / sqrt(Float64(h * Float64(Float64(Float64(-l) * l) / l)))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -6.6e-164)
tmp = -d * sqrt(((l * h) ^ -1.0));
elseif (l <= -5e-310)
tmp = d / sqrt((h * ((-l * l) / l)));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -6.6e-164], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(d / N[Sqrt[N[(h * N[(N[((-l) * l), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.6 \cdot 10^{-164}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \frac{\left(-\ell\right) \cdot \ell}{\ell}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -6.6e-164Initial program 71.5%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6444.6
Applied rewrites44.6%
if -6.6e-164 < l < -4.999999999999985e-310Initial program 66.0%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6422.0
Applied rewrites22.0%
Applied rewrites22.0%
Applied rewrites8.6%
Applied rewrites66.2%
if -4.999999999999985e-310 < l Initial program 66.3%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6444.0
Applied rewrites44.0%
Applied rewrites45.1%
Applied rewrites51.2%
Final simplification43.1%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d -3.4e-136)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= d 9.8e-287)
(/ (* (- d) (sqrt (/ h l))) h)
(/ d (* (sqrt l) (sqrt h))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -3.4e-136) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (d <= 9.8e-287) {
tmp = (-d * sqrt((h / l))) / h;
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
NOTE: d, h, l, 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 <= (-3.4d-136)) then
tmp = -d * sqrt(((l * h) ** (-1.0d0)))
else if (d <= 9.8d-287) then
tmp = (-d * sqrt((h / l))) / h
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -3.4e-136) {
tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
} else if (d <= 9.8e-287) {
tmp = (-d * Math.sqrt((h / l))) / h;
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if d <= -3.4e-136: tmp = -d * math.sqrt(math.pow((l * h), -1.0)) elif d <= 9.8e-287: tmp = (-d * math.sqrt((h / l))) / h else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -3.4e-136) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (d <= 9.8e-287) tmp = Float64(Float64(Float64(-d) * sqrt(Float64(h / l))) / h); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= -3.4e-136)
tmp = -d * sqrt(((l * h) ^ -1.0));
elseif (d <= 9.8e-287)
tmp = (-d * sqrt((h / l))) / h;
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -3.4e-136], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 9.8e-287], N[(N[((-d) * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -3.4 \cdot 10^{-136}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;d \leq 9.8 \cdot 10^{-287}:\\
\;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -3.4e-136Initial program 77.5%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6449.3
Applied rewrites49.3%
if -3.4e-136 < d < 9.8000000000000002e-287Initial program 47.4%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites41.1%
Taylor expanded in l around -inf
Applied rewrites27.6%
if 9.8000000000000002e-287 < d Initial program 68.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6444.9
Applied rewrites44.9%
Applied rewrites46.1%
Applied rewrites52.5%
Final simplification47.2%
NOTE: d, h, l, 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-305) (* (- d) (sqrt (pow (* l h) -1.0))) (/ d (* (sqrt l) (sqrt h)))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 2.8e-305) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
NOTE: d, h, l, 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.8d-305) then
tmp = -d * sqrt(((l * h) ** (-1.0d0)))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 2.8e-305) {
tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if d <= 2.8e-305: tmp = -d * math.sqrt(math.pow((l * h), -1.0)) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= 2.8e-305) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= 2.8e-305)
tmp = -d * sqrt(((l * h) ^ -1.0));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, 2.8e-305], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 2.8 \cdot 10^{-305}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < 2.80000000000000014e-305Initial program 70.3%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6440.0
Applied rewrites40.0%
if 2.80000000000000014e-305 < d Initial program 66.0%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6444.3
Applied rewrites44.3%
Applied rewrites45.5%
Applied rewrites51.6%
Final simplification45.6%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= l -2.1e-262) (* (- d) (sqrt (pow (* l h) -1.0))) (/ d (sqrt (* l h)))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2.1e-262) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else {
tmp = d / sqrt((l * h));
}
return tmp;
}
NOTE: d, h, l, 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 (l <= (-2.1d-262)) then
tmp = -d * sqrt(((l * h) ** (-1.0d0)))
else
tmp = d / sqrt((l * h))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2.1e-262) {
tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
} else {
tmp = d / Math.sqrt((l * h));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -2.1e-262: tmp = -d * math.sqrt(math.pow((l * h), -1.0)) else: tmp = d / math.sqrt((l * h)) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -2.1e-262) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); else tmp = Float64(d / sqrt(Float64(l * h))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -2.1e-262)
tmp = -d * sqrt(((l * h) ^ -1.0));
else
tmp = d / sqrt((l * h));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2.1e-262], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.1 \cdot 10^{-262}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if l < -2.1e-262Initial program 69.5%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.0
Applied rewrites42.0%
if -2.1e-262 < l Initial program 67.1%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6443.9
Applied rewrites43.9%
Applied rewrites45.0%
Final simplification43.6%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (* (* (sqrt (/ d h)) (sqrt (/ d l))) (- 1.0 (* (/ (* (* (/ D d) M) 0.5) l) (* 0.5 (* (* (* 0.5 (/ D d)) M) h))))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
return (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (((((D / d) * M) * 0.5) / l) * (0.5 * (((0.5 * (D / d)) * M) * h))));
}
NOTE: d, h, l, 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 = (sqrt((d / h)) * sqrt((d / l))) * (1.0d0 - (((((d_1 / d) * m) * 0.5d0) / l) * (0.5d0 * (((0.5d0 * (d_1 / d)) * m) * h))))
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
return (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - (((((D / d) * M) * 0.5) / l) * (0.5 * (((0.5 * (D / d)) * M) * h))));
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): return (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - (((((D / d) * M) * 0.5) / l) * (0.5 * (((0.5 * (D / d)) * M) * h))))
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) return Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D / d) * M) * 0.5) / l) * Float64(0.5 * Float64(Float64(Float64(0.5 * Float64(D / d)) * M) * h))))) end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (((((D / d) * M) * 0.5) / l) * (0.5 * (((0.5 * (D / d)) * M) * h))));
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(D / d), $MachinePrecision] * M), $MachinePrecision] * 0.5), $MachinePrecision] / l), $MachinePrecision] * N[(0.5 * N[(N[(N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right)
\end{array}
Initial program 68.2%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites70.4%
lift-/.f64N/A
div-invN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-pow.f64N/A
unpow-1N/A
remove-double-divN/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
div-invN/A
lift-/.f64N/A
times-fracN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites72.3%
lift-/.f64N/A
metadata-eval72.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6472.3
Applied rewrites72.3%
lift-/.f64N/A
metadata-eval72.3
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6472.3
Applied rewrites72.3%
NOTE: d, h, l, 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 (/ h l))))
(if (<= M 1.85e-125)
(/ (sqrt (/ d h)) (sqrt (/ l d)))
(/
(fma (* (* (* M M) -0.125) (/ (* D D) d)) (* (/ h l) t_0) (* t_0 d))
h))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h / l));
double tmp;
if (M <= 1.85e-125) {
tmp = sqrt((d / h)) / sqrt((l / d));
} else {
tmp = fma((((M * M) * -0.125) * ((D * D) / d)), ((h / l) * t_0), (t_0 * d)) / h;
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(h / l)) tmp = 0.0 if (M <= 1.85e-125) tmp = Float64(sqrt(Float64(d / h)) / sqrt(Float64(l / d))); else tmp = Float64(fma(Float64(Float64(Float64(M * M) * -0.125) * Float64(Float64(D * D) / d)), Float64(Float64(h / l) * t_0), Float64(t_0 * d)) / h); end return tmp end
NOTE: d, h, l, 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[N[(h / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[M, 1.85e-125], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(M * M), $MachinePrecision] * -0.125), $MachinePrecision] * N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * t$95$0), $MachinePrecision] + N[(t$95$0 * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{\ell}}\\
\mathbf{if}\;M \leq 1.85 \cdot 10^{-125}:\\
\;\;\;\;\frac{\sqrt{\frac{d}{h}}}{\sqrt{\frac{\ell}{d}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(\left(M \cdot M\right) \cdot -0.125\right) \cdot \frac{D \cdot D}{d}, \frac{h}{\ell} \cdot t\_0, t\_0 \cdot d\right)}{h}\\
\end{array}
\end{array}
if M < 1.85e-125Initial program 71.0%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6431.9
Applied rewrites31.9%
Applied rewrites46.2%
if 1.85e-125 < M Initial program 62.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites46.8%
Applied rewrites52.8%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (/ d (sqrt (* l h))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
return d / sqrt((l * h));
}
NOTE: d, h, l, 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((l * h))
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
return d / Math.sqrt((l * h));
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): return d / math.sqrt((l * h))
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) return Float64(d / sqrt(Float64(l * h))) end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d / sqrt((l * h));
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 68.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6427.2
Applied rewrites27.2%
Applied rewrites27.8%
herbie shell --seed 2024319
(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)))))