
(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 12 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 (/ 2.0 (* r r))))
(if (<= v -3e+158)
(+ t_0 (- -1.5 (* (* r (* w (* r w))) 0.25)))
(if (<= v 5.2e+42)
(-
(+
(+ 3.0 t_0)
(* (* w (* r (+ 0.375 (* v -0.25)))) (/ w (/ (+ v -1.0) r))))
4.5)
(+ t_0 (+ -1.5 (* 0.25 (/ (* r w) (/ -1.0 (* r w))))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (v <= -3e+158) {
tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25));
} else if (v <= 5.2e+42) {
tmp = ((3.0 + t_0) + ((w * (r * (0.375 + (v * -0.25)))) * (w / ((v + -1.0) / r)))) - 4.5;
} else {
tmp = t_0 + (-1.5 + (0.25 * ((r * w) / (-1.0 / (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) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if (v <= (-3d+158)) then
tmp = t_0 + ((-1.5d0) - ((r * (w * (r * w))) * 0.25d0))
else if (v <= 5.2d+42) then
tmp = ((3.0d0 + t_0) + ((w * (r * (0.375d0 + (v * (-0.25d0))))) * (w / ((v + (-1.0d0)) / r)))) - 4.5d0
else
tmp = t_0 + ((-1.5d0) + (0.25d0 * ((r * w) / ((-1.0d0) / (r * w)))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (v <= -3e+158) {
tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25));
} else if (v <= 5.2e+42) {
tmp = ((3.0 + t_0) + ((w * (r * (0.375 + (v * -0.25)))) * (w / ((v + -1.0) / r)))) - 4.5;
} else {
tmp = t_0 + (-1.5 + (0.25 * ((r * w) / (-1.0 / (r * w)))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if v <= -3e+158: tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25)) elif v <= 5.2e+42: tmp = ((3.0 + t_0) + ((w * (r * (0.375 + (v * -0.25)))) * (w / ((v + -1.0) / r)))) - 4.5 else: tmp = t_0 + (-1.5 + (0.25 * ((r * w) / (-1.0 / (r * w))))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (v <= -3e+158) tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(r * Float64(w * Float64(r * w))) * 0.25))); elseif (v <= 5.2e+42) tmp = Float64(Float64(Float64(3.0 + t_0) + Float64(Float64(w * Float64(r * Float64(0.375 + Float64(v * -0.25)))) * Float64(w / Float64(Float64(v + -1.0) / r)))) - 4.5); else tmp = Float64(t_0 + Float64(-1.5 + Float64(0.25 * Float64(Float64(r * w) / Float64(-1.0 / Float64(r * w)))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (v <= -3e+158) tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25)); elseif (v <= 5.2e+42) tmp = ((3.0 + t_0) + ((w * (r * (0.375 + (v * -0.25)))) * (w / ((v + -1.0) / r)))) - 4.5; else tmp = t_0 + (-1.5 + (0.25 * ((r * w) / (-1.0 / (r * w))))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, -3e+158], N[(t$95$0 + N[(-1.5 - N[(N[(r * N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[v, 5.2e+42], N[(N[(N[(3.0 + t$95$0), $MachinePrecision] + N[(N[(w * N[(r * N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w / N[(N[(v + -1.0), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(t$95$0 + N[(-1.5 + N[(0.25 * N[(N[(r * w), $MachinePrecision] / N[(-1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -3 \cdot 10^{+158}:\\
\;\;\;\;t\_0 + \left(-1.5 - \left(r \cdot \left(w \cdot \left(r \cdot w\right)\right)\right) \cdot 0.25\right)\\
\mathbf{elif}\;v \leq 5.2 \cdot 10^{+42}:\\
\;\;\;\;\left(\left(3 + t\_0\right) + \left(w \cdot \left(r \cdot \left(0.375 + v \cdot -0.25\right)\right)\right) \cdot \frac{w}{\frac{v + -1}{r}}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \left(-1.5 + 0.25 \cdot \frac{r \cdot w}{\frac{-1}{r \cdot w}}\right)\\
\end{array}
\end{array}
if v < -3e158Initial program 84.3%
Simplified89.1%
Taylor expanded in v around inf 72.4%
*-commutative72.4%
*-commutative72.4%
unpow272.4%
unpow272.4%
swap-sqr99.7%
unpow299.7%
*-commutative99.7%
Simplified99.7%
*-commutative99.7%
pow299.7%
remove-double-div99.7%
remove-double-div99.7%
frac-times99.6%
metadata-eval99.6%
Applied egg-rr99.6%
frac-times99.7%
metadata-eval99.7%
pow299.7%
*-commutative99.7%
remove-double-div99.7%
*-commutative99.7%
pow299.7%
associate-*r*99.8%
Applied egg-rr99.8%
if -3e158 < v < 5.1999999999999998e42Initial program 88.5%
associate-/l*88.5%
cancel-sign-sub-inv88.5%
metadata-eval88.5%
+-commutative88.5%
*-commutative88.5%
fma-undefine88.5%
*-commutative88.5%
*-commutative88.5%
associate-/l*88.5%
*-commutative88.5%
associate-*r/88.5%
associate-*r*88.5%
associate-*l*97.5%
associate-*r*99.8%
Applied egg-rr99.8%
if 5.1999999999999998e42 < v Initial program 76.9%
Simplified88.3%
Taylor expanded in v around inf 79.8%
*-commutative79.8%
*-commutative79.8%
unpow279.8%
unpow279.8%
swap-sqr99.8%
unpow299.8%
*-commutative99.8%
Simplified99.8%
*-commutative99.8%
pow299.8%
remove-double-div99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= v -2200.0)
(+ t_0 (- -1.5 (* (* r (* w (* r w))) 0.25)))
(if (<= v 3.65e-68)
(+ t_0 (- -1.5 (* 0.375 (* (* r w) (* r w)))))
(+ t_0 (+ -1.5 (* 0.25 (/ (* r w) (/ -1.0 (* r w))))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (v <= -2200.0) {
tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25));
} else if (v <= 3.65e-68) {
tmp = t_0 + (-1.5 - (0.375 * ((r * w) * (r * w))));
} else {
tmp = t_0 + (-1.5 + (0.25 * ((r * w) / (-1.0 / (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) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if (v <= (-2200.0d0)) then
tmp = t_0 + ((-1.5d0) - ((r * (w * (r * w))) * 0.25d0))
else if (v <= 3.65d-68) then
tmp = t_0 + ((-1.5d0) - (0.375d0 * ((r * w) * (r * w))))
else
tmp = t_0 + ((-1.5d0) + (0.25d0 * ((r * w) / ((-1.0d0) / (r * w)))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (v <= -2200.0) {
tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25));
} else if (v <= 3.65e-68) {
tmp = t_0 + (-1.5 - (0.375 * ((r * w) * (r * w))));
} else {
tmp = t_0 + (-1.5 + (0.25 * ((r * w) / (-1.0 / (r * w)))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if v <= -2200.0: tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25)) elif v <= 3.65e-68: tmp = t_0 + (-1.5 - (0.375 * ((r * w) * (r * w)))) else: tmp = t_0 + (-1.5 + (0.25 * ((r * w) / (-1.0 / (r * w))))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (v <= -2200.0) tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(r * Float64(w * Float64(r * w))) * 0.25))); elseif (v <= 3.65e-68) tmp = Float64(t_0 + Float64(-1.5 - Float64(0.375 * Float64(Float64(r * w) * Float64(r * w))))); else tmp = Float64(t_0 + Float64(-1.5 + Float64(0.25 * Float64(Float64(r * w) / Float64(-1.0 / Float64(r * w)))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (v <= -2200.0) tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25)); elseif (v <= 3.65e-68) tmp = t_0 + (-1.5 - (0.375 * ((r * w) * (r * w)))); else tmp = t_0 + (-1.5 + (0.25 * ((r * w) / (-1.0 / (r * w))))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, -2200.0], N[(t$95$0 + N[(-1.5 - N[(N[(r * N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[v, 3.65e-68], N[(t$95$0 + N[(-1.5 - N[(0.375 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.5 + N[(0.25 * N[(N[(r * w), $MachinePrecision] / N[(-1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -2200:\\
\;\;\;\;t\_0 + \left(-1.5 - \left(r \cdot \left(w \cdot \left(r \cdot w\right)\right)\right) \cdot 0.25\right)\\
\mathbf{elif}\;v \leq 3.65 \cdot 10^{-68}:\\
\;\;\;\;t\_0 + \left(-1.5 - 0.375 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \left(-1.5 + 0.25 \cdot \frac{r \cdot w}{\frac{-1}{r \cdot w}}\right)\\
\end{array}
\end{array}
if v < -2200Initial program 89.9%
Simplified92.4%
Taylor expanded in v around inf 79.5%
*-commutative79.5%
*-commutative79.5%
unpow279.5%
unpow279.5%
swap-sqr98.8%
unpow298.8%
*-commutative98.8%
Simplified98.8%
*-commutative98.8%
pow298.8%
remove-double-div98.8%
remove-double-div98.8%
frac-times98.8%
metadata-eval98.8%
Applied egg-rr98.8%
frac-times98.8%
metadata-eval98.8%
pow298.8%
*-commutative98.8%
remove-double-div98.8%
*-commutative98.8%
pow298.8%
associate-*r*98.9%
Applied egg-rr98.9%
if -2200 < v < 3.65000000000000005e-68Initial program 85.3%
Simplified85.3%
Taylor expanded in v around 0 78.9%
*-commutative78.9%
*-commutative78.9%
unpow278.9%
unpow278.9%
swap-sqr99.8%
unpow299.8%
*-commutative99.8%
Simplified99.8%
*-commutative85.3%
pow285.3%
Applied egg-rr99.8%
if 3.65000000000000005e-68 < v Initial program 82.4%
Simplified91.1%
Taylor expanded in v around inf 84.6%
*-commutative84.6%
*-commutative84.6%
unpow284.6%
unpow284.6%
swap-sqr99.9%
unpow299.9%
*-commutative99.9%
Simplified99.9%
*-commutative99.9%
pow299.9%
remove-double-div99.9%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification99.6%
(FPCore (v w r) :precision binary64 (+ (+ 3.0 (/ 2.0 (* r r))) (- (* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (/ (* r w) (+ 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) * ((r * w) / (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) * ((r * w) / (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) * ((r * w) / (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) * ((r * w) / (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(Float64(r * w) / 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) * ((r * w) / (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[(N[(r * w), $MachinePrecision] / N[(v + -1.0), $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 \frac{r \cdot w}{v + -1}\right) - 4.5\right)
\end{array}
Initial program 85.8%
associate--l-85.8%
associate-*l*78.9%
sqr-neg78.9%
associate-*l*85.8%
associate-/l*89.3%
fma-define89.4%
Simplified89.3%
*-un-lft-identity89.3%
add-sqr-sqrt89.3%
times-frac89.3%
*-commutative89.3%
sqrt-prod41.4%
*-commutative41.4%
sqrt-prod41.4%
sqrt-prod19.5%
add-sqr-sqrt30.2%
associate-*r*30.2%
add-sqr-sqrt70.3%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (v w r) :precision binary64 (- (+ 3.0 (/ 2.0 (* r r))) (+ 4.5 (* (* 0.125 (+ 3.0 (* -2.0 v))) (* w (* (* r w) (/ r (- 1.0 v))))))))
double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * (w * ((r * w) * (r / (1.0 - v))))));
}
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 + ((-2.0d0) * v))) * (w * ((r * w) * (r / (1.0d0 - v))))))
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 + (-2.0 * v))) * (w * ((r * w) * (r / (1.0 - v))))));
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * (w * ((r * w) * (r / (1.0 - v))))))
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(-2.0 * v))) * Float64(w * Float64(Float64(r * w) * Float64(r / Float64(1.0 - v))))))) end
function tmp = code(v, w, r) tmp = (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * (w * ((r * w) * (r / (1.0 - v)))))); 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[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * N[(N[(r * w), $MachinePrecision] * N[(r / N[(1.0 - v), $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 + -2 \cdot v\right)\right) \cdot \left(w \cdot \left(\left(r \cdot w\right) \cdot \frac{r}{1 - v}\right)\right)\right)
\end{array}
Initial program 85.8%
associate--l-85.8%
associate-*l*78.9%
sqr-neg78.9%
associate-*l*85.8%
associate-/l*89.3%
fma-define89.4%
Simplified89.3%
associate-/l*89.0%
*-commutative89.0%
associate-*r/88.6%
associate-*r*88.9%
*-commutative88.9%
associate-*l*96.7%
add-sqr-sqrt42.9%
associate-*r*42.9%
add-sqr-sqrt20.7%
sqrt-prod30.2%
sqrt-prod30.2%
*-commutative30.2%
sqrt-prod69.5%
*-commutative69.5%
associate-*l*69.5%
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 (* -2.0 v))) (* w (* r (/ w (/ (- 1.0 v) r))))))))
double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * (w * (r * (w / ((1.0 - v) / r))))));
}
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 + ((-2.0d0) * v))) * (w * (r * (w / ((1.0d0 - v) / r))))))
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 + (-2.0 * v))) * (w * (r * (w / ((1.0 - v) / r))))));
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * (w * (r * (w / ((1.0 - v) / r))))))
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(-2.0 * v))) * Float64(w * Float64(r * Float64(w / Float64(Float64(1.0 - v) / r))))))) end
function tmp = code(v, w, r) tmp = (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * (w * (r * (w / ((1.0 - v) / r)))))); 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[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r * N[(w / N[(N[(1.0 - v), $MachinePrecision] / r), $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 + -2 \cdot v\right)\right) \cdot \left(w \cdot \left(r \cdot \frac{w}{\frac{1 - v}{r}}\right)\right)\right)
\end{array}
Initial program 85.8%
associate--l-85.8%
associate-*l*78.9%
sqr-neg78.9%
associate-*l*85.8%
associate-/l*89.3%
fma-define89.4%
Simplified89.3%
associate-/l*89.0%
*-commutative89.0%
associate-*r/88.6%
*-commutative88.6%
associate-*l*96.2%
associate-*l*97.9%
clear-num97.9%
un-div-inv97.9%
Applied egg-rr97.9%
Final simplification97.9%
(FPCore (v w r) :precision binary64 (+ (+ 3.0 (/ 2.0 (* r r))) (- (* (* 0.125 (+ 3.0 (* -2.0 v))) (* w (/ r (/ (+ v -1.0) (* r w))))) 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 * (r / ((v + -1.0) / (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))) + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * (w * (r / ((v + (-1.0d0)) / (r * w))))) - 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 * (r / ((v + -1.0) / (r * w))))) - 4.5);
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * (w * (r / ((v + -1.0) / (r * w))))) - 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(w * Float64(r / Float64(Float64(v + -1.0) / Float64(r * w))))) - 4.5)) end
function tmp = code(v, w, r) tmp = (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * (w * (r / ((v + -1.0) / (r * w))))) - 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[(w * N[(r / N[(N[(v + -1.0), $MachinePrecision] / N[(r * w), $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(w \cdot \frac{r}{\frac{v + -1}{r \cdot w}}\right) - 4.5\right)
\end{array}
Initial program 85.8%
associate--l-85.8%
associate-*l*78.9%
sqr-neg78.9%
associate-*l*85.8%
associate-/l*89.3%
fma-define89.4%
Simplified89.3%
associate-/l*89.0%
*-commutative89.0%
associate-*r/88.6%
*-commutative88.6%
associate-*l*96.2%
associate-*l*97.9%
clear-num97.9%
un-div-inv97.9%
Applied egg-rr97.9%
div-inv97.9%
clear-num97.9%
associate-/l*98.7%
*-commutative98.7%
clear-num98.7%
un-div-inv98.7%
Applied egg-rr98.7%
Final simplification98.7%
(FPCore (v w r) :precision binary64 (- (+ 3.0 (/ 2.0 (* r r))) (+ 4.5 (* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (/ w (/ (- 1.0 v) r)))))))
double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w / ((1.0 - v) / r)))));
}
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 + ((-2.0d0) * v))) * ((r * w) * (w / ((1.0d0 - v) / r)))))
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 + (-2.0 * v))) * ((r * w) * (w / ((1.0 - v) / r)))));
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w / ((1.0 - v) / r)))))
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(-2.0 * v))) * Float64(Float64(r * w) * Float64(w / Float64(Float64(1.0 - v) / r)))))) end
function tmp = code(v, w, r) tmp = (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w / ((1.0 - v) / r))))); 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[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(w / N[(N[(1.0 - v), $MachinePrecision] / r), $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 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \frac{w}{\frac{1 - v}{r}}\right)\right)
\end{array}
Initial program 85.8%
associate--l-85.8%
associate-*l*78.9%
sqr-neg78.9%
associate-*l*85.8%
associate-/l*89.3%
fma-define89.4%
Simplified89.3%
associate-/l*89.0%
*-commutative89.0%
associate-*r/88.6%
associate-*l*96.2%
associate-*r*99.0%
add-sqr-sqrt43.7%
associate-*l*43.7%
add-sqr-sqrt21.1%
sqrt-prod30.2%
sqrt-prod30.2%
sqrt-prod69.5%
*-commutative69.5%
sqrt-prod30.2%
*-commutative30.2%
sqrt-prod30.2%
sqrt-prod21.1%
add-sqr-sqrt43.7%
associate-*r*43.7%
add-sqr-sqrt99.0%
clear-num99.0%
un-div-inv99.0%
Applied egg-rr99.0%
Final simplification99.0%
(FPCore (v w r) :precision binary64 (- (+ 3.0 (/ 2.0 (* r r))) (+ 4.5 (* (* 0.125 (+ 3.0 (* -2.0 v))) (/ w (/ (/ (- 1.0 v) (* r w)) r))))))
double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * (w / (((1.0 - v) / (r * w)) / r))));
}
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 + ((-2.0d0) * v))) * (w / (((1.0d0 - v) / (r * w)) / r))))
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 + (-2.0 * v))) * (w / (((1.0 - v) / (r * w)) / r))));
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * (w / (((1.0 - v) / (r * w)) / r))))
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(-2.0 * v))) * Float64(w / Float64(Float64(Float64(1.0 - v) / Float64(r * w)) / r))))) end
function tmp = code(v, w, r) tmp = (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * (w / (((1.0 - v) / (r * w)) / r)))); 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[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w / N[(N[(N[(1.0 - v), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision] / r), $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 + -2 \cdot v\right)\right) \cdot \frac{w}{\frac{\frac{1 - v}{r \cdot w}}{r}}\right)
\end{array}
Initial program 85.8%
associate--l-85.8%
associate-*l*78.9%
sqr-neg78.9%
associate-*l*85.8%
associate-/l*89.3%
fma-define89.4%
Simplified89.3%
associate-/l*89.0%
*-commutative89.0%
associate-*r/88.6%
*-commutative88.6%
associate-*l*96.2%
associate-*l*97.9%
clear-num97.9%
un-div-inv97.9%
Applied egg-rr97.9%
div-inv97.9%
clear-num97.9%
associate-/l*98.7%
*-commutative98.7%
clear-num98.7%
un-div-inv98.7%
Applied egg-rr98.7%
clear-num98.7%
un-div-inv99.0%
Applied egg-rr99.0%
Final simplification99.0%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* (* r w) (* r w))) (t_1 (/ 2.0 (* r r))))
(if (or (<= v -200.0) (not (<= v 3.65e-68)))
(+ t_1 (- -1.5 (* 0.25 t_0)))
(+ t_1 (- -1.5 (* 0.375 t_0))))))
double code(double v, double w, double r) {
double t_0 = (r * w) * (r * w);
double t_1 = 2.0 / (r * r);
double tmp;
if ((v <= -200.0) || !(v <= 3.65e-68)) {
tmp = t_1 + (-1.5 - (0.25 * t_0));
} else {
tmp = t_1 + (-1.5 - (0.375 * t_0));
}
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 = 2.0d0 / (r * r)
if ((v <= (-200.0d0)) .or. (.not. (v <= 3.65d-68))) then
tmp = t_1 + ((-1.5d0) - (0.25d0 * t_0))
else
tmp = t_1 + ((-1.5d0) - (0.375d0 * t_0))
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 = 2.0 / (r * r);
double tmp;
if ((v <= -200.0) || !(v <= 3.65e-68)) {
tmp = t_1 + (-1.5 - (0.25 * t_0));
} else {
tmp = t_1 + (-1.5 - (0.375 * t_0));
}
return tmp;
}
def code(v, w, r): t_0 = (r * w) * (r * w) t_1 = 2.0 / (r * r) tmp = 0 if (v <= -200.0) or not (v <= 3.65e-68): tmp = t_1 + (-1.5 - (0.25 * t_0)) else: tmp = t_1 + (-1.5 - (0.375 * t_0)) return tmp
function code(v, w, r) t_0 = Float64(Float64(r * w) * Float64(r * w)) t_1 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((v <= -200.0) || !(v <= 3.65e-68)) tmp = Float64(t_1 + Float64(-1.5 - Float64(0.25 * t_0))); else tmp = Float64(t_1 + Float64(-1.5 - Float64(0.375 * t_0))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = (r * w) * (r * w); t_1 = 2.0 / (r * r); tmp = 0.0; if ((v <= -200.0) || ~((v <= 3.65e-68))) tmp = t_1 + (-1.5 - (0.25 * t_0)); else tmp = t_1 + (-1.5 - (0.375 * t_0)); 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[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -200.0], N[Not[LessEqual[v, 3.65e-68]], $MachinePrecision]], N[(t$95$1 + N[(-1.5 - N[(0.25 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(-1.5 - N[(0.375 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(r \cdot w\right) \cdot \left(r \cdot w\right)\\
t_1 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -200 \lor \neg \left(v \leq 3.65 \cdot 10^{-68}\right):\\
\;\;\;\;t\_1 + \left(-1.5 - 0.25 \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(-1.5 - 0.375 \cdot t\_0\right)\\
\end{array}
\end{array}
if v < -200 or 3.65000000000000005e-68 < v Initial program 86.2%
Simplified91.8%
Taylor expanded in v around inf 82.0%
*-commutative82.0%
*-commutative82.0%
unpow282.0%
unpow282.0%
swap-sqr99.3%
unpow299.3%
*-commutative99.3%
Simplified99.3%
*-commutative99.3%
pow299.3%
Applied egg-rr99.3%
if -200 < v < 3.65000000000000005e-68Initial program 85.3%
Simplified85.3%
Taylor expanded in v around 0 78.9%
*-commutative78.9%
*-commutative78.9%
unpow278.9%
unpow278.9%
swap-sqr99.8%
unpow299.8%
*-commutative99.8%
Simplified99.8%
*-commutative85.3%
pow285.3%
Applied egg-rr99.8%
Final simplification99.5%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))) (t_1 (* (* r w) (* r w))))
(if (<= v -1460.0)
(+ t_0 (- -1.5 (* (* r (* w (* r w))) 0.25)))
(if (<= v 3.65e-68)
(+ t_0 (- -1.5 (* 0.375 t_1)))
(+ t_0 (- -1.5 (* 0.25 t_1)))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = (r * w) * (r * w);
double tmp;
if (v <= -1460.0) {
tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25));
} else if (v <= 3.65e-68) {
tmp = t_0 + (-1.5 - (0.375 * t_1));
} else {
tmp = t_0 + (-1.5 - (0.25 * t_1));
}
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 = 2.0d0 / (r * r)
t_1 = (r * w) * (r * w)
if (v <= (-1460.0d0)) then
tmp = t_0 + ((-1.5d0) - ((r * (w * (r * w))) * 0.25d0))
else if (v <= 3.65d-68) then
tmp = t_0 + ((-1.5d0) - (0.375d0 * t_1))
else
tmp = t_0 + ((-1.5d0) - (0.25d0 * t_1))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = (r * w) * (r * w);
double tmp;
if (v <= -1460.0) {
tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25));
} else if (v <= 3.65e-68) {
tmp = t_0 + (-1.5 - (0.375 * t_1));
} else {
tmp = t_0 + (-1.5 - (0.25 * t_1));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = (r * w) * (r * w) tmp = 0 if v <= -1460.0: tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25)) elif v <= 3.65e-68: tmp = t_0 + (-1.5 - (0.375 * t_1)) else: tmp = t_0 + (-1.5 - (0.25 * t_1)) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) t_1 = Float64(Float64(r * w) * Float64(r * w)) tmp = 0.0 if (v <= -1460.0) tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(r * Float64(w * Float64(r * w))) * 0.25))); elseif (v <= 3.65e-68) tmp = Float64(t_0 + Float64(-1.5 - Float64(0.375 * t_1))); else tmp = Float64(t_0 + Float64(-1.5 - Float64(0.25 * t_1))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); t_1 = (r * w) * (r * w); tmp = 0.0; if (v <= -1460.0) tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25)); elseif (v <= 3.65e-68) tmp = t_0 + (-1.5 - (0.375 * t_1)); else tmp = t_0 + (-1.5 - (0.25 * t_1)); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, -1460.0], N[(t$95$0 + N[(-1.5 - N[(N[(r * N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[v, 3.65e-68], N[(t$95$0 + N[(-1.5 - N[(0.375 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.5 - N[(0.25 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := \left(r \cdot w\right) \cdot \left(r \cdot w\right)\\
\mathbf{if}\;v \leq -1460:\\
\;\;\;\;t\_0 + \left(-1.5 - \left(r \cdot \left(w \cdot \left(r \cdot w\right)\right)\right) \cdot 0.25\right)\\
\mathbf{elif}\;v \leq 3.65 \cdot 10^{-68}:\\
\;\;\;\;t\_0 + \left(-1.5 - 0.375 \cdot t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \left(-1.5 - 0.25 \cdot t\_1\right)\\
\end{array}
\end{array}
if v < -1460Initial program 89.9%
Simplified92.4%
Taylor expanded in v around inf 79.5%
*-commutative79.5%
*-commutative79.5%
unpow279.5%
unpow279.5%
swap-sqr98.8%
unpow298.8%
*-commutative98.8%
Simplified98.8%
*-commutative98.8%
pow298.8%
remove-double-div98.8%
remove-double-div98.8%
frac-times98.8%
metadata-eval98.8%
Applied egg-rr98.8%
frac-times98.8%
metadata-eval98.8%
pow298.8%
*-commutative98.8%
remove-double-div98.8%
*-commutative98.8%
pow298.8%
associate-*r*98.9%
Applied egg-rr98.9%
if -1460 < v < 3.65000000000000005e-68Initial program 85.3%
Simplified85.3%
Taylor expanded in v around 0 78.9%
*-commutative78.9%
*-commutative78.9%
unpow278.9%
unpow278.9%
swap-sqr99.8%
unpow299.8%
*-commutative99.8%
Simplified99.8%
*-commutative85.3%
pow285.3%
Applied egg-rr99.8%
if 3.65000000000000005e-68 < v Initial program 82.4%
Simplified91.1%
Taylor expanded in v around inf 84.6%
*-commutative84.6%
*-commutative84.6%
unpow284.6%
unpow284.6%
swap-sqr99.9%
unpow299.9%
*-commutative99.9%
Simplified99.9%
*-commutative99.9%
pow299.9%
Applied egg-rr99.9%
Final simplification99.6%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (- -1.5 (* 0.25 (* (* r w) (* r w))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - (0.25 * ((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) - (0.25d0 * ((r * w) * (r * w))))
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - (0.25 * ((r * w) * (r * w))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 - (0.25 * ((r * w) * (r * w))))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 - Float64(0.25 * Float64(Float64(r * w) * Float64(r * w))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 - (0.25 * ((r * w) * (r * w)))); end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[(0.25 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 - 0.25 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)
\end{array}
Initial program 85.8%
Simplified88.6%
Taylor expanded in v around inf 77.0%
*-commutative77.0%
*-commutative77.0%
unpow277.0%
unpow277.0%
swap-sqr92.3%
unpow292.3%
*-commutative92.3%
Simplified92.3%
*-commutative92.3%
pow292.3%
Applied egg-rr92.3%
Final simplification92.3%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) -1.5))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + -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 = (2.0d0 / (r * r)) + (-1.5d0)
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + -1.5;
}
def code(v, w, r): return (2.0 / (r * r)) + -1.5
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + -1.5) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + -1.5; end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + -1.5
\end{array}
Initial program 85.8%
Simplified88.6%
Taylor expanded in v around inf 77.0%
*-commutative77.0%
*-commutative77.0%
unpow277.0%
unpow277.0%
swap-sqr92.3%
unpow292.3%
*-commutative92.3%
Simplified92.3%
Taylor expanded in r around 0 55.9%
Final simplification55.9%
herbie shell --seed 2024071
(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))