
(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 12 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}
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (/ M_m d) D_m))
(t_1 (fma (* (* (/ t_0 l) -0.25) h) (* t_0 0.5) 1.0)))
(if (<= d -4e+150)
(* (* (sqrt (/ 1.0 (* l h))) (- d)) t_1)
(if (<= d -5e-310)
(*
(- 1.0 (* (/ h l) (* (pow (/ (* D_m M_m) (* 2.0 d)) 2.0) (/ 1.0 2.0))))
(* (* (sqrt (/ -1.0 h)) (sqrt (- d))) (pow (/ d l) (/ 1.0 2.0))))
(* t_1 (/ (/ d (sqrt l)) (sqrt h)))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (M_m / d) * D_m;
double t_1 = fma((((t_0 / l) * -0.25) * h), (t_0 * 0.5), 1.0);
double tmp;
if (d <= -4e+150) {
tmp = (sqrt((1.0 / (l * h))) * -d) * t_1;
} else if (d <= -5e-310) {
tmp = (1.0 - ((h / l) * (pow(((D_m * M_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) * ((sqrt((-1.0 / h)) * sqrt(-d)) * pow((d / l), (1.0 / 2.0)));
} else {
tmp = t_1 * ((d / sqrt(l)) / sqrt(h));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(M_m / d) * D_m) t_1 = fma(Float64(Float64(Float64(t_0 / l) * -0.25) * h), Float64(t_0 * 0.5), 1.0) tmp = 0.0 if (d <= -4e+150) tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(l * h))) * Float64(-d)) * t_1); elseif (d <= -5e-310) tmp = Float64(Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)))) * Float64(Float64(sqrt(Float64(-1.0 / h)) * sqrt(Float64(-d))) * (Float64(d / l) ^ Float64(1.0 / 2.0)))); else tmp = Float64(t_1 * Float64(Float64(d / sqrt(l)) / sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(M$95$m / d), $MachinePrecision] * D$95$m), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(t$95$0 / l), $MachinePrecision] * -0.25), $MachinePrecision] * h), $MachinePrecision] * N[(t$95$0 * 0.5), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[d, -4e+150], N[(N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[N[(-1.0 / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{M\_m}{d} \cdot D\_m\\
t_1 := \mathsf{fma}\left(\left(\frac{t\_0}{\ell} \cdot -0.25\right) \cdot h, t\_0 \cdot 0.5, 1\right)\\
\mathbf{if}\;d \leq -4 \cdot 10^{+150}:\\
\;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\right) \cdot t\_1\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right) \cdot \left(\left(\sqrt{\frac{-1}{h}} \cdot \sqrt{-d}\right) \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -3.99999999999999992e150Initial program 67.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6467.6
Applied rewrites67.6%
Applied rewrites73.9%
Applied rewrites74.1%
Taylor expanded in h 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-*.f6493.7
Applied rewrites93.7%
if -3.99999999999999992e150 < d < -4.999999999999985e-310Initial program 75.6%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6483.7
Applied rewrites83.7%
if -4.999999999999985e-310 < d Initial program 68.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6467.6
Applied rewrites67.6%
Applied rewrites70.1%
Applied rewrites70.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-*l/N/A
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
clear-numN/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
frac-timesN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
Applied rewrites86.6%
Final simplification86.5%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (/ M_m d) D_m)))
(if (<= h -1e-310)
(*
(-
1.0
(*
(/ (* (/ M_m d) (* (* D_m 0.5) 0.5)) (pow h -1.0))
(/ (* D_m (* M_m (/ 0.5 d))) l)))
(* (pow (/ d l) (/ 1.0 2.0)) (/ (sqrt (- d)) (sqrt (- h)))))
(*
(fma (* (* (/ t_0 l) -0.25) h) (* t_0 0.5) 1.0)
(/ (/ d (sqrt l)) (sqrt h))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (M_m / d) * D_m;
double tmp;
if (h <= -1e-310) {
tmp = (1.0 - ((((M_m / d) * ((D_m * 0.5) * 0.5)) / pow(h, -1.0)) * ((D_m * (M_m * (0.5 / d))) / l))) * (pow((d / l), (1.0 / 2.0)) * (sqrt(-d) / sqrt(-h)));
} else {
tmp = fma((((t_0 / l) * -0.25) * h), (t_0 * 0.5), 1.0) * ((d / sqrt(l)) / sqrt(h));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(M_m / d) * D_m) tmp = 0.0 if (h <= -1e-310) tmp = Float64(Float64(1.0 - Float64(Float64(Float64(Float64(M_m / d) * Float64(Float64(D_m * 0.5) * 0.5)) / (h ^ -1.0)) * Float64(Float64(D_m * Float64(M_m * Float64(0.5 / d))) / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))))); else tmp = Float64(fma(Float64(Float64(Float64(t_0 / l) * -0.25) * h), Float64(t_0 * 0.5), 1.0) * Float64(Float64(d / sqrt(l)) / sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(M$95$m / d), $MachinePrecision] * D$95$m), $MachinePrecision]}, If[LessEqual[h, -1e-310], N[(N[(1.0 - N[(N[(N[(N[(M$95$m / d), $MachinePrecision] * N[(N[(D$95$m * 0.5), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / N[Power[h, -1.0], $MachinePrecision]), $MachinePrecision] * N[(N[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(t$95$0 / l), $MachinePrecision] * -0.25), $MachinePrecision] * h), $MachinePrecision] * N[(t$95$0 * 0.5), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{M\_m}{d} \cdot D\_m\\
\mathbf{if}\;h \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\left(1 - \frac{\frac{M\_m}{d} \cdot \left(\left(D\_m \cdot 0.5\right) \cdot 0.5\right)}{{h}^{-1}} \cdot \frac{D\_m \cdot \left(M\_m \cdot \frac{0.5}{d}\right)}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \frac{\sqrt{-d}}{\sqrt{-h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\frac{t\_0}{\ell} \cdot -0.25\right) \cdot h, t\_0 \cdot 0.5, 1\right) \cdot \frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if h < -9.999999999999969e-311Initial program 73.3%
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 rewrites73.0%
lift-/.f64N/A
metadata-eval73.0
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f6483.4
Applied rewrites83.4%
if -9.999999999999969e-311 < h Initial program 68.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6467.6
Applied rewrites67.6%
Applied rewrites70.1%
Applied rewrites70.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-*l/N/A
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
clear-numN/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
frac-timesN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
Applied rewrites86.6%
Final simplification85.2%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (/ M_m d) D_m))
(t_1 (fma (* (* (/ t_0 l) -0.25) h) (* t_0 0.5) 1.0)))
(if (<= d -4e+150)
(* (* (sqrt (/ 1.0 (* l h))) (- d)) t_1)
(if (<= d -5e-310)
(*
(- 1.0 (* (/ h l) (* (pow (/ (* D_m M_m) (* 2.0 d)) 2.0) (/ 1.0 2.0))))
(* (pow (/ d l) (/ 1.0 2.0)) (/ (sqrt (- d)) (sqrt (- h)))))
(* t_1 (/ (/ d (sqrt l)) (sqrt h)))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (M_m / d) * D_m;
double t_1 = fma((((t_0 / l) * -0.25) * h), (t_0 * 0.5), 1.0);
double tmp;
if (d <= -4e+150) {
tmp = (sqrt((1.0 / (l * h))) * -d) * t_1;
} else if (d <= -5e-310) {
tmp = (1.0 - ((h / l) * (pow(((D_m * M_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) * (pow((d / l), (1.0 / 2.0)) * (sqrt(-d) / sqrt(-h)));
} else {
tmp = t_1 * ((d / sqrt(l)) / sqrt(h));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(M_m / d) * D_m) t_1 = fma(Float64(Float64(Float64(t_0 / l) * -0.25) * h), Float64(t_0 * 0.5), 1.0) tmp = 0.0 if (d <= -4e+150) tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(l * h))) * Float64(-d)) * t_1); elseif (d <= -5e-310) tmp = Float64(Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))))); else tmp = Float64(t_1 * Float64(Float64(d / sqrt(l)) / sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(M$95$m / d), $MachinePrecision] * D$95$m), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(t$95$0 / l), $MachinePrecision] * -0.25), $MachinePrecision] * h), $MachinePrecision] * N[(t$95$0 * 0.5), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[d, -4e+150], N[(N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{M\_m}{d} \cdot D\_m\\
t_1 := \mathsf{fma}\left(\left(\frac{t\_0}{\ell} \cdot -0.25\right) \cdot h, t\_0 \cdot 0.5, 1\right)\\
\mathbf{if}\;d \leq -4 \cdot 10^{+150}:\\
\;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\right) \cdot t\_1\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \frac{\sqrt{-d}}{\sqrt{-h}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -3.99999999999999992e150Initial program 67.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6467.6
Applied rewrites67.6%
Applied rewrites73.9%
Applied rewrites74.1%
Taylor expanded in h 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-*.f6493.7
Applied rewrites93.7%
if -3.99999999999999992e150 < d < -4.999999999999985e-310Initial program 75.6%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/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.f6483.7
Applied rewrites83.7%
if -4.999999999999985e-310 < d Initial program 68.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6467.6
Applied rewrites67.6%
Applied rewrites70.1%
Applied rewrites70.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-*l/N/A
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
clear-numN/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
frac-timesN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
Applied rewrites86.6%
Final simplification86.5%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (/ M_m d) D_m)))
(if (<= l -4e+199)
(*
(- 1.0 (* (* (pow (* D_m (/ 0.5 d)) 2.0) M_m) (* (* (/ h l) 0.5) M_m)))
(* (pow (/ d l) (/ 1.0 2.0)) (/ (sqrt (- d)) (sqrt (- h)))))
(if (<= l -2e-310)
(*
(-
1.0
(* (* (* (/ (* D_m M_m) d) 0.5) h) (/ (* (* 0.25 D_m) (/ M_m d)) l)))
(* (sqrt (/ 1.0 (* l h))) (- d)))
(*
(fma (* (* (/ t_0 l) -0.25) h) (* t_0 0.5) 1.0)
(/ (/ d (sqrt l)) (sqrt h)))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (M_m / d) * D_m;
double tmp;
if (l <= -4e+199) {
tmp = (1.0 - ((pow((D_m * (0.5 / d)), 2.0) * M_m) * (((h / l) * 0.5) * M_m))) * (pow((d / l), (1.0 / 2.0)) * (sqrt(-d) / sqrt(-h)));
} else if (l <= -2e-310) {
tmp = (1.0 - (((((D_m * M_m) / d) * 0.5) * h) * (((0.25 * D_m) * (M_m / d)) / l))) * (sqrt((1.0 / (l * h))) * -d);
} else {
tmp = fma((((t_0 / l) * -0.25) * h), (t_0 * 0.5), 1.0) * ((d / sqrt(l)) / sqrt(h));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(M_m / d) * D_m) tmp = 0.0 if (l <= -4e+199) tmp = Float64(Float64(1.0 - Float64(Float64((Float64(D_m * Float64(0.5 / d)) ^ 2.0) * M_m) * Float64(Float64(Float64(h / l) * 0.5) * M_m))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))))); elseif (l <= -2e-310) tmp = Float64(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D_m * M_m) / d) * 0.5) * h) * Float64(Float64(Float64(0.25 * D_m) * Float64(M_m / d)) / l))) * Float64(sqrt(Float64(1.0 / Float64(l * h))) * Float64(-d))); else tmp = Float64(fma(Float64(Float64(Float64(t_0 / l) * -0.25) * h), Float64(t_0 * 0.5), 1.0) * Float64(Float64(d / sqrt(l)) / sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(M$95$m / d), $MachinePrecision] * D$95$m), $MachinePrecision]}, If[LessEqual[l, -4e+199], N[(N[(1.0 - N[(N[(N[Power[N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * M$95$m), $MachinePrecision] * N[(N[(N[(h / l), $MachinePrecision] * 0.5), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-310], N[(N[(1.0 - N[(N[(N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] * N[(N[(N[(0.25 * D$95$m), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(t$95$0 / l), $MachinePrecision] * -0.25), $MachinePrecision] * h), $MachinePrecision] * N[(t$95$0 * 0.5), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{M\_m}{d} \cdot D\_m\\
\mathbf{if}\;\ell \leq -4 \cdot 10^{+199}:\\
\;\;\;\;\left(1 - \left({\left(D\_m \cdot \frac{0.5}{d}\right)}^{2} \cdot M\_m\right) \cdot \left(\left(\frac{h}{\ell} \cdot 0.5\right) \cdot M\_m\right)\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \frac{\sqrt{-d}}{\sqrt{-h}}\right)\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(1 - \left(\left(\frac{D\_m \cdot M\_m}{d} \cdot 0.5\right) \cdot h\right) \cdot \frac{\left(0.25 \cdot D\_m\right) \cdot \frac{M\_m}{d}}{\ell}\right) \cdot \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\frac{t\_0}{\ell} \cdot -0.25\right) \cdot h, t\_0 \cdot 0.5, 1\right) \cdot \frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -4.00000000000000039e199Initial program 69.8%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-/.f64N/A
Applied rewrites62.8%
lift-/.f64N/A
metadata-eval62.8
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f6479.3
Applied rewrites79.3%
if -4.00000000000000039e199 < l < -1.999999999999994e-310Initial program 74.2%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6473.8
Applied rewrites73.8%
Applied rewrites76.3%
Taylor expanded in h 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-*.f6482.2
Applied rewrites82.2%
if -1.999999999999994e-310 < l Initial program 68.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6467.6
Applied rewrites67.6%
Applied rewrites70.1%
Applied rewrites70.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-*l/N/A
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
clear-numN/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
frac-timesN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
Applied rewrites86.6%
Final simplification84.3%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (/ M_m d) D_m))
(t_1 (fma (* (* (/ t_0 l) -0.25) h) (* t_0 0.5) 1.0)))
(if (<= d -7.4e+149)
(* (* (sqrt (/ 1.0 (* l h))) (- d)) t_1)
(if (<= d -5e-310)
(* (* (sqrt (/ d h)) (sqrt (/ d l))) t_1)
(* t_1 (/ (/ d (sqrt l)) (sqrt h)))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (M_m / d) * D_m;
double t_1 = fma((((t_0 / l) * -0.25) * h), (t_0 * 0.5), 1.0);
double tmp;
if (d <= -7.4e+149) {
tmp = (sqrt((1.0 / (l * h))) * -d) * t_1;
} else if (d <= -5e-310) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * t_1;
} else {
tmp = t_1 * ((d / sqrt(l)) / sqrt(h));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(M_m / d) * D_m) t_1 = fma(Float64(Float64(Float64(t_0 / l) * -0.25) * h), Float64(t_0 * 0.5), 1.0) tmp = 0.0 if (d <= -7.4e+149) tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(l * h))) * Float64(-d)) * t_1); elseif (d <= -5e-310) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * t_1); else tmp = Float64(t_1 * Float64(Float64(d / sqrt(l)) / sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(M$95$m / d), $MachinePrecision] * D$95$m), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(t$95$0 / l), $MachinePrecision] * -0.25), $MachinePrecision] * h), $MachinePrecision] * N[(t$95$0 * 0.5), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[d, -7.4e+149], N[(N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(t$95$1 * N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{M\_m}{d} \cdot D\_m\\
t_1 := \mathsf{fma}\left(\left(\frac{t\_0}{\ell} \cdot -0.25\right) \cdot h, t\_0 \cdot 0.5, 1\right)\\
\mathbf{if}\;d \leq -7.4 \cdot 10^{+149}:\\
\;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\right) \cdot t\_1\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -7.39999999999999957e149Initial program 67.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6467.6
Applied rewrites67.6%
Applied rewrites73.9%
Applied rewrites74.1%
Taylor expanded in h 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-*.f6493.7
Applied rewrites93.7%
if -7.39999999999999957e149 < d < -4.999999999999985e-310Initial program 75.6%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6474.0
Applied rewrites74.0%
Applied rewrites72.1%
Applied rewrites74.3%
lift-*.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
clear-numN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f640.0
lift-/.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-undivN/A
lower-sqrt.f64N/A
lower-/.f6475.9
lift-/.f64N/A
metadata-eval75.9
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6475.9
Applied rewrites75.9%
if -4.999999999999985e-310 < d Initial program 68.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6467.6
Applied rewrites67.6%
Applied rewrites70.1%
Applied rewrites70.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-*l/N/A
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
clear-numN/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
frac-timesN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
Applied rewrites86.6%
Final simplification84.0%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (/ M_m d) D_m))
(t_1 (fma (* (* (/ t_0 l) -0.25) h) (* t_0 0.5) 1.0)))
(if (<= l -2e-310)
(* (* (sqrt (/ 1.0 (* l h))) (- d)) t_1)
(* t_1 (/ (/ d (sqrt l)) (sqrt h))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (M_m / d) * D_m;
double t_1 = fma((((t_0 / l) * -0.25) * h), (t_0 * 0.5), 1.0);
double tmp;
if (l <= -2e-310) {
tmp = (sqrt((1.0 / (l * h))) * -d) * t_1;
} else {
tmp = t_1 * ((d / sqrt(l)) / sqrt(h));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(M_m / d) * D_m) t_1 = fma(Float64(Float64(Float64(t_0 / l) * -0.25) * h), Float64(t_0 * 0.5), 1.0) tmp = 0.0 if (l <= -2e-310) tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(l * h))) * Float64(-d)) * t_1); else tmp = Float64(t_1 * Float64(Float64(d / sqrt(l)) / sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(M$95$m / d), $MachinePrecision] * D$95$m), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(t$95$0 / l), $MachinePrecision] * -0.25), $MachinePrecision] * h), $MachinePrecision] * N[(t$95$0 * 0.5), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[l, -2e-310], N[(N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision] * t$95$1), $MachinePrecision], N[(t$95$1 * N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{M\_m}{d} \cdot D\_m\\
t_1 := \mathsf{fma}\left(\left(\frac{t\_0}{\ell} \cdot -0.25\right) \cdot h, t\_0 \cdot 0.5, 1\right)\\
\mathbf{if}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -1.999999999999994e-310Initial program 73.3%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6472.2
Applied rewrites72.2%
Applied rewrites72.6%
Applied rewrites74.2%
Taylor expanded in h 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-*.f6476.5
Applied rewrites76.5%
if -1.999999999999994e-310 < l Initial program 68.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6467.6
Applied rewrites67.6%
Applied rewrites70.1%
Applied rewrites70.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-*l/N/A
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
clear-numN/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
frac-timesN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
Applied rewrites86.6%
Final simplification82.0%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (/ M_m d) D_m))
(t_1 (fma (* (* (/ t_0 l) -0.25) h) (* t_0 0.5) 1.0)))
(if (<= l -2.1e-308)
(* (* (sqrt (/ 1.0 (* l h))) (- d)) t_1)
(if (<= l 1.55e+92)
(* (/ d (sqrt (* l h))) t_1)
(/ d (* (sqrt h) (sqrt l)))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (M_m / d) * D_m;
double t_1 = fma((((t_0 / l) * -0.25) * h), (t_0 * 0.5), 1.0);
double tmp;
if (l <= -2.1e-308) {
tmp = (sqrt((1.0 / (l * h))) * -d) * t_1;
} else if (l <= 1.55e+92) {
tmp = (d / sqrt((l * h))) * t_1;
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(M_m / d) * D_m) t_1 = fma(Float64(Float64(Float64(t_0 / l) * -0.25) * h), Float64(t_0 * 0.5), 1.0) tmp = 0.0 if (l <= -2.1e-308) tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(l * h))) * Float64(-d)) * t_1); elseif (l <= 1.55e+92) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * t_1); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(M$95$m / d), $MachinePrecision] * D$95$m), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(t$95$0 / l), $MachinePrecision] * -0.25), $MachinePrecision] * h), $MachinePrecision] * N[(t$95$0 * 0.5), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[l, -2.1e-308], N[(N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[l, 1.55e+92], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{M\_m}{d} \cdot D\_m\\
t_1 := \mathsf{fma}\left(\left(\frac{t\_0}{\ell} \cdot -0.25\right) \cdot h, t\_0 \cdot 0.5, 1\right)\\
\mathbf{if}\;\ell \leq -2.1 \cdot 10^{-308}:\\
\;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\right) \cdot t\_1\\
\mathbf{elif}\;\ell \leq 1.55 \cdot 10^{+92}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.1e-308Initial program 73.1%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6471.9
Applied rewrites71.9%
Applied rewrites73.2%
Applied rewrites74.8%
Taylor expanded in h 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-*.f6477.1
Applied rewrites77.1%
if -2.1e-308 < l < 1.5500000000000001e92Initial program 78.8%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6478.1
Applied rewrites78.1%
Applied rewrites79.6%
Applied rewrites79.6%
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f64N/A
sqrt-undivN/A
un-div-invN/A
lift-/.f64N/A
clear-numN/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
sqrt-divN/A
sqrt-unprodN/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-/.f6487.4
Applied rewrites87.4%
if 1.5500000000000001e92 < l Initial program 51.2%
Taylor expanded in h around 0
Applied rewrites49.9%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6451.7
Applied rewrites51.7%
Applied rewrites51.6%
Applied rewrites72.0%
Final simplification79.7%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (/ M_m d) D_m)))
(if (<= l -2.1e-308)
(* 1.0 (* (/ (sqrt (- d)) (sqrt (- l))) (sqrt (/ d h))))
(if (<= l 1.55e+92)
(* (/ d (sqrt (* l h))) (fma (* (* (/ t_0 l) -0.25) h) (* t_0 0.5) 1.0))
(/ d (* (sqrt h) (sqrt l)))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (M_m / d) * D_m;
double tmp;
if (l <= -2.1e-308) {
tmp = 1.0 * ((sqrt(-d) / sqrt(-l)) * sqrt((d / h)));
} else if (l <= 1.55e+92) {
tmp = (d / sqrt((l * h))) * fma((((t_0 / l) * -0.25) * h), (t_0 * 0.5), 1.0);
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(M_m / d) * D_m) tmp = 0.0 if (l <= -2.1e-308) tmp = Float64(1.0 * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * sqrt(Float64(d / h)))); elseif (l <= 1.55e+92) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * fma(Float64(Float64(Float64(t_0 / l) * -0.25) * h), Float64(t_0 * 0.5), 1.0)); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(M$95$m / d), $MachinePrecision] * D$95$m), $MachinePrecision]}, If[LessEqual[l, -2.1e-308], N[(1.0 * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.55e+92], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(t$95$0 / l), $MachinePrecision] * -0.25), $MachinePrecision] * h), $MachinePrecision] * N[(t$95$0 * 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{M\_m}{d} \cdot D\_m\\
\mathbf{if}\;\ell \leq -2.1 \cdot 10^{-308}:\\
\;\;\;\;1 \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{elif}\;\ell \leq 1.55 \cdot 10^{+92}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\left(\frac{t\_0}{\ell} \cdot -0.25\right) \cdot h, t\_0 \cdot 0.5, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.1e-308Initial program 73.1%
Taylor expanded in h around 0
Applied rewrites43.5%
lift-/.f64N/A
metadata-eval43.5
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f6448.9
Applied rewrites48.9%
lift-/.f64N/A
metadata-eval48.9
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6448.9
Applied rewrites48.9%
if -2.1e-308 < l < 1.5500000000000001e92Initial program 78.8%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6478.1
Applied rewrites78.1%
Applied rewrites79.6%
Applied rewrites79.6%
lift-*.f64N/A
lift-/.f64N/A
un-div-invN/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f64N/A
sqrt-undivN/A
un-div-invN/A
lift-/.f64N/A
clear-numN/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
sqrt-divN/A
sqrt-unprodN/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-/.f6487.4
Applied rewrites87.4%
if 1.5500000000000001e92 < l Initial program 51.2%
Taylor expanded in h around 0
Applied rewrites49.9%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6451.7
Applied rewrites51.7%
Applied rewrites51.6%
Applied rewrites72.0%
Final simplification66.9%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -1.72e-230)
(* 1.0 (* (/ (sqrt (- d)) (sqrt (- l))) (sqrt (/ d h))))
(if (<= l 6.5e-198)
(/ (* (sqrt (/ h l)) (- d)) h)
(/ d (* (sqrt h) (sqrt l))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -1.72e-230) {
tmp = 1.0 * ((sqrt(-d) / sqrt(-l)) * sqrt((d / h)));
} else if (l <= 6.5e-198) {
tmp = (sqrt((h / l)) * -d) / h;
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-1.72d-230)) then
tmp = 1.0d0 * ((sqrt(-d) / sqrt(-l)) * sqrt((d / h)))
else if (l <= 6.5d-198) then
tmp = (sqrt((h / l)) * -d) / h
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -1.72e-230) {
tmp = 1.0 * ((Math.sqrt(-d) / Math.sqrt(-l)) * Math.sqrt((d / h)));
} else if (l <= 6.5e-198) {
tmp = (Math.sqrt((h / l)) * -d) / h;
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -1.72e-230: tmp = 1.0 * ((math.sqrt(-d) / math.sqrt(-l)) * math.sqrt((d / h))) elif l <= 6.5e-198: tmp = (math.sqrt((h / l)) * -d) / h else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -1.72e-230) tmp = Float64(1.0 * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * sqrt(Float64(d / h)))); elseif (l <= 6.5e-198) tmp = Float64(Float64(sqrt(Float64(h / l)) * Float64(-d)) / h); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= -1.72e-230)
tmp = 1.0 * ((sqrt(-d) / sqrt(-l)) * sqrt((d / h)));
elseif (l <= 6.5e-198)
tmp = (sqrt((h / l)) * -d) / h;
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -1.72e-230], N[(1.0 * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.5e-198], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision] / h), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.72 \cdot 10^{-230}:\\
\;\;\;\;1 \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{elif}\;\ell \leq 6.5 \cdot 10^{-198}:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot \left(-d\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.71999999999999999e-230Initial program 71.8%
Taylor expanded in h around 0
Applied rewrites46.4%
lift-/.f64N/A
metadata-eval46.4
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f6452.6
Applied rewrites52.6%
lift-/.f64N/A
metadata-eval52.6
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6452.6
Applied rewrites52.6%
if -1.71999999999999999e-230 < l < 6.5000000000000004e-198Initial program 83.3%
Taylor expanded in h around 0
Applied rewrites14.6%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites38.9%
Taylor expanded in l around -inf
Applied rewrites38.1%
if 6.5000000000000004e-198 < l Initial program 66.0%
Taylor expanded in h around 0
Applied rewrites49.3%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6452.3
Applied rewrites52.3%
Applied rewrites52.8%
Applied rewrites64.0%
Final simplification55.9%
D_m = (fabs.f64 D) M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= l 5.4e-198) (* (sqrt (/ 1.0 (* l h))) (- d)) (/ d (* (sqrt h) (sqrt l)))))
D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 5.4e-198) {
tmp = sqrt((1.0 / (l * h))) * -d;
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= 5.4d-198) then
tmp = sqrt((1.0d0 / (l * h))) * -d
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 5.4e-198) {
tmp = Math.sqrt((1.0 / (l * h))) * -d;
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= 5.4e-198: tmp = math.sqrt((1.0 / (l * h))) * -d else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= 5.4e-198) tmp = Float64(sqrt(Float64(1.0 / Float64(l * h))) * Float64(-d)); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= 5.4e-198)
tmp = sqrt((1.0 / (l * h))) * -d;
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, 5.4e-198], N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 5.4 \cdot 10^{-198}:\\
\;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < 5.4000000000000003e-198Initial program 74.9%
Taylor expanded in h around 0
Applied rewrites38.0%
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.8
Applied rewrites44.8%
if 5.4000000000000003e-198 < l Initial program 66.0%
Taylor expanded in h around 0
Applied rewrites49.3%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6452.3
Applied rewrites52.3%
Applied rewrites52.8%
Applied rewrites64.0%
Final simplification53.8%
D_m = (fabs.f64 D) M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= l 5.4e-198) (* (sqrt (/ 1.0 (* l h))) (- d)) (/ d (sqrt (* l h)))))
D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 5.4e-198) {
tmp = sqrt((1.0 / (l * h))) * -d;
} else {
tmp = d / sqrt((l * h));
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= 5.4d-198) then
tmp = sqrt((1.0d0 / (l * h))) * -d
else
tmp = d / sqrt((l * h))
end if
code = tmp
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 5.4e-198) {
tmp = Math.sqrt((1.0 / (l * h))) * -d;
} else {
tmp = d / Math.sqrt((l * h));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= 5.4e-198: tmp = math.sqrt((1.0 / (l * h))) * -d else: tmp = d / math.sqrt((l * h)) return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= 5.4e-198) tmp = Float64(sqrt(Float64(1.0 / Float64(l * h))) * Float64(-d)); else tmp = Float64(d / sqrt(Float64(l * h))); end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= 5.4e-198)
tmp = sqrt((1.0 / (l * h))) * -d;
else
tmp = d / sqrt((l * h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, 5.4e-198], N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 5.4 \cdot 10^{-198}:\\
\;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if l < 5.4000000000000003e-198Initial program 74.9%
Taylor expanded in h around 0
Applied rewrites38.0%
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.8
Applied rewrites44.8%
if 5.4000000000000003e-198 < l Initial program 66.0%
Taylor expanded in h around 0
Applied rewrites49.3%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6452.3
Applied rewrites52.3%
Applied rewrites52.8%
Final simplification48.5%
D_m = (fabs.f64 D) M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (/ d (sqrt (* l h))))
D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
return d / sqrt((l * h));
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
code = d / sqrt((l * h))
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
return d / Math.sqrt((l * h));
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): return d / math.sqrt((l * h))
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) return Float64(d / sqrt(Float64(l * h))) end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp = code(d, h, l, M_m, D_m)
tmp = d / sqrt((l * h));
end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 70.7%
Taylor expanded in h around 0
Applied rewrites43.3%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6431.0
Applied rewrites31.0%
Applied rewrites31.2%
herbie shell --seed 2024250
(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)))))