
(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 12 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 (* (/ (pow (* D (* M (/ 0.5 d))) 2.0) l) h)))))
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 - ((pow((D * (M * (0.5 / d))), 2.0) / l) * h)));
}
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 * (m * (0.5d0 / d_1))) ** 2.0d0) / l) * h)))
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 - ((Math.pow((D * (M * (0.5 / d))), 2.0) / l) * h)));
}
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 - ((math.pow((D * (M * (0.5 / d))), 2.0) / l) * h)))
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(M * Float64(0.5 / d))) ^ 2.0) / l) * h)))) 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 * (M * (0.5 / d))) ^ 2.0) / l) * h)));
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[Power[N[(D * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
w0 \cdot \sqrt{1 - \frac{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell} \cdot h}
\end{array}
Initial program 81.5%
Simplified82.2%
frac-times81.5%
*-commutative81.5%
clear-num81.5%
un-div-inv82.0%
div-inv82.0%
associate-*l*83.5%
associate-/r*83.5%
metadata-eval83.5%
Applied egg-rr83.5%
associate-/r/85.8%
*-commutative85.8%
associate-*r*85.4%
*-commutative85.4%
Simplified85.4%
Final simplification85.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 (<= (* D M) 5e-139)
(* w0 (+ 1.0 (* (* h (/ (pow (* M (/ D d)) 2.0) l)) -0.125)))
(if (<= (* D M) 5e+131)
(* w0 (sqrt (- 1.0 (* h (/ (* 0.25 (* (* D M) (* D M))) (* d (* d l)))))))
(*
w0
(sqrt (- 1.0 (* 0.25 (* (* (/ D d) (/ D d)) (* h (/ M (/ l 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 ((D * M) <= 5e-139) {
tmp = w0 * (1.0 + ((h * (pow((M * (D / d)), 2.0) / l)) * -0.125));
} else if ((D * M) <= 5e+131) {
tmp = w0 * sqrt((1.0 - (h * ((0.25 * ((D * M) * (D * M))) / (d * (d * l))))));
} else {
tmp = w0 * sqrt((1.0 - (0.25 * (((D / d) * (D / d)) * (h * (M / (l / 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 ((d * m) <= 5d-139) then
tmp = w0 * (1.0d0 + ((h * (((m * (d / d_1)) ** 2.0d0) / l)) * (-0.125d0)))
else if ((d * m) <= 5d+131) then
tmp = w0 * sqrt((1.0d0 - (h * ((0.25d0 * ((d * m) * (d * m))) / (d_1 * (d_1 * l))))))
else
tmp = w0 * sqrt((1.0d0 - (0.25d0 * (((d / d_1) * (d / d_1)) * (h * (m / (l / 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 ((D * M) <= 5e-139) {
tmp = w0 * (1.0 + ((h * (Math.pow((M * (D / d)), 2.0) / l)) * -0.125));
} else if ((D * M) <= 5e+131) {
tmp = w0 * Math.sqrt((1.0 - (h * ((0.25 * ((D * M) * (D * M))) / (d * (d * l))))));
} else {
tmp = w0 * Math.sqrt((1.0 - (0.25 * (((D / d) * (D / d)) * (h * (M / (l / 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 (D * M) <= 5e-139: tmp = w0 * (1.0 + ((h * (math.pow((M * (D / d)), 2.0) / l)) * -0.125)) elif (D * M) <= 5e+131: tmp = w0 * math.sqrt((1.0 - (h * ((0.25 * ((D * M) * (D * M))) / (d * (d * l)))))) else: tmp = w0 * math.sqrt((1.0 - (0.25 * (((D / d) * (D / d)) * (h * (M / (l / 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 (Float64(D * M) <= 5e-139) tmp = Float64(w0 * Float64(1.0 + Float64(Float64(h * Float64((Float64(M * Float64(D / d)) ^ 2.0) / l)) * -0.125))); elseif (Float64(D * M) <= 5e+131) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64(Float64(0.25 * Float64(Float64(D * M) * Float64(D * M))) / Float64(d * Float64(d * l))))))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(0.25 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(h * Float64(M / Float64(l / 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 ((D * M) <= 5e-139)
tmp = w0 * (1.0 + ((h * (((M * (D / d)) ^ 2.0) / l)) * -0.125));
elseif ((D * M) <= 5e+131)
tmp = w0 * sqrt((1.0 - (h * ((0.25 * ((D * M) * (D * M))) / (d * (d * l))))));
else
tmp = w0 * sqrt((1.0 - (0.25 * (((D / d) * (D / d)) * (h * (M / (l / 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[N[(D * M), $MachinePrecision], 5e-139], N[(w0 * N[(1.0 + N[(N[(h * N[(N[Power[N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(D * M), $MachinePrecision], 5e+131], N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[(0.25 * N[(N[(D * M), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(0.25 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(M / N[(l / M), $MachinePrecision]), $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}\;D \cdot M \leq 5 \cdot 10^{-139}:\\
\;\;\;\;w0 \cdot \left(1 + \left(h \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) \cdot -0.125\right)\\
\mathbf{elif}\;D \cdot M \leq 5 \cdot 10^{+131}:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \frac{0.25 \cdot \left(\left(D \cdot M\right) \cdot \left(D \cdot M\right)\right)}{d \cdot \left(d \cdot \ell\right)}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(h \cdot \frac{M}{\frac{\ell}{M}}\right)\right)}\\
\end{array}
\end{array}
if (*.f64 M D) < 5.00000000000000034e-139Initial program 83.8%
Simplified85.3%
Taylor expanded in D around 0 64.4%
*-commutative64.4%
times-frac66.6%
unpow266.6%
unpow266.6%
unpow266.6%
Simplified66.6%
Taylor expanded in D around 0 64.4%
unpow264.4%
unpow264.4%
associate-*r*66.7%
associate-*r*64.4%
associate-*r*63.9%
associate-/l*62.6%
associate-/r/63.9%
unpow263.9%
unpow263.9%
Simplified83.0%
if 5.00000000000000034e-139 < (*.f64 M D) < 4.99999999999999995e131Initial program 78.1%
Simplified74.0%
frac-times78.1%
*-commutative78.1%
clear-num78.1%
un-div-inv78.1%
div-inv78.1%
associate-*l*78.1%
associate-/r*78.1%
metadata-eval78.1%
Applied egg-rr78.1%
associate-/r/74.2%
*-commutative74.2%
associate-*r*72.1%
*-commutative72.1%
Simplified72.1%
Taylor expanded in D around 0 45.2%
associate-*r/45.2%
unpow245.2%
associate-*l*47.3%
unpow247.3%
unpow247.3%
unswap-sqr74.8%
Simplified74.8%
if 4.99999999999999995e131 < (*.f64 M D) Initial program 72.5%
Simplified76.0%
frac-times72.5%
*-commutative72.5%
clear-num72.5%
un-div-inv72.5%
div-inv72.5%
associate-*l*75.9%
associate-/r*75.9%
metadata-eval75.9%
Applied egg-rr75.9%
associate-/r/82.7%
*-commutative82.7%
associate-*r*82.8%
*-commutative82.8%
Simplified82.8%
Taylor expanded in D around 0 50.4%
unpow250.4%
unpow250.4%
times-frac50.6%
unpow250.6%
associate-*r*57.6%
associate-*r*50.6%
associate-*l/50.6%
*-commutative50.6%
associate-/l*54.0%
Simplified54.0%
Taylor expanded in D around 0 54.0%
unpow239.8%
unpow239.8%
times-frac47.6%
Simplified72.0%
Final simplification80.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 (<= (* D M) 5e-139)
(* w0 (+ 1.0 (* (* h (/ (pow (* M (/ D d)) 2.0) l)) -0.125)))
(if (<= (* D M) 1e+131)
(* w0 (sqrt (- 1.0 (* h (/ (* 0.25 (* (* D M) (* D M))) (* d (* d l)))))))
(*
w0
(sqrt (- 1.0 (/ (* 0.25 (* (* M (* M h)) (* (/ D d) (/ D d)))) 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 ((D * M) <= 5e-139) {
tmp = w0 * (1.0 + ((h * (pow((M * (D / d)), 2.0) / l)) * -0.125));
} else if ((D * M) <= 1e+131) {
tmp = w0 * sqrt((1.0 - (h * ((0.25 * ((D * M) * (D * M))) / (d * (d * l))))));
} else {
tmp = w0 * sqrt((1.0 - ((0.25 * ((M * (M * h)) * ((D / d) * (D / d)))) / 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 ((d * m) <= 5d-139) then
tmp = w0 * (1.0d0 + ((h * (((m * (d / d_1)) ** 2.0d0) / l)) * (-0.125d0)))
else if ((d * m) <= 1d+131) then
tmp = w0 * sqrt((1.0d0 - (h * ((0.25d0 * ((d * m) * (d * m))) / (d_1 * (d_1 * l))))))
else
tmp = w0 * sqrt((1.0d0 - ((0.25d0 * ((m * (m * h)) * ((d / d_1) * (d / d_1)))) / 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 ((D * M) <= 5e-139) {
tmp = w0 * (1.0 + ((h * (Math.pow((M * (D / d)), 2.0) / l)) * -0.125));
} else if ((D * M) <= 1e+131) {
tmp = w0 * Math.sqrt((1.0 - (h * ((0.25 * ((D * M) * (D * M))) / (d * (d * l))))));
} else {
tmp = w0 * Math.sqrt((1.0 - ((0.25 * ((M * (M * h)) * ((D / d) * (D / d)))) / 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 (D * M) <= 5e-139: tmp = w0 * (1.0 + ((h * (math.pow((M * (D / d)), 2.0) / l)) * -0.125)) elif (D * M) <= 1e+131: tmp = w0 * math.sqrt((1.0 - (h * ((0.25 * ((D * M) * (D * M))) / (d * (d * l)))))) else: tmp = w0 * math.sqrt((1.0 - ((0.25 * ((M * (M * h)) * ((D / d) * (D / d)))) / 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 (Float64(D * M) <= 5e-139) tmp = Float64(w0 * Float64(1.0 + Float64(Float64(h * Float64((Float64(M * Float64(D / d)) ^ 2.0) / l)) * -0.125))); elseif (Float64(D * M) <= 1e+131) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64(Float64(0.25 * Float64(Float64(D * M) * Float64(D * M))) / Float64(d * Float64(d * l))))))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(0.25 * Float64(Float64(M * Float64(M * h)) * Float64(Float64(D / d) * Float64(D / d)))) / 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 ((D * M) <= 5e-139)
tmp = w0 * (1.0 + ((h * (((M * (D / d)) ^ 2.0) / l)) * -0.125));
elseif ((D * M) <= 1e+131)
tmp = w0 * sqrt((1.0 - (h * ((0.25 * ((D * M) * (D * M))) / (d * (d * l))))));
else
tmp = w0 * sqrt((1.0 - ((0.25 * ((M * (M * h)) * ((D / d) * (D / d)))) / 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[N[(D * M), $MachinePrecision], 5e-139], N[(w0 * N[(1.0 + N[(N[(h * N[(N[Power[N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(D * M), $MachinePrecision], 1e+131], N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[(0.25 * N[(N[(D * M), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(0.25 * N[(N[(M * N[(M * h), $MachinePrecision]), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;D \cdot M \leq 5 \cdot 10^{-139}:\\
\;\;\;\;w0 \cdot \left(1 + \left(h \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) \cdot -0.125\right)\\
\mathbf{elif}\;D \cdot M \leq 10^{+131}:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \frac{0.25 \cdot \left(\left(D \cdot M\right) \cdot \left(D \cdot M\right)\right)}{d \cdot \left(d \cdot \ell\right)}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{0.25 \cdot \left(\left(M \cdot \left(M \cdot h\right)\right) \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)}{\ell}}\\
\end{array}
\end{array}
if (*.f64 M D) < 5.00000000000000034e-139Initial program 83.8%
Simplified85.3%
Taylor expanded in D around 0 64.4%
*-commutative64.4%
times-frac66.6%
unpow266.6%
unpow266.6%
unpow266.6%
Simplified66.6%
Taylor expanded in D around 0 64.4%
unpow264.4%
unpow264.4%
associate-*r*66.7%
associate-*r*64.4%
associate-*r*63.9%
associate-/l*62.6%
associate-/r/63.9%
unpow263.9%
unpow263.9%
Simplified83.0%
if 5.00000000000000034e-139 < (*.f64 M D) < 9.9999999999999991e130Initial program 78.1%
Simplified74.0%
frac-times78.1%
*-commutative78.1%
clear-num78.1%
un-div-inv78.1%
div-inv78.1%
associate-*l*78.1%
associate-/r*78.1%
metadata-eval78.1%
Applied egg-rr78.1%
associate-/r/74.2%
*-commutative74.2%
associate-*r*72.1%
*-commutative72.1%
Simplified72.1%
Taylor expanded in D around 0 45.2%
associate-*r/45.2%
unpow245.2%
associate-*l*47.3%
unpow247.3%
unpow247.3%
unswap-sqr74.8%
Simplified74.8%
if 9.9999999999999991e130 < (*.f64 M D) Initial program 72.5%
Simplified76.0%
Taylor expanded in D around 0 50.4%
associate-*r/50.4%
*-commutative50.4%
times-frac50.6%
*-commutative50.6%
associate-/l*50.6%
unpow250.6%
associate-*l*57.6%
unpow257.6%
unpow257.6%
Simplified57.6%
associate-*l/57.6%
div-inv57.6%
clear-num57.6%
times-frac75.5%
Applied egg-rr75.5%
Final simplification80.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 (<= (/ h l) -50.0) (* w0 (sqrt (- 1.0 (* 0.25 (* (* (/ D d) (/ D d)) (* h (/ M (/ l M)))))))) (* w0 (+ 1.0 (* (* h (/ (pow (* M (/ D d)) 2.0) l)) -0.125)))))
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) <= -50.0) {
tmp = w0 * sqrt((1.0 - (0.25 * (((D / d) * (D / d)) * (h * (M / (l / M)))))));
} else {
tmp = w0 * (1.0 + ((h * (pow((M * (D / d)), 2.0) / l)) * -0.125));
}
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) <= (-50.0d0)) then
tmp = w0 * sqrt((1.0d0 - (0.25d0 * (((d / d_1) * (d / d_1)) * (h * (m / (l / m)))))))
else
tmp = w0 * (1.0d0 + ((h * (((m * (d / d_1)) ** 2.0d0) / l)) * (-0.125d0)))
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) <= -50.0) {
tmp = w0 * Math.sqrt((1.0 - (0.25 * (((D / d) * (D / d)) * (h * (M / (l / M)))))));
} else {
tmp = w0 * (1.0 + ((h * (Math.pow((M * (D / d)), 2.0) / l)) * -0.125));
}
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) <= -50.0: tmp = w0 * math.sqrt((1.0 - (0.25 * (((D / d) * (D / d)) * (h * (M / (l / M))))))) else: tmp = w0 * (1.0 + ((h * (math.pow((M * (D / d)), 2.0) / l)) * -0.125)) 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) <= -50.0) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(0.25 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(h * Float64(M / Float64(l / M)))))))); else tmp = Float64(w0 * Float64(1.0 + Float64(Float64(h * Float64((Float64(M * Float64(D / d)) ^ 2.0) / l)) * -0.125))); 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) <= -50.0)
tmp = w0 * sqrt((1.0 - (0.25 * (((D / d) * (D / d)) * (h * (M / (l / M)))))));
else
tmp = w0 * (1.0 + ((h * (((M * (D / d)) ^ 2.0) / l)) * -0.125));
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], -50.0], N[(w0 * N[Sqrt[N[(1.0 - N[(0.25 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(M / N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[(1.0 + N[(N[(h * N[(N[Power[N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -50:\\
\;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(h \cdot \frac{M}{\frac{\ell}{M}}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + \left(h \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) \cdot -0.125\right)\\
\end{array}
\end{array}
if (/.f64 h l) < -50Initial program 68.8%
Simplified70.7%
frac-times68.8%
*-commutative68.8%
clear-num68.7%
un-div-inv70.3%
div-inv70.3%
associate-*l*73.3%
associate-/r*73.3%
metadata-eval73.3%
Applied egg-rr73.3%
associate-/r/76.2%
*-commutative76.2%
associate-*r*76.2%
*-commutative76.2%
Simplified76.2%
Taylor expanded in D around 0 47.6%
unpow247.6%
unpow247.6%
times-frac49.6%
unpow249.6%
associate-*r*52.1%
associate-*r*49.6%
associate-*l/48.5%
*-commutative48.5%
associate-/l*50.9%
Simplified50.9%
Taylor expanded in D around 0 50.9%
unpow224.8%
unpow224.8%
times-frac27.6%
Simplified63.9%
if -50 < (/.f64 h l) Initial program 88.7%
Simplified88.6%
Taylor expanded in D around 0 64.9%
*-commutative64.9%
times-frac66.4%
unpow266.4%
unpow266.4%
unpow266.4%
Simplified66.4%
Taylor expanded in D around 0 64.9%
unpow264.9%
unpow264.9%
associate-*r*68.6%
associate-*r*64.9%
associate-*r*65.0%
associate-/l*64.5%
associate-/r/65.2%
unpow265.2%
unpow265.2%
Simplified88.8%
Final simplification79.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 (+ 1.0 (* (* h (/ (pow (* M (/ D d)) 2.0) l)) -0.125))))
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 * (1.0 + ((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: 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 * (1.0d0 + ((h * (((m * (d / d_1)) ** 2.0d0) / l)) * (-0.125d0)))
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 * (1.0 + ((h * (Math.pow((M * (D / d)), 2.0) / l)) * -0.125));
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): return w0 * (1.0 + ((h * (math.pow((M * (D / d)), 2.0) / l)) * -0.125))
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) return Float64(w0 * Float64(1.0 + Float64(Float64(h * Float64((Float64(M * Float64(D / d)) ^ 2.0) / l)) * -0.125))) end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0 * (1.0 + ((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: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[(1.0 + N[(N[(h * N[(N[Power[N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
w0 \cdot \left(1 + \left(h \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) \cdot -0.125\right)
\end{array}
Initial program 81.5%
Simplified82.2%
Taylor expanded in D around 0 57.6%
*-commutative57.6%
times-frac59.3%
unpow259.3%
unpow259.3%
unpow259.3%
Simplified59.3%
Taylor expanded in D around 0 57.6%
unpow257.6%
unpow257.6%
associate-*r*60.9%
associate-*r*57.6%
associate-*r*57.3%
associate-/l*56.5%
associate-/r/57.5%
unpow257.5%
unpow257.5%
Simplified78.3%
Final simplification78.3%
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 3.2e-75)
w0
(if (<= M 1.9e+155)
(* w0 (+ 1.0 (* -0.125 (* (/ (* D D) (* d d)) (/ M (/ (/ l h) M))))))
(* -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 <= 3.2e-75) {
tmp = w0;
} else if (M <= 1.9e+155) {
tmp = w0 * (1.0 + (-0.125 * (((D * D) / (d * d)) * (M / ((l / h) / M)))));
} else {
tmp = -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 <= 3.2d-75) then
tmp = w0
else if (m <= 1.9d+155) then
tmp = w0 * (1.0d0 + ((-0.125d0) * (((d * d) / (d_1 * d_1)) * (m / ((l / h) / m)))))
else
tmp = (-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 <= 3.2e-75) {
tmp = w0;
} else if (M <= 1.9e+155) {
tmp = w0 * (1.0 + (-0.125 * (((D * D) / (d * d)) * (M / ((l / h) / M)))));
} else {
tmp = -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 <= 3.2e-75: tmp = w0 elif M <= 1.9e+155: tmp = w0 * (1.0 + (-0.125 * (((D * D) / (d * d)) * (M / ((l / h) / M))))) else: tmp = -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 <= 3.2e-75) tmp = w0; elseif (M <= 1.9e+155) tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(Float64(D * D) / Float64(d * d)) * Float64(M / Float64(Float64(l / h) / M)))))); else tmp = Float64(-0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(Float64(M * M) * Float64(w0 * 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 <= 3.2e-75)
tmp = w0;
elseif (M <= 1.9e+155)
tmp = w0 * (1.0 + (-0.125 * (((D * D) / (d * d)) * (M / ((l / h) / M)))));
else
tmp = -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, 3.2e-75], w0, If[LessEqual[M, 1.9e+155], N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[(M / N[(N[(l / h), $MachinePrecision] / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M * M), $MachinePrecision] * N[(w0 * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 3.2 \cdot 10^{-75}:\\
\;\;\;\;w0\\
\mathbf{elif}\;M \leq 1.9 \cdot 10^{+155}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\frac{D \cdot D}{d \cdot d} \cdot \frac{M}{\frac{\frac{\ell}{h}}{M}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{\left(M \cdot M\right) \cdot \left(w0 \cdot h\right)}{\ell}\right)\\
\end{array}
\end{array}
if M < 3.19999999999999977e-75Initial program 83.5%
Simplified84.9%
Taylor expanded in D around 0 70.9%
if 3.19999999999999977e-75 < M < 1.9e155Initial program 83.8%
Simplified81.5%
Taylor expanded in D around 0 63.0%
*-commutative63.0%
times-frac67.7%
unpow267.7%
unpow267.7%
unpow267.7%
Simplified67.7%
Taylor expanded in M around 0 67.7%
unpow267.7%
associate-/l*69.9%
associate-/l*72.3%
Simplified72.3%
if 1.9e155 < M Initial program 56.9%
Simplified56.9%
Taylor expanded in D around 0 16.8%
+-commutative16.8%
*-commutative16.8%
fma-def16.8%
times-frac16.7%
unpow216.7%
unpow216.7%
associate-/l*11.5%
unpow211.5%
Simplified11.5%
Taylor expanded in D around inf 11.6%
unpow211.6%
unpow211.6%
times-frac11.4%
unpow211.4%
*-commutative11.4%
Simplified11.4%
Taylor expanded in D around 0 11.4%
unpow211.4%
unpow211.4%
times-frac17.1%
Simplified17.1%
Final simplification66.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 (<= (* D M) 8e+202) w0 (* -0.125 (* (* (/ D d) (* (/ D d) (* M M))) (* h (/ w0 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 ((D * M) <= 8e+202) {
tmp = w0;
} else {
tmp = -0.125 * (((D / d) * ((D / d) * (M * M))) * (h * (w0 / 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 ((d * m) <= 8d+202) then
tmp = w0
else
tmp = (-0.125d0) * (((d / d_1) * ((d / d_1) * (m * m))) * (h * (w0 / 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 ((D * M) <= 8e+202) {
tmp = w0;
} else {
tmp = -0.125 * (((D / d) * ((D / d) * (M * M))) * (h * (w0 / 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 (D * M) <= 8e+202: tmp = w0 else: tmp = -0.125 * (((D / d) * ((D / d) * (M * M))) * (h * (w0 / 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 (Float64(D * M) <= 8e+202) tmp = w0; else tmp = Float64(-0.125 * Float64(Float64(Float64(D / d) * Float64(Float64(D / d) * Float64(M * M))) * Float64(h * Float64(w0 / 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 ((D * M) <= 8e+202)
tmp = w0;
else
tmp = -0.125 * (((D / d) * ((D / d) * (M * M))) * (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: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(D * M), $MachinePrecision], 8e+202], w0, N[(-0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h * N[(w0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;D \cdot M \leq 8 \cdot 10^{+202}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(\left(\frac{D}{d} \cdot \left(\frac{D}{d} \cdot \left(M \cdot M\right)\right)\right) \cdot \left(h \cdot \frac{w0}{\ell}\right)\right)\\
\end{array}
\end{array}
if (*.f64 M D) < 7.9999999999999992e202Initial program 83.2%
Simplified83.5%
Taylor expanded in D around 0 70.9%
if 7.9999999999999992e202 < (*.f64 M D) Initial program 61.6%
Simplified66.4%
Taylor expanded in D around 0 50.6%
+-commutative50.6%
*-commutative50.6%
fma-def50.6%
times-frac50.6%
unpow250.6%
unpow250.6%
associate-/l*45.6%
unpow245.6%
Simplified45.6%
Taylor expanded in D around inf 40.4%
unpow240.4%
unpow240.4%
unpow240.4%
associate-*r*40.4%
times-frac35.4%
unswap-sqr35.4%
times-frac46.5%
*-commutative46.5%
associate-*r/46.5%
unpow146.5%
*-commutative46.5%
associate-*r/46.7%
pow-plus46.7%
metadata-eval46.7%
Simplified46.7%
unpow246.7%
*-commutative46.7%
*-commutative46.7%
unswap-sqr45.9%
associate-*l*46.5%
Applied egg-rr46.5%
*-un-lft-identity46.5%
associate-/l*51.4%
Applied egg-rr51.4%
*-lft-identity51.4%
associate-/l*46.5%
*-rgt-identity46.5%
associate-*r/46.5%
associate-*l*51.4%
associate-*r/51.4%
*-rgt-identity51.4%
Simplified51.4%
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 3.8e-75) w0 (* w0 (+ 1.0 (* -0.125 (* (/ (* D D) (* d d)) (/ (* h (* M M)) 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 <= 3.8e-75) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * (((D * D) / (d * d)) * ((h * (M * M)) / 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 <= 3.8d-75) then
tmp = w0
else
tmp = w0 * (1.0d0 + ((-0.125d0) * (((d * d) / (d_1 * d_1)) * ((h * (m * m)) / 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 <= 3.8e-75) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * (((D * D) / (d * d)) * ((h * (M * M)) / 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 <= 3.8e-75: tmp = w0 else: tmp = w0 * (1.0 + (-0.125 * (((D * D) / (d * d)) * ((h * (M * M)) / 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 <= 3.8e-75) tmp = w0; else tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(Float64(D * D) / Float64(d * d)) * Float64(Float64(h * Float64(M * M)) / 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 <= 3.8e-75)
tmp = w0;
else
tmp = w0 * (1.0 + (-0.125 * (((D * D) / (d * d)) * ((h * (M * M)) / 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, 3.8e-75], w0, N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / l), $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 3.8 \cdot 10^{-75}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\frac{D \cdot D}{d \cdot d} \cdot \frac{h \cdot \left(M \cdot M\right)}{\ell}\right)\right)\\
\end{array}
\end{array}
if M < 3.79999999999999994e-75Initial program 83.5%
Simplified84.9%
Taylor expanded in D around 0 70.9%
if 3.79999999999999994e-75 < M Initial program 75.1%
Simplified73.6%
Taylor expanded in D around 0 48.1%
*-commutative48.1%
times-frac51.2%
unpow251.2%
unpow251.2%
unpow251.2%
Simplified51.2%
Final simplification66.1%
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 4.1e-137) w0 (* w0 (+ 1.0 (* -0.125 (/ (* (* (/ D d) (/ D d)) (* M M)) (/ l 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 <= 4.1e-137) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * ((((D / d) * (D / d)) * (M * M)) / (l / 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 <= 4.1d-137) then
tmp = w0
else
tmp = w0 * (1.0d0 + ((-0.125d0) * ((((d / d_1) * (d / d_1)) * (m * m)) / (l / 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 <= 4.1e-137) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * ((((D / d) * (D / d)) * (M * M)) / (l / 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 <= 4.1e-137: tmp = w0 else: tmp = w0 * (1.0 + (-0.125 * ((((D / d) * (D / d)) * (M * M)) / (l / 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 <= 4.1e-137) tmp = w0; else tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(M * M)) / Float64(l / 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 <= 4.1e-137)
tmp = w0;
else
tmp = w0 * (1.0 + (-0.125 * ((((D / d) * (D / d)) * (M * M)) / (l / 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, 4.1e-137], w0, N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(M * M), $MachinePrecision]), $MachinePrecision] / N[(l / h), $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 4.1 \cdot 10^{-137}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \frac{\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(M \cdot M\right)}{\frac{\ell}{h}}\right)\\
\end{array}
\end{array}
if M < 4.0999999999999999e-137Initial program 83.7%
Simplified85.3%
Taylor expanded in D around 0 71.6%
if 4.0999999999999999e-137 < M Initial program 76.3%
Simplified75.1%
Taylor expanded in D around 0 51.9%
*-commutative51.9%
times-frac54.5%
unpow254.5%
unpow254.5%
unpow254.5%
Simplified54.5%
associate-/l*54.4%
associate-*r/55.7%
times-frac61.2%
Applied egg-rr61.2%
Final simplification68.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 3.7e-152) w0 (* w0 (+ 1.0 (* -0.125 (/ (* (* M (* M h)) (* (/ D d) (/ D d))) 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 <= 3.7e-152) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * (((M * (M * h)) * ((D / d) * (D / d))) / 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 <= 3.7d-152) then
tmp = w0
else
tmp = w0 * (1.0d0 + ((-0.125d0) * (((m * (m * h)) * ((d / d_1) * (d / d_1))) / 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 <= 3.7e-152) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * (((M * (M * h)) * ((D / d) * (D / d))) / 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 <= 3.7e-152: tmp = w0 else: tmp = w0 * (1.0 + (-0.125 * (((M * (M * h)) * ((D / d) * (D / d))) / 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 <= 3.7e-152) tmp = w0; else tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(Float64(M * Float64(M * h)) * Float64(Float64(D / d) * Float64(D / d))) / 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 <= 3.7e-152)
tmp = w0;
else
tmp = w0 * (1.0 + (-0.125 * (((M * (M * h)) * ((D / d) * (D / d))) / 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, 3.7e-152], w0, N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(N[(M * N[(M * h), $MachinePrecision]), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 3.7 \cdot 10^{-152}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \frac{\left(M \cdot \left(M \cdot h\right)\right) \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)}{\ell}\right)\\
\end{array}
\end{array}
if M < 3.6999999999999998e-152Initial program 83.6%
Simplified85.1%
Taylor expanded in D around 0 71.3%
if 3.6999999999999998e-152 < M Initial program 76.9%
Simplified75.7%
Taylor expanded in D around 0 51.8%
*-commutative51.8%
times-frac54.4%
unpow254.4%
unpow254.4%
unpow254.4%
Simplified54.4%
associate-*r*58.1%
associate-*r/58.3%
times-frac64.8%
Applied egg-rr64.8%
Final simplification69.3%
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.25e+36) w0 (* -0.125 (* (* (/ D d) (* M (* M (/ D d)))) (/ (* 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.25e+36) {
tmp = w0;
} else {
tmp = -0.125 * (((D / d) * (M * (M * (D / d)))) * ((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.25d+36) then
tmp = w0
else
tmp = (-0.125d0) * (((d / d_1) * (m * (m * (d / d_1)))) * ((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.25e+36) {
tmp = w0;
} else {
tmp = -0.125 * (((D / d) * (M * (M * (D / d)))) * ((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.25e+36: tmp = w0 else: tmp = -0.125 * (((D / d) * (M * (M * (D / d)))) * ((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.25e+36) tmp = w0; else tmp = Float64(-0.125 * Float64(Float64(Float64(D / d) * Float64(M * Float64(M * Float64(D / d)))) * Float64(Float64(w0 * 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.25e+36)
tmp = w0;
else
tmp = -0.125 * (((D / d) * (M * (M * (D / d)))) * ((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.25e+36], w0, N[(-0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(M * N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(w0 * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 1.25 \cdot 10^{+36}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(\left(\frac{D}{d} \cdot \left(M \cdot \left(M \cdot \frac{D}{d}\right)\right)\right) \cdot \frac{w0 \cdot h}{\ell}\right)\\
\end{array}
\end{array}
if M < 1.24999999999999994e36Initial program 83.0%
Simplified84.2%
Taylor expanded in D around 0 70.4%
if 1.24999999999999994e36 < M Initial program 73.6%
Simplified71.2%
Taylor expanded in D around 0 38.6%
+-commutative38.6%
*-commutative38.6%
fma-def38.6%
times-frac41.0%
unpow241.0%
unpow241.0%
associate-/l*40.9%
unpow240.9%
Simplified40.9%
Taylor expanded in D around inf 19.1%
unpow219.1%
unpow219.1%
unpow219.1%
associate-*r*19.2%
times-frac19.1%
unswap-sqr19.7%
times-frac23.2%
*-commutative23.2%
associate-*r/23.2%
unpow123.2%
*-commutative23.2%
associate-*r/23.2%
pow-plus23.2%
metadata-eval23.2%
Simplified23.2%
unpow223.2%
*-commutative23.2%
*-commutative23.2%
unswap-sqr22.2%
associate-*l*22.6%
Applied egg-rr22.6%
Taylor expanded in D around 0 22.6%
unpow222.6%
associate-*l/22.6%
associate-*r*23.2%
*-commutative23.2%
*-commutative23.2%
Simplified23.2%
Final simplification63.0%
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.5%
Simplified82.2%
Taylor expanded in D around 0 66.0%
Final simplification66.0%
herbie shell --seed 2023285
(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))))))