
(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 8 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}
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= (pow (/ (* M D) (* 2.0 d)) 2.0) 2e+201) (* w0 (sqrt (+ 1.0 (* (* h (pow (* (* M D) (/ 0.5 d)) 2.0)) (/ -1.0 l))))) (* w0 (sqrt (- 1.0 (* 0.25 (* M (* (* M (/ h l)) (pow (/ D d) 2.0)))))))))
assert(M < D);
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) <= 2e+201) {
tmp = w0 * sqrt((1.0 + ((h * pow(((M * D) * (0.5 / d)), 2.0)) * (-1.0 / l))));
} else {
tmp = w0 * sqrt((1.0 - (0.25 * (M * ((M * (h / l)) * pow((D / d), 2.0))))));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) <= 2d+201) then
tmp = w0 * sqrt((1.0d0 + ((h * (((m * d) * (0.5d0 / d_1)) ** 2.0d0)) * ((-1.0d0) / l))))
else
tmp = w0 * sqrt((1.0d0 - (0.25d0 * (m * ((m * (h / l)) * ((d / d_1) ** 2.0d0))))))
end if
code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (Math.pow(((M * D) / (2.0 * d)), 2.0) <= 2e+201) {
tmp = w0 * Math.sqrt((1.0 + ((h * Math.pow(((M * D) * (0.5 / d)), 2.0)) * (-1.0 / l))));
} else {
tmp = w0 * Math.sqrt((1.0 - (0.25 * (M * ((M * (h / l)) * Math.pow((D / d), 2.0))))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if math.pow(((M * D) / (2.0 * d)), 2.0) <= 2e+201: tmp = w0 * math.sqrt((1.0 + ((h * math.pow(((M * D) * (0.5 / d)), 2.0)) * (-1.0 / l)))) else: tmp = w0 * math.sqrt((1.0 - (0.25 * (M * ((M * (h / l)) * math.pow((D / d), 2.0)))))) return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if ((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) <= 2e+201) tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(Float64(h * (Float64(Float64(M * D) * Float64(0.5 / d)) ^ 2.0)) * Float64(-1.0 / l))))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(0.25 * Float64(M * Float64(Float64(M * Float64(h / l)) * (Float64(D / d) ^ 2.0))))))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if ((((M * D) / (2.0 * d)) ^ 2.0) <= 2e+201)
tmp = w0 * sqrt((1.0 + ((h * (((M * D) * (0.5 / d)) ^ 2.0)) * (-1.0 / l))));
else
tmp = w0 * sqrt((1.0 - (0.25 * (M * ((M * (h / l)) * ((D / d) ^ 2.0))))));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. 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], 2e+201], N[(w0 * N[Sqrt[N[(1.0 + N[(N[(h * N[Power[N[(N[(M * D), $MachinePrecision] * N[(0.5 / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(0.25 * N[(M * N[(N[(M * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(D / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \leq 2 \cdot 10^{+201}:\\
\;\;\;\;w0 \cdot \sqrt{1 + \left(h \cdot {\left(\left(M \cdot D\right) \cdot \frac{0.5}{d}\right)}^{2}\right) \cdot \frac{-1}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \left(M \cdot \left(\left(M \cdot \frac{h}{\ell}\right) \cdot {\left(\frac{D}{d}\right)}^{2}\right)\right)}\\
\end{array}
\end{array}
if (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) < 2.00000000000000008e201Initial program 86.4%
times-frac86.8%
Simplified86.8%
associate-*r/98.3%
clear-num98.3%
frac-times98.1%
div-inv98.1%
associate-*l*98.3%
associate-/r*98.3%
metadata-eval98.3%
Applied egg-rr98.3%
associate-/r/98.3%
*-commutative98.3%
associate-*r*98.1%
*-commutative98.1%
*-commutative98.1%
Simplified98.1%
if 2.00000000000000008e201 < (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) Initial program 49.6%
times-frac53.2%
Simplified53.2%
associate-*r/49.7%
frac-times47.9%
div-inv47.9%
associate-*l*49.7%
associate-/r*49.7%
metadata-eval49.7%
Applied egg-rr49.7%
Taylor expanded in M around 0 38.9%
*-commutative38.9%
times-frac39.0%
unpow239.0%
*-commutative39.0%
unpow239.0%
unpow239.0%
*-commutative39.0%
associate-/l*40.6%
unpow240.6%
unpow240.6%
times-frac47.0%
unpow247.0%
*-commutative47.0%
associate-/l*45.4%
associate-*r/47.1%
associate-*l*52.9%
associate-*l*56.6%
Simplified56.6%
Final simplification89.5%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= (pow (/ (* M D) (* 2.0 d)) 2.0) 2e+201) (* w0 (sqrt (- 1.0 (/ (* h (pow (* 0.5 (/ D (/ d M))) 2.0)) l)))) (* w0 (sqrt (- 1.0 (* 0.25 (* M (* (* M (/ h l)) (pow (/ D d) 2.0)))))))))
assert(M < D);
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) <= 2e+201) {
tmp = w0 * sqrt((1.0 - ((h * pow((0.5 * (D / (d / M))), 2.0)) / l)));
} else {
tmp = w0 * sqrt((1.0 - (0.25 * (M * ((M * (h / l)) * pow((D / d), 2.0))))));
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) <= 2d+201) then
tmp = w0 * sqrt((1.0d0 - ((h * ((0.5d0 * (d / (d_1 / m))) ** 2.0d0)) / l)))
else
tmp = w0 * sqrt((1.0d0 - (0.25d0 * (m * ((m * (h / l)) * ((d / d_1) ** 2.0d0))))))
end if
code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (Math.pow(((M * D) / (2.0 * d)), 2.0) <= 2e+201) {
tmp = w0 * Math.sqrt((1.0 - ((h * Math.pow((0.5 * (D / (d / M))), 2.0)) / l)));
} else {
tmp = w0 * Math.sqrt((1.0 - (0.25 * (M * ((M * (h / l)) * Math.pow((D / d), 2.0))))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if math.pow(((M * D) / (2.0 * d)), 2.0) <= 2e+201: tmp = w0 * math.sqrt((1.0 - ((h * math.pow((0.5 * (D / (d / M))), 2.0)) / l))) else: tmp = w0 * math.sqrt((1.0 - (0.25 * (M * ((M * (h / l)) * math.pow((D / d), 2.0)))))) return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if ((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) <= 2e+201) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(0.5 * Float64(D / Float64(d / M))) ^ 2.0)) / l)))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(0.25 * Float64(M * Float64(Float64(M * Float64(h / l)) * (Float64(D / d) ^ 2.0))))))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if ((((M * D) / (2.0 * d)) ^ 2.0) <= 2e+201)
tmp = w0 * sqrt((1.0 - ((h * ((0.5 * (D / (d / M))) ^ 2.0)) / l)));
else
tmp = w0 * sqrt((1.0 - (0.25 * (M * ((M * (h / l)) * ((D / d) ^ 2.0))))));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. 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], 2e+201], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(0.5 * N[(D / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(0.25 * N[(M * N[(N[(M * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(D / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \leq 2 \cdot 10^{+201}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot {\left(0.5 \cdot \frac{D}{\frac{d}{M}}\right)}^{2}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \left(M \cdot \left(\left(M \cdot \frac{h}{\ell}\right) \cdot {\left(\frac{D}{d}\right)}^{2}\right)\right)}\\
\end{array}
\end{array}
if (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) < 2.00000000000000008e201Initial program 86.4%
times-frac86.8%
Simplified86.8%
associate-*r/98.3%
frac-times98.1%
div-inv98.1%
associate-*l*98.3%
associate-/r*98.3%
metadata-eval98.3%
Applied egg-rr98.3%
Taylor expanded in M around 0 98.1%
associate-/l*97.6%
Simplified97.6%
if 2.00000000000000008e201 < (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) Initial program 49.6%
times-frac53.2%
Simplified53.2%
associate-*r/49.7%
frac-times47.9%
div-inv47.9%
associate-*l*49.7%
associate-/r*49.7%
metadata-eval49.7%
Applied egg-rr49.7%
Taylor expanded in M around 0 38.9%
*-commutative38.9%
times-frac39.0%
unpow239.0%
*-commutative39.0%
unpow239.0%
unpow239.0%
*-commutative39.0%
associate-/l*40.6%
unpow240.6%
unpow240.6%
times-frac47.0%
unpow247.0%
*-commutative47.0%
associate-/l*45.4%
associate-*r/47.1%
associate-*l*52.9%
associate-*l*56.6%
Simplified56.6%
Final simplification89.1%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* 0.25 (* h (/ (pow (* M (/ D d)) 2.0) l)))))))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (0.25 * (h * (pow((M * (D / d)), 2.0) / l)))));
}
NOTE: M and D should be sorted in increasing order before calling this function.
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 - (0.25d0 * (h * (((m * (d / d_1)) ** 2.0d0) / l)))))
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - (0.25 * (h * (Math.pow((M * (D / d)), 2.0) / l)))));
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (0.25 * (h * (math.pow((M * (D / d)), 2.0) / l)))))
M, D = sort([M, D]) function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(0.25 * Float64(h * Float64((Float64(M * Float64(D / d)) ^ 2.0) / l)))))) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0 * sqrt((1.0 - (0.25 * (h * (((M * (D / d)) ^ 2.0) / l)))));
end
NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(0.25 * N[(h * N[(N[Power[N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
w0 \cdot \sqrt{1 - 0.25 \cdot \left(h \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)}
\end{array}
Initial program 78.8%
times-frac79.8%
Simplified79.8%
associate-*r/88.2%
frac-times87.7%
div-inv87.7%
associate-*l*88.2%
associate-/r*88.2%
metadata-eval88.2%
Applied egg-rr88.2%
Taylor expanded in M around 0 87.7%
associate-/l*87.7%
Simplified87.7%
Taylor expanded in D around 0 56.2%
*-commutative56.2%
*-commutative56.2%
times-frac57.0%
unpow257.0%
*-commutative57.0%
associate-*l/58.5%
unpow258.5%
unpow258.5%
times-frac72.8%
unpow272.8%
Simplified88.6%
Final simplification88.6%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (* w0 (+ 1.0 (* (* h (/ (pow (* M (/ D d)) 2.0) l)) -0.125))))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * (1.0 + ((h * (pow((M * (D / d)), 2.0) / l)) * -0.125));
}
NOTE: M and D should be sorted in increasing order before calling this function.
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 + ((h * (((m * (d / d_1)) ** 2.0d0) / l)) * (-0.125d0)))
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * (1.0 + ((h * (Math.pow((M * (D / d)), 2.0) / l)) * -0.125));
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): return w0 * (1.0 + ((h * (math.pow((M * (D / d)), 2.0) / l)) * -0.125))
M, D = sort([M, D]) function code(w0, M, D, h, l, d) return Float64(w0 * Float64(1.0 + Float64(Float64(h * Float64((Float64(M * Float64(D / d)) ^ 2.0) / l)) * -0.125))) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0 * (1.0 + ((h * (((M * (D / d)) ^ 2.0) / l)) * -0.125));
end
NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[(1.0 + N[(N[(h * N[(N[Power[N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
w0 \cdot \left(1 + \left(h \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) \cdot -0.125\right)
\end{array}
Initial program 78.8%
times-frac79.8%
Simplified79.8%
Taylor expanded in M around 0 55.1%
+-commutative55.1%
associate-*r/55.1%
*-commutative55.1%
associate-*r/55.1%
*-commutative55.1%
fma-def55.1%
*-commutative55.1%
times-frac56.7%
unpow256.7%
unpow256.7%
times-frac69.1%
unpow269.1%
*-commutative69.1%
associate-/l*65.5%
unpow265.5%
Simplified65.5%
Taylor expanded in w0 around 0 55.1%
Simplified62.4%
Taylor expanded in D around 0 55.1%
times-frac56.7%
unpow256.7%
unpow256.7%
times-frac69.1%
unpow269.1%
unpow269.1%
associate-*l/70.3%
associate-*r*72.3%
*-commutative72.3%
associate-*r/73.9%
unpow273.9%
swap-sqr82.4%
unpow282.4%
*-commutative82.4%
Simplified82.4%
Final simplification82.4%
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
:precision binary64
(if (<= d -5.8e+107)
w0
(if (<= d 1.85e+99)
(* w0 (+ 1.0 (* -0.125 (* (* M (* (/ D d) (/ (/ D l) d))) (* M h)))))
w0)))assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (d <= -5.8e+107) {
tmp = w0;
} else if (d <= 1.85e+99) {
tmp = w0 * (1.0 + (-0.125 * ((M * ((D / d) * ((D / l) / d))) * (M * h))));
} else {
tmp = w0;
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (d_1 <= (-5.8d+107)) then
tmp = w0
else if (d_1 <= 1.85d+99) then
tmp = w0 * (1.0d0 + ((-0.125d0) * ((m * ((d / d_1) * ((d / l) / d_1))) * (m * h))))
else
tmp = w0
end if
code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (d <= -5.8e+107) {
tmp = w0;
} else if (d <= 1.85e+99) {
tmp = w0 * (1.0 + (-0.125 * ((M * ((D / d) * ((D / l) / d))) * (M * h))));
} else {
tmp = w0;
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if d <= -5.8e+107: tmp = w0 elif d <= 1.85e+99: tmp = w0 * (1.0 + (-0.125 * ((M * ((D / d) * ((D / l) / d))) * (M * h)))) else: tmp = w0 return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (d <= -5.8e+107) tmp = w0; elseif (d <= 1.85e+99) tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(M * Float64(Float64(D / d) * Float64(Float64(D / l) / d))) * Float64(M * h))))); else tmp = w0; end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (d <= -5.8e+107)
tmp = w0;
elseif (d <= 1.85e+99)
tmp = w0 * (1.0 + (-0.125 * ((M * ((D / d) * ((D / l) / d))) * (M * h))));
else
tmp = w0;
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[d, -5.8e+107], w0, If[LessEqual[d, 1.85e+99], N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(M * N[(N[(D / d), $MachinePrecision] * N[(N[(D / l), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(M * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -5.8 \cdot 10^{+107}:\\
\;\;\;\;w0\\
\mathbf{elif}\;d \leq 1.85 \cdot 10^{+99}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\left(M \cdot \left(\frac{D}{d} \cdot \frac{\frac{D}{\ell}}{d}\right)\right) \cdot \left(M \cdot h\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if d < -5.79999999999999975e107 or 1.85000000000000005e99 < d Initial program 81.5%
times-frac83.3%
Simplified83.3%
Taylor expanded in M around 0 87.6%
if -5.79999999999999975e107 < d < 1.85000000000000005e99Initial program 76.8%
times-frac77.4%
Simplified77.4%
Taylor expanded in M around 0 55.3%
+-commutative55.3%
associate-*r/55.3%
*-commutative55.3%
associate-*r/55.3%
*-commutative55.3%
fma-def55.3%
*-commutative55.3%
times-frac56.7%
unpow256.7%
unpow256.7%
times-frac67.6%
unpow267.6%
*-commutative67.6%
associate-/l*64.9%
unpow264.9%
Simplified64.9%
Taylor expanded in w0 around 0 55.3%
Simplified61.7%
Taylor expanded in D around 0 61.7%
unpow261.7%
associate-*l/63.2%
*-commutative63.2%
Simplified63.2%
times-frac73.8%
Applied egg-rr73.8%
Final simplification79.5%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= M -1.9e+203) (* w0 (+ 1.0 (* -0.125 (* M (* (/ (* D D) (* d d)) (/ h (/ l M))))))) w0))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= -1.9e+203) {
tmp = w0 * (1.0 + (-0.125 * (M * (((D * D) / (d * d)) * (h / (l / M))))));
} else {
tmp = w0;
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (m <= (-1.9d+203)) then
tmp = w0 * (1.0d0 + ((-0.125d0) * (m * (((d * d) / (d_1 * d_1)) * (h / (l / m))))))
else
tmp = w0
end if
code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= -1.9e+203) {
tmp = w0 * (1.0 + (-0.125 * (M * (((D * D) / (d * d)) * (h / (l / M))))));
} else {
tmp = w0;
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if M <= -1.9e+203: tmp = w0 * (1.0 + (-0.125 * (M * (((D * D) / (d * d)) * (h / (l / M)))))) else: tmp = w0 return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= -1.9e+203) tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(M * Float64(Float64(Float64(D * D) / Float64(d * d)) * Float64(h / Float64(l / M))))))); else tmp = w0; end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (M <= -1.9e+203)
tmp = w0 * (1.0 + (-0.125 * (M * (((D * D) / (d * d)) * (h / (l / M))))));
else
tmp = w0;
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, -1.9e+203], N[(w0 * N[(1.0 + N[(-0.125 * N[(M * N[(N[(N[(D * D), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[(h / N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq -1.9 \cdot 10^{+203}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(M \cdot \left(\frac{D \cdot D}{d \cdot d} \cdot \frac{h}{\frac{\ell}{M}}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if M < -1.90000000000000012e203Initial program 68.2%
times-frac73.3%
Simplified73.3%
Taylor expanded in M around 0 28.7%
*-commutative28.7%
*-commutative28.7%
associate-/l*28.7%
unpow228.7%
unpow228.7%
*-commutative28.7%
unpow228.7%
Simplified28.7%
Taylor expanded in D around 0 28.7%
times-frac28.7%
unpow228.7%
associate-/l*28.4%
unpow228.4%
unpow228.4%
times-frac29.1%
unpow229.1%
*-commutative29.1%
associate-/l*29.3%
associate-*r/29.1%
associate-*l*40.2%
associate-*l*56.9%
Simplified56.9%
Taylor expanded in M around 0 61.8%
times-frac50.7%
unpow250.7%
unpow250.7%
associate-/l*56.5%
Simplified56.5%
if -1.90000000000000012e203 < M Initial program 79.6%
times-frac80.3%
Simplified80.3%
Taylor expanded in M around 0 75.2%
Final simplification73.9%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= M -2.4e+202) (* w0 (+ 1.0 (* -0.125 (/ (* D D) (* (/ l M) (/ d (/ M (/ d h)))))))) w0))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= -2.4e+202) {
tmp = w0 * (1.0 + (-0.125 * ((D * D) / ((l / M) * (d / (M / (d / h)))))));
} else {
tmp = w0;
}
return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (m <= (-2.4d+202)) then
tmp = w0 * (1.0d0 + ((-0.125d0) * ((d * d) / ((l / m) * (d_1 / (m / (d_1 / h)))))))
else
tmp = w0
end if
code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= -2.4e+202) {
tmp = w0 * (1.0 + (-0.125 * ((D * D) / ((l / M) * (d / (M / (d / h)))))));
} else {
tmp = w0;
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if M <= -2.4e+202: tmp = w0 * (1.0 + (-0.125 * ((D * D) / ((l / M) * (d / (M / (d / h))))))) else: tmp = w0 return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= -2.4e+202) tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(D * D) / Float64(Float64(l / M) * Float64(d / Float64(M / Float64(d / h)))))))); else tmp = w0; end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (M <= -2.4e+202)
tmp = w0 * (1.0 + (-0.125 * ((D * D) / ((l / M) * (d / (M / (d / h)))))));
else
tmp = w0;
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, -2.4e+202], N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(D * D), $MachinePrecision] / N[(N[(l / M), $MachinePrecision] * N[(d / N[(M / N[(d / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq -2.4 \cdot 10^{+202}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \frac{D \cdot D}{\frac{\ell}{M} \cdot \frac{d}{\frac{M}{\frac{d}{h}}}}\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if M < -2.4000000000000002e202Initial program 68.2%
times-frac73.3%
Simplified73.3%
Taylor expanded in M around 0 28.7%
*-commutative28.7%
*-commutative28.7%
associate-/l*28.7%
unpow228.7%
unpow228.7%
*-commutative28.7%
unpow228.7%
Simplified28.7%
Taylor expanded in l around 0 28.7%
unpow228.7%
associate-*r*34.0%
times-frac50.7%
unpow250.7%
associate-/l*51.0%
associate-/l*56.5%
Simplified56.5%
if -2.4000000000000002e202 < M Initial program 79.6%
times-frac80.3%
Simplified80.3%
Taylor expanded in M around 0 75.2%
Final simplification73.9%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 w0)
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
NOTE: M and D should be sorted in increasing order before calling this function.
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
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): return w0
M, D = sort([M, D]) function code(w0, M, D, h, l, d) return w0 end
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := w0
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
w0
\end{array}
Initial program 78.8%
times-frac79.8%
Simplified79.8%
Taylor expanded in M around 0 72.8%
Final simplification72.8%
herbie shell --seed 2023189
(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))))))