
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5
\end{array}
(FPCore (v w r)
:precision binary64
(let* ((t_0 (+ 3.0 (/ 2.0 (* r r)))))
(if (<= v -1.55e+159)
(- (- (+ 3.0 (* (/ 2.0 r) (/ 1.0 r))) (* (* (* r w) (* r w)) 0.25)) 4.5)
(if (<= v 92000000.0)
(-
(+ t_0 (* (* r (* w (+ (* v -0.25) 0.375))) (* w (/ r (+ v -1.0)))))
4.5)
(+
t_0
(- (* (* 0.125 (+ 3.0 (* v -2.0))) (* w (* r (/ (* r w) v)))) 4.5))))))
double code(double v, double w, double r) {
double t_0 = 3.0 + (2.0 / (r * r));
double tmp;
if (v <= -1.55e+159) {
tmp = ((3.0 + ((2.0 / r) * (1.0 / r))) - (((r * w) * (r * w)) * 0.25)) - 4.5;
} else if (v <= 92000000.0) {
tmp = (t_0 + ((r * (w * ((v * -0.25) + 0.375))) * (w * (r / (v + -1.0))))) - 4.5;
} else {
tmp = t_0 + (((0.125 * (3.0 + (v * -2.0))) * (w * (r * ((r * w) / v)))) - 4.5);
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = 3.0d0 + (2.0d0 / (r * r))
if (v <= (-1.55d+159)) then
tmp = ((3.0d0 + ((2.0d0 / r) * (1.0d0 / r))) - (((r * w) * (r * w)) * 0.25d0)) - 4.5d0
else if (v <= 92000000.0d0) then
tmp = (t_0 + ((r * (w * ((v * (-0.25d0)) + 0.375d0))) * (w * (r / (v + (-1.0d0)))))) - 4.5d0
else
tmp = t_0 + (((0.125d0 * (3.0d0 + (v * (-2.0d0)))) * (w * (r * ((r * w) / v)))) - 4.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 3.0 + (2.0 / (r * r));
double tmp;
if (v <= -1.55e+159) {
tmp = ((3.0 + ((2.0 / r) * (1.0 / r))) - (((r * w) * (r * w)) * 0.25)) - 4.5;
} else if (v <= 92000000.0) {
tmp = (t_0 + ((r * (w * ((v * -0.25) + 0.375))) * (w * (r / (v + -1.0))))) - 4.5;
} else {
tmp = t_0 + (((0.125 * (3.0 + (v * -2.0))) * (w * (r * ((r * w) / v)))) - 4.5);
}
return tmp;
}
def code(v, w, r): t_0 = 3.0 + (2.0 / (r * r)) tmp = 0 if v <= -1.55e+159: tmp = ((3.0 + ((2.0 / r) * (1.0 / r))) - (((r * w) * (r * w)) * 0.25)) - 4.5 elif v <= 92000000.0: tmp = (t_0 + ((r * (w * ((v * -0.25) + 0.375))) * (w * (r / (v + -1.0))))) - 4.5 else: tmp = t_0 + (((0.125 * (3.0 + (v * -2.0))) * (w * (r * ((r * w) / v)))) - 4.5) return tmp
function code(v, w, r) t_0 = Float64(3.0 + Float64(2.0 / Float64(r * r))) tmp = 0.0 if (v <= -1.55e+159) tmp = Float64(Float64(Float64(3.0 + Float64(Float64(2.0 / r) * Float64(1.0 / r))) - Float64(Float64(Float64(r * w) * Float64(r * w)) * 0.25)) - 4.5); elseif (v <= 92000000.0) tmp = Float64(Float64(t_0 + Float64(Float64(r * Float64(w * Float64(Float64(v * -0.25) + 0.375))) * Float64(w * Float64(r / Float64(v + -1.0))))) - 4.5); else tmp = Float64(t_0 + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) * Float64(w * Float64(r * Float64(Float64(r * w) / v)))) - 4.5)); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 3.0 + (2.0 / (r * r)); tmp = 0.0; if (v <= -1.55e+159) tmp = ((3.0 + ((2.0 / r) * (1.0 / r))) - (((r * w) * (r * w)) * 0.25)) - 4.5; elseif (v <= 92000000.0) tmp = (t_0 + ((r * (w * ((v * -0.25) + 0.375))) * (w * (r / (v + -1.0))))) - 4.5; else tmp = t_0 + (((0.125 * (3.0 + (v * -2.0))) * (w * (r * ((r * w) / v)))) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, -1.55e+159], N[(N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] * N[(1.0 / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[v, 92000000.0], N[(N[(t$95$0 + N[(N[(r * N[(w * N[(N[(v * -0.25), $MachinePrecision] + 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(t$95$0 + N[(N[(N[(0.125 * N[(3.0 + N[(v * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r * N[(N[(r * w), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 3 + \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -1.55 \cdot 10^{+159}:\\
\;\;\;\;\left(\left(3 + \frac{2}{r} \cdot \frac{1}{r}\right) - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot 0.25\right) - 4.5\\
\mathbf{elif}\;v \leq 92000000:\\
\;\;\;\;\left(t\_0 + \left(r \cdot \left(w \cdot \left(v \cdot -0.25 + 0.375\right)\right)\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \left(\left(0.125 \cdot \left(3 + v \cdot -2\right)\right) \cdot \left(w \cdot \left(r \cdot \frac{r \cdot w}{v}\right)\right) - 4.5\right)\\
\end{array}
\end{array}
if v < -1.5499999999999999e159Initial program 75.6%
associate-/l*83.5%
*-commutative83.5%
*-commutative83.5%
*-commutative83.5%
div-inv83.5%
associate-*l*83.5%
associate-*r*78.8%
*-commutative78.8%
pow278.8%
pow278.8%
pow-prod-down95.5%
cancel-sign-sub-inv95.5%
metadata-eval95.5%
+-commutative95.5%
distribute-rgt-in95.5%
*-commutative95.5%
associate-*l*99.7%
metadata-eval99.7%
metadata-eval99.7%
Applied egg-rr99.7%
unpow299.7%
Applied egg-rr99.7%
Taylor expanded in v around inf 99.6%
associate-/r*99.7%
div-inv99.7%
Applied egg-rr99.7%
if -1.5499999999999999e159 < v < 9.2e7Initial program 84.4%
Applied egg-rr98.7%
Taylor expanded in r around 0 99.9%
associate-/l*99.9%
Applied egg-rr99.9%
if 9.2e7 < v Initial program 79.6%
Simplified90.1%
associate-/l*90.1%
*-commutative90.1%
associate-*r/90.2%
*-commutative90.2%
associate-*l*98.5%
associate-*l*99.8%
associate-*r/99.8%
Applied egg-rr99.8%
Taylor expanded in v around inf 99.8%
associate-*r/99.8%
mul-1-neg99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* (* (* r w) (* r w)) 0.25)) (t_1 (+ 3.0 (/ 2.0 (* r r)))))
(if (<= v -6.5e+158)
(- (- (+ 3.0 (* (/ 2.0 r) (/ 1.0 r))) t_0) 4.5)
(if (<= v 15000000.0)
(-
(+ t_1 (* (* r (* w (+ (* v -0.25) 0.375))) (* w (/ r (+ v -1.0)))))
4.5)
(- (- t_1 t_0) 4.5)))))
double code(double v, double w, double r) {
double t_0 = ((r * w) * (r * w)) * 0.25;
double t_1 = 3.0 + (2.0 / (r * r));
double tmp;
if (v <= -6.5e+158) {
tmp = ((3.0 + ((2.0 / r) * (1.0 / r))) - t_0) - 4.5;
} else if (v <= 15000000.0) {
tmp = (t_1 + ((r * (w * ((v * -0.25) + 0.375))) * (w * (r / (v + -1.0))))) - 4.5;
} else {
tmp = (t_1 - t_0) - 4.5;
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ((r * w) * (r * w)) * 0.25d0
t_1 = 3.0d0 + (2.0d0 / (r * r))
if (v <= (-6.5d+158)) then
tmp = ((3.0d0 + ((2.0d0 / r) * (1.0d0 / r))) - t_0) - 4.5d0
else if (v <= 15000000.0d0) then
tmp = (t_1 + ((r * (w * ((v * (-0.25d0)) + 0.375d0))) * (w * (r / (v + (-1.0d0)))))) - 4.5d0
else
tmp = (t_1 - t_0) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = ((r * w) * (r * w)) * 0.25;
double t_1 = 3.0 + (2.0 / (r * r));
double tmp;
if (v <= -6.5e+158) {
tmp = ((3.0 + ((2.0 / r) * (1.0 / r))) - t_0) - 4.5;
} else if (v <= 15000000.0) {
tmp = (t_1 + ((r * (w * ((v * -0.25) + 0.375))) * (w * (r / (v + -1.0))))) - 4.5;
} else {
tmp = (t_1 - t_0) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = ((r * w) * (r * w)) * 0.25 t_1 = 3.0 + (2.0 / (r * r)) tmp = 0 if v <= -6.5e+158: tmp = ((3.0 + ((2.0 / r) * (1.0 / r))) - t_0) - 4.5 elif v <= 15000000.0: tmp = (t_1 + ((r * (w * ((v * -0.25) + 0.375))) * (w * (r / (v + -1.0))))) - 4.5 else: tmp = (t_1 - t_0) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(Float64(Float64(r * w) * Float64(r * w)) * 0.25) t_1 = Float64(3.0 + Float64(2.0 / Float64(r * r))) tmp = 0.0 if (v <= -6.5e+158) tmp = Float64(Float64(Float64(3.0 + Float64(Float64(2.0 / r) * Float64(1.0 / r))) - t_0) - 4.5); elseif (v <= 15000000.0) tmp = Float64(Float64(t_1 + Float64(Float64(r * Float64(w * Float64(Float64(v * -0.25) + 0.375))) * Float64(w * Float64(r / Float64(v + -1.0))))) - 4.5); else tmp = Float64(Float64(t_1 - t_0) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = ((r * w) * (r * w)) * 0.25; t_1 = 3.0 + (2.0 / (r * r)); tmp = 0.0; if (v <= -6.5e+158) tmp = ((3.0 + ((2.0 / r) * (1.0 / r))) - t_0) - 4.5; elseif (v <= 15000000.0) tmp = (t_1 + ((r * (w * ((v * -0.25) + 0.375))) * (w * (r / (v + -1.0))))) - 4.5; else tmp = (t_1 - t_0) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]}, Block[{t$95$1 = N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, -6.5e+158], N[(N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] * N[(1.0 / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[v, 15000000.0], N[(N[(t$95$1 + N[(N[(r * N[(w * N[(N[(v * -0.25), $MachinePrecision] + 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(t$95$1 - t$95$0), $MachinePrecision] - 4.5), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot 0.25\\
t_1 := 3 + \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -6.5 \cdot 10^{+158}:\\
\;\;\;\;\left(\left(3 + \frac{2}{r} \cdot \frac{1}{r}\right) - t\_0\right) - 4.5\\
\mathbf{elif}\;v \leq 15000000:\\
\;\;\;\;\left(t\_1 + \left(r \cdot \left(w \cdot \left(v \cdot -0.25 + 0.375\right)\right)\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 - t\_0\right) - 4.5\\
\end{array}
\end{array}
if v < -6.5000000000000001e158Initial program 75.6%
associate-/l*83.5%
*-commutative83.5%
*-commutative83.5%
*-commutative83.5%
div-inv83.5%
associate-*l*83.5%
associate-*r*78.8%
*-commutative78.8%
pow278.8%
pow278.8%
pow-prod-down95.5%
cancel-sign-sub-inv95.5%
metadata-eval95.5%
+-commutative95.5%
distribute-rgt-in95.5%
*-commutative95.5%
associate-*l*99.7%
metadata-eval99.7%
metadata-eval99.7%
Applied egg-rr99.7%
unpow299.7%
Applied egg-rr99.7%
Taylor expanded in v around inf 99.6%
associate-/r*99.7%
div-inv99.7%
Applied egg-rr99.7%
if -6.5000000000000001e158 < v < 1.5e7Initial program 84.4%
Applied egg-rr98.7%
Taylor expanded in r around 0 99.9%
associate-/l*99.9%
Applied egg-rr99.9%
if 1.5e7 < v Initial program 79.6%
associate-/l*90.1%
*-commutative90.1%
*-commutative90.1%
*-commutative90.1%
div-inv90.2%
associate-*l*90.1%
associate-*r*83.9%
*-commutative83.9%
pow283.9%
pow283.9%
pow-prod-down99.7%
cancel-sign-sub-inv99.7%
metadata-eval99.7%
+-commutative99.7%
distribute-rgt-in99.7%
*-commutative99.7%
associate-*l*99.7%
metadata-eval99.7%
metadata-eval99.7%
Applied egg-rr99.7%
unpow299.7%
Applied egg-rr99.7%
Taylor expanded in v around inf 99.7%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* (* r w) (* r w))))
(if (or (<= v -23.5) (not (<= v 6.6e-10)))
(- (- (+ 3.0 (* (/ 2.0 r) (/ 1.0 r))) (* t_0 0.25)) 4.5)
(- (- (+ 3.0 (/ 2.0 (* r r))) (* t_0 (+ 0.375 (* v 0.125)))) 4.5))))
double code(double v, double w, double r) {
double t_0 = (r * w) * (r * w);
double tmp;
if ((v <= -23.5) || !(v <= 6.6e-10)) {
tmp = ((3.0 + ((2.0 / r) * (1.0 / r))) - (t_0 * 0.25)) - 4.5;
} else {
tmp = ((3.0 + (2.0 / (r * r))) - (t_0 * (0.375 + (v * 0.125)))) - 4.5;
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = (r * w) * (r * w)
if ((v <= (-23.5d0)) .or. (.not. (v <= 6.6d-10))) then
tmp = ((3.0d0 + ((2.0d0 / r) * (1.0d0 / r))) - (t_0 * 0.25d0)) - 4.5d0
else
tmp = ((3.0d0 + (2.0d0 / (r * r))) - (t_0 * (0.375d0 + (v * 0.125d0)))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = (r * w) * (r * w);
double tmp;
if ((v <= -23.5) || !(v <= 6.6e-10)) {
tmp = ((3.0 + ((2.0 / r) * (1.0 / r))) - (t_0 * 0.25)) - 4.5;
} else {
tmp = ((3.0 + (2.0 / (r * r))) - (t_0 * (0.375 + (v * 0.125)))) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = (r * w) * (r * w) tmp = 0 if (v <= -23.5) or not (v <= 6.6e-10): tmp = ((3.0 + ((2.0 / r) * (1.0 / r))) - (t_0 * 0.25)) - 4.5 else: tmp = ((3.0 + (2.0 / (r * r))) - (t_0 * (0.375 + (v * 0.125)))) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(Float64(r * w) * Float64(r * w)) tmp = 0.0 if ((v <= -23.5) || !(v <= 6.6e-10)) tmp = Float64(Float64(Float64(3.0 + Float64(Float64(2.0 / r) * Float64(1.0 / r))) - Float64(t_0 * 0.25)) - 4.5); else tmp = Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(t_0 * Float64(0.375 + Float64(v * 0.125)))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = (r * w) * (r * w); tmp = 0.0; if ((v <= -23.5) || ~((v <= 6.6e-10))) tmp = ((3.0 + ((2.0 / r) * (1.0 / r))) - (t_0 * 0.25)) - 4.5; else tmp = ((3.0 + (2.0 / (r * r))) - (t_0 * (0.375 + (v * 0.125)))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -23.5], N[Not[LessEqual[v, 6.6e-10]], $MachinePrecision]], N[(N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] * N[(1.0 / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t$95$0 * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t$95$0 * N[(0.375 + N[(v * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(r \cdot w\right) \cdot \left(r \cdot w\right)\\
\mathbf{if}\;v \leq -23.5 \lor \neg \left(v \leq 6.6 \cdot 10^{-10}\right):\\
\;\;\;\;\left(\left(3 + \frac{2}{r} \cdot \frac{1}{r}\right) - t\_0 \cdot 0.25\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(\left(3 + \frac{2}{r \cdot r}\right) - t\_0 \cdot \left(0.375 + v \cdot 0.125\right)\right) - 4.5\\
\end{array}
\end{array}
if v < -23.5 or 6.6e-10 < v Initial program 79.2%
associate-/l*85.9%
*-commutative85.9%
*-commutative85.9%
*-commutative85.9%
div-inv85.9%
associate-*l*85.9%
associate-*r*80.2%
*-commutative80.2%
pow280.2%
pow280.2%
pow-prod-down98.9%
cancel-sign-sub-inv98.9%
metadata-eval98.9%
+-commutative98.9%
distribute-rgt-in98.9%
*-commutative98.9%
associate-*l*99.7%
metadata-eval99.7%
metadata-eval99.7%
Applied egg-rr99.7%
unpow299.7%
Applied egg-rr99.7%
Taylor expanded in v around inf 98.6%
associate-/r*98.7%
div-inv98.7%
Applied egg-rr98.7%
if -23.5 < v < 6.6e-10Initial program 85.4%
associate-/l*85.4%
*-commutative85.4%
*-commutative85.4%
*-commutative85.4%
div-inv85.4%
associate-*l*85.4%
associate-*r*80.1%
*-commutative80.1%
pow280.1%
pow280.1%
pow-prod-down99.8%
cancel-sign-sub-inv99.8%
metadata-eval99.8%
+-commutative99.8%
distribute-rgt-in99.8%
*-commutative99.8%
associate-*l*99.8%
metadata-eval99.8%
metadata-eval99.8%
Applied egg-rr99.8%
unpow299.8%
Applied egg-rr99.8%
Taylor expanded in v around 0 99.8%
Final simplification99.2%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* (* r w) (* r w))) (t_1 (+ 3.0 (/ 2.0 (* r r)))))
(if (or (<= v -23.5) (not (<= v 7.8e-10)))
(- (+ t_1 (* t_0 (- (/ 0.125 v) 0.25))) 4.5)
(- (- t_1 (* t_0 (+ 0.375 (* v 0.125)))) 4.5))))
double code(double v, double w, double r) {
double t_0 = (r * w) * (r * w);
double t_1 = 3.0 + (2.0 / (r * r));
double tmp;
if ((v <= -23.5) || !(v <= 7.8e-10)) {
tmp = (t_1 + (t_0 * ((0.125 / v) - 0.25))) - 4.5;
} else {
tmp = (t_1 - (t_0 * (0.375 + (v * 0.125)))) - 4.5;
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (r * w) * (r * w)
t_1 = 3.0d0 + (2.0d0 / (r * r))
if ((v <= (-23.5d0)) .or. (.not. (v <= 7.8d-10))) then
tmp = (t_1 + (t_0 * ((0.125d0 / v) - 0.25d0))) - 4.5d0
else
tmp = (t_1 - (t_0 * (0.375d0 + (v * 0.125d0)))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = (r * w) * (r * w);
double t_1 = 3.0 + (2.0 / (r * r));
double tmp;
if ((v <= -23.5) || !(v <= 7.8e-10)) {
tmp = (t_1 + (t_0 * ((0.125 / v) - 0.25))) - 4.5;
} else {
tmp = (t_1 - (t_0 * (0.375 + (v * 0.125)))) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = (r * w) * (r * w) t_1 = 3.0 + (2.0 / (r * r)) tmp = 0 if (v <= -23.5) or not (v <= 7.8e-10): tmp = (t_1 + (t_0 * ((0.125 / v) - 0.25))) - 4.5 else: tmp = (t_1 - (t_0 * (0.375 + (v * 0.125)))) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(Float64(r * w) * Float64(r * w)) t_1 = Float64(3.0 + Float64(2.0 / Float64(r * r))) tmp = 0.0 if ((v <= -23.5) || !(v <= 7.8e-10)) tmp = Float64(Float64(t_1 + Float64(t_0 * Float64(Float64(0.125 / v) - 0.25))) - 4.5); else tmp = Float64(Float64(t_1 - Float64(t_0 * Float64(0.375 + Float64(v * 0.125)))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = (r * w) * (r * w); t_1 = 3.0 + (2.0 / (r * r)); tmp = 0.0; if ((v <= -23.5) || ~((v <= 7.8e-10))) tmp = (t_1 + (t_0 * ((0.125 / v) - 0.25))) - 4.5; else tmp = (t_1 - (t_0 * (0.375 + (v * 0.125)))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -23.5], N[Not[LessEqual[v, 7.8e-10]], $MachinePrecision]], N[(N[(t$95$1 + N[(t$95$0 * N[(N[(0.125 / v), $MachinePrecision] - 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(t$95$1 - N[(t$95$0 * N[(0.375 + N[(v * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(r \cdot w\right) \cdot \left(r \cdot w\right)\\
t_1 := 3 + \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -23.5 \lor \neg \left(v \leq 7.8 \cdot 10^{-10}\right):\\
\;\;\;\;\left(t\_1 + t\_0 \cdot \left(\frac{0.125}{v} - 0.25\right)\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 - t\_0 \cdot \left(0.375 + v \cdot 0.125\right)\right) - 4.5\\
\end{array}
\end{array}
if v < -23.5 or 7.7999999999999999e-10 < v Initial program 79.2%
associate-/l*85.9%
*-commutative85.9%
*-commutative85.9%
*-commutative85.9%
div-inv85.9%
associate-*l*85.9%
associate-*r*80.2%
*-commutative80.2%
pow280.2%
pow280.2%
pow-prod-down98.9%
cancel-sign-sub-inv98.9%
metadata-eval98.9%
+-commutative98.9%
distribute-rgt-in98.9%
*-commutative98.9%
associate-*l*99.7%
metadata-eval99.7%
metadata-eval99.7%
Applied egg-rr99.7%
unpow299.7%
Applied egg-rr99.7%
Taylor expanded in v around inf 98.8%
associate-*r/98.8%
metadata-eval98.8%
Simplified98.8%
if -23.5 < v < 7.7999999999999999e-10Initial program 85.4%
associate-/l*85.4%
*-commutative85.4%
*-commutative85.4%
*-commutative85.4%
div-inv85.4%
associate-*l*85.4%
associate-*r*80.1%
*-commutative80.1%
pow280.1%
pow280.1%
pow-prod-down99.8%
cancel-sign-sub-inv99.8%
metadata-eval99.8%
+-commutative99.8%
distribute-rgt-in99.8%
*-commutative99.8%
associate-*l*99.8%
metadata-eval99.8%
metadata-eval99.8%
Applied egg-rr99.8%
unpow299.8%
Applied egg-rr99.8%
Taylor expanded in v around 0 99.8%
Final simplification99.3%
(FPCore (v w r) :precision binary64 (if (or (<= v -23.5) (not (<= v 5e-10))) (- (- (+ 3.0 (* (/ 2.0 r) (/ 1.0 r))) (* (* (* r w) (* r w)) 0.25)) 4.5) (- (- (+ 3.0 (/ 2.0 (* r r))) (* (* r w) (* r (* w 0.375)))) 4.5)))
double code(double v, double w, double r) {
double tmp;
if ((v <= -23.5) || !(v <= 5e-10)) {
tmp = ((3.0 + ((2.0 / r) * (1.0 / r))) - (((r * w) * (r * w)) * 0.25)) - 4.5;
} else {
tmp = ((3.0 + (2.0 / (r * r))) - ((r * w) * (r * (w * 0.375)))) - 4.5;
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: tmp
if ((v <= (-23.5d0)) .or. (.not. (v <= 5d-10))) then
tmp = ((3.0d0 + ((2.0d0 / r) * (1.0d0 / r))) - (((r * w) * (r * w)) * 0.25d0)) - 4.5d0
else
tmp = ((3.0d0 + (2.0d0 / (r * r))) - ((r * w) * (r * (w * 0.375d0)))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if ((v <= -23.5) || !(v <= 5e-10)) {
tmp = ((3.0 + ((2.0 / r) * (1.0 / r))) - (((r * w) * (r * w)) * 0.25)) - 4.5;
} else {
tmp = ((3.0 + (2.0 / (r * r))) - ((r * w) * (r * (w * 0.375)))) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if (v <= -23.5) or not (v <= 5e-10): tmp = ((3.0 + ((2.0 / r) * (1.0 / r))) - (((r * w) * (r * w)) * 0.25)) - 4.5 else: tmp = ((3.0 + (2.0 / (r * r))) - ((r * w) * (r * (w * 0.375)))) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if ((v <= -23.5) || !(v <= 5e-10)) tmp = Float64(Float64(Float64(3.0 + Float64(Float64(2.0 / r) * Float64(1.0 / r))) - Float64(Float64(Float64(r * w) * Float64(r * w)) * 0.25)) - 4.5); else tmp = Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(r * w) * Float64(r * Float64(w * 0.375)))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if ((v <= -23.5) || ~((v <= 5e-10))) tmp = ((3.0 + ((2.0 / r) * (1.0 / r))) - (((r * w) * (r * w)) * 0.25)) - 4.5; else tmp = ((3.0 + (2.0 / (r * r))) - ((r * w) * (r * (w * 0.375)))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[Or[LessEqual[v, -23.5], N[Not[LessEqual[v, 5e-10]], $MachinePrecision]], N[(N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] * N[(1.0 / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(r * w), $MachinePrecision] * N[(r * N[(w * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -23.5 \lor \neg \left(v \leq 5 \cdot 10^{-10}\right):\\
\;\;\;\;\left(\left(3 + \frac{2}{r} \cdot \frac{1}{r}\right) - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot 0.25\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(\left(3 + \frac{2}{r \cdot r}\right) - \left(r \cdot w\right) \cdot \left(r \cdot \left(w \cdot 0.375\right)\right)\right) - 4.5\\
\end{array}
\end{array}
if v < -23.5 or 5.00000000000000031e-10 < v Initial program 79.2%
associate-/l*85.9%
*-commutative85.9%
*-commutative85.9%
*-commutative85.9%
div-inv85.9%
associate-*l*85.9%
associate-*r*80.2%
*-commutative80.2%
pow280.2%
pow280.2%
pow-prod-down98.9%
cancel-sign-sub-inv98.9%
metadata-eval98.9%
+-commutative98.9%
distribute-rgt-in98.9%
*-commutative98.9%
associate-*l*99.7%
metadata-eval99.7%
metadata-eval99.7%
Applied egg-rr99.7%
unpow299.7%
Applied egg-rr99.7%
Taylor expanded in v around inf 98.6%
associate-/r*98.7%
div-inv98.7%
Applied egg-rr98.7%
if -23.5 < v < 5.00000000000000031e-10Initial program 85.4%
Applied egg-rr99.9%
Taylor expanded in r around 0 99.9%
Taylor expanded in v around 0 99.6%
Taylor expanded in v around 0 99.6%
*-commutative99.6%
associate-*l*99.7%
Simplified99.7%
Final simplification99.2%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (+ 3.0 (/ 2.0 (* r r)))))
(if (or (<= v -23.5) (not (<= v 7e-10)))
(- (- t_0 (* (* (* r w) (* r w)) 0.25)) 4.5)
(- (- t_0 (* (* r w) (* r (* w 0.375)))) 4.5))))
double code(double v, double w, double r) {
double t_0 = 3.0 + (2.0 / (r * r));
double tmp;
if ((v <= -23.5) || !(v <= 7e-10)) {
tmp = (t_0 - (((r * w) * (r * w)) * 0.25)) - 4.5;
} else {
tmp = (t_0 - ((r * w) * (r * (w * 0.375)))) - 4.5;
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = 3.0d0 + (2.0d0 / (r * r))
if ((v <= (-23.5d0)) .or. (.not. (v <= 7d-10))) then
tmp = (t_0 - (((r * w) * (r * w)) * 0.25d0)) - 4.5d0
else
tmp = (t_0 - ((r * w) * (r * (w * 0.375d0)))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 3.0 + (2.0 / (r * r));
double tmp;
if ((v <= -23.5) || !(v <= 7e-10)) {
tmp = (t_0 - (((r * w) * (r * w)) * 0.25)) - 4.5;
} else {
tmp = (t_0 - ((r * w) * (r * (w * 0.375)))) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = 3.0 + (2.0 / (r * r)) tmp = 0 if (v <= -23.5) or not (v <= 7e-10): tmp = (t_0 - (((r * w) * (r * w)) * 0.25)) - 4.5 else: tmp = (t_0 - ((r * w) * (r * (w * 0.375)))) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(3.0 + Float64(2.0 / Float64(r * r))) tmp = 0.0 if ((v <= -23.5) || !(v <= 7e-10)) tmp = Float64(Float64(t_0 - Float64(Float64(Float64(r * w) * Float64(r * w)) * 0.25)) - 4.5); else tmp = Float64(Float64(t_0 - Float64(Float64(r * w) * Float64(r * Float64(w * 0.375)))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 3.0 + (2.0 / (r * r)); tmp = 0.0; if ((v <= -23.5) || ~((v <= 7e-10))) tmp = (t_0 - (((r * w) * (r * w)) * 0.25)) - 4.5; else tmp = (t_0 - ((r * w) * (r * (w * 0.375)))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -23.5], N[Not[LessEqual[v, 7e-10]], $MachinePrecision]], N[(N[(t$95$0 - N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(t$95$0 - N[(N[(r * w), $MachinePrecision] * N[(r * N[(w * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 3 + \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -23.5 \lor \neg \left(v \leq 7 \cdot 10^{-10}\right):\\
\;\;\;\;\left(t\_0 - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot 0.25\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 - \left(r \cdot w\right) \cdot \left(r \cdot \left(w \cdot 0.375\right)\right)\right) - 4.5\\
\end{array}
\end{array}
if v < -23.5 or 6.99999999999999961e-10 < v Initial program 79.2%
associate-/l*85.9%
*-commutative85.9%
*-commutative85.9%
*-commutative85.9%
div-inv85.9%
associate-*l*85.9%
associate-*r*80.2%
*-commutative80.2%
pow280.2%
pow280.2%
pow-prod-down98.9%
cancel-sign-sub-inv98.9%
metadata-eval98.9%
+-commutative98.9%
distribute-rgt-in98.9%
*-commutative98.9%
associate-*l*99.7%
metadata-eval99.7%
metadata-eval99.7%
Applied egg-rr99.7%
unpow299.7%
Applied egg-rr99.7%
Taylor expanded in v around inf 98.6%
if -23.5 < v < 6.99999999999999961e-10Initial program 85.4%
Applied egg-rr99.9%
Taylor expanded in r around 0 99.9%
Taylor expanded in v around 0 99.6%
Taylor expanded in v around 0 99.6%
*-commutative99.6%
associate-*l*99.7%
Simplified99.7%
Final simplification99.2%
(FPCore (v w r) :precision binary64 (- (+ (+ 3.0 (/ 2.0 (* r r))) (* (* (* r w) (* r w)) (* (+ (* v -0.25) 0.375) (/ -1.0 (- 1.0 v))))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) + (((r * w) * (r * w)) * (((v * -0.25) + 0.375) * (-1.0 / (1.0 - v))))) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((3.0d0 + (2.0d0 / (r * r))) + (((r * w) * (r * w)) * (((v * (-0.25d0)) + 0.375d0) * ((-1.0d0) / (1.0d0 - v))))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) + (((r * w) * (r * w)) * (((v * -0.25) + 0.375) * (-1.0 / (1.0 - v))))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) + (((r * w) * (r * w)) * (((v * -0.25) + 0.375) * (-1.0 / (1.0 - v))))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) + Float64(Float64(Float64(r * w) * Float64(r * w)) * Float64(Float64(Float64(v * -0.25) + 0.375) * Float64(-1.0 / Float64(1.0 - v))))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) + (((r * w) * (r * w)) * (((v * -0.25) + 0.375) * (-1.0 / (1.0 - v))))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(v * -0.25), $MachinePrecision] + 0.375), $MachinePrecision] * N[(-1.0 / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) + \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot \left(\left(v \cdot -0.25 + 0.375\right) \cdot \frac{-1}{1 - v}\right)\right) - 4.5
\end{array}
Initial program 82.4%
associate-/l*85.7%
*-commutative85.7%
*-commutative85.7%
*-commutative85.7%
div-inv85.7%
associate-*l*85.7%
associate-*r*80.2%
*-commutative80.2%
pow280.2%
pow280.2%
pow-prod-down99.3%
cancel-sign-sub-inv99.3%
metadata-eval99.3%
+-commutative99.3%
distribute-rgt-in99.3%
*-commutative99.3%
associate-*l*99.7%
metadata-eval99.7%
metadata-eval99.7%
Applied egg-rr99.7%
unpow299.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (v w r) :precision binary64 (+ (+ 3.0 (/ 2.0 (* r r))) (- (* (* 0.125 (+ 3.0 (* v -2.0))) (* w (* (* r w) (/ r (+ v -1.0))))) 4.5)))
double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (v * -2.0))) * (w * ((r * w) * (r / (v + -1.0))))) - 4.5);
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (3.0d0 + (2.0d0 / (r * r))) + (((0.125d0 * (3.0d0 + (v * (-2.0d0)))) * (w * ((r * w) * (r / (v + (-1.0d0)))))) - 4.5d0)
end function
public static double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (v * -2.0))) * (w * ((r * w) * (r / (v + -1.0))))) - 4.5);
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (v * -2.0))) * (w * ((r * w) * (r / (v + -1.0))))) - 4.5)
function code(v, w, r) return Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) * Float64(w * Float64(Float64(r * w) * Float64(r / Float64(v + -1.0))))) - 4.5)) end
function tmp = code(v, w, r) tmp = (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (v * -2.0))) * (w * ((r * w) * (r / (v + -1.0))))) - 4.5); end
code[v_, w_, r_] := N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(0.125 * N[(3.0 + N[(v * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * N[(N[(r * w), $MachinePrecision] * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \frac{2}{r \cdot r}\right) + \left(\left(0.125 \cdot \left(3 + v \cdot -2\right)\right) \cdot \left(w \cdot \left(\left(r \cdot w\right) \cdot \frac{r}{v + -1}\right)\right) - 4.5\right)
\end{array}
Initial program 82.4%
Simplified85.7%
associate-/l*85.7%
*-commutative85.7%
associate-*r/85.3%
associate-*l*95.9%
associate-*r*99.0%
add-sqr-sqrt47.9%
associate-*l*47.9%
add-sqr-sqrt26.5%
sqrt-prod33.7%
sqrt-prod33.7%
sqrt-prod71.8%
associate-*l*71.8%
*-commutative71.8%
associate-*l*71.4%
Applied egg-rr97.9%
Final simplification97.9%
(FPCore (v w r) :precision binary64 (- (+ 3.0 (/ 2.0 (* r r))) (- 4.5 (* (* 0.125 (+ 3.0 (* v -2.0))) (* w (* r (/ (* r w) (+ v -1.0))))))))
double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) - (4.5 - ((0.125 * (3.0 + (v * -2.0))) * (w * (r * ((r * w) / (v + -1.0))))));
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (3.0d0 + (2.0d0 / (r * r))) - (4.5d0 - ((0.125d0 * (3.0d0 + (v * (-2.0d0)))) * (w * (r * ((r * w) / (v + (-1.0d0)))))))
end function
public static double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) - (4.5 - ((0.125 * (3.0 + (v * -2.0))) * (w * (r * ((r * w) / (v + -1.0))))));
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) - (4.5 - ((0.125 * (3.0 + (v * -2.0))) * (w * (r * ((r * w) / (v + -1.0))))))
function code(v, w, r) return Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(4.5 - Float64(Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) * Float64(w * Float64(r * Float64(Float64(r * w) / Float64(v + -1.0))))))) end
function tmp = code(v, w, r) tmp = (3.0 + (2.0 / (r * r))) - (4.5 - ((0.125 * (3.0 + (v * -2.0))) * (w * (r * ((r * w) / (v + -1.0)))))); end
code[v_, w_, r_] := N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(4.5 - N[(N[(0.125 * N[(3.0 + N[(v * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r * N[(N[(r * w), $MachinePrecision] / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \frac{2}{r \cdot r}\right) - \left(4.5 - \left(0.125 \cdot \left(3 + v \cdot -2\right)\right) \cdot \left(w \cdot \left(r \cdot \frac{r \cdot w}{v + -1}\right)\right)\right)
\end{array}
Initial program 82.4%
Simplified85.7%
associate-/l*85.7%
*-commutative85.7%
associate-*r/85.3%
*-commutative85.3%
associate-*l*95.9%
associate-*l*97.9%
associate-*r/98.3%
Applied egg-rr98.3%
Final simplification98.3%
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (* (* r w) (* 0.375 (* r w)))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - ((r * w) * (0.375 * (r * w)))) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((3.0d0 + (2.0d0 / (r * r))) - ((r * w) * (0.375d0 * (r * w)))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - ((r * w) * (0.375 * (r * w)))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - ((r * w) * (0.375 * (r * w)))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(r * w) * Float64(0.375 * Float64(r * w)))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - ((r * w) * (0.375 * (r * w)))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(r * w), $MachinePrecision] * N[(0.375 * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \left(r \cdot w\right) \cdot \left(0.375 \cdot \left(r \cdot w\right)\right)\right) - 4.5
\end{array}
Initial program 82.4%
Applied egg-rr93.1%
Taylor expanded in v around 0 84.9%
Taylor expanded in v around 0 93.5%
Final simplification93.5%
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (* (* r w) (* r (* w 0.375)))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - ((r * w) * (r * (w * 0.375)))) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((3.0d0 + (2.0d0 / (r * r))) - ((r * w) * (r * (w * 0.375d0)))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - ((r * w) * (r * (w * 0.375)))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - ((r * w) * (r * (w * 0.375)))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(r * w) * Float64(r * Float64(w * 0.375)))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - ((r * w) * (r * (w * 0.375)))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(r * w), $MachinePrecision] * N[(r * N[(w * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \left(r \cdot w\right) \cdot \left(r \cdot \left(w \cdot 0.375\right)\right)\right) - 4.5
\end{array}
Initial program 82.4%
Applied egg-rr93.1%
Taylor expanded in r around 0 93.8%
Taylor expanded in v around 0 79.0%
Taylor expanded in v around 0 93.5%
*-commutative93.5%
associate-*l*93.5%
Simplified93.5%
Final simplification93.5%
herbie shell --seed 2024130
(FPCore (v w r)
:name "Rosa's TurbineBenchmark"
:precision binary64
(- (- (+ 3.0 (/ 2.0 (* r r))) (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v))) 4.5))