
(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: M 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 (sqrt (- 1.0 (* (* (/ D (/ l (/ M d))) h) (* 0.25 (* D (/ M d))))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (((D / (l / (M / d))) * h) * (0.25 * (D * (M / d))))));
}
NOTE: M 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 * sqrt((1.0d0 - (((d / (l / (m / d_1))) * h) * (0.25d0 * (d * (m / d_1))))))
end function
M = Math.abs(M);
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 * Math.sqrt((1.0 - (((D / (l / (M / d))) * h) * (0.25 * (D * (M / d))))));
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (((D / (l / (M / d))) * h) * (0.25 * (D * (M / d))))))
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(D / Float64(l / Float64(M / d))) * h) * Float64(0.25 * Float64(D * Float64(M / d))))))) end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0 * sqrt((1.0 - (((D / (l / (M / d))) * h) * (0.25 * (D * (M / d))))));
end
NOTE: M 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[Sqrt[N[(1.0 - N[(N[(N[(D / N[(l / N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] * N[(0.25 * N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
w0 \cdot \sqrt{1 - \left(\frac{D}{\frac{\ell}{\frac{M}{d}}} \cdot h\right) \cdot \left(0.25 \cdot \left(D \cdot \frac{M}{d}\right)\right)}
\end{array}
Initial program 81.0%
Simplified79.8%
Applied egg-rr80.2%
associate-/r/85.4%
*-commutative85.4%
associate-*l/85.4%
associate-*r/85.4%
Simplified85.4%
div-inv85.4%
associate-*r/85.4%
associate-*l/85.4%
unpow285.4%
associate-*l*88.0%
*-commutative88.0%
associate-*l/88.0%
associate-*r/88.0%
associate-*l*88.0%
*-commutative88.0%
associate-*l/88.0%
associate-*r/88.0%
associate-*l*88.0%
Applied egg-rr88.0%
associate-*r*89.5%
un-div-inv89.5%
associate-*r/88.7%
associate-*r*88.7%
associate-*l/86.5%
associate-/l*88.1%
associate-*l/88.2%
associate-/l*90.4%
Applied egg-rr90.4%
*-commutative90.4%
associate-/l*91.9%
associate-*l*91.9%
*-commutative91.9%
associate-/l/85.3%
associate-/r/82.7%
*-commutative82.7%
div-inv82.7%
times-frac82.7%
div-inv82.5%
clear-num82.6%
associate-/r/85.2%
Applied egg-rr85.2%
associate-/r/91.4%
associate-/l*90.9%
associate-/r/90.9%
metadata-eval90.9%
Simplified90.9%
Final simplification90.9%
NOTE: M 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 (<= (/ h l) -5e+281)
(+ w0 (* -0.125 (* (/ D (* d (/ d D))) (* (/ M l) (* h (* w0 M))))))
(if (<= (/ h l) -1e-317)
(+ w0 (* -0.125 (* (/ h l) (* w0 (pow (* D (/ M d)) 2.0)))))
w0)))M = abs(M);
D = abs(D);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -5e+281) {
tmp = w0 + (-0.125 * ((D / (d * (d / D))) * ((M / l) * (h * (w0 * M)))));
} else if ((h / l) <= -1e-317) {
tmp = w0 + (-0.125 * ((h / l) * (w0 * pow((D * (M / d)), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
NOTE: M 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 ((h / l) <= (-5d+281)) then
tmp = w0 + ((-0.125d0) * ((d / (d_1 * (d_1 / d))) * ((m / l) * (h * (w0 * m)))))
else if ((h / l) <= (-1d-317)) then
tmp = w0 + ((-0.125d0) * ((h / l) * (w0 * ((d * (m / d_1)) ** 2.0d0))))
else
tmp = w0
end if
code = tmp
end function
M = Math.abs(M);
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 ((h / l) <= -5e+281) {
tmp = w0 + (-0.125 * ((D / (d * (d / D))) * ((M / l) * (h * (w0 * M)))));
} else if ((h / l) <= -1e-317) {
tmp = w0 + (-0.125 * ((h / l) * (w0 * Math.pow((D * (M / d)), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if (h / l) <= -5e+281: tmp = w0 + (-0.125 * ((D / (d * (d / D))) * ((M / l) * (h * (w0 * M))))) elif (h / l) <= -1e-317: tmp = w0 + (-0.125 * ((h / l) * (w0 * math.pow((D * (M / d)), 2.0)))) else: tmp = w0 return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64(h / l) <= -5e+281) tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(D / Float64(d * Float64(d / D))) * Float64(Float64(M / l) * Float64(h * Float64(w0 * M)))))); elseif (Float64(h / l) <= -1e-317) tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(h / l) * Float64(w0 * (Float64(D * Float64(M / d)) ^ 2.0))))); else tmp = w0; end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if ((h / l) <= -5e+281)
tmp = w0 + (-0.125 * ((D / (d * (d / D))) * ((M / l) * (h * (w0 * M)))));
elseif ((h / l) <= -1e-317)
tmp = w0 + (-0.125 * ((h / l) * (w0 * ((D * (M / d)) ^ 2.0))));
else
tmp = w0;
end
tmp_2 = tmp;
end
NOTE: M 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[N[(h / l), $MachinePrecision], -5e+281], N[(w0 + N[(-0.125 * N[(N[(D / N[(d * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M / l), $MachinePrecision] * N[(h * N[(w0 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(h / l), $MachinePrecision], -1e-317], N[(w0 + N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[(w0 * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -5 \cdot 10^{+281}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\frac{D}{d \cdot \frac{d}{D}} \cdot \left(\frac{M}{\ell} \cdot \left(h \cdot \left(w0 \cdot M\right)\right)\right)\right)\\
\mathbf{elif}\;\frac{h}{\ell} \leq -1 \cdot 10^{-317}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\frac{h}{\ell} \cdot \left(w0 \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -5.00000000000000016e281Initial program 45.5%
Simplified45.5%
Taylor expanded in M around 0 44.3%
times-frac44.1%
unpow244.1%
unpow244.1%
times-frac56.3%
unpow256.3%
associate-/l*48.3%
Simplified48.3%
unpow248.3%
clear-num48.3%
frac-times48.3%
*-un-lft-identity48.3%
Applied egg-rr48.3%
unpow248.3%
div-inv48.3%
times-frac57.2%
Applied egg-rr57.2%
associate-/r/57.2%
*-commutative57.2%
associate-*r*61.2%
/-rgt-identity61.2%
Applied egg-rr61.2%
if -5.00000000000000016e281 < (/.f64 h l) < -1.00000023e-317Initial program 83.5%
Simplified82.8%
Taylor expanded in M around 0 45.4%
times-frac47.7%
unpow247.7%
unpow247.7%
times-frac57.4%
unpow257.4%
associate-/l*56.6%
Simplified56.6%
div-inv56.6%
unpow256.6%
associate-*l*60.0%
associate-/r*61.8%
associate-/r/61.8%
clear-num62.5%
Applied egg-rr62.5%
Taylor expanded in D around 0 45.4%
Simplified70.2%
if -1.00000023e-317 < (/.f64 h l) Initial program 86.4%
Simplified84.5%
Taylor expanded in M around 0 94.8%
Final simplification79.2%
NOTE: M 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 (<= (/ h l) -2e+295)
(+ w0 (* -0.125 (* (/ D (* d (/ d D))) (* (/ M l) (* h (* w0 M))))))
(if (<= (/ h l) -1e-289)
(+ w0 (* -0.125 (* w0 (/ (pow (* D (/ M d)) 2.0) (/ l h)))))
w0)))M = abs(M);
D = abs(D);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -2e+295) {
tmp = w0 + (-0.125 * ((D / (d * (d / D))) * ((M / l) * (h * (w0 * M)))));
} else if ((h / l) <= -1e-289) {
tmp = w0 + (-0.125 * (w0 * (pow((D * (M / d)), 2.0) / (l / h))));
} else {
tmp = w0;
}
return tmp;
}
NOTE: M 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 ((h / l) <= (-2d+295)) then
tmp = w0 + ((-0.125d0) * ((d / (d_1 * (d_1 / d))) * ((m / l) * (h * (w0 * m)))))
else if ((h / l) <= (-1d-289)) then
tmp = w0 + ((-0.125d0) * (w0 * (((d * (m / d_1)) ** 2.0d0) / (l / h))))
else
tmp = w0
end if
code = tmp
end function
M = Math.abs(M);
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 ((h / l) <= -2e+295) {
tmp = w0 + (-0.125 * ((D / (d * (d / D))) * ((M / l) * (h * (w0 * M)))));
} else if ((h / l) <= -1e-289) {
tmp = w0 + (-0.125 * (w0 * (Math.pow((D * (M / d)), 2.0) / (l / h))));
} else {
tmp = w0;
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if (h / l) <= -2e+295: tmp = w0 + (-0.125 * ((D / (d * (d / D))) * ((M / l) * (h * (w0 * M))))) elif (h / l) <= -1e-289: tmp = w0 + (-0.125 * (w0 * (math.pow((D * (M / d)), 2.0) / (l / h)))) else: tmp = w0 return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64(h / l) <= -2e+295) tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(D / Float64(d * Float64(d / D))) * Float64(Float64(M / l) * Float64(h * Float64(w0 * M)))))); elseif (Float64(h / l) <= -1e-289) tmp = Float64(w0 + Float64(-0.125 * Float64(w0 * Float64((Float64(D * Float64(M / d)) ^ 2.0) / Float64(l / h))))); else tmp = w0; end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if ((h / l) <= -2e+295)
tmp = w0 + (-0.125 * ((D / (d * (d / D))) * ((M / l) * (h * (w0 * M)))));
elseif ((h / l) <= -1e-289)
tmp = w0 + (-0.125 * (w0 * (((D * (M / d)) ^ 2.0) / (l / h))));
else
tmp = w0;
end
tmp_2 = tmp;
end
NOTE: M 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[N[(h / l), $MachinePrecision], -2e+295], N[(w0 + N[(-0.125 * N[(N[(D / N[(d * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M / l), $MachinePrecision] * N[(h * N[(w0 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(h / l), $MachinePrecision], -1e-289], N[(w0 + N[(-0.125 * N[(w0 * N[(N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -2 \cdot 10^{+295}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\frac{D}{d \cdot \frac{d}{D}} \cdot \left(\frac{M}{\ell} \cdot \left(h \cdot \left(w0 \cdot M\right)\right)\right)\right)\\
\mathbf{elif}\;\frac{h}{\ell} \leq -1 \cdot 10^{-289}:\\
\;\;\;\;w0 + -0.125 \cdot \left(w0 \cdot \frac{{\left(D \cdot \frac{M}{d}\right)}^{2}}{\frac{\ell}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -2e295Initial program 40.8%
Simplified40.8%
Taylor expanded in M around 0 43.8%
times-frac43.6%
unpow243.6%
unpow243.6%
times-frac56.9%
unpow256.9%
associate-/l*48.2%
Simplified48.2%
unpow248.2%
clear-num48.2%
frac-times48.2%
*-un-lft-identity48.2%
Applied egg-rr48.2%
unpow248.2%
div-inv48.2%
times-frac57.8%
Applied egg-rr57.8%
associate-/r/57.8%
*-commutative57.8%
associate-*r*62.2%
/-rgt-identity62.2%
Applied egg-rr62.2%
if -2e295 < (/.f64 h l) < -1e-289Initial program 84.0%
Simplified82.5%
Taylor expanded in M around 0 46.1%
times-frac48.4%
unpow248.4%
unpow248.4%
times-frac57.5%
unpow257.5%
associate-/l*56.7%
Simplified56.7%
div-inv56.7%
unpow256.7%
associate-*l*59.3%
associate-/r*61.9%
associate-/r/61.9%
clear-num61.9%
Applied egg-rr61.9%
unpow261.9%
Applied egg-rr61.9%
clear-num61.9%
times-frac61.9%
*-un-lft-identity61.9%
associate-*r*59.4%
unpow259.4%
associate-*l/56.7%
clear-num56.7%
div-inv56.7%
associate-*r/57.7%
Applied egg-rr67.2%
associate-/r/70.4%
Simplified70.4%
if -1e-289 < (/.f64 h l) Initial program 86.0%
Simplified85.0%
Taylor expanded in M around 0 94.1%
Final simplification79.6%
NOTE: M 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 5.3e+93) (+ w0 (* -0.125 (* w0 (/ (pow (* D (/ M d)) 2.0) (/ l h))))) (+ w0 (* -0.125 (* w0 (/ (* (pow (/ D d) 2.0) (* M (/ M l))) (/ 1.0 h)))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (d <= 5.3e+93) {
tmp = w0 + (-0.125 * (w0 * (pow((D * (M / d)), 2.0) / (l / h))));
} else {
tmp = w0 + (-0.125 * (w0 * ((pow((D / d), 2.0) * (M * (M / l))) / (1.0 / h))));
}
return tmp;
}
NOTE: M 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_1 <= 5.3d+93) then
tmp = w0 + ((-0.125d0) * (w0 * (((d * (m / d_1)) ** 2.0d0) / (l / h))))
else
tmp = w0 + ((-0.125d0) * (w0 * ((((d / d_1) ** 2.0d0) * (m * (m / l))) / (1.0d0 / h))))
end if
code = tmp
end function
M = Math.abs(M);
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 <= 5.3e+93) {
tmp = w0 + (-0.125 * (w0 * (Math.pow((D * (M / d)), 2.0) / (l / h))));
} else {
tmp = w0 + (-0.125 * (w0 * ((Math.pow((D / d), 2.0) * (M * (M / l))) / (1.0 / h))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if d <= 5.3e+93: tmp = w0 + (-0.125 * (w0 * (math.pow((D * (M / d)), 2.0) / (l / h)))) else: tmp = w0 + (-0.125 * (w0 * ((math.pow((D / d), 2.0) * (M * (M / l))) / (1.0 / h)))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (d <= 5.3e+93) tmp = Float64(w0 + Float64(-0.125 * Float64(w0 * Float64((Float64(D * Float64(M / d)) ^ 2.0) / Float64(l / h))))); else tmp = Float64(w0 + Float64(-0.125 * Float64(w0 * Float64(Float64((Float64(D / d) ^ 2.0) * Float64(M * Float64(M / l))) / Float64(1.0 / h))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (d <= 5.3e+93)
tmp = w0 + (-0.125 * (w0 * (((D * (M / d)) ^ 2.0) / (l / h))));
else
tmp = w0 + (-0.125 * (w0 * ((((D / d) ^ 2.0) * (M * (M / l))) / (1.0 / h))));
end
tmp_2 = tmp;
end
NOTE: M 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, 5.3e+93], N[(w0 + N[(-0.125 * N[(w0 * N[(N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 + N[(-0.125 * N[(w0 * N[(N[(N[Power[N[(D / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(M * N[(M / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 5.3 \cdot 10^{+93}:\\
\;\;\;\;w0 + -0.125 \cdot \left(w0 \cdot \frac{{\left(D \cdot \frac{M}{d}\right)}^{2}}{\frac{\ell}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left(w0 \cdot \frac{{\left(\frac{D}{d}\right)}^{2} \cdot \left(M \cdot \frac{M}{\ell}\right)}{\frac{1}{h}}\right)\\
\end{array}
\end{array}
if d < 5.3000000000000004e93Initial program 81.4%
Simplified79.4%
Taylor expanded in M around 0 50.8%
times-frac51.7%
unpow251.7%
unpow251.7%
times-frac59.1%
unpow259.1%
associate-/l*56.5%
Simplified56.5%
div-inv56.5%
unpow256.5%
associate-*l*58.8%
associate-/r*61.1%
associate-/r/60.6%
clear-num61.1%
Applied egg-rr61.1%
unpow261.1%
Applied egg-rr61.1%
clear-num61.1%
times-frac61.1%
*-un-lft-identity61.1%
associate-*r*58.8%
unpow258.8%
associate-*l/56.5%
clear-num56.5%
div-inv56.5%
associate-*r/57.1%
Applied egg-rr70.7%
associate-/r/73.7%
Simplified73.7%
if 5.3000000000000004e93 < d Initial program 79.6%
Simplified81.2%
Taylor expanded in M around 0 54.2%
times-frac55.9%
unpow255.9%
unpow255.9%
times-frac72.2%
unpow272.2%
associate-/l*70.6%
Simplified70.6%
div-inv69.1%
unpow269.1%
associate-*l*74.0%
associate-/r*69.2%
associate-/r/69.2%
clear-num69.2%
Applied egg-rr69.2%
unpow269.2%
Applied egg-rr69.2%
clear-num69.2%
times-frac69.2%
*-un-lft-identity69.2%
associate-*r*64.3%
unpow264.3%
associate-*l/69.1%
clear-num69.1%
div-inv70.6%
unpow270.6%
div-inv70.6%
frac-times78.7%
associate-*r*81.9%
associate-*r/84.8%
Applied egg-rr84.8%
associate-/r/89.6%
associate-*l*84.8%
Simplified84.8%
Final simplification76.5%
NOTE: M 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 (<= M 1.35e-58) w0 (+ w0 (* -0.125 (* (* (/ D d) (/ D d)) (* M (* M (* w0 (/ h l)))))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 1.35e-58) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (((D / d) * (D / d)) * (M * (M * (w0 * (h / l))))));
}
return tmp;
}
NOTE: M 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 (m <= 1.35d-58) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * (((d / d_1) * (d / d_1)) * (m * (m * (w0 * (h / l))))))
end if
code = tmp
end function
M = Math.abs(M);
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 (M <= 1.35e-58) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (((D / d) * (D / d)) * (M * (M * (w0 * (h / l))))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if M <= 1.35e-58: tmp = w0 else: tmp = w0 + (-0.125 * (((D / d) * (D / d)) * (M * (M * (w0 * (h / l)))))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 1.35e-58) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(M * Float64(M * Float64(w0 * Float64(h / l))))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (M <= 1.35e-58)
tmp = w0;
else
tmp = w0 + (-0.125 * (((D / d) * (D / d)) * (M * (M * (w0 * (h / 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: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 1.35e-58], w0, N[(w0 + N[(-0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(M * N[(M * N[(w0 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 1.35 \cdot 10^{-58}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(M \cdot \left(M \cdot \left(w0 \cdot \frac{h}{\ell}\right)\right)\right)\right)\\
\end{array}
\end{array}
if M < 1.3499999999999999e-58Initial program 82.8%
Simplified81.2%
Taylor expanded in M around 0 71.3%
if 1.3499999999999999e-58 < M Initial program 76.1%
Simplified76.1%
Taylor expanded in M around 0 45.4%
times-frac46.9%
unpow246.9%
unpow246.9%
times-frac56.8%
unpow256.8%
associate-/l*56.7%
Simplified56.7%
div-inv56.7%
unpow256.7%
associate-*l*62.7%
associate-/r*60.3%
associate-/r/60.3%
clear-num61.8%
Applied egg-rr61.8%
unpow261.8%
Applied egg-rr61.8%
Final simplification68.8%
NOTE: M 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 (<= M 7.7e-60) w0 (+ w0 (* -0.125 (* (/ D (* d (/ d D))) (* (/ M l) (* M (* w0 h))))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 7.7e-60) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * ((D / (d * (d / D))) * ((M / l) * (M * (w0 * h)))));
}
return tmp;
}
NOTE: M 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 (m <= 7.7d-60) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * ((d / (d_1 * (d_1 / d))) * ((m / l) * (m * (w0 * h)))))
end if
code = tmp
end function
M = Math.abs(M);
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 (M <= 7.7e-60) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * ((D / (d * (d / D))) * ((M / l) * (M * (w0 * h)))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if M <= 7.7e-60: tmp = w0 else: tmp = w0 + (-0.125 * ((D / (d * (d / D))) * ((M / l) * (M * (w0 * h))))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 7.7e-60) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(D / Float64(d * Float64(d / D))) * Float64(Float64(M / l) * Float64(M * Float64(w0 * h)))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (M <= 7.7e-60)
tmp = w0;
else
tmp = w0 + (-0.125 * ((D / (d * (d / D))) * ((M / l) * (M * (w0 * h)))));
end
tmp_2 = tmp;
end
NOTE: M 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[M, 7.7e-60], w0, N[(w0 + N[(-0.125 * N[(N[(D / N[(d * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M / l), $MachinePrecision] * N[(M * N[(w0 * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 7.7 \cdot 10^{-60}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\frac{D}{d \cdot \frac{d}{D}} \cdot \left(\frac{M}{\ell} \cdot \left(M \cdot \left(w0 \cdot h\right)\right)\right)\right)\\
\end{array}
\end{array}
if M < 7.6999999999999996e-60Initial program 82.8%
Simplified81.2%
Taylor expanded in M around 0 71.3%
if 7.6999999999999996e-60 < M Initial program 76.1%
Simplified76.1%
Taylor expanded in M around 0 45.4%
times-frac46.9%
unpow246.9%
unpow246.9%
times-frac56.8%
unpow256.8%
associate-/l*56.7%
Simplified56.7%
unpow256.7%
clear-num56.7%
frac-times56.7%
*-un-lft-identity56.7%
Applied egg-rr56.7%
unpow256.7%
div-inv56.7%
times-frac64.0%
Applied egg-rr64.0%
associate-/r/64.0%
/-rgt-identity64.0%
Simplified64.0%
Final simplification69.4%
NOTE: M 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 (<= M 2.65e-61) w0 (+ w0 (* -0.125 (* (/ D (* d (/ d D))) (* (/ M l) (* h (* w0 M))))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 2.65e-61) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * ((D / (d * (d / D))) * ((M / l) * (h * (w0 * M)))));
}
return tmp;
}
NOTE: M 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 (m <= 2.65d-61) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * ((d / (d_1 * (d_1 / d))) * ((m / l) * (h * (w0 * m)))))
end if
code = tmp
end function
M = Math.abs(M);
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 (M <= 2.65e-61) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * ((D / (d * (d / D))) * ((M / l) * (h * (w0 * M)))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if M <= 2.65e-61: tmp = w0 else: tmp = w0 + (-0.125 * ((D / (d * (d / D))) * ((M / l) * (h * (w0 * M))))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 2.65e-61) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(D / Float64(d * Float64(d / D))) * Float64(Float64(M / l) * Float64(h * Float64(w0 * M)))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (M <= 2.65e-61)
tmp = w0;
else
tmp = w0 + (-0.125 * ((D / (d * (d / D))) * ((M / l) * (h * (w0 * M)))));
end
tmp_2 = tmp;
end
NOTE: M 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[M, 2.65e-61], w0, N[(w0 + N[(-0.125 * N[(N[(D / N[(d * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M / l), $MachinePrecision] * N[(h * N[(w0 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 2.65 \cdot 10^{-61}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\frac{D}{d \cdot \frac{d}{D}} \cdot \left(\frac{M}{\ell} \cdot \left(h \cdot \left(w0 \cdot M\right)\right)\right)\right)\\
\end{array}
\end{array}
if M < 2.65e-61Initial program 82.7%
Simplified81.1%
Taylor expanded in M around 0 71.2%
if 2.65e-61 < M Initial program 76.4%
Simplified76.4%
Taylor expanded in M around 0 46.2%
times-frac47.6%
unpow247.6%
unpow247.6%
times-frac57.4%
unpow257.4%
associate-/l*57.3%
Simplified57.3%
unpow257.3%
clear-num57.3%
frac-times57.3%
*-un-lft-identity57.3%
Applied egg-rr57.3%
unpow257.3%
div-inv57.3%
times-frac64.5%
Applied egg-rr64.5%
associate-/r/64.6%
*-commutative64.6%
associate-*r*62.5%
/-rgt-identity62.5%
Applied egg-rr62.5%
Final simplification68.8%
NOTE: M 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);
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: 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);
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) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): return w0
M = abs(M) 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)
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: 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|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
w0
\end{array}
Initial program 81.0%
Simplified79.8%
Taylor expanded in M 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))))))