
(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 10 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
(if (<=
(* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* d 2.0)) 2.0) (/ h l)))))
INFINITY)
(* w0 (sqrt (- 1.0 (* (/ h l) (pow (* (/ D 2.0) (/ M d)) 2.0)))))
(* w0 (+ 1.0 (* (/ (* (* (/ D d) (/ D d)) (* M (* h M))) 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 ((w0 * sqrt((1.0 - (pow(((M * D) / (d * 2.0)), 2.0) * (h / l))))) <= ((double) INFINITY)) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow(((D / 2.0) * (M / d)), 2.0))));
} else {
tmp = w0 * (1.0 + (((((D / d) * (D / d)) * (M * (h * M))) / l) * -0.125));
}
return tmp;
}
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 ((w0 * Math.sqrt((1.0 - (Math.pow(((M * D) / (d * 2.0)), 2.0) * (h / l))))) <= Double.POSITIVE_INFINITY) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((D / 2.0) * (M / d)), 2.0))));
} else {
tmp = w0 * (1.0 + (((((D / d) * (D / d)) * (M * (h * M))) / 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 (w0 * math.sqrt((1.0 - (math.pow(((M * D) / (d * 2.0)), 2.0) * (h / l))))) <= math.inf: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((D / 2.0) * (M / d)), 2.0)))) else: tmp = w0 * (1.0 + (((((D / d) * (D / d)) * (M * (h * M))) / 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(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0) * Float64(h / l))))) <= Inf) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(D / 2.0) * Float64(M / d)) ^ 2.0))))); else tmp = Float64(w0 * Float64(1.0 + Float64(Float64(Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(M * Float64(h * M))) / 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 ((w0 * sqrt((1.0 - ((((M * D) / (d * 2.0)) ^ 2.0) * (h / l))))) <= Inf)
tmp = w0 * sqrt((1.0 - ((h / l) * (((D / 2.0) * (M / d)) ^ 2.0))));
else
tmp = w0 * (1.0 + (((((D / d) * (D / d)) * (M * (h * M))) / 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[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], Infinity], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / 2.0), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[(1.0 + N[(N[(N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell}} \leq \infty:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{D}{2} \cdot \frac{M}{d}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + \frac{\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(M \cdot \left(h \cdot M\right)\right)}{\ell} \cdot -0.125\right)\\
\end{array}
\end{array}
if (*.f64 w0 (sqrt.f64 (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))))) < +inf.0Initial program 84.7%
Simplified85.2%
if +inf.0 < (*.f64 w0 (sqrt.f64 (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))))) Initial program 0.0%
Simplified0.0%
Taylor expanded in D around 0 50.0%
*-commutative50.0%
times-frac41.7%
unpow241.7%
unpow241.7%
unpow241.7%
Simplified41.7%
associate-*r/50.6%
times-frac67.1%
*-commutative67.1%
Applied egg-rr67.1%
Taylor expanded in h around 0 67.1%
unpow267.1%
associate-*l*75.1%
Simplified75.1%
Final simplification84.7%
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 (/ (* h (pow (* M (* D (/ 0.5 d))) 2.0)) l)))))
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 - ((h * pow((M * (D * (0.5 / d))), 2.0)) / l)));
}
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 - ((h * ((m * (d * (0.5d0 / d_1))) ** 2.0d0)) / l)))
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 - ((h * Math.pow((M * (D * (0.5 / d))), 2.0)) / l)));
}
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 - ((h * math.pow((M * (D * (0.5 / d))), 2.0)) / l)))
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(h * (Float64(M * Float64(D * Float64(0.5 / d))) ^ 2.0)) / l)))) 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 - ((h * ((M * (D * (0.5 / d))) ^ 2.0)) / l)));
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[(h * N[Power[N[(M * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
w0 \cdot \sqrt{1 - \frac{h \cdot {\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}}
\end{array}
Initial program 80.7%
Simplified81.2%
*-commutative81.2%
frac-times80.7%
*-commutative80.7%
associate-*l/84.3%
div-inv84.3%
associate-*l*84.4%
associate-/r*84.4%
metadata-eval84.4%
Applied egg-rr84.4%
Final simplification84.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 1.7e-184)
w0
(*
w0
(sqrt (+ 1.0 (* (* (* (/ D d) (/ D d)) -0.25) (/ M (/ (/ l h) 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 <= 1.7e-184) {
tmp = w0;
} else {
tmp = w0 * sqrt((1.0 + ((((D / d) * (D / d)) * -0.25) * (M / ((l / h) / 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 <= 1.7d-184) then
tmp = w0
else
tmp = w0 * sqrt((1.0d0 + ((((d / d_1) * (d / d_1)) * (-0.25d0)) * (m / ((l / h) / 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 <= 1.7e-184) {
tmp = w0;
} else {
tmp = w0 * Math.sqrt((1.0 + ((((D / d) * (D / d)) * -0.25) * (M / ((l / h) / 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 <= 1.7e-184: tmp = w0 else: tmp = w0 * math.sqrt((1.0 + ((((D / d) * (D / d)) * -0.25) * (M / ((l / h) / 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 <= 1.7e-184) tmp = w0; else tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(Float64(Float64(Float64(D / d) * Float64(D / d)) * -0.25) * Float64(M / Float64(Float64(l / h) / 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 <= 1.7e-184)
tmp = w0;
else
tmp = w0 * sqrt((1.0 + ((((D / d) * (D / d)) * -0.25) * (M / ((l / h) / 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, 1.7e-184], w0, N[(w0 * N[Sqrt[N[(1.0 + N[(N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision] * N[(M / N[(N[(l / h), $MachinePrecision] / 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 1.7 \cdot 10^{-184}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 + \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot -0.25\right) \cdot \frac{M}{\frac{\frac{\ell}{h}}{M}}}\\
\end{array}
\end{array}
if M < 1.70000000000000002e-184Initial program 80.9%
Simplified81.7%
Taylor expanded in D around 0 66.9%
if 1.70000000000000002e-184 < M Initial program 80.4%
Simplified80.4%
Taylor expanded in D around 0 57.7%
times-frac57.1%
unpow257.1%
unpow257.1%
unpow257.1%
Simplified57.1%
*-un-lft-identity57.1%
cancel-sign-sub-inv57.1%
metadata-eval57.1%
times-frac66.4%
associate-/l*66.7%
Applied egg-rr66.7%
Simplified72.1%
Final simplification68.7%
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.25e-166) w0 (* w0 (sqrt (- 1.0 (* 0.25 (/ (* (* (/ 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 <= 2.25e-166) {
tmp = w0;
} else {
tmp = w0 * sqrt((1.0 - (0.25 * ((((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 <= 2.25d-166) then
tmp = w0
else
tmp = w0 * sqrt((1.0d0 - (0.25d0 * ((((d / d_1) * (d / 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 <= 2.25e-166) {
tmp = w0;
} else {
tmp = w0 * Math.sqrt((1.0 - (0.25 * ((((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 <= 2.25e-166: tmp = w0 else: tmp = w0 * math.sqrt((1.0 - (0.25 * ((((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 <= 2.25e-166) tmp = w0; else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(0.25 * Float64(Float64(Float64(Float64(D / d) * Float64(D / d)) * 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 <= 2.25e-166)
tmp = w0;
else
tmp = w0 * sqrt((1.0 - (0.25 * ((((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, 2.25e-166], w0, N[(w0 * N[Sqrt[N[(1.0 - N[(0.25 * N[(N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(M * M), $MachinePrecision]), $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 2.25 \cdot 10^{-166}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \frac{\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)}{\ell}}\\
\end{array}
\end{array}
if M < 2.2499999999999999e-166Initial program 80.9%
Simplified81.6%
Taylor expanded in D around 0 66.8%
if 2.2499999999999999e-166 < M Initial program 80.3%
Simplified80.3%
Taylor expanded in D around 0 57.5%
times-frac56.9%
unpow256.9%
unpow256.9%
unpow256.9%
Simplified56.9%
associate-*r/57.6%
times-frac66.3%
*-commutative66.3%
Applied egg-rr70.4%
Final simplification68.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 (if (<= M 5.8e-168) w0 (* w0 (+ 1.0 (* -0.125 (* h (* (pow (/ D d) 2.0) (* 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 <= 5.8e-168) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * (h * (pow((D / d), 2.0) * (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 <= 5.8d-168) then
tmp = w0
else
tmp = w0 * (1.0d0 + ((-0.125d0) * (h * (((d / d_1) ** 2.0d0) * (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 <= 5.8e-168) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * (h * (Math.pow((D / d), 2.0) * (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 <= 5.8e-168: tmp = w0 else: tmp = w0 * (1.0 + (-0.125 * (h * (math.pow((D / d), 2.0) * (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 <= 5.8e-168) tmp = w0; else tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(h * Float64((Float64(D / d) ^ 2.0) * Float64(M * Float64(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 <= 5.8e-168)
tmp = w0;
else
tmp = w0 * (1.0 + (-0.125 * (h * (((D / d) ^ 2.0) * (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, 5.8e-168], w0, N[(w0 * N[(1.0 + N[(-0.125 * N[(h * N[(N[Power[N[(D / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(M * N[(M / 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 5.8 \cdot 10^{-168}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(h \cdot \left({\left(\frac{D}{d}\right)}^{2} \cdot \left(M \cdot \frac{M}{\ell}\right)\right)\right)\right)\\
\end{array}
\end{array}
if M < 5.7999999999999997e-168Initial program 80.9%
Simplified81.6%
Taylor expanded in D around 0 66.8%
if 5.7999999999999997e-168 < M Initial program 80.3%
Simplified80.3%
Taylor expanded in D around 0 56.1%
*-commutative56.1%
times-frac53.9%
unpow253.9%
unpow253.9%
unpow253.9%
Simplified53.9%
associate-*r/57.6%
times-frac66.3%
*-commutative66.3%
Applied egg-rr66.3%
Taylor expanded in D around 0 56.1%
associate-*r*58.5%
unpow258.5%
associate-*r*58.6%
associate-/l*59.6%
associate-*r/62.1%
*-commutative62.1%
associate-*r/62.1%
associate-*r*62.1%
associate-/r*62.5%
associate-*l/62.5%
unpow262.5%
associate-/r/62.6%
Simplified72.3%
Final simplification68.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 2.7e+35) w0 (* w0 (+ 1.0 (* -0.125 (* h (/ (* (* M D) (* M D)) (* l (* d d)))))))))
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 <= 2.7e+35) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * (h * (((M * D) * (M * D)) / (l * (d * d))))));
}
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 <= 2.7d+35) then
tmp = w0
else
tmp = w0 * (1.0d0 + ((-0.125d0) * (h * (((m * d) * (m * d)) / (l * (d_1 * d_1))))))
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 <= 2.7e+35) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * (h * (((M * D) * (M * D)) / (l * (d * d))))));
}
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 <= 2.7e+35: tmp = w0 else: tmp = w0 * (1.0 + (-0.125 * (h * (((M * D) * (M * D)) / (l * (d * d)))))) 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 <= 2.7e+35) tmp = w0; else tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(h * Float64(Float64(Float64(M * D) * Float64(M * D)) / Float64(l * Float64(d * d))))))); 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 <= 2.7e+35)
tmp = w0;
else
tmp = w0 * (1.0 + (-0.125 * (h * (((M * D) * (M * D)) / (l * (d * d))))));
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, 2.7e+35], w0, N[(w0 * N[(1.0 + N[(-0.125 * N[(h * N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d * d), $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 \leq 2.7 \cdot 10^{+35}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(h \cdot \frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{\ell \cdot \left(d \cdot d\right)}\right)\right)\\
\end{array}
\end{array}
if D < 2.70000000000000003e35Initial program 83.3%
Simplified84.0%
Taylor expanded in D around 0 68.0%
if 2.70000000000000003e35 < D Initial program 70.4%
Simplified70.4%
Taylor expanded in D around 0 44.8%
*-commutative44.8%
times-frac43.0%
unpow243.0%
unpow243.0%
unpow243.0%
Simplified43.0%
Taylor expanded in D around 0 44.8%
associate-*r*46.8%
unpow246.8%
unpow246.8%
unpow246.8%
associate-*r*46.9%
associate-*l/46.9%
*-commutative46.9%
unswap-sqr62.3%
associate-*r*62.2%
Simplified62.2%
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 (<= M 1.16e-182) w0 (* w0 (+ 1.0 (* -0.125 (* (/ 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 (M <= 1.16e-182) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * ((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 (m <= 1.16d-182) then
tmp = w0
else
tmp = w0 * (1.0d0 + ((-0.125d0) * ((d / (d_1 * d_1)) * (d * ((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 (M <= 1.16e-182) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * ((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 M <= 1.16e-182: tmp = w0 else: tmp = w0 * (1.0 + (-0.125 * ((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 (M <= 1.16e-182) tmp = w0; else tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(D / Float64(d * d)) * Float64(D * Float64(Float64(h * 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 (M <= 1.16e-182)
tmp = w0;
else
tmp = w0 * (1.0 + (-0.125 * ((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[M, 1.16e-182], w0, N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(D / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[(D * N[(N[(h * M), $MachinePrecision] / N[(l / M), $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.16 \cdot 10^{-182}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\frac{D}{d \cdot d} \cdot \left(D \cdot \frac{h \cdot M}{\frac{\ell}{M}}\right)\right)\right)\\
\end{array}
\end{array}
if M < 1.16e-182Initial program 80.4%
Simplified81.2%
Taylor expanded in D around 0 66.5%
if 1.16e-182 < M Initial program 81.2%
Simplified81.2%
Taylor expanded in D around 0 57.0%
*-commutative57.0%
times-frac54.9%
unpow254.9%
unpow254.9%
unpow254.9%
Simplified54.9%
Taylor expanded in D around 0 57.0%
*-commutative57.0%
unpow257.0%
unpow257.0%
associate-*l*59.5%
times-frac64.2%
unpow264.2%
associate-*r/60.8%
associate-*r*64.9%
associate-/l*68.2%
*-commutative68.2%
Simplified68.2%
Final simplification67.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 2.75e-200) w0 (* w0 (+ 1.0 (* (/ (* (* (/ D d) (/ D d)) (* M (* h M))) 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 (M <= 2.75e-200) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (((((D / d) * (D / d)) * (M * (h * M))) / 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 (m <= 2.75d-200) then
tmp = w0
else
tmp = w0 * (1.0d0 + (((((d / d_1) * (d / d_1)) * (m * (h * m))) / 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 (M <= 2.75e-200) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (((((D / d) * (D / d)) * (M * (h * M))) / 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 M <= 2.75e-200: tmp = w0 else: tmp = w0 * (1.0 + (((((D / d) * (D / d)) * (M * (h * M))) / 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 (M <= 2.75e-200) tmp = w0; else tmp = Float64(w0 * Float64(1.0 + Float64(Float64(Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(M * Float64(h * M))) / 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 (M <= 2.75e-200)
tmp = w0;
else
tmp = w0 * (1.0 + (((((D / d) * (D / d)) * (M * (h * M))) / 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[M, 2.75e-200], w0, N[(w0 * N[(1.0 + N[(N[(N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 2.75 \cdot 10^{-200}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + \frac{\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(M \cdot \left(h \cdot M\right)\right)}{\ell} \cdot -0.125\right)\\
\end{array}
\end{array}
if M < 2.7499999999999998e-200Initial program 80.9%
Simplified81.7%
Taylor expanded in D around 0 65.9%
if 2.7499999999999998e-200 < M Initial program 80.4%
Simplified80.4%
Taylor expanded in D around 0 54.4%
*-commutative54.4%
times-frac52.4%
unpow252.4%
unpow252.4%
unpow252.4%
Simplified52.4%
associate-*r/55.7%
times-frac67.8%
*-commutative67.8%
Applied egg-rr67.8%
Taylor expanded in h around 0 67.8%
unpow267.8%
associate-*l*73.2%
Simplified73.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 6.5e+30) w0 (* -0.125 (* (* (/ D d) (/ D (* d l))) (* (* h M) (* 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 <= 6.5e+30) {
tmp = w0;
} else {
tmp = -0.125 * (((D / d) * (D / (d * l))) * ((h * M) * (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 <= 6.5d+30) then
tmp = w0
else
tmp = (-0.125d0) * (((d / d_1) * (d / (d_1 * l))) * ((h * m) * (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 <= 6.5e+30) {
tmp = w0;
} else {
tmp = -0.125 * (((D / d) * (D / (d * l))) * ((h * M) * (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 <= 6.5e+30: tmp = w0 else: tmp = -0.125 * (((D / d) * (D / (d * l))) * ((h * M) * (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 <= 6.5e+30) tmp = w0; else tmp = Float64(-0.125 * Float64(Float64(Float64(D / d) * Float64(D / Float64(d * l))) * Float64(Float64(h * M) * 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 <= 6.5e+30)
tmp = w0;
else
tmp = -0.125 * (((D / d) * (D / (d * l))) * ((h * M) * (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, 6.5e+30], w0, N[(-0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(h * M), $MachinePrecision] * N[(w0 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 6.5 \cdot 10^{+30}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d \cdot \ell}\right) \cdot \left(\left(h \cdot M\right) \cdot \left(w0 \cdot M\right)\right)\right)\\
\end{array}
\end{array}
if M < 6.5e30Initial program 81.6%
Simplified82.2%
Taylor expanded in D around 0 69.6%
if 6.5e30 < M Initial program 76.5%
Simplified76.5%
Taylor expanded in D around 0 42.9%
+-commutative42.9%
*-commutative42.9%
fma-def42.9%
associate-*r*43.0%
unpow243.0%
unpow243.0%
swap-sqr60.8%
associate-/l*60.4%
swap-sqr42.5%
unpow242.5%
associate-*l*42.6%
Simplified42.6%
Taylor expanded in D around inf 30.0%
unpow230.0%
associate-*r*30.2%
associate-/l*30.1%
unpow230.1%
associate-*r*29.8%
associate-*r*30.0%
*-commutative30.0%
unpow230.0%
associate-*r*30.1%
Simplified30.1%
associate-*r*30.3%
associate-/r/30.3%
associate-*l*30.6%
Applied egg-rr30.6%
times-frac33.7%
Applied egg-rr33.7%
Final simplification63.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 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 80.7%
Simplified81.2%
Taylor expanded in D around 0 64.1%
Final simplification64.1%
herbie shell --seed 2023282
(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))))))