
(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 11 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 (if (<= (* 2.0 d) 5e-128) (* (sqrt (+ 1.0 (* -0.25 (/ (* D h) (* (/ l D) (* (/ d M) (/ d M))))))) w0) (* w0 (sqrt (- 1.0 (/ (* h (pow (* (/ M d) (* D 0.5)) 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 ((2.0 * d) <= 5e-128) {
tmp = sqrt((1.0 + (-0.25 * ((D * h) / ((l / D) * ((d / M) * (d / M))))))) * w0;
} else {
tmp = w0 * sqrt((1.0 - ((h * pow(((M / d) * (D * 0.5)), 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 ((2.0d0 * d_1) <= 5d-128) then
tmp = sqrt((1.0d0 + ((-0.25d0) * ((d * h) / ((l / d) * ((d_1 / m) * (d_1 / m))))))) * w0
else
tmp = w0 * sqrt((1.0d0 - ((h * (((m / d_1) * (d * 0.5d0)) ** 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 ((2.0 * d) <= 5e-128) {
tmp = Math.sqrt((1.0 + (-0.25 * ((D * h) / ((l / D) * ((d / M) * (d / M))))))) * w0;
} else {
tmp = w0 * Math.sqrt((1.0 - ((h * Math.pow(((M / d) * (D * 0.5)), 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 (2.0 * d) <= 5e-128: tmp = math.sqrt((1.0 + (-0.25 * ((D * h) / ((l / D) * ((d / M) * (d / M))))))) * w0 else: tmp = w0 * math.sqrt((1.0 - ((h * math.pow(((M / d) * (D * 0.5)), 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(2.0 * d) <= 5e-128) tmp = Float64(sqrt(Float64(1.0 + Float64(-0.25 * Float64(Float64(D * h) / Float64(Float64(l / D) * Float64(Float64(d / M) * Float64(d / M))))))) * w0); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(Float64(M / d) * Float64(D * 0.5)) ^ 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 ((2.0 * d) <= 5e-128)
tmp = sqrt((1.0 + (-0.25 * ((D * h) / ((l / D) * ((d / M) * (d / M))))))) * w0;
else
tmp = w0 * sqrt((1.0 - ((h * (((M / d) * (D * 0.5)) ^ 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[(2.0 * d), $MachinePrecision], 5e-128], N[(N[Sqrt[N[(1.0 + N[(-0.25 * N[(N[(D * h), $MachinePrecision] / N[(N[(l / D), $MachinePrecision] * N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * w0), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(N[(M / d), $MachinePrecision] * N[(D * 0.5), $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}\;2 \cdot d \leq 5 \cdot 10^{-128}:\\
\;\;\;\;\sqrt{1 + -0.25 \cdot \frac{D \cdot h}{\frac{\ell}{D} \cdot \left(\frac{d}{M} \cdot \frac{d}{M}\right)}} \cdot w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot {\left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right)}^{2}}{\ell}}\\
\end{array}
\end{array}
if (*.f64 2 d) < 5.0000000000000001e-128Initial program 80.7%
times-frac78.6%
Simplified78.6%
Taylor expanded in w0 around 0 56.5%
Simplified59.6%
frac-times62.0%
times-frac76.9%
Applied egg-rr76.9%
if 5.0000000000000001e-128 < (*.f64 2 d) Initial program 87.8%
times-frac89.0%
Simplified89.0%
associate-*r/93.6%
frac-times92.4%
*-commutative92.4%
frac-times92.5%
div-inv92.5%
metadata-eval92.5%
Applied egg-rr92.5%
Final simplification81.8%
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 (<= (- 1.0 (* (pow (/ (* D M) (* 2.0 d)) 2.0) (/ h l))) 5e+291)
(* w0 (sqrt (- 1.0 (* (/ h l) (pow (* (/ M d) (/ D 2.0)) 2.0)))))
(*
(sqrt (+ 1.0 (* -0.25 (/ (* D h) (* (/ l D) (* (/ d M) (/ d M)))))))
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) {
double tmp;
if ((1.0 - (pow(((D * M) / (2.0 * d)), 2.0) * (h / l))) <= 5e+291) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow(((M / d) * (D / 2.0)), 2.0))));
} else {
tmp = sqrt((1.0 + (-0.25 * ((D * h) / ((l / D) * ((d / M) * (d / M))))))) * w0;
}
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 ((1.0d0 - ((((d * m) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))) <= 5d+291) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * (((m / d_1) * (d / 2.0d0)) ** 2.0d0))))
else
tmp = sqrt((1.0d0 + ((-0.25d0) * ((d * h) / ((l / d) * ((d_1 / m) * (d_1 / m))))))) * w0
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 ((1.0 - (Math.pow(((D * M) / (2.0 * d)), 2.0) * (h / l))) <= 5e+291) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((M / d) * (D / 2.0)), 2.0))));
} else {
tmp = Math.sqrt((1.0 + (-0.25 * ((D * h) / ((l / D) * ((d / M) * (d / M))))))) * w0;
}
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 (1.0 - (math.pow(((D * M) / (2.0 * d)), 2.0) * (h / l))) <= 5e+291: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((M / d) * (D / 2.0)), 2.0)))) else: tmp = math.sqrt((1.0 + (-0.25 * ((D * h) / ((l / D) * ((d / M) * (d / M))))))) * w0 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(1.0 - Float64((Float64(Float64(D * M) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))) <= 5e+291) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(M / d) * Float64(D / 2.0)) ^ 2.0))))); else tmp = Float64(sqrt(Float64(1.0 + Float64(-0.25 * Float64(Float64(D * h) / Float64(Float64(l / D) * Float64(Float64(d / M) * Float64(d / M))))))) * w0); 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 ((1.0 - ((((D * M) / (2.0 * d)) ^ 2.0) * (h / l))) <= 5e+291)
tmp = w0 * sqrt((1.0 - ((h / l) * (((M / d) * (D / 2.0)) ^ 2.0))));
else
tmp = sqrt((1.0 + (-0.25 * ((D * h) / ((l / D) * ((d / M) * (d / M))))))) * w0;
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: 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[(1.0 - N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+291], 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[(N[Sqrt[N[(1.0 + N[(-0.25 * N[(N[(D * h), $MachinePrecision] / N[(N[(l / D), $MachinePrecision] * N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * w0), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
d = |d|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;1 - {\left(\frac{D \cdot M}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq 5 \cdot 10^{+291}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{1 + -0.25 \cdot \frac{D \cdot h}{\frac{\ell}{D} \cdot \left(\frac{d}{M} \cdot \frac{d}{M}\right)}} \cdot w0\\
\end{array}
\end{array}
if (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))) < 5.0000000000000001e291Initial program 99.9%
*-commutative99.9%
times-frac98.8%
Simplified98.8%
if 5.0000000000000001e291 < (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))) Initial program 48.9%
times-frac50.1%
Simplified50.1%
Taylor expanded in w0 around 0 51.4%
Simplified52.2%
frac-times53.2%
times-frac61.9%
Applied egg-rr61.9%
Final simplification86.6%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
:precision binary64
(if (<= d 2e-132)
(* w0 (sqrt (+ 1.0 (* -0.25 (* (/ D (/ l D)) (/ h (* (/ d M) (/ d M))))))))
(if (<= d 5e+23)
(* w0 (sqrt (- 1.0 (/ (* 0.25 (* D (* M (/ (* D h) (* d (/ d M)))))) l))))
(*
w0
(sqrt (- 1.0 (* 0.25 (* D (* (/ D (* d d)) (/ (* h (* M M)) l))))))))))M = abs(M);
D = abs(D);
d = abs(d);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (d <= 2e-132) {
tmp = w0 * sqrt((1.0 + (-0.25 * ((D / (l / D)) * (h / ((d / M) * (d / M)))))));
} else if (d <= 5e+23) {
tmp = w0 * sqrt((1.0 - ((0.25 * (D * (M * ((D * h) / (d * (d / M)))))) / l)));
} 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: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: tmp
if (d_1 <= 2d-132) then
tmp = w0 * sqrt((1.0d0 + ((-0.25d0) * ((d / (l / d)) * (h / ((d_1 / m) * (d_1 / m)))))))
else if (d_1 <= 5d+23) then
tmp = w0 * sqrt((1.0d0 - ((0.25d0 * (d * (m * ((d * h) / (d_1 * (d_1 / m)))))) / l)))
else
tmp = w0 * sqrt((1.0d0 - (0.25d0 * (d * ((d / (d_1 * d_1)) * ((h * (m * m)) / l))))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
d = Math.abs(d);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (d <= 2e-132) {
tmp = w0 * Math.sqrt((1.0 + (-0.25 * ((D / (l / D)) * (h / ((d / M) * (d / M)))))));
} else if (d <= 5e+23) {
tmp = w0 * Math.sqrt((1.0 - ((0.25 * (D * (M * ((D * h) / (d * (d / M)))))) / l)));
} 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) d = abs(d) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if d <= 2e-132: tmp = w0 * math.sqrt((1.0 + (-0.25 * ((D / (l / D)) * (h / ((d / M) * (d / M))))))) elif d <= 5e+23: tmp = w0 * math.sqrt((1.0 - ((0.25 * (D * (M * ((D * h) / (d * (d / M)))))) / l))) 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) d = abs(d) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (d <= 2e-132) tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(-0.25 * Float64(Float64(D / Float64(l / D)) * Float64(h / Float64(Float64(d / M) * Float64(d / M)))))))); elseif (d <= 5e+23) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(0.25 * Float64(D * Float64(M * Float64(Float64(D * h) / Float64(d * Float64(d / M)))))) / l)))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(0.25 * Float64(D * Float64(Float64(D / Float64(d * d)) * Float64(Float64(h * Float64(M * M)) / l))))))); end return tmp end
M = abs(M)
D = abs(D)
d = abs(d)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (d <= 2e-132)
tmp = w0 * sqrt((1.0 + (-0.25 * ((D / (l / D)) * (h / ((d / M) * (d / M)))))));
elseif (d <= 5e+23)
tmp = w0 * sqrt((1.0 - ((0.25 * (D * (M * ((D * h) / (d * (d / M)))))) / l)));
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: 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, 2e-132], N[(w0 * N[Sqrt[N[(1.0 + N[(-0.25 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(h / N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5e+23], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(0.25 * N[(D * N[(M * N[(N[(D * h), $MachinePrecision] / N[(d * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(0.25 * N[(D * N[(N[(D / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $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}\;d \leq 2 \cdot 10^{-132}:\\
\;\;\;\;w0 \cdot \sqrt{1 + -0.25 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{h}{\frac{d}{M} \cdot \frac{d}{M}}\right)}\\
\mathbf{elif}\;d \leq 5 \cdot 10^{+23}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{0.25 \cdot \left(D \cdot \left(M \cdot \frac{D \cdot h}{d \cdot \frac{d}{M}}\right)\right)}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \left(D \cdot \left(\frac{D}{d \cdot d} \cdot \frac{h \cdot \left(M \cdot M\right)}{\ell}\right)\right)}\\
\end{array}
\end{array}
if d < 2e-132Initial program 80.5%
times-frac78.3%
Simplified78.3%
Taylor expanded in w0 around 0 56.6%
Simplified59.1%
Taylor expanded in d around 0 59.1%
unpow259.1%
unpow259.1%
times-frac71.7%
Simplified71.7%
if 2e-132 < d < 4.9999999999999999e23Initial program 86.5%
times-frac86.5%
Simplified86.5%
associate-*r/88.7%
frac-times88.7%
*-commutative88.7%
frac-times85.5%
div-inv85.5%
metadata-eval85.5%
Applied egg-rr85.5%
Taylor expanded in M around 0 78.4%
unpow278.4%
associate-*r*78.4%
unpow278.4%
times-frac78.3%
associate-*r/74.9%
associate-*r*71.4%
unpow271.4%
associate-*l*73.6%
*-commutative73.6%
associate-/l*73.6%
associate-*r/76.9%
associate-/r/76.9%
associate-/r*70.3%
associate-*r/72.8%
associate-*l/72.8%
associate-/r/83.2%
Simplified83.2%
if 4.9999999999999999e23 < d Initial program 89.0%
times-frac90.8%
Simplified90.8%
associate-*r/96.5%
frac-times94.7%
*-commutative94.7%
frac-times96.5%
div-inv96.5%
metadata-eval96.5%
Applied egg-rr96.5%
Taylor expanded in M around 0 65.3%
*-commutative65.3%
Simplified85.4%
Taylor expanded in D around 0 83.9%
*-commutative83.9%
times-frac83.5%
unpow283.5%
*-commutative83.5%
unpow283.5%
Simplified83.5%
Final simplification75.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
(if (<= d 3.1e-132)
(* (sqrt (+ 1.0 (* -0.25 (/ (* D h) (* (/ l D) (* (/ d M) (/ d M))))))) w0)
(if (<= d 5e+23)
(* w0 (sqrt (- 1.0 (/ (* 0.25 (* D (* M (/ (* D h) (* d (/ d M)))))) l))))
(*
w0
(sqrt (- 1.0 (* 0.25 (* D (* (/ D (* d d)) (/ (* h (* M M)) l))))))))))M = abs(M);
D = abs(D);
d = abs(d);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (d <= 3.1e-132) {
tmp = sqrt((1.0 + (-0.25 * ((D * h) / ((l / D) * ((d / M) * (d / M))))))) * w0;
} else if (d <= 5e+23) {
tmp = w0 * sqrt((1.0 - ((0.25 * (D * (M * ((D * h) / (d * (d / M)))))) / l)));
} 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: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: tmp
if (d_1 <= 3.1d-132) then
tmp = sqrt((1.0d0 + ((-0.25d0) * ((d * h) / ((l / d) * ((d_1 / m) * (d_1 / m))))))) * w0
else if (d_1 <= 5d+23) then
tmp = w0 * sqrt((1.0d0 - ((0.25d0 * (d * (m * ((d * h) / (d_1 * (d_1 / m)))))) / l)))
else
tmp = w0 * sqrt((1.0d0 - (0.25d0 * (d * ((d / (d_1 * d_1)) * ((h * (m * m)) / l))))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
d = Math.abs(d);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (d <= 3.1e-132) {
tmp = Math.sqrt((1.0 + (-0.25 * ((D * h) / ((l / D) * ((d / M) * (d / M))))))) * w0;
} else if (d <= 5e+23) {
tmp = w0 * Math.sqrt((1.0 - ((0.25 * (D * (M * ((D * h) / (d * (d / M)))))) / l)));
} 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) d = abs(d) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if d <= 3.1e-132: tmp = math.sqrt((1.0 + (-0.25 * ((D * h) / ((l / D) * ((d / M) * (d / M))))))) * w0 elif d <= 5e+23: tmp = w0 * math.sqrt((1.0 - ((0.25 * (D * (M * ((D * h) / (d * (d / M)))))) / l))) 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) d = abs(d) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (d <= 3.1e-132) tmp = Float64(sqrt(Float64(1.0 + Float64(-0.25 * Float64(Float64(D * h) / Float64(Float64(l / D) * Float64(Float64(d / M) * Float64(d / M))))))) * w0); elseif (d <= 5e+23) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(0.25 * Float64(D * Float64(M * Float64(Float64(D * h) / Float64(d * Float64(d / M)))))) / l)))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(0.25 * Float64(D * Float64(Float64(D / Float64(d * d)) * Float64(Float64(h * Float64(M * M)) / l))))))); end return tmp end
M = abs(M)
D = abs(D)
d = abs(d)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (d <= 3.1e-132)
tmp = sqrt((1.0 + (-0.25 * ((D * h) / ((l / D) * ((d / M) * (d / M))))))) * w0;
elseif (d <= 5e+23)
tmp = w0 * sqrt((1.0 - ((0.25 * (D * (M * ((D * h) / (d * (d / M)))))) / l)));
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: 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, 3.1e-132], N[(N[Sqrt[N[(1.0 + N[(-0.25 * N[(N[(D * h), $MachinePrecision] / N[(N[(l / D), $MachinePrecision] * N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * w0), $MachinePrecision], If[LessEqual[d, 5e+23], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(0.25 * N[(D * N[(M * N[(N[(D * h), $MachinePrecision] / N[(d * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(0.25 * N[(D * N[(N[(D / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $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}\;d \leq 3.1 \cdot 10^{-132}:\\
\;\;\;\;\sqrt{1 + -0.25 \cdot \frac{D \cdot h}{\frac{\ell}{D} \cdot \left(\frac{d}{M} \cdot \frac{d}{M}\right)}} \cdot w0\\
\mathbf{elif}\;d \leq 5 \cdot 10^{+23}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{0.25 \cdot \left(D \cdot \left(M \cdot \frac{D \cdot h}{d \cdot \frac{d}{M}}\right)\right)}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \left(D \cdot \left(\frac{D}{d \cdot d} \cdot \frac{h \cdot \left(M \cdot M\right)}{\ell}\right)\right)}\\
\end{array}
\end{array}
if d < 3.10000000000000008e-132Initial program 80.5%
times-frac78.3%
Simplified78.3%
Taylor expanded in w0 around 0 56.6%
Simplified59.1%
frac-times61.5%
times-frac76.6%
Applied egg-rr76.6%
if 3.10000000000000008e-132 < d < 4.9999999999999999e23Initial program 86.5%
times-frac86.5%
Simplified86.5%
associate-*r/88.7%
frac-times88.7%
*-commutative88.7%
frac-times85.5%
div-inv85.5%
metadata-eval85.5%
Applied egg-rr85.5%
Taylor expanded in M around 0 78.4%
unpow278.4%
associate-*r*78.4%
unpow278.4%
times-frac78.3%
associate-*r/74.9%
associate-*r*71.4%
unpow271.4%
associate-*l*73.6%
*-commutative73.6%
associate-/l*73.6%
associate-*r/76.9%
associate-/r/76.9%
associate-/r*70.3%
associate-*r/72.8%
associate-*l/72.8%
associate-/r/83.2%
Simplified83.2%
if 4.9999999999999999e23 < d Initial program 89.0%
times-frac90.8%
Simplified90.8%
associate-*r/96.5%
frac-times94.7%
*-commutative94.7%
frac-times96.5%
div-inv96.5%
metadata-eval96.5%
Applied egg-rr96.5%
Taylor expanded in M around 0 65.3%
*-commutative65.3%
Simplified85.4%
Taylor expanded in D around 0 83.9%
*-commutative83.9%
times-frac83.5%
unpow283.5%
*-commutative83.5%
unpow283.5%
Simplified83.5%
Final simplification78.8%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: d should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= d 4.2e-67) (* w0 (fma -0.125 (/ (* D h) (* (/ l D) (* (/ d M) (/ d M)))) 1.0)) (* w0 (sqrt (- 1.0 (* 0.25 (* D (* (/ D (* d d)) (/ (* h (* M M)) l)))))))))
M = abs(M);
D = abs(D);
d = abs(d);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (d <= 4.2e-67) {
tmp = w0 * fma(-0.125, ((D * h) / ((l / D) * ((d / M) * (d / M)))), 1.0);
} else {
tmp = w0 * sqrt((1.0 - (0.25 * (D * ((D / (d * d)) * ((h * (M * M)) / l))))));
}
return tmp;
}
M = abs(M) D = abs(D) d = abs(d) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (d <= 4.2e-67) tmp = Float64(w0 * fma(-0.125, Float64(Float64(D * h) / Float64(Float64(l / D) * Float64(Float64(d / M) * Float64(d / M)))), 1.0)); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(0.25 * Float64(D * Float64(Float64(D / Float64(d * d)) * Float64(Float64(h * Float64(M * M)) / l))))))); end return tmp end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: d should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[d, 4.2e-67], N[(w0 * N[(-0.125 * N[(N[(D * h), $MachinePrecision] / N[(N[(l / D), $MachinePrecision] * N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(0.25 * N[(D * N[(N[(D / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $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}\;d \leq 4.2 \cdot 10^{-67}:\\
\;\;\;\;w0 \cdot \mathsf{fma}\left(-0.125, \frac{D \cdot h}{\frac{\ell}{D} \cdot \left(\frac{d}{M} \cdot \frac{d}{M}\right)}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \left(D \cdot \left(\frac{D}{d \cdot d} \cdot \frac{h \cdot \left(M \cdot M\right)}{\ell}\right)\right)}\\
\end{array}
\end{array}
if d < 4.2000000000000003e-67Initial program 80.8%
times-frac78.8%
Simplified78.8%
Taylor expanded in M around 0 54.6%
+-commutative54.6%
*-commutative54.6%
*-commutative54.6%
fma-def54.6%
*-commutative54.6%
times-frac54.6%
unpow254.6%
associate-/l*54.8%
associate-/l*57.0%
unpow257.0%
unpow257.0%
Simplified57.0%
frac-times61.0%
times-frac75.1%
Applied egg-rr69.0%
if 4.2000000000000003e-67 < d Initial program 88.7%
times-frac90.1%
Simplified90.1%
associate-*r/95.4%
frac-times94.0%
*-commutative94.0%
frac-times95.4%
div-inv95.4%
metadata-eval95.4%
Applied egg-rr95.4%
Taylor expanded in M around 0 69.9%
*-commutative69.9%
Simplified85.9%
Taylor expanded in D around 0 84.8%
*-commutative84.8%
times-frac83.2%
unpow283.2%
*-commutative83.2%
unpow283.2%
Simplified83.2%
Final simplification72.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 (<= d 6e-67) (* w0 (sqrt (- 1.0 (* 0.25 (* D (/ (* D h) (* l (* (/ d M) (/ d M))))))))) (* w0 (sqrt (- 1.0 (* 0.25 (* D (* (/ D (* d d)) (/ (* h (* M M)) l)))))))))
M = abs(M);
D = abs(D);
d = abs(d);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (d <= 6e-67) {
tmp = w0 * sqrt((1.0 - (0.25 * (D * ((D * h) / (l * ((d / M) * (d / M))))))));
} 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: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: tmp
if (d_1 <= 6d-67) then
tmp = w0 * sqrt((1.0d0 - (0.25d0 * (d * ((d * h) / (l * ((d_1 / m) * (d_1 / m))))))))
else
tmp = w0 * sqrt((1.0d0 - (0.25d0 * (d * ((d / (d_1 * d_1)) * ((h * (m * m)) / l))))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
d = Math.abs(d);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (d <= 6e-67) {
tmp = w0 * Math.sqrt((1.0 - (0.25 * (D * ((D * h) / (l * ((d / M) * (d / M))))))));
} 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) d = abs(d) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if d <= 6e-67: tmp = w0 * math.sqrt((1.0 - (0.25 * (D * ((D * h) / (l * ((d / M) * (d / M)))))))) 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) d = abs(d) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (d <= 6e-67) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(0.25 * Float64(D * Float64(Float64(D * h) / Float64(l * Float64(Float64(d / M) * Float64(d / M))))))))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(0.25 * Float64(D * Float64(Float64(D / Float64(d * d)) * Float64(Float64(h * Float64(M * M)) / l))))))); end return tmp end
M = abs(M)
D = abs(D)
d = abs(d)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (d <= 6e-67)
tmp = w0 * sqrt((1.0 - (0.25 * (D * ((D * h) / (l * ((d / M) * (d / M))))))));
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: 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, 6e-67], N[(w0 * N[Sqrt[N[(1.0 - N[(0.25 * N[(D * N[(N[(D * h), $MachinePrecision] / N[(l * N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(0.25 * N[(D * N[(N[(D / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $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}\;d \leq 6 \cdot 10^{-67}:\\
\;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \left(D \cdot \frac{D \cdot h}{\ell \cdot \left(\frac{d}{M} \cdot \frac{d}{M}\right)}\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \left(D \cdot \left(\frac{D}{d \cdot d} \cdot \frac{h \cdot \left(M \cdot M\right)}{\ell}\right)\right)}\\
\end{array}
\end{array}
if d < 6.00000000000000065e-67Initial program 80.8%
times-frac78.8%
Simplified78.8%
associate-*r/82.1%
frac-times83.1%
*-commutative83.1%
frac-times82.6%
div-inv82.6%
metadata-eval82.6%
Applied egg-rr82.6%
Taylor expanded in M around 0 55.9%
*-commutative55.9%
Simplified74.0%
if 6.00000000000000065e-67 < d Initial program 88.7%
times-frac90.1%
Simplified90.1%
associate-*r/95.4%
frac-times94.0%
*-commutative94.0%
frac-times95.4%
div-inv95.4%
metadata-eval95.4%
Applied egg-rr95.4%
Taylor expanded in M around 0 69.9%
*-commutative69.9%
Simplified85.9%
Taylor expanded in D around 0 84.8%
*-commutative84.8%
times-frac83.2%
unpow283.2%
*-commutative83.2%
unpow283.2%
Simplified83.2%
Final simplification76.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 (if (<= D 4.3e+51) (+ w0 (* w0 (* (* D -0.125) (* (/ D l) (/ h (pow (/ d M) 2.0)))))) (fma -0.125 (* D (/ (* D (/ (* w0 (* h (/ M d))) (/ d M))) l)) 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) {
double tmp;
if (D <= 4.3e+51) {
tmp = w0 + (w0 * ((D * -0.125) * ((D / l) * (h / pow((d / M), 2.0)))));
} else {
tmp = fma(-0.125, (D * ((D * ((w0 * (h * (M / d))) / (d / M))) / l)), w0);
}
return tmp;
}
M = abs(M) D = abs(D) d = abs(d) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (D <= 4.3e+51) tmp = Float64(w0 + Float64(w0 * Float64(Float64(D * -0.125) * Float64(Float64(D / l) * Float64(h / (Float64(d / M) ^ 2.0)))))); else tmp = fma(-0.125, Float64(D * Float64(Float64(D * Float64(Float64(w0 * Float64(h * Float64(M / d))) / Float64(d / M))) / l)), w0); end return tmp end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: d should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[D, 4.3e+51], N[(w0 + N[(w0 * N[(N[(D * -0.125), $MachinePrecision] * N[(N[(D / l), $MachinePrecision] * N[(h / N[Power[N[(d / M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.125 * N[(D * N[(N[(D * N[(N[(w0 * N[(h * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + w0), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
d = |d|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;D \leq 4.3 \cdot 10^{+51}:\\
\;\;\;\;w0 + w0 \cdot \left(\left(D \cdot -0.125\right) \cdot \left(\frac{D}{\ell} \cdot \frac{h}{{\left(\frac{d}{M}\right)}^{2}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.125, D \cdot \frac{D \cdot \frac{w0 \cdot \left(h \cdot \frac{M}{d}\right)}{\frac{d}{M}}}{\ell}, w0\right)\\
\end{array}
\end{array}
if D < 4.2999999999999997e51Initial program 83.8%
times-frac83.3%
Simplified83.3%
Taylor expanded in M around 0 60.9%
associate-*r/60.9%
*-commutative60.9%
associate-*r/60.9%
times-frac60.1%
unpow260.1%
*-commutative60.1%
unpow260.1%
unpow260.1%
Simplified60.1%
Taylor expanded in D around 0 60.9%
*-commutative60.9%
times-frac60.1%
unpow260.1%
*-commutative60.1%
unpow260.1%
unpow260.1%
associate-/l*61.7%
unpow261.7%
associate-/l*63.6%
unpow263.6%
times-frac71.6%
associate-*l/74.7%
associate-/r/76.7%
*-commutative76.7%
associate-*r/76.4%
associate-/l/75.5%
Simplified75.5%
distribute-rgt-in75.5%
*-un-lft-identity75.5%
associate-*r*75.5%
times-frac74.7%
pow274.7%
Applied egg-rr74.7%
if 4.2999999999999997e51 < D Initial program 78.8%
times-frac74.2%
Simplified74.2%
Taylor expanded in M around 0 50.0%
fma-def50.0%
times-frac44.7%
unpow244.7%
associate-/l*44.7%
*-commutative44.7%
associate-*r*44.5%
unpow244.5%
times-frac44.6%
unpow244.6%
associate-*r*47.1%
*-commutative47.1%
Simplified47.1%
associate-*l/59.7%
associate-/l*62.3%
Applied egg-rr62.3%
Taylor expanded in M around 0 57.2%
*-commutative57.2%
associate-*r*57.1%
unpow257.1%
times-frac57.2%
unpow257.2%
associate-*r*59.7%
*-commutative59.7%
associate-/l*62.3%
times-frac62.3%
*-commutative62.3%
times-frac62.3%
*-commutative62.3%
associate-/l*62.3%
*-rgt-identity62.3%
associate-*r/62.3%
associate-/r/62.3%
associate-*l/62.3%
*-lft-identity62.3%
Simplified62.3%
associate-/r/67.7%
associate-*l/67.7%
Applied egg-rr67.7%
Final simplification73.6%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: d should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= d 8.6e+108) (* w0 (+ 1.0 (* (* D (/ (* D h) (* l (* (/ d M) (/ d M))))) -0.125))) 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) {
double tmp;
if (d <= 8.6e+108) {
tmp = w0 * (1.0 + ((D * ((D * h) / (l * ((d / M) * (d / M))))) * -0.125));
} else {
tmp = w0;
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: d should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: tmp
if (d_1 <= 8.6d+108) then
tmp = w0 * (1.0d0 + ((d * ((d * h) / (l * ((d_1 / m) * (d_1 / m))))) * (-0.125d0)))
else
tmp = w0
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
d = Math.abs(d);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (d <= 8.6e+108) {
tmp = w0 * (1.0 + ((D * ((D * h) / (l * ((d / M) * (d / M))))) * -0.125));
} else {
tmp = w0;
}
return tmp;
}
M = abs(M) D = abs(D) d = abs(d) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if d <= 8.6e+108: tmp = w0 * (1.0 + ((D * ((D * h) / (l * ((d / M) * (d / M))))) * -0.125)) else: tmp = w0 return tmp
M = abs(M) D = abs(D) d = abs(d) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (d <= 8.6e+108) tmp = Float64(w0 * Float64(1.0 + Float64(Float64(D * Float64(Float64(D * h) / Float64(l * Float64(Float64(d / M) * Float64(d / M))))) * -0.125))); else tmp = w0; end return tmp end
M = abs(M)
D = abs(D)
d = abs(d)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (d <= 8.6e+108)
tmp = w0 * (1.0 + ((D * ((D * h) / (l * ((d / M) * (d / M))))) * -0.125));
else
tmp = w0;
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: 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, 8.6e+108], N[(w0 * N[(1.0 + N[(N[(D * N[(N[(D * h), $MachinePrecision] / N[(l * N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
M = |M|\\
D = |D|\\
d = |d|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 8.6 \cdot 10^{+108}:\\
\;\;\;\;w0 \cdot \left(1 + \left(D \cdot \frac{D \cdot h}{\ell \cdot \left(\frac{d}{M} \cdot \frac{d}{M}\right)}\right) \cdot -0.125\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if d < 8.59999999999999993e108Initial program 81.9%
times-frac80.2%
Simplified80.2%
Taylor expanded in M around 0 57.7%
associate-*r/57.7%
*-commutative57.7%
associate-*r/57.7%
times-frac57.3%
unpow257.3%
*-commutative57.3%
unpow257.3%
unpow257.3%
Simplified57.3%
Taylor expanded in D around 0 57.7%
*-commutative57.7%
times-frac57.3%
unpow257.3%
*-commutative57.3%
unpow257.3%
unpow257.3%
associate-/l*57.5%
unpow257.5%
associate-/l*59.4%
unpow259.4%
times-frac67.3%
associate-*l/70.7%
associate-/r/72.8%
*-commutative72.8%
associate-*r/72.5%
associate-/l/71.6%
Simplified71.6%
if 8.59999999999999993e108 < d Initial program 89.2%
times-frac91.8%
Simplified91.8%
Taylor expanded in M around 0 90.1%
Final simplification74.3%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: d should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= M 2.65e-28) w0 (* -0.125 (* (/ (* D (* D w0)) l) (/ (* h (* M M)) (* d d))))))
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 <= 2.65e-28) {
tmp = w0;
} else {
tmp = -0.125 * (((D * (D * w0)) / l) * ((h * (M * M)) / (d * d)));
}
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 <= 2.65d-28) then
tmp = w0
else
tmp = (-0.125d0) * (((d * (d * w0)) / l) * ((h * (m * m)) / (d_1 * d_1)))
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 <= 2.65e-28) {
tmp = w0;
} else {
tmp = -0.125 * (((D * (D * w0)) / l) * ((h * (M * M)) / (d * d)));
}
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 <= 2.65e-28: tmp = w0 else: tmp = -0.125 * (((D * (D * w0)) / l) * ((h * (M * M)) / (d * d))) 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 <= 2.65e-28) tmp = w0; else tmp = Float64(-0.125 * Float64(Float64(Float64(D * Float64(D * w0)) / l) * Float64(Float64(h * Float64(M * M)) / Float64(d * d)))); 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 <= 2.65e-28)
tmp = w0;
else
tmp = -0.125 * (((D * (D * w0)) / l) * ((h * (M * M)) / (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: d should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 2.65e-28], w0, N[(-0.125 * N[(N[(N[(D * N[(D * w0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / N[(d * d), $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 2.65 \cdot 10^{-28}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(\frac{D \cdot \left(D \cdot w0\right)}{\ell} \cdot \frac{h \cdot \left(M \cdot M\right)}{d \cdot d}\right)\\
\end{array}
\end{array}
if M < 2.64999999999999994e-28Initial program 84.3%
times-frac82.3%
Simplified82.3%
Taylor expanded in M around 0 68.9%
if 2.64999999999999994e-28 < M Initial program 79.2%
times-frac80.7%
Simplified80.7%
Taylor expanded in M around 0 52.5%
associate-*r/52.5%
*-commutative52.5%
associate-*r/52.5%
times-frac48.2%
unpow248.2%
*-commutative48.2%
unpow248.2%
unpow248.2%
Simplified48.2%
Taylor expanded in D around 0 52.5%
*-commutative52.5%
times-frac48.2%
unpow248.2%
*-commutative48.2%
unpow248.2%
unpow248.2%
associate-/l*48.9%
unpow248.9%
associate-/l*53.5%
unpow253.5%
times-frac61.3%
associate-*l/66.3%
associate-/r/66.6%
*-commutative66.6%
associate-*r/69.1%
associate-/l/66.1%
Simplified66.1%
Taylor expanded in D around inf 23.7%
associate-*r*23.8%
unpow223.8%
*-commutative23.8%
unpow223.8%
*-commutative23.8%
unpow223.8%
Simplified23.8%
times-frac23.7%
associate-*l*24.2%
*-commutative24.2%
Applied egg-rr24.2%
Final simplification57.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 (if (<= M 8.5e-31) w0 (* -0.125 (/ (* D (* (* D w0) (* h (* M M)))) (* l (* d d))))))
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 <= 8.5e-31) {
tmp = w0;
} else {
tmp = -0.125 * ((D * ((D * w0) * (h * (M * M)))) / (l * (d * d)));
}
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 <= 8.5d-31) then
tmp = w0
else
tmp = (-0.125d0) * ((d * ((d * w0) * (h * (m * m)))) / (l * (d_1 * d_1)))
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 <= 8.5e-31) {
tmp = w0;
} else {
tmp = -0.125 * ((D * ((D * w0) * (h * (M * M)))) / (l * (d * d)));
}
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 <= 8.5e-31: tmp = w0 else: tmp = -0.125 * ((D * ((D * w0) * (h * (M * M)))) / (l * (d * d))) 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 <= 8.5e-31) tmp = w0; else tmp = Float64(-0.125 * Float64(Float64(D * Float64(Float64(D * w0) * Float64(h * Float64(M * M)))) / Float64(l * Float64(d * d)))); 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 <= 8.5e-31)
tmp = w0;
else
tmp = -0.125 * ((D * ((D * w0) * (h * (M * M)))) / (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: 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, 8.5e-31], w0, N[(-0.125 * N[(N[(D * N[(N[(D * w0), $MachinePrecision] * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d * d), $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 8.5 \cdot 10^{-31}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \frac{D \cdot \left(\left(D \cdot w0\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)}{\ell \cdot \left(d \cdot d\right)}\\
\end{array}
\end{array}
if M < 8.5000000000000007e-31Initial program 84.3%
times-frac82.3%
Simplified82.3%
Taylor expanded in M around 0 68.9%
if 8.5000000000000007e-31 < M Initial program 79.2%
times-frac80.7%
Simplified80.7%
Taylor expanded in M around 0 52.5%
associate-*r/52.5%
*-commutative52.5%
associate-*r/52.5%
times-frac48.2%
unpow248.2%
*-commutative48.2%
unpow248.2%
unpow248.2%
Simplified48.2%
Taylor expanded in D around 0 52.5%
*-commutative52.5%
times-frac48.2%
unpow248.2%
*-commutative48.2%
unpow248.2%
unpow248.2%
associate-/l*48.9%
unpow248.9%
associate-/l*53.5%
unpow253.5%
times-frac61.3%
associate-*l/66.3%
associate-/r/66.6%
*-commutative66.6%
associate-*r/69.1%
associate-/l/66.1%
Simplified66.1%
Taylor expanded in D around inf 23.7%
associate-*r*23.8%
unpow223.8%
*-commutative23.8%
unpow223.8%
*-commutative23.8%
unpow223.8%
Simplified23.8%
Taylor expanded in D around 0 23.7%
*-commutative23.7%
unpow223.7%
associate-*r*24.6%
associate-*r*24.7%
unpow224.7%
Simplified24.7%
Final simplification57.7%
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 83.0%
times-frac81.9%
Simplified81.9%
Taylor expanded in M around 0 64.7%
Final simplification64.7%
herbie shell --seed 2023200
(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))))))