
(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 13 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 (+ (+ 3.0 (* (pow r -2.0) 2.0)) (- (* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (* w (/ r (+ v -1.0))))) 4.5)))
double code(double v, double w, double r) {
return (3.0 + (pow(r, -2.0) * 2.0)) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (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 + ((r ** (-2.0d0)) * 2.0d0)) + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * (w * (r / (v + (-1.0d0)))))) - 4.5d0)
end function
public static double code(double v, double w, double r) {
return (3.0 + (Math.pow(r, -2.0) * 2.0)) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (v + -1.0))))) - 4.5);
}
def code(v, w, r): return (3.0 + (math.pow(r, -2.0) * 2.0)) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (v + -1.0))))) - 4.5)
function code(v, w, r) return Float64(Float64(3.0 + Float64((r ^ -2.0) * 2.0)) + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) * Float64(w * Float64(r / Float64(v + -1.0))))) - 4.5)) end
function tmp = code(v, w, r) tmp = (3.0 + ((r ^ -2.0) * 2.0)) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (v + -1.0))))) - 4.5); end
code[v_, w_, r_] := N[(N[(3.0 + N[(N[Power[r, -2.0], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(w * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + {r}^{-2} \cdot 2\right) + \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\right) - 4.5\right)
\end{array}
Initial program 83.4%
associate--l-83.4%
associate-*l*76.4%
sqr-neg76.4%
associate-*l*83.4%
associate-/l*84.9%
fma-define84.9%
Simplified84.9%
associate-/l*84.9%
*-commutative84.9%
associate-*r/84.9%
associate-*l*96.0%
associate-*r*99.7%
Applied egg-rr99.7%
clear-num99.7%
associate-/r/99.7%
pow299.7%
pow-flip99.8%
metadata-eval99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(if (<= r 1.65e-111)
(- (+ 3.0 (/ 2.0 (* r r))) (+ 4.5 (* 0.375 (/ (* r w) (/ v (* r w))))))
(if (<= r 50.0)
(- (- -1.5 (* 0.375 (* r (* r (* w w))))) (* (/ 2.0 r) (/ -1.0 r)))
(-
3.0
(+
4.5
(* (* 0.125 (+ 3.0 (* -2.0 v))) (/ (* w (* r w)) (/ (- 1.0 v) r))))))))
double code(double v, double w, double r) {
double tmp;
if (r <= 1.65e-111) {
tmp = (3.0 + (2.0 / (r * r))) - (4.5 + (0.375 * ((r * w) / (v / (r * w)))));
} else if (r <= 50.0) {
tmp = (-1.5 - (0.375 * (r * (r * (w * w))))) - ((2.0 / r) * (-1.0 / r));
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((w * (r * w)) / ((1.0 - v) / r))));
}
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 (r <= 1.65d-111) then
tmp = (3.0d0 + (2.0d0 / (r * r))) - (4.5d0 + (0.375d0 * ((r * w) / (v / (r * w)))))
else if (r <= 50.0d0) then
tmp = ((-1.5d0) - (0.375d0 * (r * (r * (w * w))))) - ((2.0d0 / r) * ((-1.0d0) / r))
else
tmp = 3.0d0 - (4.5d0 + ((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((w * (r * w)) / ((1.0d0 - v) / r))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 1.65e-111) {
tmp = (3.0 + (2.0 / (r * r))) - (4.5 + (0.375 * ((r * w) / (v / (r * w)))));
} else if (r <= 50.0) {
tmp = (-1.5 - (0.375 * (r * (r * (w * w))))) - ((2.0 / r) * (-1.0 / r));
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((w * (r * w)) / ((1.0 - v) / r))));
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 1.65e-111: tmp = (3.0 + (2.0 / (r * r))) - (4.5 + (0.375 * ((r * w) / (v / (r * w))))) elif r <= 50.0: tmp = (-1.5 - (0.375 * (r * (r * (w * w))))) - ((2.0 / r) * (-1.0 / r)) else: tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((w * (r * w)) / ((1.0 - v) / r)))) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 1.65e-111) tmp = Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(4.5 + Float64(0.375 * Float64(Float64(r * w) / Float64(v / Float64(r * w)))))); elseif (r <= 50.0) tmp = Float64(Float64(-1.5 - Float64(0.375 * Float64(r * Float64(r * Float64(w * w))))) - Float64(Float64(2.0 / r) * Float64(-1.0 / r))); else tmp = Float64(3.0 - Float64(4.5 + Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(w * Float64(r * w)) / Float64(Float64(1.0 - v) / r))))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 1.65e-111) tmp = (3.0 + (2.0 / (r * r))) - (4.5 + (0.375 * ((r * w) / (v / (r * w))))); elseif (r <= 50.0) tmp = (-1.5 - (0.375 * (r * (r * (w * w))))) - ((2.0 / r) * (-1.0 / r)); else tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((w * (r * w)) / ((1.0 - v) / r)))); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 1.65e-111], N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(4.5 + N[(0.375 * N[(N[(r * w), $MachinePrecision] / N[(v / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[r, 50.0], N[(N[(-1.5 - N[(0.375 * N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(2.0 / r), $MachinePrecision] * N[(-1.0 / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 - N[(4.5 + N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 - v), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.65 \cdot 10^{-111}:\\
\;\;\;\;\left(3 + \frac{2}{r \cdot r}\right) - \left(4.5 + 0.375 \cdot \frac{r \cdot w}{\frac{v}{r \cdot w}}\right)\\
\mathbf{elif}\;r \leq 50:\\
\;\;\;\;\left(-1.5 - 0.375 \cdot \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right)\right) - \frac{2}{r} \cdot \frac{-1}{r}\\
\mathbf{else}:\\
\;\;\;\;3 - \left(4.5 + \left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \frac{w \cdot \left(r \cdot w\right)}{\frac{1 - v}{r}}\right)\\
\end{array}
\end{array}
if r < 1.65e-111Initial program 80.5%
associate--l-80.5%
associate-*l*74.4%
sqr-neg74.4%
associate-*l*80.5%
associate-/l*81.6%
fma-define81.6%
Simplified81.6%
associate-/l*81.6%
*-commutative81.6%
associate-*r/81.6%
associate-*l*95.4%
associate-*r*99.7%
Applied egg-rr99.7%
Taylor expanded in v around inf 82.8%
associate-*r/82.8%
mul-1-neg82.8%
*-commutative82.8%
distribute-rgt-neg-in82.8%
Simplified82.8%
Taylor expanded in v around 0 71.1%
clear-num71.1%
un-div-inv71.1%
*-commutative71.1%
add-sqr-sqrt46.9%
sqrt-unprod71.0%
sqr-neg71.0%
sqrt-prod24.8%
add-sqr-sqrt71.2%
Applied egg-rr71.2%
if 1.65e-111 < r < 50Initial program 76.8%
Simplified81.4%
Taylor expanded in v around 0 57.9%
associate-/r*58.1%
div-inv57.9%
Applied egg-rr57.9%
Taylor expanded in v around 0 69.9%
if 50 < r Initial program 95.0%
associate--l-95.0%
associate-*l*82.6%
sqr-neg82.6%
associate-*l*95.0%
associate-/l*96.7%
fma-define96.7%
Simplified96.7%
associate-/l*96.6%
*-commutative96.6%
associate-*r/96.6%
associate-*l*98.2%
associate-*r*99.7%
Applied egg-rr99.7%
Taylor expanded in r around inf 99.7%
associate-*r*99.9%
clear-num99.8%
un-div-inv99.8%
Applied egg-rr99.8%
Final simplification77.4%
(FPCore (v w r)
:precision binary64
(if (<= r 5e-113)
(- (+ 3.0 (/ 2.0 (* r r))) (+ 4.5 (* 0.375 (/ (* r w) (/ v (* r w))))))
(if (<= r 6e+37)
(- (- -1.5 (* 0.375 (* r (* r (* w w))))) (* (/ 2.0 r) (/ -1.0 r)))
(-
3.0
(+
(* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (* w (/ r (- 1.0 v)))))
4.5)))))
double code(double v, double w, double r) {
double tmp;
if (r <= 5e-113) {
tmp = (3.0 + (2.0 / (r * r))) - (4.5 + (0.375 * ((r * w) / (v / (r * w)))));
} else if (r <= 6e+37) {
tmp = (-1.5 - (0.375 * (r * (r * (w * w))))) - ((2.0 / r) * (-1.0 / r));
} else {
tmp = 3.0 - (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - 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) :: tmp
if (r <= 5d-113) then
tmp = (3.0d0 + (2.0d0 / (r * r))) - (4.5d0 + (0.375d0 * ((r * w) / (v / (r * w)))))
else if (r <= 6d+37) then
tmp = ((-1.5d0) - (0.375d0 * (r * (r * (w * w))))) - ((2.0d0 / r) * ((-1.0d0) / r))
else
tmp = 3.0d0 - (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * (w * (r / (1.0d0 - v))))) + 4.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 5e-113) {
tmp = (3.0 + (2.0 / (r * r))) - (4.5 + (0.375 * ((r * w) / (v / (r * w)))));
} else if (r <= 6e+37) {
tmp = (-1.5 - (0.375 * (r * (r * (w * w))))) - ((2.0 / r) * (-1.0 / r));
} else {
tmp = 3.0 - (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - v))))) + 4.5);
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 5e-113: tmp = (3.0 + (2.0 / (r * r))) - (4.5 + (0.375 * ((r * w) / (v / (r * w))))) elif r <= 6e+37: tmp = (-1.5 - (0.375 * (r * (r * (w * w))))) - ((2.0 / r) * (-1.0 / r)) else: tmp = 3.0 - (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - v))))) + 4.5) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 5e-113) tmp = Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(4.5 + Float64(0.375 * Float64(Float64(r * w) / Float64(v / Float64(r * w)))))); elseif (r <= 6e+37) tmp = Float64(Float64(-1.5 - Float64(0.375 * Float64(r * Float64(r * Float64(w * w))))) - Float64(Float64(2.0 / r) * Float64(-1.0 / r))); else tmp = Float64(3.0 - Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) * Float64(w * Float64(r / Float64(1.0 - v))))) + 4.5)); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 5e-113) tmp = (3.0 + (2.0 / (r * r))) - (4.5 + (0.375 * ((r * w) / (v / (r * w))))); elseif (r <= 6e+37) tmp = (-1.5 - (0.375 * (r * (r * (w * w))))) - ((2.0 / r) * (-1.0 / r)); else tmp = 3.0 - (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - v))))) + 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 5e-113], N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(4.5 + N[(0.375 * N[(N[(r * w), $MachinePrecision] / N[(v / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[r, 6e+37], N[(N[(-1.5 - N[(0.375 * N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(2.0 / r), $MachinePrecision] * N[(-1.0 / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 - N[(N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(w * N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 4.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 5 \cdot 10^{-113}:\\
\;\;\;\;\left(3 + \frac{2}{r \cdot r}\right) - \left(4.5 + 0.375 \cdot \frac{r \cdot w}{\frac{v}{r \cdot w}}\right)\\
\mathbf{elif}\;r \leq 6 \cdot 10^{+37}:\\
\;\;\;\;\left(-1.5 - 0.375 \cdot \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right)\right) - \frac{2}{r} \cdot \frac{-1}{r}\\
\mathbf{else}:\\
\;\;\;\;3 - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right)\\
\end{array}
\end{array}
if r < 4.9999999999999997e-113Initial program 80.5%
associate--l-80.5%
associate-*l*74.4%
sqr-neg74.4%
associate-*l*80.5%
associate-/l*81.6%
fma-define81.6%
Simplified81.6%
associate-/l*81.6%
*-commutative81.6%
associate-*r/81.6%
associate-*l*95.4%
associate-*r*99.7%
Applied egg-rr99.7%
Taylor expanded in v around inf 82.8%
associate-*r/82.8%
mul-1-neg82.8%
*-commutative82.8%
distribute-rgt-neg-in82.8%
Simplified82.8%
Taylor expanded in v around 0 71.1%
clear-num71.1%
un-div-inv71.1%
*-commutative71.1%
add-sqr-sqrt46.9%
sqrt-unprod71.0%
sqr-neg71.0%
sqrt-prod24.8%
add-sqr-sqrt71.2%
Applied egg-rr71.2%
if 4.9999999999999997e-113 < r < 6.00000000000000043e37Initial program 83.1%
Simplified86.4%
Taylor expanded in v around 0 69.4%
associate-/r*69.5%
div-inv69.4%
Applied egg-rr69.4%
Taylor expanded in v around 0 78.1%
if 6.00000000000000043e37 < r Initial program 94.2%
associate--l-94.2%
associate-*l*79.8%
sqr-neg79.8%
associate-*l*94.2%
associate-/l*96.2%
fma-define96.2%
Simplified96.2%
associate-/l*96.2%
*-commutative96.2%
associate-*r/96.2%
associate-*l*98.0%
associate-*r*99.8%
Applied egg-rr99.8%
Taylor expanded in r around inf 99.8%
Final simplification77.4%
(FPCore (v w r)
:precision binary64
(if (<= r 5.2e-113)
(- (+ 3.0 (/ 2.0 (* r r))) (+ 4.5 (* 0.375 (/ (* r w) (/ v (* r w))))))
(if (<= r 52.0)
(- (- -1.5 (* 0.375 (* r (* r (* w w))))) (* (/ 2.0 r) (/ -1.0 r)))
(-
3.0
(+
4.5
(* (* 0.125 (+ 3.0 (* -2.0 v))) (* w (* r (* w (/ r (- 1.0 v)))))))))))
double code(double v, double w, double r) {
double tmp;
if (r <= 5.2e-113) {
tmp = (3.0 + (2.0 / (r * r))) - (4.5 + (0.375 * ((r * w) / (v / (r * w)))));
} else if (r <= 52.0) {
tmp = (-1.5 - (0.375 * (r * (r * (w * w))))) - ((2.0 / r) * (-1.0 / r));
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * (w * (r * (w * (r / (1.0 - v)))))));
}
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 (r <= 5.2d-113) then
tmp = (3.0d0 + (2.0d0 / (r * r))) - (4.5d0 + (0.375d0 * ((r * w) / (v / (r * w)))))
else if (r <= 52.0d0) then
tmp = ((-1.5d0) - (0.375d0 * (r * (r * (w * w))))) - ((2.0d0 / r) * ((-1.0d0) / r))
else
tmp = 3.0d0 - (4.5d0 + ((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * (w * (r * (w * (r / (1.0d0 - v)))))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 5.2e-113) {
tmp = (3.0 + (2.0 / (r * r))) - (4.5 + (0.375 * ((r * w) / (v / (r * w)))));
} else if (r <= 52.0) {
tmp = (-1.5 - (0.375 * (r * (r * (w * w))))) - ((2.0 / r) * (-1.0 / r));
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * (w * (r * (w * (r / (1.0 - v)))))));
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 5.2e-113: tmp = (3.0 + (2.0 / (r * r))) - (4.5 + (0.375 * ((r * w) / (v / (r * w))))) elif r <= 52.0: tmp = (-1.5 - (0.375 * (r * (r * (w * w))))) - ((2.0 / r) * (-1.0 / r)) else: tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * (w * (r * (w * (r / (1.0 - v))))))) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 5.2e-113) tmp = Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(4.5 + Float64(0.375 * Float64(Float64(r * w) / Float64(v / Float64(r * w)))))); elseif (r <= 52.0) tmp = Float64(Float64(-1.5 - Float64(0.375 * Float64(r * Float64(r * Float64(w * w))))) - Float64(Float64(2.0 / r) * Float64(-1.0 / r))); else tmp = Float64(3.0 - Float64(4.5 + Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(w * Float64(r * Float64(w * Float64(r / Float64(1.0 - v)))))))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 5.2e-113) tmp = (3.0 + (2.0 / (r * r))) - (4.5 + (0.375 * ((r * w) / (v / (r * w))))); elseif (r <= 52.0) tmp = (-1.5 - (0.375 * (r * (r * (w * w))))) - ((2.0 / r) * (-1.0 / r)); else tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * (w * (r * (w * (r / (1.0 - v))))))); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 5.2e-113], N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(4.5 + N[(0.375 * N[(N[(r * w), $MachinePrecision] / N[(v / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[r, 52.0], N[(N[(-1.5 - N[(0.375 * N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(2.0 / r), $MachinePrecision] * N[(-1.0 / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 - N[(4.5 + N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r * N[(w * N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 5.2 \cdot 10^{-113}:\\
\;\;\;\;\left(3 + \frac{2}{r \cdot r}\right) - \left(4.5 + 0.375 \cdot \frac{r \cdot w}{\frac{v}{r \cdot w}}\right)\\
\mathbf{elif}\;r \leq 52:\\
\;\;\;\;\left(-1.5 - 0.375 \cdot \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right)\right) - \frac{2}{r} \cdot \frac{-1}{r}\\
\mathbf{else}:\\
\;\;\;\;3 - \left(4.5 + \left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(w \cdot \left(r \cdot \left(w \cdot \frac{r}{1 - v}\right)\right)\right)\right)\\
\end{array}
\end{array}
if r < 5.1999999999999998e-113Initial program 80.5%
associate--l-80.5%
associate-*l*74.4%
sqr-neg74.4%
associate-*l*80.5%
associate-/l*81.6%
fma-define81.6%
Simplified81.6%
associate-/l*81.6%
*-commutative81.6%
associate-*r/81.6%
associate-*l*95.4%
associate-*r*99.7%
Applied egg-rr99.7%
Taylor expanded in v around inf 82.8%
associate-*r/82.8%
mul-1-neg82.8%
*-commutative82.8%
distribute-rgt-neg-in82.8%
Simplified82.8%
Taylor expanded in v around 0 71.1%
clear-num71.1%
un-div-inv71.1%
*-commutative71.1%
add-sqr-sqrt46.9%
sqrt-unprod71.0%
sqr-neg71.0%
sqrt-prod24.8%
add-sqr-sqrt71.2%
Applied egg-rr71.2%
if 5.1999999999999998e-113 < r < 52Initial program 76.8%
Simplified81.4%
Taylor expanded in v around 0 57.9%
associate-/r*58.1%
div-inv57.9%
Applied egg-rr57.9%
Taylor expanded in v around 0 69.9%
if 52 < r Initial program 95.0%
associate--l-95.0%
associate-*l*82.6%
sqr-neg82.6%
associate-*l*95.0%
associate-/l*96.7%
fma-define96.7%
Simplified96.7%
associate-/l*96.6%
*-commutative96.6%
associate-*r/96.6%
*-commutative96.6%
associate-*l*98.2%
associate-*l*99.9%
Applied egg-rr99.9%
Taylor expanded in r around inf 99.9%
Final simplification77.4%
(FPCore (v w r) :precision binary64 (- (- 3.0 (/ (/ -1.0 r) (* r 0.5))) (+ (* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (* w (/ r (- 1.0 v))))) 4.5)))
double code(double v, double w, double r) {
return (3.0 - ((-1.0 / r) / (r * 0.5))) - (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (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 - (((-1.0d0) / r) / (r * 0.5d0))) - (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * (w * (r / (1.0d0 - v))))) + 4.5d0)
end function
public static double code(double v, double w, double r) {
return (3.0 - ((-1.0 / r) / (r * 0.5))) - (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - v))))) + 4.5);
}
def code(v, w, r): return (3.0 - ((-1.0 / r) / (r * 0.5))) - (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - v))))) + 4.5)
function code(v, w, r) return Float64(Float64(3.0 - Float64(Float64(-1.0 / r) / Float64(r * 0.5))) - Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) * Float64(w * Float64(r / Float64(1.0 - v))))) + 4.5)) end
function tmp = code(v, w, r) tmp = (3.0 - ((-1.0 / r) / (r * 0.5))) - (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - v))))) + 4.5); end
code[v_, w_, r_] := N[(N[(3.0 - N[(N[(-1.0 / r), $MachinePrecision] / N[(r * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(w * N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 4.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 - \frac{\frac{-1}{r}}{r \cdot 0.5}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right)
\end{array}
Initial program 83.4%
associate--l-83.4%
associate-*l*76.4%
sqr-neg76.4%
associate-*l*83.4%
associate-/l*84.9%
fma-define84.9%
Simplified84.9%
associate-/l*84.9%
*-commutative84.9%
associate-*r/84.9%
associate-*l*96.0%
associate-*r*99.7%
Applied egg-rr99.7%
clear-num99.7%
associate-/r/99.7%
pow299.7%
pow-flip99.8%
metadata-eval99.8%
Applied egg-rr99.8%
*-commutative99.8%
metadata-eval99.8%
metadata-eval99.8%
pow-sqr99.7%
inv-pow99.7%
inv-pow99.7%
un-div-inv99.8%
times-frac99.8%
*-un-lft-identity99.8%
associate-*l/99.7%
*-commutative99.7%
clear-num99.7%
un-div-inv99.8%
div-inv99.8%
metadata-eval99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (+ (+ 3.0 (/ 2.0 (* r r))) (- (* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (* 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 + (-2.0 * v))) * ((r * w) * (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 + ((-2.0d0) * v))) * ((r * w) * (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 + (-2.0 * v))) * ((r * w) * (w * (r / (v + -1.0))))) - 4.5);
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (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(-2.0 * v))) * Float64(Float64(r * w) * Float64(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 + (-2.0 * v))) * ((r * w) * (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[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(w * 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 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\right) - 4.5\right)
\end{array}
Initial program 83.4%
associate--l-83.4%
associate-*l*76.4%
sqr-neg76.4%
associate-*l*83.4%
associate-/l*84.9%
fma-define84.9%
Simplified84.9%
associate-/l*84.9%
*-commutative84.9%
associate-*r/84.9%
associate-*l*96.0%
associate-*r*99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (v w r)
:precision binary64
(if (<= r 41.0)
(+
(+ 3.0 (/ 2.0 (* r r)))
(- (* (* v -0.25) (* (* r w) (/ (* r w) v))) 4.5))
(+
3.0
(-
(* (* 0.125 (+ 3.0 (* -2.0 v))) (/ (* w (* r w)) (/ (+ v -1.0) r)))
4.5))))
double code(double v, double w, double r) {
double tmp;
if (r <= 41.0) {
tmp = (3.0 + (2.0 / (r * r))) + (((v * -0.25) * ((r * w) * ((r * w) / v))) - 4.5);
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((w * (r * w)) / ((v + -1.0) / r))) - 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 (r <= 41.0d0) then
tmp = (3.0d0 + (2.0d0 / (r * r))) + (((v * (-0.25d0)) * ((r * w) * ((r * w) / v))) - 4.5d0)
else
tmp = 3.0d0 + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((w * (r * w)) / ((v + (-1.0d0)) / r))) - 4.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 41.0) {
tmp = (3.0 + (2.0 / (r * r))) + (((v * -0.25) * ((r * w) * ((r * w) / v))) - 4.5);
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((w * (r * w)) / ((v + -1.0) / r))) - 4.5);
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 41.0: tmp = (3.0 + (2.0 / (r * r))) + (((v * -0.25) * ((r * w) * ((r * w) / v))) - 4.5) else: tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((w * (r * w)) / ((v + -1.0) / r))) - 4.5) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 41.0) tmp = Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) + Float64(Float64(Float64(v * -0.25) * Float64(Float64(r * w) * Float64(Float64(r * w) / v))) - 4.5)); else tmp = Float64(3.0 + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(w * Float64(r * w)) / Float64(Float64(v + -1.0) / r))) - 4.5)); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 41.0) tmp = (3.0 + (2.0 / (r * r))) + (((v * -0.25) * ((r * w) * ((r * w) / v))) - 4.5); else tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((w * (r * w)) / ((v + -1.0) / r))) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 41.0], N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(v * -0.25), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision], N[(3.0 + N[(N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision] / N[(N[(v + -1.0), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 41:\\
\;\;\;\;\left(3 + \frac{2}{r \cdot r}\right) + \left(\left(v \cdot -0.25\right) \cdot \left(\left(r \cdot w\right) \cdot \frac{r \cdot w}{v}\right) - 4.5\right)\\
\mathbf{else}:\\
\;\;\;\;3 + \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \frac{w \cdot \left(r \cdot w\right)}{\frac{v + -1}{r}} - 4.5\right)\\
\end{array}
\end{array}
if r < 41Initial program 80.1%
associate--l-80.1%
associate-*l*74.7%
sqr-neg74.7%
associate-*l*80.1%
associate-/l*81.6%
fma-define81.5%
Simplified81.6%
associate-/l*81.6%
*-commutative81.6%
associate-*r/81.6%
associate-*l*95.4%
associate-*r*99.7%
Applied egg-rr99.7%
Taylor expanded in v around inf 81.2%
associate-*r/81.2%
mul-1-neg81.2%
*-commutative81.2%
distribute-rgt-neg-in81.2%
Simplified81.2%
Taylor expanded in v around inf 89.2%
*-commutative89.2%
Simplified89.2%
if 41 < r Initial program 95.0%
associate--l-95.0%
associate-*l*82.6%
sqr-neg82.6%
associate-*l*95.0%
associate-/l*96.7%
fma-define96.7%
Simplified96.7%
associate-/l*96.6%
*-commutative96.6%
associate-*r/96.6%
associate-*l*98.2%
associate-*r*99.7%
Applied egg-rr99.7%
Taylor expanded in r around inf 99.7%
associate-*r*99.9%
clear-num99.8%
un-div-inv99.8%
Applied egg-rr99.8%
Final simplification91.6%
(FPCore (v w r) :precision binary64 (if (<= r 2.9e-113) (- (+ 3.0 (/ 2.0 (* r r))) (+ 4.5 (* 0.375 (/ (* r w) (/ v (* r w)))))) (- (- -1.5 (* 0.375 (* r (* r (* w w))))) (* (/ 2.0 r) (/ -1.0 r)))))
double code(double v, double w, double r) {
double tmp;
if (r <= 2.9e-113) {
tmp = (3.0 + (2.0 / (r * r))) - (4.5 + (0.375 * ((r * w) / (v / (r * w)))));
} else {
tmp = (-1.5 - (0.375 * (r * (r * (w * w))))) - ((2.0 / r) * (-1.0 / r));
}
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 (r <= 2.9d-113) then
tmp = (3.0d0 + (2.0d0 / (r * r))) - (4.5d0 + (0.375d0 * ((r * w) / (v / (r * w)))))
else
tmp = ((-1.5d0) - (0.375d0 * (r * (r * (w * w))))) - ((2.0d0 / r) * ((-1.0d0) / r))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 2.9e-113) {
tmp = (3.0 + (2.0 / (r * r))) - (4.5 + (0.375 * ((r * w) / (v / (r * w)))));
} else {
tmp = (-1.5 - (0.375 * (r * (r * (w * w))))) - ((2.0 / r) * (-1.0 / r));
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 2.9e-113: tmp = (3.0 + (2.0 / (r * r))) - (4.5 + (0.375 * ((r * w) / (v / (r * w))))) else: tmp = (-1.5 - (0.375 * (r * (r * (w * w))))) - ((2.0 / r) * (-1.0 / r)) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 2.9e-113) tmp = Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(4.5 + Float64(0.375 * Float64(Float64(r * w) / Float64(v / Float64(r * w)))))); else tmp = Float64(Float64(-1.5 - Float64(0.375 * Float64(r * Float64(r * Float64(w * w))))) - Float64(Float64(2.0 / r) * Float64(-1.0 / r))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 2.9e-113) tmp = (3.0 + (2.0 / (r * r))) - (4.5 + (0.375 * ((r * w) / (v / (r * w))))); else tmp = (-1.5 - (0.375 * (r * (r * (w * w))))) - ((2.0 / r) * (-1.0 / r)); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 2.9e-113], N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(4.5 + N[(0.375 * N[(N[(r * w), $MachinePrecision] / N[(v / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.5 - N[(0.375 * N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(2.0 / r), $MachinePrecision] * N[(-1.0 / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 2.9 \cdot 10^{-113}:\\
\;\;\;\;\left(3 + \frac{2}{r \cdot r}\right) - \left(4.5 + 0.375 \cdot \frac{r \cdot w}{\frac{v}{r \cdot w}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-1.5 - 0.375 \cdot \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right)\right) - \frac{2}{r} \cdot \frac{-1}{r}\\
\end{array}
\end{array}
if r < 2.90000000000000004e-113Initial program 80.5%
associate--l-80.5%
associate-*l*74.4%
sqr-neg74.4%
associate-*l*80.5%
associate-/l*81.6%
fma-define81.6%
Simplified81.6%
associate-/l*81.6%
*-commutative81.6%
associate-*r/81.6%
associate-*l*95.4%
associate-*r*99.7%
Applied egg-rr99.7%
Taylor expanded in v around inf 82.8%
associate-*r/82.8%
mul-1-neg82.8%
*-commutative82.8%
distribute-rgt-neg-in82.8%
Simplified82.8%
Taylor expanded in v around 0 71.1%
clear-num71.1%
un-div-inv71.1%
*-commutative71.1%
add-sqr-sqrt46.9%
sqrt-unprod71.0%
sqr-neg71.0%
sqrt-prod24.8%
add-sqr-sqrt71.2%
Applied egg-rr71.2%
if 2.90000000000000004e-113 < r Initial program 90.1%
Simplified92.5%
Taylor expanded in v around 0 73.7%
associate-/r*73.7%
div-inv73.7%
Applied egg-rr73.7%
Taylor expanded in v around 0 87.4%
Final simplification76.1%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (+ -1.5 (/ (+ (* v -0.25) 0.375) (/ (+ v -1.0) (* (* r w) (* r w)))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) / ((v + -1.0) / ((r * w) * (r * w)))));
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (2.0d0 / (r * r)) + ((-1.5d0) + (((v * (-0.25d0)) + 0.375d0) / ((v + (-1.0d0)) / ((r * w) * (r * w)))))
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) / ((v + -1.0) / ((r * w) * (r * w)))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) / ((v + -1.0) / ((r * w) * (r * w)))))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(Float64(Float64(v * -0.25) + 0.375) / Float64(Float64(v + -1.0) / Float64(Float64(r * w) * Float64(r * w)))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) / ((v + -1.0) / ((r * w) * (r * w))))); end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(N[(N[(v * -0.25), $MachinePrecision] + 0.375), $MachinePrecision] / N[(N[(v + -1.0), $MachinePrecision] / N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 + \frac{v \cdot -0.25 + 0.375}{\frac{v + -1}{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}}\right)
\end{array}
Initial program 83.4%
Simplified84.9%
fma-undefine84.9%
*-commutative84.9%
+-commutative84.9%
associate-*r/84.9%
*-commutative84.9%
associate-/l*84.9%
clear-num84.9%
un-div-inv85.0%
+-commutative85.0%
distribute-rgt-in85.0%
*-commutative85.0%
associate-*l*85.0%
metadata-eval85.0%
metadata-eval85.0%
associate-*r*77.6%
pow277.6%
pow277.6%
pow-prod-down99.7%
Applied egg-rr99.7%
unpow299.7%
*-commutative99.7%
*-commutative99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (v w r) :precision binary64 (if (<= r 3.5e-124) (- 3.0 (+ 4.5 (* 0.375 (* (* r w) (* r (+ w (* v w))))))) (- 3.0 (+ 4.5 (* 0.375 (* (* r w) (* r w)))))))
double code(double v, double w, double r) {
double tmp;
if (r <= 3.5e-124) {
tmp = 3.0 - (4.5 + (0.375 * ((r * w) * (r * (w + (v * w))))));
} else {
tmp = 3.0 - (4.5 + (0.375 * ((r * w) * (r * w))));
}
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 (r <= 3.5d-124) then
tmp = 3.0d0 - (4.5d0 + (0.375d0 * ((r * w) * (r * (w + (v * w))))))
else
tmp = 3.0d0 - (4.5d0 + (0.375d0 * ((r * w) * (r * w))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 3.5e-124) {
tmp = 3.0 - (4.5 + (0.375 * ((r * w) * (r * (w + (v * w))))));
} else {
tmp = 3.0 - (4.5 + (0.375 * ((r * w) * (r * w))));
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 3.5e-124: tmp = 3.0 - (4.5 + (0.375 * ((r * w) * (r * (w + (v * w)))))) else: tmp = 3.0 - (4.5 + (0.375 * ((r * w) * (r * w)))) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 3.5e-124) tmp = Float64(3.0 - Float64(4.5 + Float64(0.375 * Float64(Float64(r * w) * Float64(r * Float64(w + Float64(v * w))))))); else tmp = Float64(3.0 - Float64(4.5 + Float64(0.375 * Float64(Float64(r * w) * Float64(r * w))))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 3.5e-124) tmp = 3.0 - (4.5 + (0.375 * ((r * w) * (r * (w + (v * w)))))); else tmp = 3.0 - (4.5 + (0.375 * ((r * w) * (r * w)))); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 3.5e-124], N[(3.0 - N[(4.5 + N[(0.375 * N[(N[(r * w), $MachinePrecision] * N[(r * N[(w + N[(v * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 - N[(4.5 + N[(0.375 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 3.5 \cdot 10^{-124}:\\
\;\;\;\;3 - \left(4.5 + 0.375 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot \left(w + v \cdot w\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;3 - \left(4.5 + 0.375 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\
\end{array}
\end{array}
if r < 3.4999999999999999e-124Initial program 80.4%
associate--l-80.4%
associate-*l*74.3%
sqr-neg74.3%
associate-*l*80.4%
associate-/l*81.5%
fma-define81.5%
Simplified81.5%
associate-/l*81.5%
*-commutative81.5%
associate-*r/81.5%
associate-*l*95.4%
associate-*r*99.7%
Applied egg-rr99.7%
Taylor expanded in r around inf 40.6%
Taylor expanded in v around 0 29.2%
Taylor expanded in v around 0 27.4%
distribute-lft-out28.0%
*-commutative28.0%
Simplified28.0%
if 3.4999999999999999e-124 < r Initial program 90.2%
associate--l-90.2%
associate-*l*81.3%
sqr-neg81.3%
associate-*l*90.2%
associate-/l*92.6%
fma-define92.6%
Simplified92.6%
associate-/l*92.6%
*-commutative92.6%
associate-*r/92.6%
associate-*l*97.5%
associate-*r*99.7%
Applied egg-rr99.7%
Taylor expanded in r around inf 86.4%
Taylor expanded in v around 0 62.1%
Taylor expanded in v around 0 79.4%
*-commutative79.4%
Simplified79.4%
Final simplification43.9%
(FPCore (v w r) :precision binary64 (- (- -1.5 (* 0.375 (* r (* r (* w w))))) (* (/ 2.0 r) (/ -1.0 r))))
double code(double v, double w, double r) {
return (-1.5 - (0.375 * (r * (r * (w * w))))) - ((2.0 / r) * (-1.0 / r));
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((-1.5d0) - (0.375d0 * (r * (r * (w * w))))) - ((2.0d0 / r) * ((-1.0d0) / r))
end function
public static double code(double v, double w, double r) {
return (-1.5 - (0.375 * (r * (r * (w * w))))) - ((2.0 / r) * (-1.0 / r));
}
def code(v, w, r): return (-1.5 - (0.375 * (r * (r * (w * w))))) - ((2.0 / r) * (-1.0 / r))
function code(v, w, r) return Float64(Float64(-1.5 - Float64(0.375 * Float64(r * Float64(r * Float64(w * w))))) - Float64(Float64(2.0 / r) * Float64(-1.0 / r))) end
function tmp = code(v, w, r) tmp = (-1.5 - (0.375 * (r * (r * (w * w))))) - ((2.0 / r) * (-1.0 / r)); end
code[v_, w_, r_] := N[(N[(-1.5 - N[(0.375 * N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(2.0 / r), $MachinePrecision] * N[(-1.0 / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-1.5 - 0.375 \cdot \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right)\right) - \frac{2}{r} \cdot \frac{-1}{r}
\end{array}
Initial program 83.4%
Simplified84.9%
Taylor expanded in v around 0 73.2%
associate-/r*73.2%
div-inv73.2%
Applied egg-rr73.2%
Taylor expanded in v around 0 81.2%
Final simplification81.2%
(FPCore (v w r) :precision binary64 (- 3.0 (+ 4.5 (* 0.375 (* (* r w) (* r w))))))
double code(double v, double w, double r) {
return 3.0 - (4.5 + (0.375 * ((r * w) * (r * w))));
}
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 - (4.5d0 + (0.375d0 * ((r * w) * (r * w))))
end function
public static double code(double v, double w, double r) {
return 3.0 - (4.5 + (0.375 * ((r * w) * (r * w))));
}
def code(v, w, r): return 3.0 - (4.5 + (0.375 * ((r * w) * (r * w))))
function code(v, w, r) return Float64(3.0 - Float64(4.5 + Float64(0.375 * Float64(Float64(r * w) * Float64(r * w))))) end
function tmp = code(v, w, r) tmp = 3.0 - (4.5 + (0.375 * ((r * w) * (r * w)))); end
code[v_, w_, r_] := N[(3.0 - N[(4.5 + N[(0.375 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
3 - \left(4.5 + 0.375 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)
\end{array}
Initial program 83.4%
associate--l-83.4%
associate-*l*76.4%
sqr-neg76.4%
associate-*l*83.4%
associate-/l*84.9%
fma-define84.9%
Simplified84.9%
associate-/l*84.9%
*-commutative84.9%
associate-*r/84.9%
associate-*l*96.0%
associate-*r*99.7%
Applied egg-rr99.7%
Taylor expanded in r around inf 54.7%
Taylor expanded in v around 0 39.3%
Taylor expanded in v around 0 48.8%
*-commutative48.8%
Simplified48.8%
Final simplification48.8%
(FPCore (v w r) :precision binary64 -1.5)
double code(double v, double w, double r) {
return -1.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = -1.5d0
end function
public static double code(double v, double w, double r) {
return -1.5;
}
def code(v, w, r): return -1.5
function code(v, w, r) return -1.5 end
function tmp = code(v, w, r) tmp = -1.5; end
code[v_, w_, r_] := -1.5
\begin{array}{l}
\\
-1.5
\end{array}
Initial program 83.4%
associate--l-83.4%
associate-*l*76.4%
sqr-neg76.4%
associate-*l*83.4%
associate-/l*84.9%
fma-define84.9%
Simplified84.9%
associate-/l*84.9%
*-commutative84.9%
associate-*r/84.9%
associate-*l*96.0%
associate-*r*99.7%
Applied egg-rr99.7%
Taylor expanded in r around inf 54.7%
Taylor expanded in v around 0 39.3%
Taylor expanded in r around 0 15.7%
herbie shell --seed 2024176
(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))