
(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 9 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 (if (<= (* (pow (/ (* D M) (* 2.0 d)) 2.0) (/ h l)) 0.01) (* w0 (sqrt (- 1.0 (* (/ h l) (pow (* (* D M) (/ 0.5 d)) 2.0))))) w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((D * M) / (2.0 * d)), 2.0) * (h / l)) <= 0.01) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow(((D * M) * (0.5 / d)), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
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 * m) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= 0.01d0) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * (((d * m) * (0.5d0 / d_1)) ** 2.0d0))))
else
tmp = w0
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((Math.pow(((D * M) / (2.0 * d)), 2.0) * (h / l)) <= 0.01) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((D * M) * (0.5 / d)), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((D * M) / (2.0 * d)), 2.0) * (h / l)) <= 0.01: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((D * M) * (0.5 / d)), 2.0)))) else: tmp = w0 return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(D * M) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= 0.01) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(D * M) * Float64(0.5 / d)) ^ 2.0))))); else tmp = w0; end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (((((D * M) / (2.0 * d)) ^ 2.0) * (h / l)) <= 0.01) tmp = w0 * sqrt((1.0 - ((h / l) * (((D * M) * (0.5 / d)) ^ 2.0)))); else tmp = w0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], 0.01], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D * M), $MachinePrecision] * N[(0.5 / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{D \cdot M}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq 0.01:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\left(D \cdot M\right) \cdot \frac{0.5}{d}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\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)) < 0.0100000000000000002Initial program 86.5%
clear-num86.5%
associate-/r/86.5%
associate-/r*86.5%
metadata-eval86.5%
*-commutative86.5%
Applied egg-rr86.5%
if 0.0100000000000000002 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 0.0%
Simplified0.0%
Taylor expanded in D around 0 81.2%
Final simplification85.8%
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (/ (* (pow (/ (/ (* D M) 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((((D * M) / 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 - ((((((d * m) / 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((((D * M) / 2.0) / d), 2.0) * h) / l)));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - ((math.pow((((D * M) / 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(Float64(Float64(D * M) / 2.0) / d) ^ 2.0) * h) / l)))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((((((D * M) / 2.0) / d) ^ 2.0) * h) / l))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[Power[N[(N[(N[(D * M), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - \frac{{\left(\frac{\frac{D \cdot M}{2}}{d}\right)}^{2} \cdot h}{\ell}}
\end{array}
Initial program 76.0%
Simplified74.9%
associate-*r/84.3%
associate-/r*84.3%
Applied egg-rr84.3%
associate-*r/85.0%
Applied egg-rr85.0%
associate-/r*85.0%
Simplified85.0%
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (/ (* h (pow (* D (/ M (* 2.0 d))) 2.0)) l)))))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - ((h * pow((D * (M / (2.0 * d))), 2.0)) / 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 - ((h * ((d * (m / (2.0d0 * d_1))) ** 2.0d0)) / 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 - ((h * Math.pow((D * (M / (2.0 * d))), 2.0)) / l)));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - ((h * math.pow((D * (M / (2.0 * d))), 2.0)) / l)))
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(D * Float64(M / Float64(2.0 * d))) ^ 2.0)) / l)))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((h * ((D * (M / (2.0 * d))) ^ 2.0)) / l))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(D * N[(M / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - \frac{h \cdot {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}}{\ell}}
\end{array}
Initial program 76.0%
Simplified74.9%
associate-*r/84.3%
associate-/r*84.3%
Applied egg-rr84.3%
Final simplification84.3%
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (* D (/ M (* 2.0 d)))))
(if (<= (/ h l) (- INFINITY))
(+ w0 (* -0.125 (* (* D (* M (* D M))) (/ (* w0 h) (* l (pow d 2.0))))))
(if (<= (/ h l) -2e-306)
(* w0 (sqrt (+ (- 2.0 (* (/ h l) (* t_0 t_0))) -1.0)))
w0))))
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = D * (M / (2.0 * d));
double tmp;
if ((h / l) <= -((double) INFINITY)) {
tmp = w0 + (-0.125 * ((D * (M * (D * M))) * ((w0 * h) / (l * pow(d, 2.0)))));
} else if ((h / l) <= -2e-306) {
tmp = w0 * sqrt(((2.0 - ((h / l) * (t_0 * t_0))) + -1.0));
} else {
tmp = w0;
}
return tmp;
}
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = D * (M / (2.0 * d));
double tmp;
if ((h / l) <= -Double.POSITIVE_INFINITY) {
tmp = w0 + (-0.125 * ((D * (M * (D * M))) * ((w0 * h) / (l * Math.pow(d, 2.0)))));
} else if ((h / l) <= -2e-306) {
tmp = w0 * Math.sqrt(((2.0 - ((h / l) * (t_0 * t_0))) + -1.0));
} else {
tmp = w0;
}
return tmp;
}
def code(w0, M, D, h, l, d): t_0 = D * (M / (2.0 * d)) tmp = 0 if (h / l) <= -math.inf: tmp = w0 + (-0.125 * ((D * (M * (D * M))) * ((w0 * h) / (l * math.pow(d, 2.0))))) elif (h / l) <= -2e-306: tmp = w0 * math.sqrt(((2.0 - ((h / l) * (t_0 * t_0))) + -1.0)) else: tmp = w0 return tmp
function code(w0, M, D, h, l, d) t_0 = Float64(D * Float64(M / Float64(2.0 * d))) tmp = 0.0 if (Float64(h / l) <= Float64(-Inf)) tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(D * Float64(M * Float64(D * M))) * Float64(Float64(w0 * h) / Float64(l * (d ^ 2.0)))))); elseif (Float64(h / l) <= -2e-306) tmp = Float64(w0 * sqrt(Float64(Float64(2.0 - Float64(Float64(h / l) * Float64(t_0 * t_0))) + -1.0))); else tmp = w0; end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) t_0 = D * (M / (2.0 * d)); tmp = 0.0; if ((h / l) <= -Inf) tmp = w0 + (-0.125 * ((D * (M * (D * M))) * ((w0 * h) / (l * (d ^ 2.0))))); elseif ((h / l) <= -2e-306) tmp = w0 * sqrt(((2.0 - ((h / l) * (t_0 * t_0))) + -1.0)); else tmp = w0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(D * N[(M / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(h / l), $MachinePrecision], (-Infinity)], N[(w0 + N[(-0.125 * N[(N[(D * N[(M * N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(w0 * h), $MachinePrecision] / N[(l * N[Power[d, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(h / l), $MachinePrecision], -2e-306], N[(w0 * N[Sqrt[N[(N[(2.0 - N[(N[(h / l), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := D \cdot \frac{M}{2 \cdot d}\\
\mathbf{if}\;\frac{h}{\ell} \leq -\infty:\\
\;\;\;\;w0 + -0.125 \cdot \left(\left(D \cdot \left(M \cdot \left(D \cdot M\right)\right)\right) \cdot \frac{w0 \cdot h}{\ell \cdot {d}^{2}}\right)\\
\mathbf{elif}\;\frac{h}{\ell} \leq -2 \cdot 10^{-306}:\\
\;\;\;\;w0 \cdot \sqrt{\left(2 - \frac{h}{\ell} \cdot \left(t\_0 \cdot t\_0\right)\right) + -1}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -inf.0Initial program 22.9%
Simplified22.9%
Taylor expanded in D around 0 48.1%
+-commutative48.1%
fma-define48.1%
associate-*r*56.8%
unpow256.8%
unpow256.8%
swap-sqr62.5%
unpow262.5%
*-commutative62.5%
Simplified62.5%
fma-undefine62.5%
associate-/l*62.5%
*-commutative62.5%
Applied egg-rr62.5%
add-exp-log62.5%
log-pow26.9%
Applied egg-rr26.9%
*-commutative26.9%
pow-to-exp62.5%
pow262.5%
associate-*l*62.5%
Applied egg-rr62.5%
if -inf.0 < (/.f64 h l) < -2.00000000000000006e-306Initial program 81.0%
Simplified78.8%
associate-*r/78.0%
associate-/r*78.0%
Applied egg-rr78.0%
associate-*r/79.6%
Applied egg-rr79.6%
associate-/r*79.6%
Simplified79.6%
expm1-log1p-u78.5%
*-commutative78.5%
associate-/l*78.5%
associate-*r/77.2%
associate-*l/77.8%
associate-/l/77.8%
Applied egg-rr77.8%
expm1-undefine77.8%
sub-neg77.8%
log1p-undefine77.8%
rem-exp-log78.8%
associate-+r-78.8%
metadata-eval78.8%
associate-*r/81.0%
*-commutative81.0%
metadata-eval81.0%
Simplified81.0%
unpow281.0%
associate-/l*78.1%
associate-/l*78.8%
Applied egg-rr78.8%
if -2.00000000000000006e-306 < (/.f64 h l) Initial program 81.5%
Simplified81.5%
Taylor expanded in D around 0 95.7%
Final simplification84.1%
(FPCore (w0 M D h l d) :precision binary64 (if (<= D 6.8e+145) w0 (+ w0 (* -0.125 (* (/ (* w0 h) (* l (pow d 2.0))) (* (* D M) (* D M)))))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (D <= 6.8e+145) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (((w0 * h) / (l * pow(d, 2.0))) * ((D * M) * (D * M))));
}
return tmp;
}
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 <= 6.8d+145) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * (((w0 * h) / (l * (d_1 ** 2.0d0))) * ((d * m) * (d * m))))
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (D <= 6.8e+145) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (((w0 * h) / (l * Math.pow(d, 2.0))) * ((D * M) * (D * M))));
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if D <= 6.8e+145: tmp = w0 else: tmp = w0 + (-0.125 * (((w0 * h) / (l * math.pow(d, 2.0))) * ((D * M) * (D * M)))) return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (D <= 6.8e+145) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(Float64(w0 * h) / Float64(l * (d ^ 2.0))) * Float64(Float64(D * M) * Float64(D * M))))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (D <= 6.8e+145) tmp = w0; else tmp = w0 + (-0.125 * (((w0 * h) / (l * (d ^ 2.0))) * ((D * M) * (D * M)))); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[D, 6.8e+145], w0, N[(w0 + N[(-0.125 * N[(N[(N[(w0 * h), $MachinePrecision] / N[(l * N[Power[d, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(D * M), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;D \leq 6.8 \cdot 10^{+145}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\frac{w0 \cdot h}{\ell \cdot {d}^{2}} \cdot \left(\left(D \cdot M\right) \cdot \left(D \cdot M\right)\right)\right)\\
\end{array}
\end{array}
if D < 6.7999999999999998e145Initial program 77.1%
Simplified75.4%
Taylor expanded in D around 0 68.0%
if 6.7999999999999998e145 < D Initial program 67.6%
Simplified70.7%
Taylor expanded in D around 0 33.8%
+-commutative33.8%
fma-define33.8%
associate-*r*33.8%
unpow233.8%
unpow233.8%
swap-sqr54.4%
unpow254.4%
*-commutative54.4%
Simplified54.4%
fma-undefine54.4%
associate-/l*57.4%
*-commutative57.4%
Applied egg-rr57.4%
unpow257.4%
Applied egg-rr57.4%
Final simplification66.7%
(FPCore (w0 M D h l d) :precision binary64 (if (<= D 4.6e+146) w0 (+ w0 (* -0.125 (* (* D (* M (* D M))) (/ (* w0 h) (* l (pow d 2.0))))))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (D <= 4.6e+146) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * ((D * (M * (D * M))) * ((w0 * h) / (l * pow(d, 2.0)))));
}
return tmp;
}
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 <= 4.6d+146) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * ((d * (m * (d * m))) * ((w0 * h) / (l * (d_1 ** 2.0d0)))))
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (D <= 4.6e+146) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * ((D * (M * (D * M))) * ((w0 * h) / (l * Math.pow(d, 2.0)))));
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if D <= 4.6e+146: tmp = w0 else: tmp = w0 + (-0.125 * ((D * (M * (D * M))) * ((w0 * h) / (l * math.pow(d, 2.0))))) return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (D <= 4.6e+146) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(D * Float64(M * Float64(D * M))) * Float64(Float64(w0 * h) / Float64(l * (d ^ 2.0)))))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (D <= 4.6e+146) tmp = w0; else tmp = w0 + (-0.125 * ((D * (M * (D * M))) * ((w0 * h) / (l * (d ^ 2.0))))); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[D, 4.6e+146], w0, N[(w0 + N[(-0.125 * N[(N[(D * N[(M * N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(w0 * h), $MachinePrecision] / N[(l * N[Power[d, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;D \leq 4.6 \cdot 10^{+146}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\left(D \cdot \left(M \cdot \left(D \cdot M\right)\right)\right) \cdot \frac{w0 \cdot h}{\ell \cdot {d}^{2}}\right)\\
\end{array}
\end{array}
if D < 4.60000000000000001e146Initial program 77.2%
Simplified75.5%
Taylor expanded in D around 0 67.7%
if 4.60000000000000001e146 < D Initial program 66.5%
Simplified69.7%
Taylor expanded in D around 0 31.5%
+-commutative31.5%
fma-define31.5%
associate-*r*31.6%
unpow231.6%
unpow231.6%
swap-sqr52.8%
unpow252.8%
*-commutative52.8%
Simplified52.8%
fma-undefine52.8%
associate-/l*55.9%
*-commutative55.9%
Applied egg-rr55.9%
add-exp-log55.9%
log-pow21.2%
Applied egg-rr21.2%
*-commutative21.2%
pow-to-exp55.9%
pow255.9%
associate-*l*55.9%
Applied egg-rr55.9%
Final simplification66.3%
(FPCore (w0 M D h l d) :precision binary64 (if (<= M 2.6e+101) w0 (* -0.125 (* (* (* D M) (* D M)) (/ (* w0 (* h (pow d -2.0))) l)))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 2.6e+101) {
tmp = w0;
} else {
tmp = -0.125 * (((D * M) * (D * M)) * ((w0 * (h * pow(d, -2.0))) / l));
}
return tmp;
}
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.6d+101) then
tmp = w0
else
tmp = (-0.125d0) * (((d * m) * (d * m)) * ((w0 * (h * (d_1 ** (-2.0d0)))) / l))
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 2.6e+101) {
tmp = w0;
} else {
tmp = -0.125 * (((D * M) * (D * M)) * ((w0 * (h * Math.pow(d, -2.0))) / l));
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if M <= 2.6e+101: tmp = w0 else: tmp = -0.125 * (((D * M) * (D * M)) * ((w0 * (h * math.pow(d, -2.0))) / l)) return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 2.6e+101) tmp = w0; else tmp = Float64(-0.125 * Float64(Float64(Float64(D * M) * Float64(D * M)) * Float64(Float64(w0 * Float64(h * (d ^ -2.0))) / l))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (M <= 2.6e+101) tmp = w0; else tmp = -0.125 * (((D * M) * (D * M)) * ((w0 * (h * (d ^ -2.0))) / l)); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 2.6e+101], w0, N[(-0.125 * N[(N[(N[(D * M), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] * N[(N[(w0 * N[(h * N[Power[d, -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 2.6 \cdot 10^{+101}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(\left(\left(D \cdot M\right) \cdot \left(D \cdot M\right)\right) \cdot \frac{w0 \cdot \left(h \cdot {d}^{-2}\right)}{\ell}\right)\\
\end{array}
\end{array}
if M < 2.6e101Initial program 77.3%
Simplified76.0%
Taylor expanded in D around 0 68.4%
if 2.6e101 < M Initial program 69.0%
Simplified69.0%
Taylor expanded in D around 0 30.0%
+-commutative30.0%
fma-define30.0%
associate-*r*32.4%
unpow232.4%
unpow232.4%
swap-sqr50.0%
unpow250.0%
*-commutative50.0%
Simplified50.0%
Taylor expanded in D around inf 20.5%
associate-*r*20.6%
unpow220.6%
unpow220.6%
swap-sqr21.7%
unpow221.7%
*-commutative21.7%
*-commutative21.7%
associate-*r/21.5%
times-frac24.1%
Simplified24.1%
unpow250.9%
Applied egg-rr24.1%
associate-*l/24.3%
div-inv24.3%
pow-flip26.7%
metadata-eval26.7%
Applied egg-rr26.7%
(FPCore (w0 M D h l d) :precision binary64 (if (<= M 7.8e+98) w0 (* -0.125 (* (* (* D M) (* D M)) (* (pow d -2.0) (* w0 (/ h l)))))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 7.8e+98) {
tmp = w0;
} else {
tmp = -0.125 * (((D * M) * (D * M)) * (pow(d, -2.0) * (w0 * (h / l))));
}
return tmp;
}
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 <= 7.8d+98) then
tmp = w0
else
tmp = (-0.125d0) * (((d * m) * (d * m)) * ((d_1 ** (-2.0d0)) * (w0 * (h / l))))
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 7.8e+98) {
tmp = w0;
} else {
tmp = -0.125 * (((D * M) * (D * M)) * (Math.pow(d, -2.0) * (w0 * (h / l))));
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if M <= 7.8e+98: tmp = w0 else: tmp = -0.125 * (((D * M) * (D * M)) * (math.pow(d, -2.0) * (w0 * (h / l)))) return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 7.8e+98) tmp = w0; else tmp = Float64(-0.125 * Float64(Float64(Float64(D * M) * Float64(D * M)) * Float64((d ^ -2.0) * Float64(w0 * Float64(h / l))))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (M <= 7.8e+98) tmp = w0; else tmp = -0.125 * (((D * M) * (D * M)) * ((d ^ -2.0) * (w0 * (h / l)))); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 7.8e+98], w0, N[(-0.125 * N[(N[(N[(D * M), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] * N[(N[Power[d, -2.0], $MachinePrecision] * N[(w0 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 7.8 \cdot 10^{+98}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(\left(\left(D \cdot M\right) \cdot \left(D \cdot M\right)\right) \cdot \left({d}^{-2} \cdot \left(w0 \cdot \frac{h}{\ell}\right)\right)\right)\\
\end{array}
\end{array}
if M < 7.7999999999999999e98Initial program 77.3%
Simplified76.0%
Taylor expanded in D around 0 68.4%
if 7.7999999999999999e98 < M Initial program 69.0%
Simplified69.0%
Taylor expanded in D around 0 30.0%
+-commutative30.0%
fma-define30.0%
associate-*r*32.4%
unpow232.4%
unpow232.4%
swap-sqr50.0%
unpow250.0%
*-commutative50.0%
Simplified50.0%
Taylor expanded in D around inf 20.5%
associate-*r*20.6%
unpow220.6%
unpow220.6%
swap-sqr21.7%
unpow221.7%
*-commutative21.7%
*-commutative21.7%
associate-*r/21.5%
times-frac24.1%
Simplified24.1%
unpow250.9%
Applied egg-rr24.1%
associate-*l/24.3%
div-inv24.3%
pow-flip26.7%
metadata-eval26.7%
Applied egg-rr26.7%
associate-*r*26.4%
associate-*l/26.3%
associate-/l*26.2%
Simplified26.2%
Final simplification61.7%
(FPCore (w0 M D h l d) :precision binary64 w0)
double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
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
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
def code(w0, M, D, h, l, d): return w0
function code(w0, M, D, h, l, d) return w0 end
function tmp = code(w0, M, D, h, l, d) tmp = w0; end
code[w0_, M_, D_, h_, l_, d_] := w0
\begin{array}{l}
\\
w0
\end{array}
Initial program 76.0%
Simplified74.9%
Taylor expanded in D around 0 64.3%
herbie shell --seed 2024150
(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))))))