
(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 (/ (* M D) (* 2.0 d)) 2.0) (/ h l)))))
(if (<= t_0 5e+207)
(* w0 (sqrt t_0))
(*
w0
(sqrt
(- 1.0 (* h (* (/ (* M 0.5) (/ d D)) (/ (* (* M 0.5) (/ D d)) l)))))))))
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = 1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l));
double tmp;
if (t_0 <= 5e+207) {
tmp = w0 * sqrt(t_0);
} else {
tmp = w0 * sqrt((1.0 - (h * (((M * 0.5) / (d / D)) * (((M * 0.5) * (D / d)) / 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 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))
if (t_0 <= 5d+207) then
tmp = w0 * sqrt(t_0)
else
tmp = w0 * sqrt((1.0d0 - (h * (((m * 0.5d0) / (d_1 / d)) * (((m * 0.5d0) * (d / d_1)) / 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(((M * D) / (2.0 * d)), 2.0) * (h / l));
double tmp;
if (t_0 <= 5e+207) {
tmp = w0 * Math.sqrt(t_0);
} else {
tmp = w0 * Math.sqrt((1.0 - (h * (((M * 0.5) / (d / D)) * (((M * 0.5) * (D / d)) / l)))));
}
return tmp;
}
def code(w0, M, D, h, l, d): t_0 = 1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) tmp = 0 if t_0 <= 5e+207: tmp = w0 * math.sqrt(t_0) else: tmp = w0 * math.sqrt((1.0 - (h * (((M * 0.5) / (d / D)) * (((M * 0.5) * (D / d)) / l))))) return tmp
function code(w0, M, D, h, l, d) t_0 = Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))) tmp = 0.0 if (t_0 <= 5e+207) tmp = Float64(w0 * sqrt(t_0)); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64(Float64(Float64(M * 0.5) / Float64(d / D)) * Float64(Float64(Float64(M * 0.5) * Float64(D / d)) / l)))))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) t_0 = 1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)); tmp = 0.0; if (t_0 <= 5e+207) tmp = w0 * sqrt(t_0); else tmp = w0 * sqrt((1.0 - (h * (((M * 0.5) / (d / D)) * (((M * 0.5) * (D / d)) / 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[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e+207], N[(w0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[(N[(M * 0.5), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M * 0.5), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{+207}:\\
\;\;\;\;w0 \cdot \sqrt{t\_0}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \left(\frac{M \cdot 0.5}{\frac{d}{D}} \cdot \frac{\left(M \cdot 0.5\right) \cdot \frac{D}{d}}{\ell}\right)}\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))) < 4.9999999999999999e207Initial program 99.7%
if 4.9999999999999999e207 < (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))) Initial program 42.6%
Simplified42.6%
clear-num42.5%
un-div-inv44.7%
clear-num44.7%
un-div-inv44.7%
associate-/r/44.7%
Applied egg-rr44.7%
associate-/r/62.6%
associate-/r*62.6%
associate-/r/61.6%
associate-*l/61.6%
Simplified61.6%
unpow261.6%
div-inv61.6%
metadata-eval61.6%
div-inv61.6%
metadata-eval61.6%
Applied egg-rr61.6%
associate-/l*65.9%
associate-*l*65.9%
associate-*l*65.9%
Applied egg-rr65.9%
*-commutative65.9%
clear-num65.9%
un-div-inv65.9%
Applied egg-rr65.9%
Final simplification87.1%
(FPCore (w0 M D h l d)
:precision binary64
(if (<= (/ h l) (- INFINITY))
(* w0 (sqrt (- 1.0 (* (* (* (/ D d) (/ D d)) (/ (* h (* M M)) l)) 0.25))))
(if (<= (/ h l) -1e-233)
(*
w0
(sqrt
(- 1.0 (* (/ h l) (* (* M D) (* (/ 0.5 d) (/ D (* 2.0 (/ d M)))))))))
w0)))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -((double) INFINITY)) {
tmp = w0 * sqrt((1.0 - ((((D / d) * (D / d)) * ((h * (M * M)) / l)) * 0.25)));
} else if ((h / l) <= -1e-233) {
tmp = w0 * sqrt((1.0 - ((h / l) * ((M * D) * ((0.5 / d) * (D / (2.0 * (d / M))))))));
} else {
tmp = w0;
}
return tmp;
}
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -Double.POSITIVE_INFINITY) {
tmp = w0 * Math.sqrt((1.0 - ((((D / d) * (D / d)) * ((h * (M * M)) / l)) * 0.25)));
} else if ((h / l) <= -1e-233) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * ((M * D) * ((0.5 / d) * (D / (2.0 * (d / M))))))));
} else {
tmp = w0;
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (h / l) <= -math.inf: tmp = w0 * math.sqrt((1.0 - ((((D / d) * (D / d)) * ((h * (M * M)) / l)) * 0.25))) elif (h / l) <= -1e-233: tmp = w0 * math.sqrt((1.0 - ((h / l) * ((M * D) * ((0.5 / d) * (D / (2.0 * (d / M)))))))) else: tmp = w0 return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64(h / l) <= Float64(-Inf)) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(h * Float64(M * M)) / l)) * 0.25)))); elseif (Float64(h / l) <= -1e-233) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * Float64(Float64(M * D) * Float64(Float64(0.5 / d) * Float64(D / Float64(2.0 * Float64(d / M))))))))); else tmp = w0; end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if ((h / l) <= -Inf) tmp = w0 * sqrt((1.0 - ((((D / d) * (D / d)) * ((h * (M * M)) / l)) * 0.25))); elseif ((h / l) <= -1e-233) tmp = w0 * sqrt((1.0 - ((h / l) * ((M * D) * ((0.5 / d) * (D / (2.0 * (d / M)))))))); else tmp = w0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(h / l), $MachinePrecision], (-Infinity)], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(h / l), $MachinePrecision], -1e-233], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[(M * D), $MachinePrecision] * N[(N[(0.5 / d), $MachinePrecision] * N[(D / N[(2.0 * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -\infty:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{h \cdot \left(M \cdot M\right)}{\ell}\right) \cdot 0.25}\\
\mathbf{elif}\;\frac{h}{\ell} \leq -1 \cdot 10^{-233}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \left(\left(M \cdot D\right) \cdot \left(\frac{0.5}{d} \cdot \frac{D}{2 \cdot \frac{d}{M}}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -inf.0Initial program 30.5%
Simplified30.5%
clear-num30.5%
un-div-inv37.0%
clear-num37.0%
un-div-inv37.0%
associate-/r/37.0%
Applied egg-rr37.0%
associate-/r/74.6%
associate-/r*74.6%
associate-/r/71.6%
associate-*l/71.6%
Simplified71.6%
Taylor expanded in D around 0 48.9%
*-commutative48.9%
times-frac42.5%
unpow242.5%
unpow242.5%
times-frac48.6%
unpow248.6%
Simplified48.6%
unpow248.6%
Applied egg-rr48.6%
unpow248.6%
Applied egg-rr48.6%
if -inf.0 < (/.f64 h l) < -9.99999999999999958e-234Initial program 83.4%
Simplified82.3%
unpow282.3%
associate-/r*82.3%
associate-*r/81.9%
*-commutative81.9%
div-inv81.9%
associate-*l*79.5%
*-commutative79.5%
associate-/r*79.5%
metadata-eval79.5%
clear-num79.5%
un-div-inv79.7%
associate-/r/79.7%
Applied egg-rr79.7%
if -9.99999999999999958e-234 < (/.f64 h l) Initial program 86.9%
Simplified86.0%
Taylor expanded in D around 0 92.9%
Final simplification81.5%
(FPCore (w0 M D h l d) :precision binary64 (if (<= M 6.5e-127) w0 (* w0 (sqrt (- 1.0 (* (* (* (/ D d) (/ D d)) (/ (* h (* M M)) l)) 0.25))))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 6.5e-127) {
tmp = w0;
} else {
tmp = w0 * sqrt((1.0 - ((((D / d) * (D / d)) * ((h * (M * M)) / l)) * 0.25)));
}
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 <= 6.5d-127) then
tmp = w0
else
tmp = w0 * sqrt((1.0d0 - ((((d / d_1) * (d / d_1)) * ((h * (m * m)) / l)) * 0.25d0)))
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 <= 6.5e-127) {
tmp = w0;
} else {
tmp = w0 * Math.sqrt((1.0 - ((((D / d) * (D / d)) * ((h * (M * M)) / l)) * 0.25)));
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if M <= 6.5e-127: tmp = w0 else: tmp = w0 * math.sqrt((1.0 - ((((D / d) * (D / d)) * ((h * (M * M)) / l)) * 0.25))) return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 6.5e-127) tmp = w0; else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(h * Float64(M * M)) / l)) * 0.25)))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (M <= 6.5e-127) tmp = w0; else tmp = w0 * sqrt((1.0 - ((((D / d) * (D / d)) * ((h * (M * M)) / l)) * 0.25))); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 6.5e-127], w0, N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 6.5 \cdot 10^{-127}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{h \cdot \left(M \cdot M\right)}{\ell}\right) \cdot 0.25}\\
\end{array}
\end{array}
if M < 6.49999999999999998e-127Initial program 81.2%
Simplified80.1%
Taylor expanded in D around 0 70.6%
if 6.49999999999999998e-127 < M Initial program 73.8%
Simplified73.2%
clear-num73.2%
un-div-inv73.2%
clear-num73.2%
un-div-inv73.4%
associate-/r/73.4%
Applied egg-rr73.4%
associate-/r/77.9%
associate-/r*77.9%
associate-/r/77.6%
associate-*l/77.6%
Simplified77.6%
Taylor expanded in D around 0 50.5%
*-commutative50.5%
times-frac51.6%
unpow251.6%
unpow251.6%
times-frac60.5%
unpow260.5%
Simplified60.5%
unpow260.5%
Applied egg-rr60.5%
unpow260.5%
Applied egg-rr60.5%
Final simplification66.9%
(FPCore (w0 M D h l d) :precision binary64 (let* ((t_0 (* (* M 0.5) (/ D d)))) (* w0 (sqrt (- 1.0 (* h (* t_0 (/ t_0 l))))))))
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = (M * 0.5) * (D / d);
return w0 * sqrt((1.0 - (h * (t_0 * (t_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
real(8) :: t_0
t_0 = (m * 0.5d0) * (d / d_1)
code = w0 * sqrt((1.0d0 - (h * (t_0 * (t_0 / l)))))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = (M * 0.5) * (D / d);
return w0 * Math.sqrt((1.0 - (h * (t_0 * (t_0 / l)))));
}
def code(w0, M, D, h, l, d): t_0 = (M * 0.5) * (D / d) return w0 * math.sqrt((1.0 - (h * (t_0 * (t_0 / l)))))
function code(w0, M, D, h, l, d) t_0 = Float64(Float64(M * 0.5) * Float64(D / d)) return Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64(t_0 * Float64(t_0 / l)))))) end
function tmp = code(w0, M, D, h, l, d) t_0 = (M * 0.5) * (D / d); tmp = w0 * sqrt((1.0 - (h * (t_0 * (t_0 / l))))); end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(N[(M * 0.5), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]}, N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(M \cdot 0.5\right) \cdot \frac{D}{d}\\
w0 \cdot \sqrt{1 - h \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)}
\end{array}
\end{array}
Initial program 78.5%
Simplified77.6%
clear-num77.6%
un-div-inv78.3%
clear-num78.3%
un-div-inv78.4%
associate-/r/78.4%
Applied egg-rr78.4%
associate-/r/85.1%
associate-/r*85.1%
associate-/r/84.2%
associate-*l/84.2%
Simplified84.2%
unpow284.2%
div-inv84.2%
metadata-eval84.2%
div-inv84.2%
metadata-eval84.2%
Applied egg-rr84.2%
associate-/l*85.7%
associate-*l*85.7%
associate-*l*85.7%
Applied egg-rr85.7%
Final simplification85.7%
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* h (* (* (* M 0.5) (/ D d)) (/ (* 0.5 (* D (/ M d))) l)))))))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (h * (((M * 0.5) * (D / d)) * ((0.5 * (D * (M / d))) / 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 * (((m * 0.5d0) * (d / d_1)) * ((0.5d0 * (d * (m / d_1))) / 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 * (((M * 0.5) * (D / d)) * ((0.5 * (D * (M / d))) / l)))));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (h * (((M * 0.5) * (D / d)) * ((0.5 * (D * (M / d))) / l)))))
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64(Float64(Float64(M * 0.5) * Float64(D / d)) * Float64(Float64(0.5 * Float64(D * Float64(M / d))) / l)))))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - (h * (((M * 0.5) * (D / d)) * ((0.5 * (D * (M / d))) / l))))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[(N[(M * 0.5), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - h \cdot \left(\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right) \cdot \frac{0.5 \cdot \left(D \cdot \frac{M}{d}\right)}{\ell}\right)}
\end{array}
Initial program 78.5%
Simplified77.6%
clear-num77.6%
un-div-inv78.3%
clear-num78.3%
un-div-inv78.4%
associate-/r/78.4%
Applied egg-rr78.4%
associate-/r/85.1%
associate-/r*85.1%
associate-/r/84.2%
associate-*l/84.2%
Simplified84.2%
unpow284.2%
div-inv84.2%
metadata-eval84.2%
div-inv84.2%
metadata-eval84.2%
Applied egg-rr84.2%
associate-/l*85.7%
associate-*l*85.7%
associate-*l*85.7%
Applied egg-rr85.7%
Taylor expanded in D around 0 85.5%
associate-/l*84.3%
Simplified84.3%
Final simplification84.3%
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* h (* (* (* M 0.5) (/ D d)) (* D (/ (* M (/ 0.5 l)) d))))))))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (h * (((M * 0.5) * (D / d)) * (D * ((M * (0.5 / l)) / d))))));
}
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 * (((m * 0.5d0) * (d / d_1)) * (d * ((m * (0.5d0 / l)) / d_1))))))
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 * (((M * 0.5) * (D / d)) * (D * ((M * (0.5 / l)) / d))))));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (h * (((M * 0.5) * (D / d)) * (D * ((M * (0.5 / l)) / d))))))
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64(Float64(Float64(M * 0.5) * Float64(D / d)) * Float64(D * Float64(Float64(M * Float64(0.5 / l)) / d))))))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - (h * (((M * 0.5) * (D / d)) * (D * ((M * (0.5 / l)) / d)))))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[(N[(M * 0.5), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(D * N[(N[(M * N[(0.5 / l), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - h \cdot \left(\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right) \cdot \left(D \cdot \frac{M \cdot \frac{0.5}{\ell}}{d}\right)\right)}
\end{array}
Initial program 78.5%
Simplified77.6%
clear-num77.6%
un-div-inv78.3%
clear-num78.3%
un-div-inv78.4%
associate-/r/78.4%
Applied egg-rr78.4%
associate-/r/85.1%
associate-/r*85.1%
associate-/r/84.2%
associate-*l/84.2%
Simplified84.2%
unpow284.2%
div-inv84.2%
metadata-eval84.2%
div-inv84.2%
metadata-eval84.2%
Applied egg-rr84.2%
associate-/l*85.7%
associate-*l*85.7%
associate-*l*85.7%
Applied egg-rr85.7%
*-un-lft-identity85.7%
associate-/l*84.1%
Applied egg-rr84.1%
*-lft-identity84.1%
associate-*l/83.4%
associate-/l*83.0%
*-commutative83.0%
associate-/l*83.0%
Simplified83.0%
Final simplification83.0%
(FPCore (w0 M D h l d) :precision binary64 (if (<= M 5.6e-63) w0 (+ w0 (* -0.125 (/ (* (pow (* M (/ D d)) 2.0) (* h w0)) l)))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 5.6e-63) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * ((pow((M * (D / d)), 2.0) * (h * w0)) / 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 <= 5.6d-63) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * ((((m * (d / d_1)) ** 2.0d0) * (h * w0)) / 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 <= 5.6e-63) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * ((Math.pow((M * (D / d)), 2.0) * (h * w0)) / l));
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if M <= 5.6e-63: tmp = w0 else: tmp = w0 + (-0.125 * ((math.pow((M * (D / d)), 2.0) * (h * w0)) / l)) return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 5.6e-63) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64((Float64(M * Float64(D / d)) ^ 2.0) * Float64(h * w0)) / l))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (M <= 5.6e-63) tmp = w0; else tmp = w0 + (-0.125 * ((((M * (D / d)) ^ 2.0) * (h * w0)) / l)); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 5.6e-63], w0, N[(w0 + N[(-0.125 * N[(N[(N[Power[N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * w0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 5.6 \cdot 10^{-63}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2} \cdot \left(h \cdot w0\right)}{\ell}\\
\end{array}
\end{array}
if M < 5.6000000000000005e-63Initial program 81.2%
Simplified80.4%
Taylor expanded in D around 0 72.0%
if 5.6000000000000005e-63 < M Initial program 72.0%
Simplified70.8%
associate-/r*70.8%
associate-*r/72.0%
*-commutative72.0%
unpow272.0%
clear-num72.0%
clear-num72.0%
frac-times71.9%
metadata-eval71.9%
times-frac71.8%
times-frac71.9%
Applied egg-rr71.9%
Taylor expanded in M around 0 38.8%
+-commutative38.8%
fma-define38.8%
times-frac37.6%
associate-*r/38.9%
unpow238.9%
unpow238.9%
times-frac43.6%
unpow243.6%
Simplified43.6%
fma-undefine43.6%
pow243.6%
associate-*r*47.5%
pow247.5%
pow-prod-down59.8%
Applied egg-rr59.8%
Final simplification68.4%
(FPCore (w0 M D h l d) :precision binary64 (if (<= M 4.5e-20) w0 (* -0.125 (* (pow (* D (/ M d)) 2.0) (* h (/ w0 l))))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 4.5e-20) {
tmp = w0;
} else {
tmp = -0.125 * (pow((D * (M / d)), 2.0) * (h * (w0 / 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 <= 4.5d-20) then
tmp = w0
else
tmp = (-0.125d0) * (((d * (m / d_1)) ** 2.0d0) * (h * (w0 / 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 <= 4.5e-20) {
tmp = w0;
} else {
tmp = -0.125 * (Math.pow((D * (M / d)), 2.0) * (h * (w0 / l)));
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if M <= 4.5e-20: tmp = w0 else: tmp = -0.125 * (math.pow((D * (M / d)), 2.0) * (h * (w0 / l))) return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 4.5e-20) tmp = w0; else tmp = Float64(-0.125 * Float64((Float64(D * Float64(M / d)) ^ 2.0) * Float64(h * Float64(w0 / l)))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (M <= 4.5e-20) tmp = w0; else tmp = -0.125 * (((D * (M / d)) ^ 2.0) * (h * (w0 / l))); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 4.5e-20], w0, N[(-0.125 * N[(N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * N[(w0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 4.5 \cdot 10^{-20}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(h \cdot \frac{w0}{\ell}\right)\right)\\
\end{array}
\end{array}
if M < 4.5000000000000001e-20Initial program 82.4%
Simplified81.7%
Taylor expanded in D around 0 73.3%
if 4.5000000000000001e-20 < M Initial program 66.8%
Simplified65.3%
associate-/r*65.3%
associate-*r/66.8%
*-commutative66.8%
unpow266.8%
clear-num66.7%
clear-num66.7%
frac-times66.7%
metadata-eval66.7%
times-frac66.6%
times-frac66.6%
Applied egg-rr66.6%
Taylor expanded in M around 0 36.8%
+-commutative36.8%
fma-define36.8%
times-frac35.3%
associate-*r/36.8%
unpow236.8%
unpow236.8%
times-frac37.6%
unpow237.6%
Simplified37.6%
Taylor expanded in D around inf 21.7%
associate-*r*21.8%
times-frac21.9%
*-commutative21.9%
associate-/l*21.8%
unpow221.8%
unpow221.8%
unpow221.8%
times-frac22.4%
swap-sqr24.9%
*-commutative24.9%
*-commutative24.9%
unpow224.9%
associate-*l/25.1%
associate-/l*25.0%
associate-/l*24.9%
Simplified24.9%
(FPCore (w0 M D h l d) :precision binary64 (if (<= M 2.8e-35) w0 (sqrt (* w0 w0))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 2.8e-35) {
tmp = w0;
} else {
tmp = sqrt((w0 * 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 (m <= 2.8d-35) then
tmp = w0
else
tmp = sqrt((w0 * 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 (M <= 2.8e-35) {
tmp = w0;
} else {
tmp = Math.sqrt((w0 * w0));
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if M <= 2.8e-35: tmp = w0 else: tmp = math.sqrt((w0 * w0)) return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 2.8e-35) tmp = w0; else tmp = sqrt(Float64(w0 * w0)); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (M <= 2.8e-35) tmp = w0; else tmp = sqrt((w0 * w0)); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 2.8e-35], w0, N[Sqrt[N[(w0 * w0), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 2.8 \cdot 10^{-35}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{w0 \cdot w0}\\
\end{array}
\end{array}
if M < 2.8e-35Initial program 82.0%
Simplified81.3%
Taylor expanded in D around 0 73.2%
if 2.8e-35 < M Initial program 68.7%
Simplified67.4%
add-sqr-sqrt28.5%
sqrt-unprod19.5%
*-commutative19.5%
*-commutative19.5%
swap-sqr19.4%
Applied egg-rr19.4%
associate-*l/19.5%
associate-/l*19.6%
associate-/r*19.6%
associate-/r/19.6%
associate-*l/19.6%
Simplified19.6%
Taylor expanded in h around 0 17.1%
unpow217.1%
Applied egg-rr17.1%
(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 78.5%
Simplified77.6%
Taylor expanded in D around 0 65.4%
herbie shell --seed 2024118
(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))))))