
(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 8 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}
NOTE: d should be positive before calling this function
(FPCore (w0 M D h l d)
:precision binary64
(if (<= (pow (/ (* M D) (* 2.0 d)) 2.0) 2e+296)
(* w0 (sqrt (+ 1.0 (/ -1.0 (/ l (* (pow (* 0.5 (/ (* M D) d)) 2.0) h))))))
(*
w0
(pow
(pow
(exp 0.25)
(fma -2.0 (log d) (log (* (/ (* h (pow (* M D) 2.0)) l) -0.25))))
2.0))))d = abs(d);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (pow(((M * D) / (2.0 * d)), 2.0) <= 2e+296) {
tmp = w0 * sqrt((1.0 + (-1.0 / (l / (pow((0.5 * ((M * D) / d)), 2.0) * h)))));
} else {
tmp = w0 * pow(pow(exp(0.25), fma(-2.0, log(d), log((((h * pow((M * D), 2.0)) / l) * -0.25)))), 2.0);
}
return tmp;
}
d = abs(d) function code(w0, M, D, h, l, d) tmp = 0.0 if ((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) <= 2e+296) tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(-1.0 / Float64(l / Float64((Float64(0.5 * Float64(Float64(M * D) / d)) ^ 2.0) * h)))))); else tmp = Float64(w0 * ((exp(0.25) ^ fma(-2.0, log(d), log(Float64(Float64(Float64(h * (Float64(M * D) ^ 2.0)) / l) * -0.25)))) ^ 2.0)); end return tmp end
NOTE: d should be positive before calling this function code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], 2e+296], N[(w0 * N[Sqrt[N[(1.0 + N[(-1.0 / N[(l / N[(N[Power[N[(0.5 * N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Power[N[Power[N[Exp[0.25], $MachinePrecision], N[(-2.0 * N[Log[d], $MachinePrecision] + N[Log[N[(N[(N[(h * N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
d = |d|\\
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \leq 2 \cdot 10^{+296}:\\
\;\;\;\;w0 \cdot \sqrt{1 + \frac{-1}{\frac{\ell}{{\left(0.5 \cdot \frac{M \cdot D}{d}\right)}^{2} \cdot h}}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot {\left({\left(e^{0.25}\right)}^{\left(\mathsf{fma}\left(-2, \log d, \log \left(\frac{h \cdot {\left(M \cdot D\right)}^{2}}{\ell} \cdot -0.25\right)\right)\right)}\right)}^{2}\\
\end{array}
\end{array}
if (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) < 1.99999999999999996e296Initial program 90.1%
Simplified89.6%
associate-*r/96.1%
frac-times96.6%
*-commutative96.6%
clear-num96.6%
unpow296.6%
unpow296.6%
*-un-lft-identity96.6%
times-frac96.6%
metadata-eval96.6%
*-commutative96.6%
Applied egg-rr96.6%
if 1.99999999999999996e296 < (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) Initial program 49.2%
Simplified54.2%
associate-*r/57.9%
frac-times52.9%
*-commutative52.9%
clear-num52.9%
unpow252.9%
unpow252.9%
*-un-lft-identity52.9%
times-frac52.9%
metadata-eval52.9%
*-commutative52.9%
Applied egg-rr52.9%
clear-num52.9%
add-sqr-sqrt52.9%
pow252.9%
Applied egg-rr52.4%
Taylor expanded in d around 0 30.3%
exp-prod30.3%
+-commutative30.3%
fma-def30.3%
*-commutative30.3%
distribute-rgt-neg-in30.3%
associate-*r*30.3%
unpow230.3%
unpow230.3%
swap-sqr32.0%
unpow232.0%
metadata-eval32.0%
Simplified32.0%
Final simplification82.2%
NOTE: d should be positive before calling this function (FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) 0.0001) (* w0 (sqrt (- 1.0 (* (/ h l) (pow (* (/ D 2.0) (/ M d)) 2.0))))) w0))
d = abs(d);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= 0.0001) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow(((D / 2.0) * (M / d)), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
NOTE: d should be positive before calling this function
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 * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= 0.0001d0) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * (((d / 2.0d0) * (m / d_1)) ** 2.0d0))))
else
tmp = w0
end if
code = tmp
end function
d = Math.abs(d);
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= 0.0001) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((D / 2.0) * (M / d)), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
d = abs(d) def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= 0.0001: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((D / 2.0) * (M / d)), 2.0)))) else: tmp = w0 return tmp
d = abs(d) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= 0.0001) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(D / 2.0) * Float64(M / d)) ^ 2.0))))); else tmp = w0; end return tmp end
d = abs(d) function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)) <= 0.0001) tmp = w0 * sqrt((1.0 - ((h / l) * (((D / 2.0) * (M / d)) ^ 2.0)))); else tmp = w0; end tmp_2 = tmp; end
NOTE: d should be positive before calling this function code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], 0.0001], 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], w0]
\begin{array}{l}
d = |d|\\
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq 0.0001:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{D}{2} \cdot \frac{M}{d}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) < 1.00000000000000005e-4Initial program 88.2%
Simplified89.0%
if 1.00000000000000005e-4 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) Initial program 0.0%
Simplified0.0%
Taylor expanded in D around 0 73.3%
Final simplification87.7%
NOTE: d should be positive before calling this function (FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (+ 1.0 (/ -1.0 (/ l (* (pow (* 0.5 (/ (* M D) d)) 2.0) h)))))))
d = abs(d);
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 + (-1.0 / (l / (pow((0.5 * ((M * D) / d)), 2.0) * h)))));
}
NOTE: d should be positive before calling this function
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 + ((-1.0d0) / (l / (((0.5d0 * ((m * d) / d_1)) ** 2.0d0) * h)))))
end function
d = Math.abs(d);
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 + (-1.0 / (l / (Math.pow((0.5 * ((M * D) / d)), 2.0) * h)))));
}
d = abs(d) def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 + (-1.0 / (l / (math.pow((0.5 * ((M * D) / d)), 2.0) * h)))))
d = abs(d) function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 + Float64(-1.0 / Float64(l / Float64((Float64(0.5 * Float64(Float64(M * D) / d)) ^ 2.0) * h)))))) end
d = abs(d) function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 + (-1.0 / (l / (((0.5 * ((M * D) / d)) ^ 2.0) * h))))); end
NOTE: d should be positive before calling this function code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 + N[(-1.0 / N[(l / N[(N[Power[N[(0.5 * N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
d = |d|\\
\\
w0 \cdot \sqrt{1 + \frac{-1}{\frac{\ell}{{\left(0.5 \cdot \frac{M \cdot D}{d}\right)}^{2} \cdot h}}}
\end{array}
Initial program 81.0%
Simplified81.7%
associate-*r/87.6%
frac-times86.9%
*-commutative86.9%
clear-num86.9%
unpow286.9%
unpow286.9%
*-un-lft-identity86.9%
times-frac86.9%
metadata-eval86.9%
*-commutative86.9%
Applied egg-rr86.9%
Final simplification86.9%
NOTE: d should be positive before calling this function (FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (/ (* (pow (* 0.5 (/ (* M D) d)) 2.0) h) l)))))
d = abs(d);
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - ((pow((0.5 * ((M * D) / d)), 2.0) * h) / l)));
}
NOTE: d should be positive before calling this function
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.5d0 * ((m * d) / d_1)) ** 2.0d0) * h) / l)))
end function
d = Math.abs(d);
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - ((Math.pow((0.5 * ((M * D) / d)), 2.0) * h) / l)));
}
d = abs(d) def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - ((math.pow((0.5 * ((M * D) / d)), 2.0) * h) / l)))
d = abs(d) function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64((Float64(0.5 * Float64(Float64(M * D) / d)) ^ 2.0) * h) / l)))) end
d = abs(d) function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((((0.5 * ((M * D) / d)) ^ 2.0) * h) / l))); end
NOTE: d should be positive before calling this function code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[Power[N[(0.5 * N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
d = |d|\\
\\
w0 \cdot \sqrt{1 - \frac{{\left(0.5 \cdot \frac{M \cdot D}{d}\right)}^{2} \cdot h}{\ell}}
\end{array}
Initial program 81.0%
Simplified81.7%
associate-*r/87.6%
frac-times86.9%
*-commutative86.9%
unpow286.9%
unpow286.9%
*-un-lft-identity86.9%
times-frac86.9%
metadata-eval86.9%
*-commutative86.9%
Applied egg-rr86.9%
Final simplification86.9%
NOTE: d should be positive before calling this function (FPCore (w0 M D h l d) :precision binary64 (* w0 (+ 1.0 (* -0.125 (/ (* h (pow (* D (/ M d)) 2.0)) l)))))
d = abs(d);
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * (1.0 + (-0.125 * ((h * pow((D * (M / d)), 2.0)) / l)));
}
NOTE: d should be positive before calling this function
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 * (1.0d0 + ((-0.125d0) * ((h * ((d * (m / d_1)) ** 2.0d0)) / l)))
end function
d = Math.abs(d);
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * (1.0 + (-0.125 * ((h * Math.pow((D * (M / d)), 2.0)) / l)));
}
d = abs(d) def code(w0, M, D, h, l, d): return w0 * (1.0 + (-0.125 * ((h * math.pow((D * (M / d)), 2.0)) / l)))
d = abs(d) function code(w0, M, D, h, l, d) return Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(h * (Float64(D * Float64(M / d)) ^ 2.0)) / l)))) end
d = abs(d) function tmp = code(w0, M, D, h, l, d) tmp = w0 * (1.0 + (-0.125 * ((h * ((D * (M / d)) ^ 2.0)) / l))); end
NOTE: d should be positive before calling this function code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(h * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
d = |d|\\
\\
w0 \cdot \left(1 + -0.125 \cdot \frac{h \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}}{\ell}\right)
\end{array}
Initial program 81.0%
Simplified81.7%
Taylor expanded in D around 0 53.6%
expm1-log1p-u42.7%
expm1-udef42.7%
associate-*r*46.3%
unpow-prod-down53.9%
*-commutative53.9%
Applied egg-rr53.9%
expm1-def53.9%
expm1-log1p66.8%
*-commutative66.8%
times-frac64.3%
unpow264.3%
unpow264.3%
times-frac73.7%
associate-/l*73.7%
associate-/l*74.5%
unpow274.5%
associate-/l*73.7%
*-commutative73.7%
associate-/l*73.7%
Simplified73.7%
associate-*l/79.3%
associate-/r/80.1%
Applied egg-rr80.1%
Final simplification80.1%
NOTE: d should be positive before calling this function
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (/ (* M D) d)))
(if (<= (* M D) 2.4e-22)
w0
(* w0 (+ 1.0 (* -0.125 (* t_0 (* (/ h l) t_0))))))))d = abs(d);
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = (M * D) / d;
double tmp;
if ((M * D) <= 2.4e-22) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * (t_0 * ((h / l) * t_0))));
}
return tmp;
}
NOTE: d should be positive before calling this function
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) / d_1
if ((m * d) <= 2.4d-22) then
tmp = w0
else
tmp = w0 * (1.0d0 + ((-0.125d0) * (t_0 * ((h / l) * t_0))))
end if
code = tmp
end function
d = Math.abs(d);
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = (M * D) / d;
double tmp;
if ((M * D) <= 2.4e-22) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * (t_0 * ((h / l) * t_0))));
}
return tmp;
}
d = abs(d) def code(w0, M, D, h, l, d): t_0 = (M * D) / d tmp = 0 if (M * D) <= 2.4e-22: tmp = w0 else: tmp = w0 * (1.0 + (-0.125 * (t_0 * ((h / l) * t_0)))) return tmp
d = abs(d) function code(w0, M, D, h, l, d) t_0 = Float64(Float64(M * D) / d) tmp = 0.0 if (Float64(M * D) <= 2.4e-22) tmp = w0; else tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(t_0 * Float64(Float64(h / l) * t_0))))); end return tmp end
d = abs(d) function tmp_2 = code(w0, M, D, h, l, d) t_0 = (M * D) / d; tmp = 0.0; if ((M * D) <= 2.4e-22) tmp = w0; else tmp = w0 * (1.0 + (-0.125 * (t_0 * ((h / l) * t_0)))); end tmp_2 = tmp; end
NOTE: d should be positive before calling this function
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[N[(M * D), $MachinePrecision], 2.4e-22], w0, N[(w0 * N[(1.0 + N[(-0.125 * N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
d = |d|\\
\\
\begin{array}{l}
t_0 := \frac{M \cdot D}{d}\\
\mathbf{if}\;M \cdot D \leq 2.4 \cdot 10^{-22}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(t_0 \cdot \left(\frac{h}{\ell} \cdot t_0\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 M D) < 2.40000000000000002e-22Initial program 83.9%
Simplified84.8%
Taylor expanded in D around 0 74.0%
if 2.40000000000000002e-22 < (*.f64 M D) Initial program 69.0%
Simplified69.0%
Taylor expanded in D around 0 41.4%
expm1-log1p-u14.2%
expm1-udef14.2%
associate-*r*12.0%
unpow-prod-down24.0%
*-commutative24.0%
Applied egg-rr24.0%
expm1-def24.0%
expm1-log1p55.4%
*-commutative55.4%
times-frac57.2%
unpow257.2%
unpow257.2%
times-frac63.5%
associate-/l*63.5%
associate-/l*63.5%
unpow263.5%
associate-/l*63.5%
*-commutative63.5%
associate-/l*63.5%
Simplified63.5%
associate-*l/65.6%
associate-/r/65.6%
Applied egg-rr65.6%
pow265.6%
associate-*l/63.5%
associate-*r*67.8%
associate-*l/65.8%
associate-*l/65.8%
Applied egg-rr65.8%
Final simplification72.4%
NOTE: d should be positive before calling this function
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (* D (/ M d))))
(if (<= (* M D) 2e-22)
w0
(* w0 (+ 1.0 (* -0.125 (* (/ h l) (* t_0 t_0))))))))d = abs(d);
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = D * (M / d);
double tmp;
if ((M * D) <= 2e-22) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * ((h / l) * (t_0 * t_0))));
}
return tmp;
}
NOTE: d should be positive before calling this function
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)
if ((m * d) <= 2d-22) then
tmp = w0
else
tmp = w0 * (1.0d0 + ((-0.125d0) * ((h / l) * (t_0 * t_0))))
end if
code = tmp
end function
d = Math.abs(d);
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = D * (M / d);
double tmp;
if ((M * D) <= 2e-22) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * ((h / l) * (t_0 * t_0))));
}
return tmp;
}
d = abs(d) def code(w0, M, D, h, l, d): t_0 = D * (M / d) tmp = 0 if (M * D) <= 2e-22: tmp = w0 else: tmp = w0 * (1.0 + (-0.125 * ((h / l) * (t_0 * t_0)))) return tmp
d = abs(d) function code(w0, M, D, h, l, d) t_0 = Float64(D * Float64(M / d)) tmp = 0.0 if (Float64(M * D) <= 2e-22) tmp = w0; else tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(h / l) * Float64(t_0 * t_0))))); end return tmp end
d = abs(d) function tmp_2 = code(w0, M, D, h, l, d) t_0 = D * (M / d); tmp = 0.0; if ((M * D) <= 2e-22) tmp = w0; else tmp = w0 * (1.0 + (-0.125 * ((h / l) * (t_0 * t_0)))); end tmp_2 = tmp; end
NOTE: d should be positive before calling this function
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(M * D), $MachinePrecision], 2e-22], w0, N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
d = |d|\\
\\
\begin{array}{l}
t_0 := D \cdot \frac{M}{d}\\
\mathbf{if}\;M \cdot D \leq 2 \cdot 10^{-22}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\frac{h}{\ell} \cdot \left(t_0 \cdot t_0\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 M D) < 2.0000000000000001e-22Initial program 83.9%
Simplified84.8%
Taylor expanded in D around 0 74.0%
if 2.0000000000000001e-22 < (*.f64 M D) Initial program 69.0%
Simplified69.0%
Taylor expanded in D around 0 41.4%
expm1-log1p-u14.2%
expm1-udef14.2%
associate-*r*12.0%
unpow-prod-down24.0%
*-commutative24.0%
Applied egg-rr24.0%
expm1-def24.0%
expm1-log1p55.4%
*-commutative55.4%
times-frac57.2%
unpow257.2%
unpow257.2%
times-frac63.5%
associate-/l*63.5%
associate-/l*63.5%
unpow263.5%
associate-/l*63.5%
*-commutative63.5%
associate-/l*63.5%
Simplified63.5%
unpow263.5%
associate-/r/63.5%
associate-/r/63.5%
Applied egg-rr63.5%
Final simplification71.9%
NOTE: d should be positive before calling this function (FPCore (w0 M D h l d) :precision binary64 w0)
d = abs(d);
double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
NOTE: d should be positive before calling this function
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
d = Math.abs(d);
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
d = abs(d) def code(w0, M, D, h, l, d): return w0
d = abs(d) function code(w0, M, D, h, l, d) return w0 end
d = abs(d) function tmp = code(w0, M, D, h, l, d) tmp = w0; end
NOTE: d should be positive before calling this function code[w0_, M_, D_, h_, l_, d_] := w0
\begin{array}{l}
d = |d|\\
\\
w0
\end{array}
Initial program 81.0%
Simplified81.7%
Taylor expanded in D around 0 67.4%
Final simplification67.4%
herbie shell --seed 2023301
(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))))))