
(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: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))) (t_1 (* D (/ M d))))
(if (<= t_0 -5e+295)
(* w0 (* t_1 (sqrt (* h (/ -0.25 l)))))
(if (<= t_0 0.002)
(* w0 (sqrt (- 1.0 (* (/ h l) (pow (/ (/ M d) (/ 2.0 D)) 2.0)))))
(+ w0 (* -0.125 (/ (* h (* w0 (pow t_1 2.0))) l)))))))M = abs(M);
D = abs(D);
d = abs(d);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = pow(((M * D) / (2.0 * d)), 2.0) * (h / l);
double t_1 = D * (M / d);
double tmp;
if (t_0 <= -5e+295) {
tmp = w0 * (t_1 * sqrt((h * (-0.25 / l))));
} else if (t_0 <= 0.002) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow(((M / d) / (2.0 / D)), 2.0))));
} else {
tmp = w0 + (-0.125 * ((h * (w0 * pow(t_1, 2.0))) / l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)
t_1 = d * (m / d_1)
if (t_0 <= (-5d+295)) then
tmp = w0 * (t_1 * sqrt((h * ((-0.25d0) / l))))
else if (t_0 <= 0.002d0) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * (((m / d_1) / (2.0d0 / d)) ** 2.0d0))))
else
tmp = w0 + ((-0.125d0) * ((h * (w0 * (t_1 ** 2.0d0))) / l))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
d = Math.abs(d);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l);
double t_1 = D * (M / d);
double tmp;
if (t_0 <= -5e+295) {
tmp = w0 * (t_1 * Math.sqrt((h * (-0.25 / l))));
} else if (t_0 <= 0.002) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((M / d) / (2.0 / D)), 2.0))));
} else {
tmp = w0 + (-0.125 * ((h * (w0 * Math.pow(t_1, 2.0))) / l));
}
return tmp;
}
M = abs(M) D = abs(D) d = abs(d) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): t_0 = math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l) t_1 = D * (M / d) tmp = 0 if t_0 <= -5e+295: tmp = w0 * (t_1 * math.sqrt((h * (-0.25 / l)))) elif t_0 <= 0.002: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((M / d) / (2.0 / D)), 2.0)))) else: tmp = w0 + (-0.125 * ((h * (w0 * math.pow(t_1, 2.0))) / l)) return tmp
M = abs(M) D = abs(D) d = abs(d) M, D = sort([M, D]) function code(w0, M, D, h, l, d) t_0 = Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) t_1 = Float64(D * Float64(M / d)) tmp = 0.0 if (t_0 <= -5e+295) tmp = Float64(w0 * Float64(t_1 * sqrt(Float64(h * Float64(-0.25 / l))))); elseif (t_0 <= 0.002) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(M / d) / Float64(2.0 / D)) ^ 2.0))))); else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(h * Float64(w0 * (t_1 ^ 2.0))) / l))); end return tmp end
M = abs(M)
D = abs(D)
d = abs(d)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
t_0 = (((M * D) / (2.0 * d)) ^ 2.0) * (h / l);
t_1 = D * (M / d);
tmp = 0.0;
if (t_0 <= -5e+295)
tmp = w0 * (t_1 * sqrt((h * (-0.25 / l))));
elseif (t_0 <= 0.002)
tmp = w0 * sqrt((1.0 - ((h / l) * (((M / d) / (2.0 / D)) ^ 2.0))));
else
tmp = w0 + (-0.125 * ((h * (w0 * (t_1 ^ 2.0))) / l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+295], N[(w0 * N[(t$95$1 * N[Sqrt[N[(h * N[(-0.25 / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.002], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M / d), $MachinePrecision] / N[(2.0 / D), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 + N[(-0.125 * N[(N[(h * N[(w0 * N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
d = |d|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\\
t_1 := D \cdot \frac{M}{d}\\
\mathbf{if}\;t_0 \leq -5 \cdot 10^{+295}:\\
\;\;\;\;w0 \cdot \left(t_1 \cdot \sqrt{h \cdot \frac{-0.25}{\ell}}\right)\\
\mathbf{elif}\;t_0 \leq 0.002:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{\frac{M}{d}}{\frac{2}{D}}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \frac{h \cdot \left(w0 \cdot {t_1}^{2}\right)}{\ell}\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) < -4.99999999999999991e295Initial program 53.2%
Simplified53.1%
Taylor expanded in D around inf 41.8%
associate-*r/41.8%
*-commutative41.8%
times-frac41.9%
associate-*r*43.6%
unpow243.6%
unpow243.6%
swap-sqr51.0%
unpow251.0%
associate-/l*50.9%
Simplified50.9%
Taylor expanded in D around 0 41.9%
associate-*r*43.6%
unpow243.6%
unpow243.6%
swap-sqr51.0%
unpow251.0%
associate-*l/51.0%
*-commutative51.0%
unpow251.0%
unpow251.0%
times-frac54.9%
associate-/l*53.2%
associate-/l*53.2%
unpow253.2%
associate-/l*54.9%
*-rgt-identity54.9%
associate-*r/54.9%
associate-*l*54.9%
associate-*r/54.9%
associate-*l/54.9%
*-rgt-identity54.9%
Simplified54.9%
pow1/254.9%
associate-*r*54.9%
unpow-prod-down58.2%
pow1/258.2%
*-commutative58.2%
Applied egg-rr58.2%
unpow1/258.2%
*-commutative58.2%
unpow258.2%
rem-sqrt-square76.6%
*-commutative76.6%
Simplified76.6%
expm1-log1p-u43.5%
expm1-udef33.4%
*-commutative33.4%
add-sqr-sqrt14.4%
fabs-sqr14.4%
add-sqr-sqrt14.6%
*-commutative14.6%
Applied egg-rr14.6%
expm1-def19.6%
expm1-log1p36.1%
*-commutative36.1%
Simplified36.1%
if -4.99999999999999991e295 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) < 2e-3Initial program 99.9%
Simplified99.4%
*-commutative99.4%
clear-num99.4%
un-div-inv99.4%
Applied egg-rr99.4%
if 2e-3 < (*.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 53.0%
times-frac52.8%
Simplified52.8%
Taylor expanded in D around 0 53.0%
associate-*r*53.0%
times-frac42.1%
unpow242.1%
unpow242.1%
swap-sqr47.4%
unpow247.4%
times-frac47.4%
associate-/l*47.4%
associate-/l*47.4%
unpow247.4%
associate-/l*47.4%
*-rgt-identity47.4%
associate-*r/47.4%
associate-*l*47.4%
associate-*r/47.4%
associate-*l/47.4%
*-rgt-identity47.4%
Simplified47.4%
expm1-log1p-u36.8%
expm1-udef36.8%
*-commutative36.8%
associate-/l*36.8%
Applied egg-rr36.8%
expm1-def36.8%
expm1-log1p47.4%
*-commutative47.4%
associate-/r/0.0%
associate-*l*0.0%
*-commutative0.0%
Simplified0.0%
associate-*l/79.9%
Applied egg-rr79.9%
Final simplification83.9%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))) (t_1 (* D (/ M d))))
(if (<= t_0 -5e+295)
(* w0 (* t_1 (sqrt (* h (/ -0.25 l)))))
(if (<= t_0 0.002)
(* w0 (sqrt (- 1.0 (* (/ h l) (pow (* (/ M d) (/ D 2.0)) 2.0)))))
(+ w0 (* -0.125 (/ (* h (* w0 (pow t_1 2.0))) l)))))))M = abs(M);
D = abs(D);
d = abs(d);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = pow(((M * D) / (2.0 * d)), 2.0) * (h / l);
double t_1 = D * (M / d);
double tmp;
if (t_0 <= -5e+295) {
tmp = w0 * (t_1 * sqrt((h * (-0.25 / l))));
} else if (t_0 <= 0.002) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow(((M / d) * (D / 2.0)), 2.0))));
} else {
tmp = w0 + (-0.125 * ((h * (w0 * pow(t_1, 2.0))) / l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)
t_1 = d * (m / d_1)
if (t_0 <= (-5d+295)) then
tmp = w0 * (t_1 * sqrt((h * ((-0.25d0) / l))))
else if (t_0 <= 0.002d0) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * (((m / d_1) * (d / 2.0d0)) ** 2.0d0))))
else
tmp = w0 + ((-0.125d0) * ((h * (w0 * (t_1 ** 2.0d0))) / l))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
d = Math.abs(d);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l);
double t_1 = D * (M / d);
double tmp;
if (t_0 <= -5e+295) {
tmp = w0 * (t_1 * Math.sqrt((h * (-0.25 / l))));
} else if (t_0 <= 0.002) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((M / d) * (D / 2.0)), 2.0))));
} else {
tmp = w0 + (-0.125 * ((h * (w0 * Math.pow(t_1, 2.0))) / l));
}
return tmp;
}
M = abs(M) D = abs(D) d = abs(d) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): t_0 = math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l) t_1 = D * (M / d) tmp = 0 if t_0 <= -5e+295: tmp = w0 * (t_1 * math.sqrt((h * (-0.25 / l)))) elif t_0 <= 0.002: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((M / d) * (D / 2.0)), 2.0)))) else: tmp = w0 + (-0.125 * ((h * (w0 * math.pow(t_1, 2.0))) / l)) return tmp
M = abs(M) D = abs(D) d = abs(d) M, D = sort([M, D]) function code(w0, M, D, h, l, d) t_0 = Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) t_1 = Float64(D * Float64(M / d)) tmp = 0.0 if (t_0 <= -5e+295) tmp = Float64(w0 * Float64(t_1 * sqrt(Float64(h * Float64(-0.25 / l))))); elseif (t_0 <= 0.002) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(M / d) * Float64(D / 2.0)) ^ 2.0))))); else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(h * Float64(w0 * (t_1 ^ 2.0))) / l))); end return tmp end
M = abs(M)
D = abs(D)
d = abs(d)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
t_0 = (((M * D) / (2.0 * d)) ^ 2.0) * (h / l);
t_1 = D * (M / d);
tmp = 0.0;
if (t_0 <= -5e+295)
tmp = w0 * (t_1 * sqrt((h * (-0.25 / l))));
elseif (t_0 <= 0.002)
tmp = w0 * sqrt((1.0 - ((h / l) * (((M / d) * (D / 2.0)) ^ 2.0))));
else
tmp = w0 + (-0.125 * ((h * (w0 * (t_1 ^ 2.0))) / l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+295], N[(w0 * N[(t$95$1 * N[Sqrt[N[(h * N[(-0.25 / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.002], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M / d), $MachinePrecision] * N[(D / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 + N[(-0.125 * N[(N[(h * N[(w0 * N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
d = |d|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\\
t_1 := D \cdot \frac{M}{d}\\
\mathbf{if}\;t_0 \leq -5 \cdot 10^{+295}:\\
\;\;\;\;w0 \cdot \left(t_1 \cdot \sqrt{h \cdot \frac{-0.25}{\ell}}\right)\\
\mathbf{elif}\;t_0 \leq 0.002:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \frac{h \cdot \left(w0 \cdot {t_1}^{2}\right)}{\ell}\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) < -4.99999999999999991e295Initial program 53.2%
Simplified53.1%
Taylor expanded in D around inf 41.8%
associate-*r/41.8%
*-commutative41.8%
times-frac41.9%
associate-*r*43.6%
unpow243.6%
unpow243.6%
swap-sqr51.0%
unpow251.0%
associate-/l*50.9%
Simplified50.9%
Taylor expanded in D around 0 41.9%
associate-*r*43.6%
unpow243.6%
unpow243.6%
swap-sqr51.0%
unpow251.0%
associate-*l/51.0%
*-commutative51.0%
unpow251.0%
unpow251.0%
times-frac54.9%
associate-/l*53.2%
associate-/l*53.2%
unpow253.2%
associate-/l*54.9%
*-rgt-identity54.9%
associate-*r/54.9%
associate-*l*54.9%
associate-*r/54.9%
associate-*l/54.9%
*-rgt-identity54.9%
Simplified54.9%
pow1/254.9%
associate-*r*54.9%
unpow-prod-down58.2%
pow1/258.2%
*-commutative58.2%
Applied egg-rr58.2%
unpow1/258.2%
*-commutative58.2%
unpow258.2%
rem-sqrt-square76.6%
*-commutative76.6%
Simplified76.6%
expm1-log1p-u43.5%
expm1-udef33.4%
*-commutative33.4%
add-sqr-sqrt14.4%
fabs-sqr14.4%
add-sqr-sqrt14.6%
*-commutative14.6%
Applied egg-rr14.6%
expm1-def19.6%
expm1-log1p36.1%
*-commutative36.1%
Simplified36.1%
if -4.99999999999999991e295 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) < 2e-3Initial program 99.9%
Simplified99.4%
if 2e-3 < (*.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 53.0%
times-frac52.8%
Simplified52.8%
Taylor expanded in D around 0 53.0%
associate-*r*53.0%
times-frac42.1%
unpow242.1%
unpow242.1%
swap-sqr47.4%
unpow247.4%
times-frac47.4%
associate-/l*47.4%
associate-/l*47.4%
unpow247.4%
associate-/l*47.4%
*-rgt-identity47.4%
associate-*r/47.4%
associate-*l*47.4%
associate-*r/47.4%
associate-*l/47.4%
*-rgt-identity47.4%
Simplified47.4%
expm1-log1p-u36.8%
expm1-udef36.8%
*-commutative36.8%
associate-/l*36.8%
Applied egg-rr36.8%
expm1-def36.8%
expm1-log1p47.4%
*-commutative47.4%
associate-/r/0.0%
associate-*l*0.0%
*-commutative0.0%
Simplified0.0%
associate-*l/79.9%
Applied egg-rr79.9%
Final simplification83.9%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: d should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -5e+72) (* w0 (* (* D (/ M d)) (sqrt (* h (/ -0.25 l))))) (* w0 (sqrt (- 1.0 (/ (* h (pow (* 0.5 (/ (* M D) d)) 2.0)) l))))))
M = abs(M);
D = abs(D);
d = abs(d);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+72) {
tmp = w0 * ((D * (M / d)) * sqrt((h * (-0.25 / l))));
} else {
tmp = w0 * sqrt((1.0 - ((h * pow((0.5 * ((M * D) / d)), 2.0)) / l)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: tmp
if (((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= (-5d+72)) then
tmp = w0 * ((d * (m / d_1)) * sqrt((h * ((-0.25d0) / l))))
else
tmp = w0 * sqrt((1.0d0 - ((h * ((0.5d0 * ((m * d) / d_1)) ** 2.0d0)) / l)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
d = Math.abs(d);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+72) {
tmp = w0 * ((D * (M / d)) * Math.sqrt((h * (-0.25 / l))));
} else {
tmp = w0 * Math.sqrt((1.0 - ((h * Math.pow((0.5 * ((M * D) / d)), 2.0)) / l)));
}
return tmp;
}
M = abs(M) D = abs(D) d = abs(d) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+72: tmp = w0 * ((D * (M / d)) * math.sqrt((h * (-0.25 / l)))) else: tmp = w0 * math.sqrt((1.0 - ((h * math.pow((0.5 * ((M * D) / d)), 2.0)) / l))) return tmp
M = abs(M) D = abs(D) d = abs(d) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -5e+72) tmp = Float64(w0 * Float64(Float64(D * Float64(M / d)) * sqrt(Float64(h * Float64(-0.25 / l))))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(0.5 * Float64(Float64(M * D) / d)) ^ 2.0)) / l)))); end return tmp end
M = abs(M)
D = abs(D)
d = abs(d)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)) <= -5e+72)
tmp = w0 * ((D * (M / d)) * sqrt((h * (-0.25 / l))));
else
tmp = w0 * sqrt((1.0 - ((h * ((0.5 * ((M * D) / d)) ^ 2.0)) / l)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: d should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e+72], N[(w0 * N[(N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h * N[(-0.25 / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(0.5 * N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
d = |d|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+72}:\\
\;\;\;\;w0 \cdot \left(\left(D \cdot \frac{M}{d}\right) \cdot \sqrt{h \cdot \frac{-0.25}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot {\left(0.5 \cdot \frac{M \cdot D}{d}\right)}^{2}}{\ell}}\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) < -4.99999999999999992e72Initial program 62.8%
Simplified62.2%
Taylor expanded in D around inf 37.4%
associate-*r/37.4%
*-commutative37.4%
times-frac37.4%
associate-*r*38.8%
unpow238.8%
unpow238.8%
swap-sqr48.8%
unpow248.8%
associate-/l*48.9%
Simplified48.9%
Taylor expanded in D around 0 37.4%
associate-*r*38.8%
unpow238.8%
unpow238.8%
swap-sqr48.8%
unpow248.8%
associate-*l/48.9%
*-commutative48.9%
unpow248.9%
unpow248.9%
times-frac61.6%
associate-/l*60.2%
associate-/l*60.2%
unpow260.2%
associate-/l*61.6%
*-rgt-identity61.6%
associate-*r/61.6%
associate-*l*61.5%
associate-*r/61.6%
associate-*l/61.6%
*-rgt-identity61.6%
Simplified61.6%
pow1/261.6%
associate-*r*62.9%
unpow-prod-down65.4%
pow1/265.4%
*-commutative65.4%
Applied egg-rr65.4%
unpow1/265.4%
*-commutative65.4%
unpow265.4%
rem-sqrt-square80.0%
*-commutative80.0%
Simplified80.0%
expm1-log1p-u49.2%
expm1-udef31.9%
*-commutative31.9%
add-sqr-sqrt15.5%
fabs-sqr15.5%
add-sqr-sqrt15.8%
*-commutative15.8%
Applied egg-rr15.8%
expm1-def25.1%
expm1-log1p41.2%
*-commutative41.2%
Simplified41.2%
if -4.99999999999999992e72 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) Initial program 89.6%
Simplified89.7%
associate-*r/97.9%
frac-times97.9%
*-commutative97.9%
*-un-lft-identity97.9%
times-frac97.9%
metadata-eval97.9%
*-commutative97.9%
Applied egg-rr97.9%
Final simplification81.9%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
:precision binary64
(if (<= (* M D) 1e-10)
w0
(if (<= (* M D) 5e+188)
(+ w0 (* -0.125 (* (pow (/ (* M D) d) 2.0) (/ (* h w0) l))))
(* w0 (* (* D (/ M d)) (sqrt (* h (/ -0.25 l))))))))M = abs(M);
D = abs(D);
d = abs(d);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((M * D) <= 1e-10) {
tmp = w0;
} else if ((M * D) <= 5e+188) {
tmp = w0 + (-0.125 * (pow(((M * D) / d), 2.0) * ((h * w0) / l)));
} else {
tmp = w0 * ((D * (M / d)) * sqrt((h * (-0.25 / l))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: tmp
if ((m * d) <= 1d-10) then
tmp = w0
else if ((m * d) <= 5d+188) then
tmp = w0 + ((-0.125d0) * ((((m * d) / d_1) ** 2.0d0) * ((h * w0) / l)))
else
tmp = w0 * ((d * (m / d_1)) * sqrt((h * ((-0.25d0) / l))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
d = Math.abs(d);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((M * D) <= 1e-10) {
tmp = w0;
} else if ((M * D) <= 5e+188) {
tmp = w0 + (-0.125 * (Math.pow(((M * D) / d), 2.0) * ((h * w0) / l)));
} else {
tmp = w0 * ((D * (M / d)) * Math.sqrt((h * (-0.25 / l))));
}
return tmp;
}
M = abs(M) D = abs(D) d = abs(d) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if (M * D) <= 1e-10: tmp = w0 elif (M * D) <= 5e+188: tmp = w0 + (-0.125 * (math.pow(((M * D) / d), 2.0) * ((h * w0) / l))) else: tmp = w0 * ((D * (M / d)) * math.sqrt((h * (-0.25 / l)))) return tmp
M = abs(M) D = abs(D) d = abs(d) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64(M * D) <= 1e-10) tmp = w0; elseif (Float64(M * D) <= 5e+188) tmp = Float64(w0 + Float64(-0.125 * Float64((Float64(Float64(M * D) / d) ^ 2.0) * Float64(Float64(h * w0) / l)))); else tmp = Float64(w0 * Float64(Float64(D * Float64(M / d)) * sqrt(Float64(h * Float64(-0.25 / l))))); end return tmp end
M = abs(M)
D = abs(D)
d = abs(d)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if ((M * D) <= 1e-10)
tmp = w0;
elseif ((M * D) <= 5e+188)
tmp = w0 + (-0.125 * ((((M * D) / d) ^ 2.0) * ((h * w0) / l)));
else
tmp = w0 * ((D * (M / d)) * sqrt((h * (-0.25 / l))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: d should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(M * D), $MachinePrecision], 1e-10], w0, If[LessEqual[N[(M * D), $MachinePrecision], 5e+188], N[(w0 + N[(-0.125 * N[(N[Power[N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h * w0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * N[(N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h * N[(-0.25 / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
d = |d|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \cdot D \leq 10^{-10}:\\
\;\;\;\;w0\\
\mathbf{elif}\;M \cdot D \leq 5 \cdot 10^{+188}:\\
\;\;\;\;w0 + -0.125 \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot \frac{h \cdot w0}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(\left(D \cdot \frac{M}{d}\right) \cdot \sqrt{h \cdot \frac{-0.25}{\ell}}\right)\\
\end{array}
\end{array}
if (*.f64 M D) < 1.00000000000000004e-10Initial program 85.8%
Simplified85.9%
Taylor expanded in D around 0 79.4%
if 1.00000000000000004e-10 < (*.f64 M D) < 5.0000000000000001e188Initial program 84.9%
Simplified82.0%
Taylor expanded in D around 0 26.1%
times-frac25.9%
Simplified25.9%
Taylor expanded in D around 0 26.1%
associate-*r*26.1%
times-frac26.0%
unpow226.0%
unpow226.0%
swap-sqr48.7%
unpow248.7%
times-frac61.4%
associate-/l*58.3%
associate-/l*58.3%
unpow258.3%
associate-/l*61.4%
*-rgt-identity61.4%
associate-*r/61.4%
associate-*l*61.3%
associate-*r/61.3%
associate-*l/61.3%
*-rgt-identity61.3%
Simplified61.3%
associate-*r/61.4%
*-commutative61.4%
Applied egg-rr61.4%
if 5.0000000000000001e188 < (*.f64 M D) Initial program 47.3%
Simplified51.4%
Taylor expanded in D around inf 43.1%
associate-*r/43.1%
*-commutative43.1%
times-frac47.4%
associate-*r*47.4%
unpow247.4%
unpow247.4%
swap-sqr47.4%
unpow247.4%
associate-/l*43.3%
Simplified43.3%
Taylor expanded in D around 0 47.4%
associate-*r*47.4%
unpow247.4%
unpow247.4%
swap-sqr47.4%
unpow247.4%
associate-*l/47.4%
*-commutative47.4%
unpow247.4%
unpow247.4%
times-frac51.8%
associate-/l*51.8%
associate-/l*51.8%
unpow251.8%
associate-/l*51.8%
*-rgt-identity51.8%
associate-*r/51.8%
associate-*l*51.8%
associate-*r/51.8%
associate-*l/51.8%
*-rgt-identity51.8%
Simplified51.8%
pow1/251.8%
associate-*r*43.3%
unpow-prod-down47.2%
pow1/247.2%
*-commutative47.2%
Applied egg-rr47.2%
unpow1/247.2%
*-commutative47.2%
unpow247.2%
rem-sqrt-square63.4%
*-commutative63.4%
Simplified63.4%
expm1-log1p-u28.8%
expm1-udef16.8%
*-commutative16.8%
add-sqr-sqrt16.3%
fabs-sqr16.3%
add-sqr-sqrt16.8%
*-commutative16.8%
Applied egg-rr16.8%
expm1-def24.7%
expm1-log1p46.8%
*-commutative46.8%
Simplified46.8%
Final simplification74.1%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (* D (/ M d))))
(if (<= M 4e-128)
w0
(if (<= M 9e+29)
(+ w0 (* -0.125 (* (/ h l) (* w0 (pow t_0 2.0)))))
(* w0 (* t_0 (sqrt (* h (/ -0.25 l)))))))))M = abs(M);
D = abs(D);
d = abs(d);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = D * (M / d);
double tmp;
if (M <= 4e-128) {
tmp = w0;
} else if (M <= 9e+29) {
tmp = w0 + (-0.125 * ((h / l) * (w0 * pow(t_0, 2.0))));
} else {
tmp = w0 * (t_0 * sqrt((h * (-0.25 / l))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = d * (m / d_1)
if (m <= 4d-128) then
tmp = w0
else if (m <= 9d+29) then
tmp = w0 + ((-0.125d0) * ((h / l) * (w0 * (t_0 ** 2.0d0))))
else
tmp = w0 * (t_0 * sqrt((h * ((-0.25d0) / l))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
d = Math.abs(d);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = D * (M / d);
double tmp;
if (M <= 4e-128) {
tmp = w0;
} else if (M <= 9e+29) {
tmp = w0 + (-0.125 * ((h / l) * (w0 * Math.pow(t_0, 2.0))));
} else {
tmp = w0 * (t_0 * Math.sqrt((h * (-0.25 / l))));
}
return tmp;
}
M = abs(M) D = abs(D) d = abs(d) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): t_0 = D * (M / d) tmp = 0 if M <= 4e-128: tmp = w0 elif M <= 9e+29: tmp = w0 + (-0.125 * ((h / l) * (w0 * math.pow(t_0, 2.0)))) else: tmp = w0 * (t_0 * math.sqrt((h * (-0.25 / l)))) return tmp
M = abs(M) D = abs(D) d = abs(d) M, D = sort([M, D]) function code(w0, M, D, h, l, d) t_0 = Float64(D * Float64(M / d)) tmp = 0.0 if (M <= 4e-128) tmp = w0; elseif (M <= 9e+29) tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(h / l) * Float64(w0 * (t_0 ^ 2.0))))); else tmp = Float64(w0 * Float64(t_0 * sqrt(Float64(h * Float64(-0.25 / l))))); end return tmp end
M = abs(M)
D = abs(D)
d = abs(d)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
t_0 = D * (M / d);
tmp = 0.0;
if (M <= 4e-128)
tmp = w0;
elseif (M <= 9e+29)
tmp = w0 + (-0.125 * ((h / l) * (w0 * (t_0 ^ 2.0))));
else
tmp = w0 * (t_0 * sqrt((h * (-0.25 / l))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, 4e-128], w0, If[LessEqual[M, 9e+29], N[(w0 + N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[(w0 * N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * N[(t$95$0 * N[Sqrt[N[(h * N[(-0.25 / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
d = |d|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := D \cdot \frac{M}{d}\\
\mathbf{if}\;M \leq 4 \cdot 10^{-128}:\\
\;\;\;\;w0\\
\mathbf{elif}\;M \leq 9 \cdot 10^{+29}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\frac{h}{\ell} \cdot \left(w0 \cdot {t_0}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(t_0 \cdot \sqrt{h \cdot \frac{-0.25}{\ell}}\right)\\
\end{array}
\end{array}
if M < 4.00000000000000022e-128Initial program 83.6%
Simplified84.2%
Taylor expanded in D around 0 73.2%
if 4.00000000000000022e-128 < M < 9.0000000000000005e29Initial program 78.7%
Simplified78.7%
Taylor expanded in D around 0 57.3%
times-frac56.9%
Simplified56.9%
Taylor expanded in D around 0 57.3%
associate-*r*57.3%
times-frac54.0%
unpow254.0%
unpow254.0%
swap-sqr57.1%
unpow257.1%
times-frac63.4%
associate-/l*63.4%
associate-/l*63.4%
unpow263.4%
associate-/l*63.4%
*-rgt-identity63.4%
associate-*r/63.4%
associate-*l*63.4%
associate-*r/63.4%
associate-*l/63.4%
*-rgt-identity63.4%
Simplified63.4%
expm1-log1p-u62.6%
expm1-udef62.6%
*-commutative62.6%
associate-/l*62.6%
Applied egg-rr62.6%
expm1-def62.6%
expm1-log1p63.3%
*-commutative63.3%
associate-/r/69.7%
associate-*l*70.1%
*-commutative70.1%
Simplified70.1%
if 9.0000000000000005e29 < M Initial program 79.7%
Simplified79.1%
Taylor expanded in D around inf 25.5%
associate-*r/25.5%
*-commutative25.5%
times-frac25.5%
associate-*r*25.8%
unpow225.8%
unpow225.8%
swap-sqr28.1%
unpow228.1%
associate-/l*28.1%
Simplified28.1%
Taylor expanded in D around 0 25.5%
associate-*r*25.8%
unpow225.8%
unpow225.8%
swap-sqr28.1%
unpow228.1%
associate-*l/28.1%
*-commutative28.1%
unpow228.1%
unpow228.1%
times-frac31.6%
associate-/l*31.6%
associate-/l*31.6%
unpow231.6%
associate-/l*31.6%
*-rgt-identity31.6%
associate-*r/31.6%
associate-*l*31.5%
associate-*r/31.6%
associate-*l/31.6%
*-rgt-identity31.6%
Simplified31.6%
pow1/231.6%
associate-*r*28.0%
unpow-prod-down27.6%
pow1/227.6%
*-commutative27.6%
Applied egg-rr27.6%
unpow1/227.6%
*-commutative27.6%
unpow227.6%
rem-sqrt-square32.6%
*-commutative32.6%
Simplified32.6%
expm1-log1p-u20.0%
expm1-udef13.3%
*-commutative13.3%
add-sqr-sqrt8.1%
fabs-sqr8.1%
add-sqr-sqrt8.2%
*-commutative8.2%
Applied egg-rr8.2%
expm1-def13.2%
expm1-log1p17.1%
*-commutative17.1%
Simplified17.1%
Final simplification60.1%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (* D (/ M d))))
(if (<= (* M D) 5e+188)
(+ w0 (* -0.125 (/ (* h (* w0 (pow t_0 2.0))) l)))
(* w0 (* t_0 (sqrt (* h (/ -0.25 l))))))))M = abs(M);
D = abs(D);
d = abs(d);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = D * (M / d);
double tmp;
if ((M * D) <= 5e+188) {
tmp = w0 + (-0.125 * ((h * (w0 * pow(t_0, 2.0))) / l));
} else {
tmp = w0 * (t_0 * sqrt((h * (-0.25 / l))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = d * (m / d_1)
if ((m * d) <= 5d+188) then
tmp = w0 + ((-0.125d0) * ((h * (w0 * (t_0 ** 2.0d0))) / l))
else
tmp = w0 * (t_0 * sqrt((h * ((-0.25d0) / l))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
d = Math.abs(d);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = D * (M / d);
double tmp;
if ((M * D) <= 5e+188) {
tmp = w0 + (-0.125 * ((h * (w0 * Math.pow(t_0, 2.0))) / l));
} else {
tmp = w0 * (t_0 * Math.sqrt((h * (-0.25 / l))));
}
return tmp;
}
M = abs(M) D = abs(D) d = abs(d) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): t_0 = D * (M / d) tmp = 0 if (M * D) <= 5e+188: tmp = w0 + (-0.125 * ((h * (w0 * math.pow(t_0, 2.0))) / l)) else: tmp = w0 * (t_0 * math.sqrt((h * (-0.25 / l)))) return tmp
M = abs(M) D = abs(D) d = abs(d) M, D = sort([M, D]) function code(w0, M, D, h, l, d) t_0 = Float64(D * Float64(M / d)) tmp = 0.0 if (Float64(M * D) <= 5e+188) tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(h * Float64(w0 * (t_0 ^ 2.0))) / l))); else tmp = Float64(w0 * Float64(t_0 * sqrt(Float64(h * Float64(-0.25 / l))))); end return tmp end
M = abs(M)
D = abs(D)
d = abs(d)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
t_0 = D * (M / d);
tmp = 0.0;
if ((M * D) <= 5e+188)
tmp = w0 + (-0.125 * ((h * (w0 * (t_0 ^ 2.0))) / l));
else
tmp = w0 * (t_0 * sqrt((h * (-0.25 / l))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(M * D), $MachinePrecision], 5e+188], N[(w0 + N[(-0.125 * N[(N[(h * N[(w0 * N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * N[(t$95$0 * N[Sqrt[N[(h * N[(-0.25 / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
D = |D|\\
d = |d|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := D \cdot \frac{M}{d}\\
\mathbf{if}\;M \cdot D \leq 5 \cdot 10^{+188}:\\
\;\;\;\;w0 + -0.125 \cdot \frac{h \cdot \left(w0 \cdot {t_0}^{2}\right)}{\ell}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(t_0 \cdot \sqrt{h \cdot \frac{-0.25}{\ell}}\right)\\
\end{array}
\end{array}
if (*.f64 M D) < 5.0000000000000001e188Initial program 85.7%
Simplified85.3%
Taylor expanded in D around 0 47.4%
times-frac47.3%
Simplified47.3%
Taylor expanded in D around 0 47.4%
associate-*r*49.5%
times-frac49.1%
unpow249.1%
unpow249.1%
swap-sqr63.1%
unpow263.1%
times-frac72.2%
associate-/l*71.8%
associate-/l*71.8%
unpow271.8%
associate-/l*72.2%
*-rgt-identity72.2%
associate-*r/72.2%
associate-*l*72.2%
associate-*r/72.2%
associate-*l/72.2%
*-rgt-identity72.2%
Simplified72.2%
expm1-log1p-u65.7%
expm1-udef65.5%
*-commutative65.5%
associate-/l*67.6%
Applied egg-rr67.6%
expm1-def67.8%
expm1-log1p74.4%
*-commutative74.4%
associate-/r/74.8%
associate-*l*77.4%
*-commutative77.4%
Simplified77.4%
associate-*l/82.6%
Applied egg-rr82.6%
if 5.0000000000000001e188 < (*.f64 M D) Initial program 47.3%
Simplified51.4%
Taylor expanded in D around inf 43.1%
associate-*r/43.1%
*-commutative43.1%
times-frac47.4%
associate-*r*47.4%
unpow247.4%
unpow247.4%
swap-sqr47.4%
unpow247.4%
associate-/l*43.3%
Simplified43.3%
Taylor expanded in D around 0 47.4%
associate-*r*47.4%
unpow247.4%
unpow247.4%
swap-sqr47.4%
unpow247.4%
associate-*l/47.4%
*-commutative47.4%
unpow247.4%
unpow247.4%
times-frac51.8%
associate-/l*51.8%
associate-/l*51.8%
unpow251.8%
associate-/l*51.8%
*-rgt-identity51.8%
associate-*r/51.8%
associate-*l*51.8%
associate-*r/51.8%
associate-*l/51.8%
*-rgt-identity51.8%
Simplified51.8%
pow1/251.8%
associate-*r*43.3%
unpow-prod-down47.2%
pow1/247.2%
*-commutative47.2%
Applied egg-rr47.2%
unpow1/247.2%
*-commutative47.2%
unpow247.2%
rem-sqrt-square63.4%
*-commutative63.4%
Simplified63.4%
expm1-log1p-u28.8%
expm1-udef16.8%
*-commutative16.8%
add-sqr-sqrt16.3%
fabs-sqr16.3%
add-sqr-sqrt16.8%
*-commutative16.8%
Applied egg-rr16.8%
expm1-def24.7%
expm1-log1p46.8%
*-commutative46.8%
Simplified46.8%
Final simplification79.2%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: d should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (or (<= M 1.32e-30) (and (not (<= M 8e-12)) (<= M 3.15e+29))) w0 (* w0 (* (* D (/ M d)) (sqrt (* h (/ -0.25 l)))))))
M = abs(M);
D = abs(D);
d = abs(d);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((M <= 1.32e-30) || (!(M <= 8e-12) && (M <= 3.15e+29))) {
tmp = w0;
} else {
tmp = w0 * ((D * (M / d)) * sqrt((h * (-0.25 / l))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: tmp
if ((m <= 1.32d-30) .or. (.not. (m <= 8d-12)) .and. (m <= 3.15d+29)) then
tmp = w0
else
tmp = w0 * ((d * (m / d_1)) * sqrt((h * ((-0.25d0) / l))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
d = Math.abs(d);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((M <= 1.32e-30) || (!(M <= 8e-12) && (M <= 3.15e+29))) {
tmp = w0;
} else {
tmp = w0 * ((D * (M / d)) * Math.sqrt((h * (-0.25 / l))));
}
return tmp;
}
M = abs(M) D = abs(D) d = abs(d) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if (M <= 1.32e-30) or (not (M <= 8e-12) and (M <= 3.15e+29)): tmp = w0 else: tmp = w0 * ((D * (M / d)) * math.sqrt((h * (-0.25 / l)))) return tmp
M = abs(M) D = abs(D) d = abs(d) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if ((M <= 1.32e-30) || (!(M <= 8e-12) && (M <= 3.15e+29))) tmp = w0; else tmp = Float64(w0 * Float64(Float64(D * Float64(M / d)) * sqrt(Float64(h * Float64(-0.25 / l))))); end return tmp end
M = abs(M)
D = abs(D)
d = abs(d)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if ((M <= 1.32e-30) || (~((M <= 8e-12)) && (M <= 3.15e+29)))
tmp = w0;
else
tmp = w0 * ((D * (M / d)) * sqrt((h * (-0.25 / l))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: d should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[Or[LessEqual[M, 1.32e-30], And[N[Not[LessEqual[M, 8e-12]], $MachinePrecision], LessEqual[M, 3.15e+29]]], w0, N[(w0 * N[(N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h * N[(-0.25 / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
d = |d|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 1.32 \cdot 10^{-30} \lor \neg \left(M \leq 8 \cdot 10^{-12}\right) \land M \leq 3.15 \cdot 10^{+29}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(\left(D \cdot \frac{M}{d}\right) \cdot \sqrt{h \cdot \frac{-0.25}{\ell}}\right)\\
\end{array}
\end{array}
if M < 1.32e-30 or 7.99999999999999984e-12 < M < 3.1499999999999999e29Initial program 83.6%
Simplified84.1%
Taylor expanded in D around 0 73.9%
if 1.32e-30 < M < 7.99999999999999984e-12 or 3.1499999999999999e29 < M Initial program 77.3%
Simplified76.6%
Taylor expanded in D around inf 24.8%
associate-*r/24.8%
*-commutative24.8%
times-frac24.8%
associate-*r*25.1%
unpow225.1%
unpow225.1%
swap-sqr27.4%
unpow227.4%
associate-/l*27.4%
Simplified27.4%
Taylor expanded in D around 0 24.8%
associate-*r*25.1%
unpow225.1%
unpow225.1%
swap-sqr27.4%
unpow227.4%
associate-*l/27.4%
*-commutative27.4%
unpow227.4%
unpow227.4%
times-frac30.7%
associate-/l*30.7%
associate-/l*30.7%
unpow230.7%
associate-/l*30.7%
*-rgt-identity30.7%
associate-*r/30.7%
associate-*l*30.7%
associate-*r/30.7%
associate-*l/30.7%
*-rgt-identity30.7%
Simplified30.7%
pow1/230.7%
associate-*r*27.3%
unpow-prod-down28.4%
pow1/228.4%
*-commutative28.4%
Applied egg-rr28.4%
unpow1/228.4%
*-commutative28.4%
unpow228.4%
rem-sqrt-square33.3%
*-commutative33.3%
Simplified33.3%
expm1-log1p-u20.8%
expm1-udef14.3%
*-commutative14.3%
add-sqr-sqrt7.8%
fabs-sqr7.8%
add-sqr-sqrt7.9%
*-commutative7.9%
Applied egg-rr7.9%
expm1-def12.8%
expm1-log1p16.6%
*-commutative16.6%
Simplified16.6%
Final simplification60.5%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: d should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 w0)
M = abs(M);
D = abs(D);
d = abs(d);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0
end function
M = Math.abs(M);
D = Math.abs(D);
d = Math.abs(d);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
M = abs(M) D = abs(D) d = abs(d) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): return w0
M = abs(M) D = abs(D) d = abs(d) M, D = sort([M, D]) function code(w0, M, D, h, l, d) return w0 end
M = abs(M)
D = abs(D)
d = abs(d)
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: d should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := w0
\begin{array}{l}
M = |M|\\
D = |D|\\
d = |d|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
w0
\end{array}
Initial program 82.1%
Simplified82.1%
Taylor expanded in D around 0 69.2%
Final simplification69.2%
herbie shell --seed 2023300
(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))))))