
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * sqrt((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))))
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * sqrt((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))))
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\end{array}
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (fma (* (/ (* (/ (* -0.5 (* D M)) d) h) l) (/ 0.5 d)) (* D M) 1.0))))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt(fma((((((-0.5 * (D * M)) / d) * h) / l) * (0.5 / d)), (D * M), 1.0));
}
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(fma(Float64(Float64(Float64(Float64(Float64(-0.5 * Float64(D * M)) / d) * h) / l) * Float64(0.5 / d)), Float64(D * M), 1.0))) end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(N[(N[(N[(N[(N[(-0.5 * N[(D * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision] * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * N[(D * M), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{\mathsf{fma}\left(\frac{\frac{-0.5 \cdot \left(D \cdot M\right)}{d} \cdot h}{\ell} \cdot \frac{0.5}{d}, D \cdot M, 1\right)}
\end{array}
Initial program 78.7%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
distribute-neg-frac2N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.7%
Applied rewrites88.4%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -2e+47) (* w0 (sqrt (fma (/ (* (/ (* (* M h) D) d) -0.25) (* l d)) (* D M) 1.0))) (* w0 (fma (* (* (/ (* h M) d) (/ (/ M l) d)) D) (* -0.125 D) 1.0))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -2e+47) {
tmp = w0 * sqrt(fma((((((M * h) * D) / d) * -0.25) / (l * d)), (D * M), 1.0));
} else {
tmp = w0 * fma(((((h * M) / d) * ((M / l) / d)) * D), (-0.125 * D), 1.0);
}
return tmp;
}
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -2e+47) tmp = Float64(w0 * sqrt(fma(Float64(Float64(Float64(Float64(Float64(M * h) * D) / d) * -0.25) / Float64(l * d)), Float64(D * M), 1.0))); else tmp = Float64(w0 * fma(Float64(Float64(Float64(Float64(h * M) / d) * Float64(Float64(M / l) / d)) * D), Float64(-0.125 * D), 1.0)); end return tmp end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2e+47], N[(w0 * N[Sqrt[N[(N[(N[(N[(N[(N[(M * h), $MachinePrecision] * D), $MachinePrecision] / d), $MachinePrecision] * -0.25), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(D * M), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[(N[(N[(N[(N[(h * M), $MachinePrecision] / d), $MachinePrecision] * N[(N[(M / l), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * D), $MachinePrecision] * N[(-0.125 * D), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{+47}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{\frac{\left(M \cdot h\right) \cdot D}{d} \cdot -0.25}{\ell \cdot d}, D \cdot M, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \mathsf{fma}\left(\left(\frac{h \cdot M}{d} \cdot \frac{\frac{M}{\ell}}{d}\right) \cdot D, -0.125 \cdot D, 1\right)\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -2.0000000000000001e47Initial program 62.0%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
distribute-neg-frac2N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites58.1%
Applied rewrites64.5%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6462.0
Applied rewrites62.0%
Taylor expanded in M around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6454.3
Applied rewrites54.3%
if -2.0000000000000001e47 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 85.6%
Taylor expanded in M around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites64.7%
Applied rewrites70.9%
Applied rewrites89.2%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -5e+47) (* w0 (sqrt (fma (* (* -0.25 (/ D (* d d))) (/ (* M h) l)) (* D M) 1.0))) (* w0 (fma (* (* (/ (* h M) d) (/ (/ M l) d)) D) (* -0.125 D) 1.0))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+47) {
tmp = w0 * sqrt(fma(((-0.25 * (D / (d * d))) * ((M * h) / l)), (D * M), 1.0));
} else {
tmp = w0 * fma(((((h * M) / d) * ((M / l) / d)) * D), (-0.125 * D), 1.0);
}
return tmp;
}
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -5e+47) tmp = Float64(w0 * sqrt(fma(Float64(Float64(-0.25 * Float64(D / Float64(d * d))) * Float64(Float64(M * h) / l)), Float64(D * M), 1.0))); else tmp = Float64(w0 * fma(Float64(Float64(Float64(Float64(h * M) / d) * Float64(Float64(M / l) / d)) * D), Float64(-0.125 * D), 1.0)); end return tmp end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e+47], N[(w0 * N[Sqrt[N[(N[(N[(-0.25 * N[(D / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(D * M), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[(N[(N[(N[(N[(h * M), $MachinePrecision] / d), $MachinePrecision] * N[(N[(M / l), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * D), $MachinePrecision] * N[(-0.125 * D), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+47}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\left(-0.25 \cdot \frac{D}{d \cdot d}\right) \cdot \frac{M \cdot h}{\ell}, D \cdot M, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \mathsf{fma}\left(\left(\frac{h \cdot M}{d} \cdot \frac{\frac{M}{\ell}}{d}\right) \cdot D, -0.125 \cdot D, 1\right)\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -5.00000000000000022e47Initial program 61.5%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
distribute-neg-frac2N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites58.9%
Applied rewrites64.0%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6461.5
Applied rewrites61.5%
Taylor expanded in M around 0
times-fracN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6450.0
Applied rewrites50.0%
if -5.00000000000000022e47 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 85.7%
Taylor expanded in M around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites64.3%
Applied rewrites70.5%
Applied rewrites88.7%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -1e+76) (* w0 (fma (* (* D D) -0.125) (* M (* M (/ h (* (* d d) l)))) 1.0)) (* w0 1.0)))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -1e+76) {
tmp = w0 * fma(((D * D) * -0.125), (M * (M * (h / ((d * d) * l)))), 1.0);
} else {
tmp = w0 * 1.0;
}
return tmp;
}
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -1e+76) tmp = Float64(w0 * fma(Float64(Float64(D * D) * -0.125), Float64(M * Float64(M * Float64(h / Float64(Float64(d * d) * l)))), 1.0)); else tmp = Float64(w0 * 1.0); end return tmp end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -1e+76], N[(w0 * N[(N[(N[(D * D), $MachinePrecision] * -0.125), $MachinePrecision] * N[(M * N[(M * N[(h / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -1 \cdot 10^{+76}:\\
\;\;\;\;w0 \cdot \mathsf{fma}\left(\left(D \cdot D\right) \cdot -0.125, M \cdot \left(M \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot 1\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -1e76Initial program 59.9%
Taylor expanded in M around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites38.1%
Applied rewrites42.9%
Applied rewrites44.3%
if -1e76 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 85.9%
Taylor expanded in M around 0
Applied rewrites94.5%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -2e+47) (* w0 (fma D (* D (* (* -0.125 (/ (* M h) (* (* d d) l))) M)) 1.0)) (* w0 1.0)))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -2e+47) {
tmp = w0 * fma(D, (D * ((-0.125 * ((M * h) / ((d * d) * l))) * M)), 1.0);
} else {
tmp = w0 * 1.0;
}
return tmp;
}
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -2e+47) tmp = Float64(w0 * fma(D, Float64(D * Float64(Float64(-0.125 * Float64(Float64(M * h) / Float64(Float64(d * d) * l))) * M)), 1.0)); else tmp = Float64(w0 * 1.0); end return tmp end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2e+47], N[(w0 * N[(D * N[(D * N[(N[(-0.125 * N[(N[(M * h), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{+47}:\\
\;\;\;\;w0 \cdot \mathsf{fma}\left(D, D \cdot \left(\left(-0.125 \cdot \frac{M \cdot h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot M\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot 1\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -2.0000000000000001e47Initial program 62.0%
Taylor expanded in M around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites36.2%
Applied rewrites38.4%
Applied rewrites44.3%
Applied rewrites43.0%
if -2.0000000000000001e47 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 85.6%
Taylor expanded in M around 0
Applied rewrites96.3%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (pow (/ (* M D) (* 2.0 d)) 2.0) 1e-291) (* w0 1.0) (* w0 (fma D (* D (* (* -0.125 (/ (* (/ M d) h) (* l d))) M)) 1.0))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (pow(((M * D) / (2.0 * d)), 2.0) <= 1e-291) {
tmp = w0 * 1.0;
} else {
tmp = w0 * fma(D, (D * ((-0.125 * (((M / d) * h) / (l * d))) * M)), 1.0);
}
return tmp;
}
function code(w0, M, D, h, l, d) tmp = 0.0 if ((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) <= 1e-291) tmp = Float64(w0 * 1.0); else tmp = Float64(w0 * fma(D, Float64(D * Float64(Float64(-0.125 * Float64(Float64(Float64(M / d) * h) / Float64(l * d))) * M)), 1.0)); end return tmp end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], 1e-291], N[(w0 * 1.0), $MachinePrecision], N[(w0 * N[(D * N[(D * N[(N[(-0.125 * N[(N[(N[(M / d), $MachinePrecision] * h), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \leq 10^{-291}:\\
\;\;\;\;w0 \cdot 1\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \mathsf{fma}\left(D, D \cdot \left(\left(-0.125 \cdot \frac{\frac{M}{d} \cdot h}{\ell \cdot d}\right) \cdot M\right), 1\right)\\
\end{array}
\end{array}
if (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) < 9.99999999999999962e-292Initial program 87.9%
Taylor expanded in M around 0
Applied rewrites100.0%
if 9.99999999999999962e-292 < (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) Initial program 70.1%
Taylor expanded in M around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites37.3%
Applied rewrites44.8%
Applied rewrites50.5%
Applied rewrites62.6%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (pow (/ (* M D) (* 2.0 d)) 2.0) 1e-291) (* w0 1.0) (* w0 (fma D (* D (* (* -0.125 (* (/ M d) (/ h (* l d)))) M)) 1.0))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (pow(((M * D) / (2.0 * d)), 2.0) <= 1e-291) {
tmp = w0 * 1.0;
} else {
tmp = w0 * fma(D, (D * ((-0.125 * ((M / d) * (h / (l * d)))) * M)), 1.0);
}
return tmp;
}
function code(w0, M, D, h, l, d) tmp = 0.0 if ((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) <= 1e-291) tmp = Float64(w0 * 1.0); else tmp = Float64(w0 * fma(D, Float64(D * Float64(Float64(-0.125 * Float64(Float64(M / d) * Float64(h / Float64(l * d)))) * M)), 1.0)); end return tmp end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], 1e-291], N[(w0 * 1.0), $MachinePrecision], N[(w0 * N[(D * N[(D * N[(N[(-0.125 * N[(N[(M / d), $MachinePrecision] * N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \leq 10^{-291}:\\
\;\;\;\;w0 \cdot 1\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \mathsf{fma}\left(D, D \cdot \left(\left(-0.125 \cdot \left(\frac{M}{d} \cdot \frac{h}{\ell \cdot d}\right)\right) \cdot M\right), 1\right)\\
\end{array}
\end{array}
if (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) < 9.99999999999999962e-292Initial program 87.9%
Taylor expanded in M around 0
Applied rewrites100.0%
if 9.99999999999999962e-292 < (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) Initial program 70.1%
Taylor expanded in M around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites37.3%
Applied rewrites44.8%
Applied rewrites50.5%
Applied rewrites62.6%
(FPCore (w0 M D h l d)
:precision binary64
(if (<= (/ (* M D) (* 2.0 d)) 5e-80)
(* w0 (fma (* (* (/ (* h M) d) (/ (/ M l) d)) D) (* -0.125 D) 1.0))
(*
w0
(sqrt
(fma (* (/ (* h (* (* M D) -0.5)) (* l d)) (/ 0.5 d)) (* D M) 1.0)))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (((M * D) / (2.0 * d)) <= 5e-80) {
tmp = w0 * fma(((((h * M) / d) * ((M / l) / d)) * D), (-0.125 * D), 1.0);
} else {
tmp = w0 * sqrt(fma((((h * ((M * D) * -0.5)) / (l * d)) * (0.5 / d)), (D * M), 1.0));
}
return tmp;
}
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64(Float64(M * D) / Float64(2.0 * d)) <= 5e-80) tmp = Float64(w0 * fma(Float64(Float64(Float64(Float64(h * M) / d) * Float64(Float64(M / l) / d)) * D), Float64(-0.125 * D), 1.0)); else tmp = Float64(w0 * sqrt(fma(Float64(Float64(Float64(h * Float64(Float64(M * D) * -0.5)) / Float64(l * d)) * Float64(0.5 / d)), Float64(D * M), 1.0))); end return tmp end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 5e-80], N[(w0 * N[(N[(N[(N[(N[(h * M), $MachinePrecision] / d), $MachinePrecision] * N[(N[(M / l), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * D), $MachinePrecision] * N[(-0.125 * D), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(N[(N[(N[(h * N[(N[(M * D), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * N[(D * M), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{M \cdot D}{2 \cdot d} \leq 5 \cdot 10^{-80}:\\
\;\;\;\;w0 \cdot \mathsf{fma}\left(\left(\frac{h \cdot M}{d} \cdot \frac{\frac{M}{\ell}}{d}\right) \cdot D, -0.125 \cdot D, 1\right)\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{h \cdot \left(\left(M \cdot D\right) \cdot -0.5\right)}{\ell \cdot d} \cdot \frac{0.5}{d}, D \cdot M, 1\right)}\\
\end{array}
\end{array}
if (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 5e-80Initial program 81.3%
Taylor expanded in M around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites61.5%
Applied rewrites66.1%
Applied rewrites80.2%
if 5e-80 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) Initial program 68.7%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
distribute-neg-frac2N/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites69.0%
Applied rewrites72.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
frac-timesN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6468.8
Applied rewrites68.8%
(FPCore (w0 M D h l d) :precision binary64 (* w0 (fma (* (* (/ (* h M) d) (/ (/ M l) d)) D) (* -0.125 D) 1.0)))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * fma(((((h * M) / d) * ((M / l) / d)) * D), (-0.125 * D), 1.0);
}
function code(w0, M, D, h, l, d) return Float64(w0 * fma(Float64(Float64(Float64(Float64(h * M) / d) * Float64(Float64(M / l) / d)) * D), Float64(-0.125 * D), 1.0)) end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[(N[(N[(N[(N[(h * M), $MachinePrecision] / d), $MachinePrecision] * N[(N[(M / l), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * D), $MachinePrecision] * N[(-0.125 * D), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \mathsf{fma}\left(\left(\frac{h \cdot M}{d} \cdot \frac{\frac{M}{\ell}}{d}\right) \cdot D, -0.125 \cdot D, 1\right)
\end{array}
Initial program 78.7%
Taylor expanded in M around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites56.3%
Applied rewrites62.0%
Applied rewrites75.4%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* M D) 1e-36) (* w0 1.0) (* w0 (fma D (* D (* h (/ (* -0.125 (* M M)) (* (* d d) l)))) 1.0))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((M * D) <= 1e-36) {
tmp = w0 * 1.0;
} else {
tmp = w0 * fma(D, (D * (h * ((-0.125 * (M * M)) / ((d * d) * l)))), 1.0);
}
return tmp;
}
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64(M * D) <= 1e-36) tmp = Float64(w0 * 1.0); else tmp = Float64(w0 * fma(D, Float64(D * Float64(h * Float64(Float64(-0.125 * Float64(M * M)) / Float64(Float64(d * d) * l)))), 1.0)); end return tmp end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(M * D), $MachinePrecision], 1e-36], N[(w0 * 1.0), $MachinePrecision], N[(w0 * N[(D * N[(D * N[(h * N[(N[(-0.125 * N[(M * M), $MachinePrecision]), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \cdot D \leq 10^{-36}:\\
\;\;\;\;w0 \cdot 1\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \mathsf{fma}\left(D, D \cdot \left(h \cdot \frac{-0.125 \cdot \left(M \cdot M\right)}{\left(d \cdot d\right) \cdot \ell}\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 M D) < 9.9999999999999994e-37Initial program 82.4%
Taylor expanded in M around 0
Applied rewrites78.6%
if 9.9999999999999994e-37 < (*.f64 M D) Initial program 61.3%
Taylor expanded in M around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites43.0%
Applied rewrites48.0%
Applied rewrites45.6%
Applied rewrites52.5%
(FPCore (w0 M D h l d) :precision binary64 (* w0 1.0))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * 1.0;
}
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * 1.0d0
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * 1.0;
}
def code(w0, M, D, h, l, d): return w0 * 1.0
function code(w0, M, D, h, l, d) return Float64(w0 * 1.0) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * 1.0; end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * 1.0), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot 1
\end{array}
Initial program 78.7%
Taylor expanded in M around 0
Applied rewrites69.7%
herbie shell --seed 2024321
(FPCore (w0 M D h l d)
:name "Henrywood and Agarwal, Equation (9a)"
:precision binary64
(* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))