
(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 7 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 (* (pow (/ (* D M) (* d 2.0)) 2.0) (/ h l)))) (if (<= t_0 0.04) (* w0 (sqrt (- 1.0 t_0))) w0)))
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = pow(((D * M) / (d * 2.0)), 2.0) * (h / l);
double tmp;
if (t_0 <= 0.04) {
tmp = w0 * sqrt((1.0 - t_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) :: t_0
real(8) :: tmp
t_0 = (((d * m) / (d_1 * 2.0d0)) ** 2.0d0) * (h / l)
if (t_0 <= 0.04d0) then
tmp = w0 * sqrt((1.0d0 - t_0))
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 t_0 = Math.pow(((D * M) / (d * 2.0)), 2.0) * (h / l);
double tmp;
if (t_0 <= 0.04) {
tmp = w0 * Math.sqrt((1.0 - t_0));
} else {
tmp = w0;
}
return tmp;
}
def code(w0, M, D, h, l, d): t_0 = math.pow(((D * M) / (d * 2.0)), 2.0) * (h / l) tmp = 0 if t_0 <= 0.04: tmp = w0 * math.sqrt((1.0 - t_0)) else: tmp = w0 return tmp
function code(w0, M, D, h, l, d) t_0 = Float64((Float64(Float64(D * M) / Float64(d * 2.0)) ^ 2.0) * Float64(h / l)) tmp = 0.0 if (t_0 <= 0.04) tmp = Float64(w0 * sqrt(Float64(1.0 - t_0))); else tmp = w0; end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) t_0 = (((D * M) / (d * 2.0)) ^ 2.0) * (h / l); tmp = 0.0; if (t_0 <= 0.04) tmp = w0 * sqrt((1.0 - t_0)); else tmp = w0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.04], N[(w0 * N[Sqrt[N[(1.0 - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell}\\
\mathbf{if}\;t\_0 \leq 0.04:\\
\;\;\;\;w0 \cdot \sqrt{1 - t\_0}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) < 0.0400000000000000008Initial program 91.2%
if 0.0400000000000000008 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) Initial program 0.0%
Simplified7.0%
Taylor expanded in D around 0 60.9%
Final simplification87.8%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* D M) 1e-7) w0 (* w0 (sqrt (- 1.0 (* (/ h l) (pow (* 0.5 (* M (/ D d))) 2.0)))))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((D * M) <= 1e-7) {
tmp = w0;
} else {
tmp = w0 * sqrt((1.0 - ((h / l) * pow((0.5 * (M * (D / 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 * m) <= 1d-7) then
tmp = w0
else
tmp = w0 * sqrt((1.0d0 - ((h / l) * ((0.5d0 * (m * (d / 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 * M) <= 1e-7) {
tmp = w0;
} else {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow((0.5 * (M * (D / d))), 2.0))));
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (D * M) <= 1e-7: tmp = w0 else: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow((0.5 * (M * (D / d))), 2.0)))) return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64(D * M) <= 1e-7) tmp = w0; else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(0.5 * Float64(M * Float64(D / d))) ^ 2.0))))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if ((D * M) <= 1e-7) tmp = w0; else tmp = w0 * sqrt((1.0 - ((h / l) * ((0.5 * (M * (D / d))) ^ 2.0)))); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(D * M), $MachinePrecision], 1e-7], w0, N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(0.5 * N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;D \cdot M \leq 10^{-7}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}}\\
\end{array}
\end{array}
if (*.f64 M D) < 9.9999999999999995e-8Initial program 87.1%
Simplified86.6%
Taylor expanded in D around 0 84.3%
if 9.9999999999999995e-8 < (*.f64 M D) Initial program 62.1%
Simplified65.2%
associate-*r/68.7%
add-sqr-sqrt68.7%
pow268.7%
unpow268.7%
sqrt-prod39.6%
add-sqr-sqrt68.7%
div-inv68.7%
metadata-eval68.7%
Applied egg-rr68.7%
associate-*r/65.2%
expm1-log1p-u28.1%
expm1-udef28.1%
log1p-udef28.1%
add-exp-log65.2%
expm1-log1p-u64.1%
expm1-udef64.1%
Applied egg-rr61.0%
expm1-def61.0%
expm1-log1p62.1%
*-commutative62.1%
*-commutative62.1%
associate-*r*62.1%
associate-*r/62.1%
*-commutative62.1%
associate-*r/65.2%
Simplified65.2%
Final simplification79.5%
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (/ (* (pow (* (* D 0.5) (/ M 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 * 0.5) * (M / 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 * 0.5d0) * (m / 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 * 0.5) * (M / d)), 2.0) * h) / l)));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - ((math.pow(((D * 0.5) * (M / d)), 2.0) * h) / l)))
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64((Float64(Float64(D * 0.5) * Float64(M / d)) ^ 2.0) * h) / l)))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - (((((D * 0.5) * (M / 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[(D * 0.5), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - \frac{{\left(\left(D \cdot 0.5\right) \cdot \frac{M}{d}\right)}^{2} \cdot h}{\ell}}
\end{array}
Initial program 80.9%
Simplified81.2%
associate-*r/86.9%
add-sqr-sqrt86.9%
pow286.9%
unpow286.9%
sqrt-prod60.7%
add-sqr-sqrt86.9%
div-inv86.9%
metadata-eval86.9%
Applied egg-rr86.9%
Final simplification86.9%
(FPCore (w0 M D h l d) :precision binary64 (if (<= M 3e-46) w0 (+ w0 (* -0.125 (* (* (/ D d) (/ D d)) (* (* w0 h) (/ (pow M 2.0) l)))))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 3e-46) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (((D / d) * (D / d)) * ((w0 * h) * (pow(M, 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 <= 3d-46) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * (((d / d_1) * (d / d_1)) * ((w0 * h) * ((m ** 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 <= 3e-46) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (((D / d) * (D / d)) * ((w0 * h) * (Math.pow(M, 2.0) / l))));
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if M <= 3e-46: tmp = w0 else: tmp = w0 + (-0.125 * (((D / d) * (D / d)) * ((w0 * h) * (math.pow(M, 2.0) / l)))) return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 3e-46) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(w0 * h) * Float64((M ^ 2.0) / l))))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (M <= 3e-46) tmp = w0; else tmp = w0 + (-0.125 * (((D / d) * (D / d)) * ((w0 * h) * ((M ^ 2.0) / l)))); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 3e-46], w0, N[(w0 + N[(-0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(w0 * h), $MachinePrecision] * N[(N[Power[M, 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 3 \cdot 10^{-46}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(\left(w0 \cdot h\right) \cdot \frac{{M}^{2}}{\ell}\right)\right)\\
\end{array}
\end{array}
if M < 2.99999999999999987e-46Initial program 84.2%
Simplified84.7%
Taylor expanded in D around 0 77.2%
if 2.99999999999999987e-46 < M Initial program 70.4%
Simplified70.4%
Taylor expanded in D around 0 41.5%
times-frac42.9%
Simplified42.9%
add-sqr-sqrt42.9%
sqrt-div42.9%
unpow242.9%
sqrt-prod26.3%
add-sqr-sqrt36.0%
unpow236.0%
sqrt-prod19.4%
add-sqr-sqrt37.4%
sqrt-div37.4%
unpow237.4%
sqrt-prod27.6%
add-sqr-sqrt41.0%
unpow241.0%
sqrt-prod28.0%
add-sqr-sqrt51.3%
Applied egg-rr51.3%
expm1-log1p-u41.4%
expm1-udef41.3%
associate-/l*41.2%
Applied egg-rr41.2%
expm1-def41.2%
expm1-log1p51.0%
associate-/r/51.3%
Simplified51.3%
Final simplification70.9%
(FPCore (w0 M D h l d) :precision binary64 (if (<= M 1.8e-45) w0 (+ w0 (* -0.125 (* (* (/ D d) (/ D d)) (/ (* (pow M 2.0) (* w0 h)) l))))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 1.8e-45) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (((D / d) * (D / d)) * ((pow(M, 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 <= 1.8d-45) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * (((d / d_1) * (d / d_1)) * (((m ** 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 <= 1.8e-45) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (((D / d) * (D / d)) * ((Math.pow(M, 2.0) * (w0 * h)) / l)));
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if M <= 1.8e-45: tmp = w0 else: tmp = w0 + (-0.125 * (((D / d) * (D / d)) * ((math.pow(M, 2.0) * (w0 * h)) / l))) return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 1.8e-45) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64((M ^ 2.0) * Float64(w0 * h)) / l)))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (M <= 1.8e-45) tmp = w0; else tmp = w0 + (-0.125 * (((D / d) * (D / d)) * (((M ^ 2.0) * (w0 * h)) / l))); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 1.8e-45], w0, N[(w0 + N[(-0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[M, 2.0], $MachinePrecision] * N[(w0 * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 1.8 \cdot 10^{-45}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{{M}^{2} \cdot \left(w0 \cdot h\right)}{\ell}\right)\\
\end{array}
\end{array}
if M < 1.8e-45Initial program 84.2%
Simplified84.7%
Taylor expanded in D around 0 77.2%
if 1.8e-45 < M Initial program 70.4%
Simplified70.4%
Taylor expanded in D around 0 41.5%
times-frac42.9%
Simplified42.9%
add-sqr-sqrt42.9%
sqrt-div42.9%
unpow242.9%
sqrt-prod26.3%
add-sqr-sqrt36.0%
unpow236.0%
sqrt-prod19.4%
add-sqr-sqrt37.4%
sqrt-div37.4%
unpow237.4%
sqrt-prod27.6%
add-sqr-sqrt41.0%
unpow241.0%
sqrt-prod28.0%
add-sqr-sqrt51.3%
Applied egg-rr51.3%
Final simplification70.9%
(FPCore (w0 M D h l d) :precision binary64 (if (<= M 1.06e-48) w0 (+ w0 (* -0.125 (/ (pow (/ M (/ d D)) 2.0) (/ l (* w0 h)))))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 1.06e-48) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (pow((M / (d / D)), 2.0) / (l / (w0 * 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 <= 1.06d-48) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * (((m / (d_1 / d)) ** 2.0d0) / (l / (w0 * 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 <= 1.06e-48) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (Math.pow((M / (d / D)), 2.0) / (l / (w0 * h))));
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if M <= 1.06e-48: tmp = w0 else: tmp = w0 + (-0.125 * (math.pow((M / (d / D)), 2.0) / (l / (w0 * h)))) return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 1.06e-48) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64((Float64(M / Float64(d / D)) ^ 2.0) / Float64(l / Float64(w0 * h))))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (M <= 1.06e-48) tmp = w0; else tmp = w0 + (-0.125 * (((M / (d / D)) ^ 2.0) / (l / (w0 * h)))); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 1.06e-48], w0, N[(w0 + N[(-0.125 * N[(N[Power[N[(M / N[(d / D), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / N[(l / N[(w0 * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 1.06 \cdot 10^{-48}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \frac{{\left(\frac{M}{\frac{d}{D}}\right)}^{2}}{\frac{\ell}{w0 \cdot h}}\\
\end{array}
\end{array}
if M < 1.0600000000000001e-48Initial program 84.1%
Simplified84.6%
Taylor expanded in D around 0 77.5%
if 1.0600000000000001e-48 < M Initial program 70.8%
Simplified70.9%
Taylor expanded in D around 0 40.9%
times-frac42.2%
Simplified42.2%
add-sqr-sqrt42.2%
sqrt-div42.2%
unpow242.2%
sqrt-prod25.8%
add-sqr-sqrt35.5%
unpow235.5%
sqrt-prod19.1%
add-sqr-sqrt36.8%
sqrt-div36.8%
unpow236.8%
sqrt-prod27.2%
add-sqr-sqrt40.3%
unpow240.3%
sqrt-prod27.6%
add-sqr-sqrt50.5%
Applied egg-rr50.5%
expm1-log1p-u40.7%
expm1-udef40.7%
associate-/l*40.5%
Applied egg-rr40.5%
expm1-def40.5%
expm1-log1p50.2%
associate-/r/50.5%
Simplified50.5%
Taylor expanded in D around 0 40.9%
times-frac42.2%
unpow242.2%
unpow242.2%
times-frac50.5%
unpow250.5%
associate-/l*50.2%
associate-*r/50.3%
unpow250.3%
unpow250.3%
swap-sqr61.9%
*-commutative61.9%
*-commutative61.9%
unpow161.9%
pow-plus61.9%
associate-*r/60.4%
associate-/l*61.9%
metadata-eval61.9%
Simplified61.9%
Final simplification73.6%
(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.9%
Simplified81.2%
Taylor expanded in D around 0 71.2%
Final simplification71.2%
herbie shell --seed 2024031
(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))))))