
(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 5 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: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (* D (/ M d))))
(if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -5e+64)
(* w0 (* D (* (/ M d) (sqrt (/ (* h -0.25) l)))))
(* w0 (sqrt (- 1.0 (* h (* (/ t_0 l) (/ t_0 4.0)))))))))M = abs(M);
D = abs(D);
d = abs(d);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = D * (M / d);
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+64) {
tmp = w0 * (D * ((M / d) * sqrt(((h * -0.25) / l))));
} else {
tmp = w0 * sqrt((1.0 - (h * ((t_0 / l) * (t_0 / 4.0)))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order 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) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= (-5d+64)) then
tmp = w0 * (d * ((m / d_1) * sqrt(((h * (-0.25d0)) / l))))
else
tmp = w0 * sqrt((1.0d0 - (h * ((t_0 / l) * (t_0 / 4.0d0)))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
d = Math.abs(d);
assert M < 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 ((Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+64) {
tmp = w0 * (D * ((M / d) * Math.sqrt(((h * -0.25) / l))));
} else {
tmp = w0 * Math.sqrt((1.0 - (h * ((t_0 / l) * (t_0 / 4.0)))));
}
return tmp;
}
M = abs(M) D = abs(D) d = abs(d) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): t_0 = D * (M / d) tmp = 0 if (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+64: tmp = w0 * (D * ((M / d) * math.sqrt(((h * -0.25) / l)))) else: tmp = w0 * math.sqrt((1.0 - (h * ((t_0 / l) * (t_0 / 4.0))))) return tmp
M = abs(M) D = abs(D) d = abs(d) M, D = sort([M, D]) function code(w0, M, D, h, l, d) t_0 = Float64(D * Float64(M / d)) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -5e+64) tmp = Float64(w0 * Float64(D * Float64(Float64(M / d) * sqrt(Float64(Float64(h * -0.25) / l))))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64(Float64(t_0 / l) * Float64(t_0 / 4.0)))))); end return tmp end
M = abs(M)
D = abs(D)
d = abs(d)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
t_0 = D * (M / d);
tmp = 0.0;
if (((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)) <= -5e+64)
tmp = w0 * (D * ((M / d) * sqrt(((h * -0.25) / l))));
else
tmp = w0 * sqrt((1.0 - (h * ((t_0 / l) * (t_0 / 4.0)))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order 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[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e+64], N[(w0 * N[(D * N[(N[(M / d), $MachinePrecision] * N[Sqrt[N[(N[(h * -0.25), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[(t$95$0 / l), $MachinePrecision] * N[(t$95$0 / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
d = |d|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := D \cdot \frac{M}{d}\\
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+64}:\\
\;\;\;\;w0 \cdot \left(D \cdot \left(\frac{M}{d} \cdot \sqrt{\frac{h \cdot -0.25}{\ell}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \left(\frac{t_0}{\ell} \cdot \frac{t_0}{4}\right)}\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) < -5e64Initial program 70.0%
Simplified68.9%
Taylor expanded in D around inf 41.7%
*-commutative41.7%
times-frac41.7%
Simplified41.7%
expm1-log1p-u41.4%
expm1-udef41.4%
frac-times41.6%
*-commutative41.6%
Applied egg-rr41.6%
Simplified68.9%
expm1-log1p-u67.7%
expm1-udef67.7%
associate-*r*67.7%
sqrt-prod71.7%
unpow271.7%
sqrt-prod39.4%
add-sqr-sqrt39.4%
Applied egg-rr39.4%
expm1-def39.4%
expm1-log1p40.9%
*-commutative40.9%
associate-*l*38.7%
*-commutative38.7%
associate-*r/38.7%
Simplified38.7%
if -5e64 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) Initial program 86.2%
Simplified86.2%
associate-*r/96.8%
frac-times96.8%
*-commutative96.8%
unpow296.8%
unpow296.8%
*-un-lft-identity96.8%
times-frac96.8%
metadata-eval96.8%
*-commutative96.8%
Applied egg-rr96.8%
Taylor expanded in D around 0 58.1%
associate-/l*58.2%
*-commutative58.2%
associate-/l*58.1%
*-commutative58.1%
associate-*r*61.2%
unpow261.2%
unpow261.2%
swap-sqr76.6%
unpow276.6%
times-frac69.0%
unpow269.0%
unpow269.0%
times-frac86.2%
associate-*l/85.3%
associate-*l/85.3%
unpow285.3%
Simplified96.8%
unpow296.8%
div-inv96.8%
times-frac98.3%
metadata-eval98.3%
Applied egg-rr98.3%
Final simplification79.2%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: d should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= D 7.7e+151) w0 (+ w0 (* -0.125 (* (pow (* D (/ M d)) 2.0) (/ (* h w0) l))))))
M = abs(M);
D = abs(D);
d = abs(d);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (D <= 7.7e+151) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (pow((D * (M / d)), 2.0) * ((h * w0) / l)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order 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 (d <= 7.7d+151) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * (((d * (m / d_1)) ** 2.0d0) * ((h * w0) / l)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
d = Math.abs(d);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (D <= 7.7e+151) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (Math.pow((D * (M / d)), 2.0) * ((h * w0) / l)));
}
return tmp;
}
M = abs(M) D = abs(D) d = abs(d) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if D <= 7.7e+151: tmp = w0 else: tmp = w0 + (-0.125 * (math.pow((D * (M / d)), 2.0) * ((h * w0) / l))) return tmp
M = abs(M) D = abs(D) d = abs(d) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (D <= 7.7e+151) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64((Float64(D * Float64(M / d)) ^ 2.0) * Float64(Float64(h * w0) / l)))); end return tmp end
M = abs(M)
D = abs(D)
d = abs(d)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (D <= 7.7e+151)
tmp = w0;
else
tmp = w0 + (-0.125 * (((D * (M / d)) ^ 2.0) * ((h * w0) / l)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: d should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[D, 7.7e+151], w0, N[(w0 + N[(-0.125 * N[(N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h * w0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
d = |d|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;D \leq 7.7 \cdot 10^{+151}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h \cdot w0}{\ell}\right)\\
\end{array}
\end{array}
if D < 7.70000000000000038e151Initial program 83.3%
Simplified82.9%
Taylor expanded in D around 0 68.9%
if 7.70000000000000038e151 < D Initial program 62.9%
Simplified63.0%
associate-*r/77.1%
frac-times77.0%
*-commutative77.0%
unpow277.0%
unpow277.0%
*-un-lft-identity77.0%
times-frac77.0%
metadata-eval77.0%
*-commutative77.0%
Applied egg-rr77.0%
Taylor expanded in D around 0 39.0%
associate-*r*39.1%
unpow239.1%
unpow239.1%
swap-sqr56.7%
unpow256.7%
Simplified56.7%
distribute-rgt-in56.7%
*-un-lft-identity56.7%
*-commutative56.7%
times-frac39.5%
unpow239.5%
unpow239.5%
frac-times53.5%
associate-*r/53.5%
associate-*r/53.5%
unpow253.5%
Applied egg-rr53.5%
Taylor expanded in D around 0 39.1%
associate-*r*39.1%
times-frac35.4%
Simplified63.7%
Final simplification68.3%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: d should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (+ w0 (* w0 (* (/ (* h (pow (/ M (/ d D)) 2.0)) l) -0.125))))
M = abs(M);
D = abs(D);
d = abs(d);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
return w0 + (w0 * (((h * pow((M / (d / D)), 2.0)) / l) * -0.125));
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order 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 + (w0 * (((h * ((m / (d_1 / d)) ** 2.0d0)) / l) * (-0.125d0)))
end function
M = Math.abs(M);
D = Math.abs(D);
d = Math.abs(d);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 + (w0 * (((h * Math.pow((M / (d / D)), 2.0)) / l) * -0.125));
}
M = abs(M) D = abs(D) d = abs(d) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): return w0 + (w0 * (((h * math.pow((M / (d / D)), 2.0)) / l) * -0.125))
M = abs(M) D = abs(D) d = abs(d) M, D = sort([M, D]) function code(w0, M, D, h, l, d) return Float64(w0 + Float64(w0 * Float64(Float64(Float64(h * (Float64(M / Float64(d / D)) ^ 2.0)) / l) * -0.125))) end
M = abs(M)
D = abs(D)
d = abs(d)
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0 + (w0 * (((h * ((M / (d / D)) ^ 2.0)) / l) * -0.125));
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: d should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := N[(w0 + N[(w0 * N[(N[(N[(h * N[Power[N[(M / N[(d / D), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
D = |D|\\
d = |d|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
w0 + w0 \cdot \left(\frac{h \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}}{\ell} \cdot -0.125\right)
\end{array}
Initial program 81.0%
Simplified80.6%
associate-*r/88.2%
frac-times88.6%
*-commutative88.6%
unpow288.6%
unpow288.6%
*-un-lft-identity88.6%
times-frac88.6%
metadata-eval88.6%
*-commutative88.6%
Applied egg-rr88.6%
Taylor expanded in D around 0 51.7%
associate-*r*54.6%
unpow254.6%
unpow254.6%
swap-sqr66.0%
unpow266.0%
Simplified66.0%
distribute-rgt-in66.0%
*-un-lft-identity66.0%
*-commutative66.0%
times-frac61.3%
unpow261.3%
unpow261.3%
frac-times74.4%
associate-*r/74.4%
associate-*r/74.4%
unpow274.4%
Applied egg-rr74.4%
associate-*r/81.6%
*-commutative81.6%
associate-/r/81.5%
Applied egg-rr81.5%
Final simplification81.5%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: d should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (let* ((t_0 (/ M (/ d D)))) (if (<= D 3.2e+25) w0 (+ w0 (* w0 (* -0.125 (* (/ h l) (* t_0 t_0))))))))
M = abs(M);
D = abs(D);
d = abs(d);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = M / (d / D);
double tmp;
if (D <= 3.2e+25) {
tmp = w0;
} else {
tmp = w0 + (w0 * (-0.125 * ((h / l) * (t_0 * t_0))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order 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_1 / d)
if (d <= 3.2d+25) then
tmp = w0
else
tmp = w0 + (w0 * ((-0.125d0) * ((h / l) * (t_0 * t_0))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
d = Math.abs(d);
assert M < 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 (D <= 3.2e+25) {
tmp = w0;
} else {
tmp = w0 + (w0 * (-0.125 * ((h / l) * (t_0 * t_0))));
}
return tmp;
}
M = abs(M) D = abs(D) d = abs(d) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): t_0 = M / (d / D) tmp = 0 if D <= 3.2e+25: tmp = w0 else: tmp = w0 + (w0 * (-0.125 * ((h / l) * (t_0 * t_0)))) return tmp
M = abs(M) D = abs(D) d = abs(d) M, D = sort([M, D]) function code(w0, M, D, h, l, d) t_0 = Float64(M / Float64(d / D)) tmp = 0.0 if (D <= 3.2e+25) tmp = w0; else tmp = Float64(w0 + Float64(w0 * Float64(-0.125 * Float64(Float64(h / l) * Float64(t_0 * t_0))))); end return tmp end
M = abs(M)
D = abs(D)
d = abs(d)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
t_0 = M / (d / D);
tmp = 0.0;
if (D <= 3.2e+25)
tmp = w0;
else
tmp = w0 + (w0 * (-0.125 * ((h / l) * (t_0 * t_0))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(M / N[(d / D), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[D, 3.2e+25], w0, N[(w0 + N[(w0 * N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
d = |d|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \frac{M}{\frac{d}{D}}\\
\mathbf{if}\;D \leq 3.2 \cdot 10^{+25}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + w0 \cdot \left(-0.125 \cdot \left(\frac{h}{\ell} \cdot \left(t_0 \cdot t_0\right)\right)\right)\\
\end{array}
\end{array}
if D < 3.1999999999999999e25Initial program 82.7%
Simplified82.2%
Taylor expanded in D around 0 70.5%
if 3.1999999999999999e25 < D Initial program 74.5%
Simplified74.5%
associate-*r/82.2%
frac-times82.2%
*-commutative82.2%
unpow282.2%
unpow282.2%
*-un-lft-identity82.2%
times-frac82.2%
metadata-eval82.2%
*-commutative82.2%
Applied egg-rr82.2%
Taylor expanded in D around 0 51.8%
associate-*r*52.4%
unpow252.4%
unpow252.4%
swap-sqr62.0%
unpow262.0%
Simplified62.0%
distribute-rgt-in62.0%
*-un-lft-identity62.0%
*-commutative62.0%
times-frac52.6%
unpow252.6%
unpow252.6%
frac-times65.9%
associate-*r/65.9%
associate-*r/65.9%
unpow265.9%
Applied egg-rr65.9%
unpow265.9%
*-commutative65.9%
associate-/r/65.9%
*-commutative65.9%
associate-/r/65.9%
Applied egg-rr65.9%
Final simplification69.5%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: d should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 w0)
M = abs(M);
D = abs(D);
d = abs(d);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order 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
M = Math.abs(M);
D = Math.abs(D);
d = Math.abs(d);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
M = abs(M) D = abs(D) d = abs(d) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): return w0
M = abs(M) D = abs(D) d = abs(d) M, D = sort([M, D]) function code(w0, M, D, h, l, d) return w0 end
M = abs(M)
D = abs(D)
d = abs(d)
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: d should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := w0
\begin{array}{l}
M = |M|\\
D = |D|\\
d = |d|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
w0
\end{array}
Initial program 81.0%
Simplified80.6%
Taylor expanded in D around 0 65.0%
Final simplification65.0%
herbie shell --seed 2023299
(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))))))