
(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 10 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
(let* ((t_0 (- 1.0 (* (pow (/ (* D M) (* d 2.0)) 2.0) (/ h l)))))
(if (<= t_0 2e+107)
(* w0 (sqrt t_0))
(*
w0
(sqrt (- 1.0 (* 0.25 (* h (* (/ D d) (* (/ M d) (* D (/ M l))))))))))))
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = 1.0 - (pow(((D * M) / (d * 2.0)), 2.0) * (h / l));
double tmp;
if (t_0 <= 2e+107) {
tmp = w0 * sqrt(t_0);
} else {
tmp = w0 * sqrt((1.0 - (0.25 * (h * ((D / d) * ((M / d) * (D * (M / 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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - ((((d * m) / (d_1 * 2.0d0)) ** 2.0d0) * (h / l))
if (t_0 <= 2d+107) then
tmp = w0 * sqrt(t_0)
else
tmp = w0 * sqrt((1.0d0 - (0.25d0 * (h * ((d / d_1) * ((m / d_1) * (d * (m / l))))))))
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = 1.0 - (Math.pow(((D * M) / (d * 2.0)), 2.0) * (h / l));
double tmp;
if (t_0 <= 2e+107) {
tmp = w0 * Math.sqrt(t_0);
} else {
tmp = w0 * Math.sqrt((1.0 - (0.25 * (h * ((D / d) * ((M / d) * (D * (M / l))))))));
}
return tmp;
}
def code(w0, M, D, h, l, d): t_0 = 1.0 - (math.pow(((D * M) / (d * 2.0)), 2.0) * (h / l)) tmp = 0 if t_0 <= 2e+107: tmp = w0 * math.sqrt(t_0) else: tmp = w0 * math.sqrt((1.0 - (0.25 * (h * ((D / d) * ((M / d) * (D * (M / l)))))))) return tmp
function code(w0, M, D, h, l, d) t_0 = Float64(1.0 - Float64((Float64(Float64(D * M) / Float64(d * 2.0)) ^ 2.0) * Float64(h / l))) tmp = 0.0 if (t_0 <= 2e+107) tmp = Float64(w0 * sqrt(t_0)); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(0.25 * Float64(h * Float64(Float64(D / d) * Float64(Float64(M / d) * Float64(D * Float64(M / l))))))))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) t_0 = 1.0 - ((((D * M) / (d * 2.0)) ^ 2.0) * (h / l)); tmp = 0.0; if (t_0 <= 2e+107) tmp = w0 * sqrt(t_0); else tmp = w0 * sqrt((1.0 - (0.25 * (h * ((D / d) * ((M / d) * (D * (M / l)))))))); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(1.0 - N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2e+107], N[(w0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(0.25 * N[(h * N[(N[(D / d), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(D * N[(M / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell}\\
\mathbf{if}\;t_0 \leq 2 \cdot 10^{+107}:\\
\;\;\;\;w0 \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \left(h \cdot \left(\frac{D}{d} \cdot \left(\frac{M}{d} \cdot \left(D \cdot \frac{M}{\ell}\right)\right)\right)\right)}\\
\end{array}
\end{array}
if (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))) < 1.9999999999999999e107Initial program 100.0%
if 1.9999999999999999e107 < (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))) Initial program 49.0%
Simplified50.0%
Taylor expanded in D around 0 43.4%
associate-*r*44.2%
unpow244.2%
unpow244.2%
swap-sqr49.9%
associate-/l*49.1%
swap-sqr43.3%
unpow243.3%
associate-*l*46.6%
Simplified46.6%
*-un-lft-identity46.6%
*-commutative46.6%
associate-/r/49.5%
*-commutative49.5%
Applied egg-rr49.5%
Simplified52.9%
Taylor expanded in D around 0 45.1%
unpow245.1%
unpow245.1%
unpow245.1%
associate-*r*49.5%
times-frac52.9%
associate-*l/56.5%
times-frac61.1%
associate-*l*63.1%
*-commutative63.1%
associate-*l*64.9%
Simplified64.9%
Final simplification86.3%
(FPCore (w0 M D h l d) :precision binary64 (if (<= D 7.5e+67) (* w0 (sqrt (- 1.0 (* 0.25 (* h (* (/ D d) (* (/ M d) (* D (/ M l))))))))) (* w0 (sqrt (- 1.0 (* (/ h l) (pow (* (/ M d) (/ D 2.0)) 2.0)))))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (D <= 7.5e+67) {
tmp = w0 * sqrt((1.0 - (0.25 * (h * ((D / d) * ((M / d) * (D * (M / l))))))));
} else {
tmp = w0 * sqrt((1.0 - ((h / l) * pow(((M / d) * (D / 2.0)), 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 <= 7.5d+67) then
tmp = w0 * sqrt((1.0d0 - (0.25d0 * (h * ((d / d_1) * ((m / d_1) * (d * (m / l))))))))
else
tmp = w0 * sqrt((1.0d0 - ((h / l) * (((m / d_1) * (d / 2.0d0)) ** 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 <= 7.5e+67) {
tmp = w0 * Math.sqrt((1.0 - (0.25 * (h * ((D / d) * ((M / d) * (D * (M / l))))))));
} else {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((M / d) * (D / 2.0)), 2.0))));
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if D <= 7.5e+67: tmp = w0 * math.sqrt((1.0 - (0.25 * (h * ((D / d) * ((M / d) * (D * (M / l)))))))) else: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((M / d) * (D / 2.0)), 2.0)))) return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (D <= 7.5e+67) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(0.25 * Float64(h * Float64(Float64(D / d) * Float64(Float64(M / d) * Float64(D * Float64(M / l))))))))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(M / d) * Float64(D / 2.0)) ^ 2.0))))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (D <= 7.5e+67) tmp = w0 * sqrt((1.0 - (0.25 * (h * ((D / d) * ((M / d) * (D * (M / l)))))))); else tmp = w0 * sqrt((1.0 - ((h / l) * (((M / d) * (D / 2.0)) ^ 2.0)))); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[D, 7.5e+67], N[(w0 * N[Sqrt[N[(1.0 - N[(0.25 * N[(h * N[(N[(D / d), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(D * N[(M / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M / d), $MachinePrecision] * N[(D / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;D \leq 7.5 \cdot 10^{+67}:\\
\;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \left(h \cdot \left(\frac{D}{d} \cdot \left(\frac{M}{d} \cdot \left(D \cdot \frac{M}{\ell}\right)\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2}}\\
\end{array}
\end{array}
if D < 7.5000000000000005e67Initial program 81.9%
Simplified81.0%
Taylor expanded in D around 0 52.5%
associate-*r*53.8%
unpow253.8%
unpow253.8%
swap-sqr66.0%
associate-/l*67.5%
swap-sqr53.4%
unpow253.4%
associate-*l*55.8%
Simplified55.8%
*-un-lft-identity55.8%
*-commutative55.8%
associate-/r/59.4%
*-commutative59.4%
Applied egg-rr59.4%
Simplified67.5%
Taylor expanded in D around 0 54.2%
unpow254.2%
unpow254.2%
unpow254.2%
associate-*r*59.4%
times-frac67.5%
associate-*l/73.0%
times-frac79.7%
associate-*l*82.9%
*-commutative82.9%
associate-*l*85.5%
Simplified85.5%
if 7.5000000000000005e67 < D Initial program 69.0%
Simplified71.7%
Final simplification83.5%
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (/ (* h (pow (* D (* M (/ 0.5 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 * (0.5 / 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 * (0.5d0 / 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 * (0.5 / d))), 2.0)) / l)));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - ((h * math.pow((D * (M * (0.5 / 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(0.5 / d))) ^ 2.0)) / l)))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((h * ((D * (M * (0.5 / 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[(0.5 / 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 \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}}
\end{array}
Initial program 80.1%
Simplified79.7%
associate-*r/84.0%
frac-times83.8%
*-commutative83.8%
clear-num83.8%
*-commutative83.8%
div-inv83.8%
associate-*l*84.0%
associate-/r*84.0%
metadata-eval84.0%
Applied egg-rr84.0%
associate-/r/84.0%
*-commutative84.0%
associate-*r*84.0%
*-commutative84.0%
Simplified84.0%
associate-*l/84.0%
*-un-lft-identity84.0%
Applied egg-rr84.0%
Final simplification84.0%
(FPCore (w0 M D h l d) :precision binary64 (if (<= D 4800000.0) (* w0 (sqrt (+ 1.0 (* (* -0.25 (* h (* D (/ D d)))) (/ (* M (/ M d)) l))))) (* w0 (+ 1.0 (* -0.125 (* M (* (/ D d) (* (/ D d) (/ M (/ l h))))))))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (D <= 4800000.0) {
tmp = w0 * sqrt((1.0 + ((-0.25 * (h * (D * (D / d)))) * ((M * (M / d)) / l))));
} else {
tmp = w0 * (1.0 + (-0.125 * (M * ((D / d) * ((D / d) * (M / (l / h)))))));
}
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 <= 4800000.0d0) then
tmp = w0 * sqrt((1.0d0 + (((-0.25d0) * (h * (d * (d / d_1)))) * ((m * (m / d_1)) / l))))
else
tmp = w0 * (1.0d0 + ((-0.125d0) * (m * ((d / d_1) * ((d / d_1) * (m / (l / h)))))))
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 <= 4800000.0) {
tmp = w0 * Math.sqrt((1.0 + ((-0.25 * (h * (D * (D / d)))) * ((M * (M / d)) / l))));
} else {
tmp = w0 * (1.0 + (-0.125 * (M * ((D / d) * ((D / d) * (M / (l / h)))))));
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if D <= 4800000.0: tmp = w0 * math.sqrt((1.0 + ((-0.25 * (h * (D * (D / d)))) * ((M * (M / d)) / l)))) else: tmp = w0 * (1.0 + (-0.125 * (M * ((D / d) * ((D / d) * (M / (l / h))))))) return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (D <= 4800000.0) tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(Float64(-0.25 * Float64(h * Float64(D * Float64(D / d)))) * Float64(Float64(M * Float64(M / d)) / l))))); else tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(M * Float64(Float64(D / d) * Float64(Float64(D / d) * Float64(M / Float64(l / h)))))))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (D <= 4800000.0) tmp = w0 * sqrt((1.0 + ((-0.25 * (h * (D * (D / d)))) * ((M * (M / d)) / l)))); else tmp = w0 * (1.0 + (-0.125 * (M * ((D / d) * ((D / d) * (M / (l / h))))))); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[D, 4800000.0], N[(w0 * N[Sqrt[N[(1.0 + N[(N[(-0.25 * N[(h * N[(D * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[(1.0 + N[(-0.125 * N[(M * N[(N[(D / d), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(M / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;D \leq 4800000:\\
\;\;\;\;w0 \cdot \sqrt{1 + \left(-0.25 \cdot \left(h \cdot \left(D \cdot \frac{D}{d}\right)\right)\right) \cdot \frac{M \cdot \frac{M}{d}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(M \cdot \left(\frac{D}{d} \cdot \left(\frac{D}{d} \cdot \frac{M}{\frac{\ell}{h}}\right)\right)\right)\right)\\
\end{array}
\end{array}
if D < 4.8e6Initial program 82.1%
Simplified81.1%
Taylor expanded in D around 0 52.4%
associate-*r*53.7%
unpow253.7%
unpow253.7%
swap-sqr66.4%
associate-/l*68.0%
swap-sqr53.3%
unpow253.3%
associate-*l*55.8%
Simplified55.8%
*-un-lft-identity55.8%
*-commutative55.8%
associate-/r/59.5%
*-commutative59.5%
Applied egg-rr59.5%
Simplified67.9%
*-un-lft-identity67.9%
cancel-sign-sub-inv67.9%
metadata-eval67.9%
associate-*r*67.0%
associate-/l*70.8%
times-frac77.8%
Applied egg-rr77.8%
*-lft-identity77.8%
associate-*r*77.8%
associate-/r/77.8%
associate-*r/77.2%
Simplified77.2%
if 4.8e6 < D Initial program 70.9%
Simplified73.0%
Taylor expanded in D around 0 40.1%
+-commutative40.1%
*-commutative40.1%
fma-def40.1%
associate-*r*40.1%
unpow240.1%
unpow240.1%
swap-sqr47.0%
associate-/l*47.1%
swap-sqr40.1%
unpow240.1%
associate-*l*42.6%
Simplified42.6%
Taylor expanded in w0 around 0 40.1%
*-commutative40.1%
unpow240.1%
times-frac42.4%
unpow242.4%
unpow242.4%
associate-/l*42.3%
associate-/l*48.9%
Simplified48.9%
Taylor expanded in D around 0 40.1%
unpow240.1%
unpow240.1%
times-frac42.4%
times-frac54.1%
unpow254.1%
associate-/l*53.9%
associate-*l/62.6%
associate-*r*62.9%
*-commutative62.9%
associate-*l*65.0%
Simplified65.0%
Final simplification75.0%
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* 0.25 (* h (* (/ D d) (* (/ M d) (* D (/ M l))))))))))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (0.25 * (h * ((D / d) * ((M / d) * (D * (M / 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 - (0.25d0 * (h * ((d / d_1) * ((m / d_1) * (d * (m / 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 - (0.25 * (h * ((D / d) * ((M / d) * (D * (M / l))))))));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (0.25 * (h * ((D / d) * ((M / d) * (D * (M / l))))))))
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(0.25 * Float64(h * Float64(Float64(D / d) * Float64(Float64(M / d) * Float64(D * Float64(M / l))))))))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - (0.25 * (h * ((D / d) * ((M / d) * (D * (M / l)))))))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(0.25 * N[(h * N[(N[(D / d), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(D * N[(M / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - 0.25 \cdot \left(h \cdot \left(\frac{D}{d} \cdot \left(\frac{M}{d} \cdot \left(D \cdot \frac{M}{\ell}\right)\right)\right)\right)}
\end{array}
Initial program 80.1%
Simplified79.7%
Taylor expanded in D around 0 50.5%
associate-*r*51.6%
unpow251.6%
unpow251.6%
swap-sqr63.7%
associate-/l*64.9%
swap-sqr51.3%
unpow251.3%
associate-*l*54.1%
Simplified54.1%
*-un-lft-identity54.1%
*-commutative54.1%
associate-/r/57.2%
*-commutative57.2%
Applied egg-rr57.2%
Simplified64.6%
Taylor expanded in D around 0 52.0%
unpow252.0%
unpow252.0%
unpow252.0%
associate-*r*57.2%
times-frac64.6%
associate-*l/70.6%
times-frac77.1%
associate-*l*81.0%
*-commutative81.0%
associate-*l*82.4%
Simplified82.4%
Final simplification82.4%
(FPCore (w0 M D h l d) :precision binary64 (if (<= M 1.05e-145) w0 (* w0 (+ 1.0 (* -0.125 (* (* (/ D d) (/ D d)) (/ (* h (* M M)) l)))))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 1.05e-145) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * (((D / d) * (D / d)) * ((h * (M * M)) / 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 <= 1.05d-145) then
tmp = w0
else
tmp = w0 * (1.0d0 + ((-0.125d0) * (((d / d_1) * (d / d_1)) * ((h * (m * m)) / 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 <= 1.05e-145) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * (((D / d) * (D / d)) * ((h * (M * M)) / l))));
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if M <= 1.05e-145: tmp = w0 else: tmp = w0 * (1.0 + (-0.125 * (((D / d) * (D / d)) * ((h * (M * M)) / l)))) return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 1.05e-145) tmp = w0; else tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(h * Float64(M * M)) / l))))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (M <= 1.05e-145) tmp = w0; else tmp = w0 * (1.0 + (-0.125 * (((D / d) * (D / d)) * ((h * (M * M)) / l)))); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 1.05e-145], w0, N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 1.05 \cdot 10^{-145}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{h \cdot \left(M \cdot M\right)}{\ell}\right)\right)\\
\end{array}
\end{array}
if M < 1.04999999999999996e-145Initial program 81.1%
Simplified81.7%
Taylor expanded in D around 0 72.4%
if 1.04999999999999996e-145 < M Initial program 78.1%
Simplified75.8%
Taylor expanded in D around 0 47.9%
*-commutative47.9%
times-frac50.3%
unpow250.3%
unpow250.3%
unpow250.3%
Simplified50.3%
Taylor expanded in D around 0 50.3%
unpow250.3%
unpow250.3%
times-frac62.3%
Simplified62.3%
Final simplification69.0%
(FPCore (w0 M D h l d) :precision binary64 (if (<= M 2.2e-196) w0 (* w0 (+ 1.0 (* -0.125 (* M (* (/ D d) (* (/ D d) (/ M (/ l h))))))))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 2.2e-196) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * (M * ((D / d) * ((D / d) * (M / (l / h)))))));
}
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.2d-196) then
tmp = w0
else
tmp = w0 * (1.0d0 + ((-0.125d0) * (m * ((d / d_1) * ((d / d_1) * (m / (l / h)))))))
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.2e-196) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * (M * ((D / d) * ((D / d) * (M / (l / h)))))));
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if M <= 2.2e-196: tmp = w0 else: tmp = w0 * (1.0 + (-0.125 * (M * ((D / d) * ((D / d) * (M / (l / h))))))) return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 2.2e-196) tmp = w0; else tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(M * Float64(Float64(D / d) * Float64(Float64(D / d) * Float64(M / Float64(l / h)))))))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (M <= 2.2e-196) tmp = w0; else tmp = w0 * (1.0 + (-0.125 * (M * ((D / d) * ((D / d) * (M / (l / h))))))); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 2.2e-196], w0, N[(w0 * N[(1.0 + N[(-0.125 * N[(M * N[(N[(D / d), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(M / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 2.2 \cdot 10^{-196}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(M \cdot \left(\frac{D}{d} \cdot \left(\frac{D}{d} \cdot \frac{M}{\frac{\ell}{h}}\right)\right)\right)\right)\\
\end{array}
\end{array}
if M < 2.20000000000000015e-196Initial program 81.4%
Simplified82.0%
Taylor expanded in D around 0 71.3%
if 2.20000000000000015e-196 < M Initial program 77.9%
Simplified75.9%
Taylor expanded in D around 0 48.7%
+-commutative48.7%
*-commutative48.7%
fma-def48.7%
associate-*r*50.6%
unpow250.6%
unpow250.6%
swap-sqr57.5%
associate-/l*59.5%
swap-sqr50.6%
unpow250.6%
associate-*l*52.7%
Simplified52.7%
Taylor expanded in w0 around 0 48.7%
*-commutative48.7%
unpow248.7%
times-frac51.8%
unpow251.8%
unpow251.8%
associate-/l*49.7%
associate-/l*57.2%
Simplified57.2%
Taylor expanded in D around 0 48.7%
unpow248.7%
unpow248.7%
times-frac51.8%
times-frac63.4%
unpow263.4%
associate-/l*61.3%
associate-*l/69.1%
associate-*r*69.2%
*-commutative69.2%
associate-*l*72.3%
Simplified72.3%
Final simplification71.7%
(FPCore (w0 M D h l d) :precision binary64 (if (<= M 7.5e+50) w0 (* -0.125 (* (* M (* M (* w0 h))) (/ (/ D d) (* d (/ l D)))))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 7.5e+50) {
tmp = w0;
} else {
tmp = -0.125 * ((M * (M * (w0 * h))) * ((D / d) / (d * (l / D))));
}
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.5d+50) then
tmp = w0
else
tmp = (-0.125d0) * ((m * (m * (w0 * h))) * ((d / d_1) / (d_1 * (l / d))))
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.5e+50) {
tmp = w0;
} else {
tmp = -0.125 * ((M * (M * (w0 * h))) * ((D / d) / (d * (l / D))));
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if M <= 7.5e+50: tmp = w0 else: tmp = -0.125 * ((M * (M * (w0 * h))) * ((D / d) / (d * (l / D)))) return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 7.5e+50) tmp = w0; else tmp = Float64(-0.125 * Float64(Float64(M * Float64(M * Float64(w0 * h))) * Float64(Float64(D / d) / Float64(d * Float64(l / D))))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (M <= 7.5e+50) tmp = w0; else tmp = -0.125 * ((M * (M * (w0 * h))) * ((D / d) / (d * (l / D)))); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 7.5e+50], w0, N[(-0.125 * N[(N[(M * N[(M * N[(w0 * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] / N[(d * N[(l / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 7.5 \cdot 10^{+50}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(\left(M \cdot \left(M \cdot \left(w0 \cdot h\right)\right)\right) \cdot \frac{\frac{D}{d}}{d \cdot \frac{\ell}{D}}\right)\\
\end{array}
\end{array}
if M < 7.4999999999999999e50Initial program 82.2%
Simplified82.7%
Taylor expanded in D around 0 72.0%
if 7.4999999999999999e50 < M Initial program 70.9%
Simplified66.8%
Taylor expanded in D around 0 37.5%
+-commutative37.5%
*-commutative37.5%
fma-def37.5%
associate-*r*41.6%
unpow241.6%
unpow241.6%
swap-sqr53.6%
associate-/l*55.8%
swap-sqr41.6%
unpow241.6%
associate-*l*43.8%
Simplified43.8%
Taylor expanded in D around inf 31.8%
unpow231.8%
times-frac31.9%
unpow231.9%
unpow231.9%
*-commutative31.9%
Simplified31.9%
Taylor expanded in D around 0 31.8%
unpow231.8%
associate-/l*31.8%
unpow231.8%
*-commutative31.8%
unpow231.8%
*-commutative31.8%
associate-/r/31.8%
*-commutative31.8%
*-commutative31.8%
associate-*l*32.4%
associate-/r*32.4%
associate-/l*34.4%
Simplified34.4%
Taylor expanded in D around 0 32.4%
unpow232.4%
associate-/l*34.7%
unpow234.7%
associate-*r/34.7%
associate-*l*39.3%
associate-/r*39.3%
Simplified39.3%
Final simplification65.8%
(FPCore (w0 M D h l d) :precision binary64 (if (<= M 1.1e+52) w0 (* -0.125 (/ (* (* (/ D d) (/ D d)) (* (* M M) (* w0 h))) l))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 1.1e+52) {
tmp = w0;
} else {
tmp = -0.125 * ((((D / d) * (D / d)) * ((M * M) * (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 <= 1.1d+52) then
tmp = w0
else
tmp = (-0.125d0) * ((((d / d_1) * (d / d_1)) * ((m * m) * (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 <= 1.1e+52) {
tmp = w0;
} else {
tmp = -0.125 * ((((D / d) * (D / d)) * ((M * M) * (w0 * h))) / l);
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if M <= 1.1e+52: tmp = w0 else: tmp = -0.125 * ((((D / d) * (D / d)) * ((M * M) * (w0 * h))) / l) return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 1.1e+52) tmp = w0; else tmp = Float64(-0.125 * Float64(Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(M * M) * Float64(w0 * h))) / l)); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (M <= 1.1e+52) tmp = w0; else tmp = -0.125 * ((((D / d) * (D / d)) * ((M * M) * (w0 * h))) / l); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 1.1e+52], w0, N[(-0.125 * N[(N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] * N[(w0 * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 1.1 \cdot 10^{+52}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \frac{\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(\left(M \cdot M\right) \cdot \left(w0 \cdot h\right)\right)}{\ell}\\
\end{array}
\end{array}
if M < 1.1e52Initial program 82.2%
Simplified82.7%
Taylor expanded in D around 0 72.0%
if 1.1e52 < M Initial program 70.9%
Simplified66.8%
Taylor expanded in D around 0 37.5%
+-commutative37.5%
*-commutative37.5%
fma-def37.5%
associate-*r*41.6%
unpow241.6%
unpow241.6%
swap-sqr53.6%
associate-/l*55.8%
swap-sqr41.6%
unpow241.6%
associate-*l*43.8%
Simplified43.8%
Taylor expanded in D around inf 31.8%
unpow231.8%
times-frac31.9%
unpow231.9%
unpow231.9%
*-commutative31.9%
Simplified31.9%
associate-*r/31.9%
times-frac38.9%
Applied egg-rr38.9%
Final simplification65.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 80.1%
Simplified79.7%
Taylor expanded in D around 0 64.5%
Final simplification64.5%
herbie shell --seed 2023272
(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))))))