
(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 (- 1.0 (* (pow (/ (* D M) (* d 2.0)) 2.0) (/ h l)))))
(if (<= t_0 1e+287)
(* w0 (sqrt t_0))
(* w0 (sqrt (- 1.0 (* h (/ (pow (* M (/ 0.5 (/ d D))) 2.0) 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 <= 1e+287) {
tmp = w0 * sqrt(t_0);
} else {
tmp = w0 * sqrt((1.0 - (h * (pow((M * (0.5 / (d / 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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - ((((d * m) / (d_1 * 2.0d0)) ** 2.0d0) * (h / l))
if (t_0 <= 1d+287) then
tmp = w0 * sqrt(t_0)
else
tmp = w0 * sqrt((1.0d0 - (h * (((m * (0.5d0 / (d_1 / d))) ** 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 t_0 = 1.0 - (Math.pow(((D * M) / (d * 2.0)), 2.0) * (h / l));
double tmp;
if (t_0 <= 1e+287) {
tmp = w0 * Math.sqrt(t_0);
} else {
tmp = w0 * Math.sqrt((1.0 - (h * (Math.pow((M * (0.5 / (d / D))), 2.0) / 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 <= 1e+287: tmp = w0 * math.sqrt(t_0) else: tmp = w0 * math.sqrt((1.0 - (h * (math.pow((M * (0.5 / (d / D))), 2.0) / 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 <= 1e+287) tmp = Float64(w0 * sqrt(t_0)); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64((Float64(M * Float64(0.5 / Float64(d / D))) ^ 2.0) / 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 <= 1e+287) tmp = w0 * sqrt(t_0); else tmp = w0 * sqrt((1.0 - (h * (((M * (0.5 / (d / D))) ^ 2.0) / 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, 1e+287], N[(w0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[Power[N[(M * N[(0.5 / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $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 10^{+287}:\\
\;\;\;\;w0 \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \frac{{\left(M \cdot \frac{0.5}{\frac{d}{D}}\right)}^{2}}{\ell}}\\
\end{array}
\end{array}
if (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))) < 1.0000000000000001e287Initial program 99.9%
if 1.0000000000000001e287 < (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))) Initial program 41.0%
Simplified44.5%
frac-times41.0%
*-commutative41.0%
clear-num41.0%
un-div-inv42.2%
*-commutative42.2%
frac-times45.7%
frac-times42.2%
*-commutative42.2%
div-inv42.2%
*-commutative42.2%
associate-/r*42.2%
metadata-eval42.2%
Applied egg-rr42.2%
associate-/r/60.2%
*-commutative60.2%
*-commutative60.2%
associate-*r*63.7%
*-commutative63.7%
associate-/r/63.7%
Simplified63.7%
Final simplification88.0%
(FPCore (w0 M D h l d) :precision binary64 (if (<= d 1.22) (* w0 (sqrt (- 1.0 (* (/ h l) (pow (* (/ D 2.0) (/ M d)) 2.0))))) (* w0 (sqrt (- 1.0 (* h (/ (pow (* M (/ 0.5 (/ d D))) 2.0) l)))))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (d <= 1.22) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow(((D / 2.0) * (M / d)), 2.0))));
} else {
tmp = w0 * sqrt((1.0 - (h * (pow((M * (0.5 / (d / 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 (d_1 <= 1.22d0) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * (((d / 2.0d0) * (m / d_1)) ** 2.0d0))))
else
tmp = w0 * sqrt((1.0d0 - (h * (((m * (0.5d0 / (d_1 / d))) ** 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 (d <= 1.22) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((D / 2.0) * (M / d)), 2.0))));
} else {
tmp = w0 * Math.sqrt((1.0 - (h * (Math.pow((M * (0.5 / (d / D))), 2.0) / l))));
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if d <= 1.22: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((D / 2.0) * (M / d)), 2.0)))) else: tmp = w0 * math.sqrt((1.0 - (h * (math.pow((M * (0.5 / (d / D))), 2.0) / l)))) return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (d <= 1.22) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(D / 2.0) * Float64(M / d)) ^ 2.0))))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64((Float64(M * Float64(0.5 / Float64(d / D))) ^ 2.0) / l))))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (d <= 1.22) tmp = w0 * sqrt((1.0 - ((h / l) * (((D / 2.0) * (M / d)) ^ 2.0)))); else tmp = w0 * sqrt((1.0 - (h * (((M * (0.5 / (d / D))) ^ 2.0) / l)))); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[d, 1.22], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / 2.0), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[Power[N[(M * N[(0.5 / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.22:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{D}{2} \cdot \frac{M}{d}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \frac{{\left(M \cdot \frac{0.5}{\frac{d}{D}}\right)}^{2}}{\ell}}\\
\end{array}
\end{array}
if d < 1.21999999999999997Initial program 78.7%
Simplified76.6%
if 1.21999999999999997 < d Initial program 85.3%
Simplified86.8%
frac-times85.3%
*-commutative85.3%
clear-num85.2%
un-div-inv85.2%
*-commutative85.2%
frac-times86.8%
frac-times85.2%
*-commutative85.2%
div-inv85.2%
*-commutative85.2%
associate-/r*85.2%
metadata-eval85.2%
Applied egg-rr85.2%
associate-/r/89.5%
*-commutative89.5%
*-commutative89.5%
associate-*r*92.1%
*-commutative92.1%
associate-/r/92.1%
Simplified92.1%
Final simplification81.0%
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* h (/ (pow (* M (/ 0.5 (/ d 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((M * (0.5 / (d / 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 * (((m * (0.5d0 / (d_1 / d))) ** 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((M * (0.5 / (d / D))), 2.0) / l))));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (h * (math.pow((M * (0.5 / (d / D))), 2.0) / l))))
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64((Float64(M * Float64(0.5 / Float64(d / D))) ^ 2.0) / l))))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - (h * (((M * (0.5 / (d / D))) ^ 2.0) / l)))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[Power[N[(M * N[(0.5 / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - h \cdot \frac{{\left(M \cdot \frac{0.5}{\frac{d}{D}}\right)}^{2}}{\ell}}
\end{array}
Initial program 80.6%
Simplified79.5%
frac-times80.6%
*-commutative80.6%
clear-num80.6%
un-div-inv81.0%
*-commutative81.0%
frac-times79.9%
frac-times81.0%
*-commutative81.0%
div-inv81.0%
*-commutative81.0%
associate-/r*81.0%
metadata-eval81.0%
Applied egg-rr81.0%
associate-/r/85.4%
*-commutative85.4%
*-commutative85.4%
associate-*r*85.8%
*-commutative85.8%
associate-/r/85.7%
Simplified85.7%
Final simplification85.7%
(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(Float64(D * 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[(N[(D * M), $MachinePrecision] * N[(0.5 / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - \frac{h \cdot {\left(\left(D \cdot M\right) \cdot \frac{0.5}{d}\right)}^{2}}{\ell}}
\end{array}
Initial program 80.6%
Simplified79.5%
*-commutative79.5%
frac-times80.6%
*-commutative80.6%
associate-*l/86.5%
*-commutative86.5%
frac-times85.4%
frac-times86.5%
*-commutative86.5%
div-inv86.5%
*-commutative86.5%
associate-/r*86.5%
metadata-eval86.5%
Applied egg-rr86.5%
Final simplification86.5%
(FPCore (w0 M D h l d) :precision binary64 (let* ((t_0 (/ M (* d (/ 2.0 D))))) (if (<= (/ h l) -2e-223) (* w0 (sqrt (- 1.0 (* (/ h l) (* t_0 t_0))))) w0)))
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = M / (d * (2.0 / D));
double tmp;
if ((h / l) <= -2e-223) {
tmp = w0 * sqrt((1.0 - ((h / l) * (t_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 = m / (d_1 * (2.0d0 / d))
if ((h / l) <= (-2d-223)) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * (t_0 * 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 = M / (d * (2.0 / D));
double tmp;
if ((h / l) <= -2e-223) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * (t_0 * t_0))));
} else {
tmp = w0;
}
return tmp;
}
def code(w0, M, D, h, l, d): t_0 = M / (d * (2.0 / D)) tmp = 0 if (h / l) <= -2e-223: tmp = w0 * math.sqrt((1.0 - ((h / l) * (t_0 * t_0)))) else: tmp = w0 return tmp
function code(w0, M, D, h, l, d) t_0 = Float64(M / Float64(d * Float64(2.0 / D))) tmp = 0.0 if (Float64(h / l) <= -2e-223) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * Float64(t_0 * t_0))))); else tmp = w0; end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) t_0 = M / (d * (2.0 / D)); tmp = 0.0; if ((h / l) <= -2e-223) tmp = w0 * sqrt((1.0 - ((h / l) * (t_0 * t_0)))); else tmp = w0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(M / N[(d * N[(2.0 / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(h / l), $MachinePrecision], -2e-223], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{M}{d \cdot \frac{2}{D}}\\
\mathbf{if}\;\frac{h}{\ell} \leq -2 \cdot 10^{-223}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \left(t_0 \cdot t_0\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -1.9999999999999999e-223Initial program 76.8%
Simplified76.1%
clear-num76.0%
frac-times77.5%
*-un-lft-identity77.5%
Applied egg-rr77.5%
unpow277.5%
Applied egg-rr77.5%
if -1.9999999999999999e-223 < (/.f64 h l) Initial program 84.7%
Simplified83.2%
Taylor expanded in D around 0 93.6%
Final simplification85.2%
(FPCore (w0 M D h l d) :precision binary64 (if (<= M 4.7e-138) w0 (+ w0 (* -0.125 (/ (* (* w0 h) (* (* D M) (* D M))) (* l (pow d 2.0)))))))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 4.7e-138) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (((w0 * h) * ((D * M) * (D * M))) / (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 (m <= 4.7d-138) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * (((w0 * h) * ((d * m) * (d * m))) / (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 (M <= 4.7e-138) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (((w0 * h) * ((D * M) * (D * M))) / (l * Math.pow(d, 2.0))));
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if M <= 4.7e-138: tmp = w0 else: tmp = w0 + (-0.125 * (((w0 * h) * ((D * M) * (D * M))) / (l * math.pow(d, 2.0)))) return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 4.7e-138) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(Float64(w0 * h) * Float64(Float64(D * M) * Float64(D * M))) / Float64(l * (d ^ 2.0))))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (M <= 4.7e-138) tmp = w0; else tmp = w0 + (-0.125 * (((w0 * h) * ((D * M) * (D * M))) / (l * (d ^ 2.0)))); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 4.7e-138], w0, N[(w0 + N[(-0.125 * N[(N[(N[(w0 * h), $MachinePrecision] * N[(N[(D * M), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[Power[d, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 4.7 \cdot 10^{-138}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \frac{\left(w0 \cdot h\right) \cdot \left(\left(D \cdot M\right) \cdot \left(D \cdot M\right)\right)}{\ell \cdot {d}^{2}}\\
\end{array}
\end{array}
if M < 4.7000000000000001e-138Initial program 82.9%
Simplified83.0%
Taylor expanded in D around 0 77.5%
if 4.7000000000000001e-138 < M Initial program 76.8%
Simplified73.7%
Taylor expanded in D around 0 50.6%
expm1-log1p-u33.9%
expm1-udef33.9%
associate-*r*38.1%
pow-prod-down43.3%
Applied egg-rr43.3%
expm1-def43.4%
expm1-log1p62.2%
*-commutative62.2%
Simplified62.2%
unpow262.2%
Applied egg-rr62.2%
Final simplification71.8%
(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.6%
Simplified79.5%
Taylor expanded in D around 0 69.1%
Final simplification69.1%
herbie shell --seed 2023311
(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))))))