
(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 9 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 (or (<= v -4.7e+119) (not (<= v 2e+15)))
(+ t_0 (- -1.5 (* (* (* r w) (* r w)) 0.25)))
(-
(+
(+ 3.0 t_0)
(* (* w (* r (+ 0.375 (* v -0.25)))) (/ (* r w) (+ v -1.0))))
4.5))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((v <= -4.7e+119) || !(v <= 2e+15)) {
tmp = t_0 + (-1.5 - (((r * w) * (r * w)) * 0.25));
} else {
tmp = ((3.0 + t_0) + ((w * (r * (0.375 + (v * -0.25)))) * ((r * w) / (v + -1.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) :: tmp
t_0 = 2.0d0 / (r * r)
if ((v <= (-4.7d+119)) .or. (.not. (v <= 2d+15))) then
tmp = t_0 + ((-1.5d0) - (((r * w) * (r * w)) * 0.25d0))
else
tmp = ((3.0d0 + t_0) + ((w * (r * (0.375d0 + (v * (-0.25d0))))) * ((r * w) / (v + (-1.0d0))))) - 4.5d0
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 <= -4.7e+119) || !(v <= 2e+15)) {
tmp = t_0 + (-1.5 - (((r * w) * (r * w)) * 0.25));
} else {
tmp = ((3.0 + t_0) + ((w * (r * (0.375 + (v * -0.25)))) * ((r * w) / (v + -1.0)))) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if (v <= -4.7e+119) or not (v <= 2e+15): tmp = t_0 + (-1.5 - (((r * w) * (r * w)) * 0.25)) else: tmp = ((3.0 + t_0) + ((w * (r * (0.375 + (v * -0.25)))) * ((r * w) / (v + -1.0)))) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((v <= -4.7e+119) || !(v <= 2e+15)) tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(Float64(r * w) * Float64(r * w)) * 0.25))); else tmp = Float64(Float64(Float64(3.0 + t_0) + Float64(Float64(w * Float64(r * Float64(0.375 + Float64(v * -0.25)))) * Float64(Float64(r * w) / Float64(v + -1.0)))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if ((v <= -4.7e+119) || ~((v <= 2e+15))) tmp = t_0 + (-1.5 - (((r * w) * (r * w)) * 0.25)); else tmp = ((3.0 + t_0) + ((w * (r * (0.375 + (v * -0.25)))) * ((r * w) / (v + -1.0)))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -4.7e+119], N[Not[LessEqual[v, 2e+15]], $MachinePrecision]], N[(t$95$0 + N[(-1.5 - N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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[(N[(r * w), $MachinePrecision] / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -4.7 \cdot 10^{+119} \lor \neg \left(v \leq 2 \cdot 10^{+15}\right):\\
\;\;\;\;t\_0 + \left(-1.5 - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot 0.25\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(3 + t\_0\right) + \left(w \cdot \left(r \cdot \left(0.375 + v \cdot -0.25\right)\right)\right) \cdot \frac{r \cdot w}{v + -1}\right) - 4.5\\
\end{array}
\end{array}
if v < -4.70000000000000008e119 or 2e15 < v Initial program 79.9%
Simplified87.5%
Taylor expanded in v around inf 82.7%
*-commutative82.7%
*-commutative82.7%
unpow282.7%
unpow282.7%
swap-sqr99.8%
unpow299.8%
*-commutative99.8%
Simplified99.8%
unpow299.8%
Applied egg-rr99.8%
if -4.70000000000000008e119 < v < 2e15Initial program 84.4%
associate-/l*84.4%
cancel-sign-sub-inv84.4%
metadata-eval84.4%
+-commutative84.4%
*-commutative84.4%
fma-undefine84.4%
*-commutative84.4%
*-commutative84.4%
associate-/l*84.4%
*-commutative84.4%
associate-*r/84.4%
associate-*r*84.4%
associate-*l*95.4%
associate-*r*99.8%
Applied egg-rr99.8%
Taylor expanded in w around 0 99.9%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (or (<= v -5e+119) (not (<= v 6800000000000.0)))
(+ t_0 (- -1.5 (* (* (* r w) (* r w)) 0.25)))
(-
(+
(+ 3.0 t_0)
(* (* w (* r (+ 0.375 (* v -0.25)))) (/ w (/ (+ v -1.0) r))))
4.5))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((v <= -5e+119) || !(v <= 6800000000000.0)) {
tmp = t_0 + (-1.5 - (((r * w) * (r * w)) * 0.25));
} else {
tmp = ((3.0 + t_0) + ((w * (r * (0.375 + (v * -0.25)))) * (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) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if ((v <= (-5d+119)) .or. (.not. (v <= 6800000000000.0d0))) then
tmp = t_0 + ((-1.5d0) - (((r * w) * (r * w)) * 0.25d0))
else
tmp = ((3.0d0 + t_0) + ((w * (r * (0.375d0 + (v * (-0.25d0))))) * (w / ((v + (-1.0d0)) / r)))) - 4.5d0
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 <= -5e+119) || !(v <= 6800000000000.0)) {
tmp = t_0 + (-1.5 - (((r * w) * (r * w)) * 0.25));
} else {
tmp = ((3.0 + t_0) + ((w * (r * (0.375 + (v * -0.25)))) * (w / ((v + -1.0) / r)))) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if (v <= -5e+119) or not (v <= 6800000000000.0): tmp = t_0 + (-1.5 - (((r * w) * (r * w)) * 0.25)) else: tmp = ((3.0 + t_0) + ((w * (r * (0.375 + (v * -0.25)))) * (w / ((v + -1.0) / r)))) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((v <= -5e+119) || !(v <= 6800000000000.0)) tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(Float64(r * w) * Float64(r * w)) * 0.25))); else 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); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if ((v <= -5e+119) || ~((v <= 6800000000000.0))) tmp = t_0 + (-1.5 - (((r * w) * (r * w)) * 0.25)); else tmp = ((3.0 + t_0) + ((w * (r * (0.375 + (v * -0.25)))) * (w / ((v + -1.0) / r)))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -5e+119], N[Not[LessEqual[v, 6800000000000.0]], $MachinePrecision]], N[(t$95$0 + N[(-1.5 - N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -5 \cdot 10^{+119} \lor \neg \left(v \leq 6800000000000\right):\\
\;\;\;\;t\_0 + \left(-1.5 - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot 0.25\right)\\
\mathbf{else}:\\
\;\;\;\;\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\\
\end{array}
\end{array}
if v < -4.9999999999999999e119 or 6.8e12 < v Initial program 79.9%
Simplified87.5%
Taylor expanded in v around inf 82.7%
*-commutative82.7%
*-commutative82.7%
unpow282.7%
unpow282.7%
swap-sqr99.8%
unpow299.8%
*-commutative99.8%
Simplified99.8%
unpow299.8%
Applied egg-rr99.8%
if -4.9999999999999999e119 < v < 6.8e12Initial program 84.4%
associate-/l*84.4%
cancel-sign-sub-inv84.4%
metadata-eval84.4%
+-commutative84.4%
*-commutative84.4%
fma-undefine84.4%
*-commutative84.4%
*-commutative84.4%
associate-/l*84.4%
*-commutative84.4%
associate-*r/84.4%
associate-*r*84.4%
associate-*l*95.4%
associate-*r*99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (or (<= v -6.6) (not (<= v 1.5)))
(+ t_0 (- -1.5 (* (* (* r w) (* r w)) 0.25)))
(- (+ (+ 3.0 t_0) (* (* (* r w) 0.375) (/ w (/ (+ v -1.0) r)))) 4.5))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((v <= -6.6) || !(v <= 1.5)) {
tmp = t_0 + (-1.5 - (((r * w) * (r * w)) * 0.25));
} else {
tmp = ((3.0 + t_0) + (((r * w) * 0.375) * (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) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if ((v <= (-6.6d0)) .or. (.not. (v <= 1.5d0))) then
tmp = t_0 + ((-1.5d0) - (((r * w) * (r * w)) * 0.25d0))
else
tmp = ((3.0d0 + t_0) + (((r * w) * 0.375d0) * (w / ((v + (-1.0d0)) / r)))) - 4.5d0
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 <= -6.6) || !(v <= 1.5)) {
tmp = t_0 + (-1.5 - (((r * w) * (r * w)) * 0.25));
} else {
tmp = ((3.0 + t_0) + (((r * w) * 0.375) * (w / ((v + -1.0) / r)))) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if (v <= -6.6) or not (v <= 1.5): tmp = t_0 + (-1.5 - (((r * w) * (r * w)) * 0.25)) else: tmp = ((3.0 + t_0) + (((r * w) * 0.375) * (w / ((v + -1.0) / r)))) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((v <= -6.6) || !(v <= 1.5)) tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(Float64(r * w) * Float64(r * w)) * 0.25))); else tmp = Float64(Float64(Float64(3.0 + t_0) + Float64(Float64(Float64(r * w) * 0.375) * Float64(w / Float64(Float64(v + -1.0) / r)))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if ((v <= -6.6) || ~((v <= 1.5))) tmp = t_0 + (-1.5 - (((r * w) * (r * w)) * 0.25)); else tmp = ((3.0 + t_0) + (((r * w) * 0.375) * (w / ((v + -1.0) / r)))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -6.6], N[Not[LessEqual[v, 1.5]], $MachinePrecision]], N[(t$95$0 + N[(-1.5 - N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(3.0 + t$95$0), $MachinePrecision] + N[(N[(N[(r * w), $MachinePrecision] * 0.375), $MachinePrecision] * N[(w / N[(N[(v + -1.0), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -6.6 \lor \neg \left(v \leq 1.5\right):\\
\;\;\;\;t\_0 + \left(-1.5 - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot 0.25\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(3 + t\_0\right) + \left(\left(r \cdot w\right) \cdot 0.375\right) \cdot \frac{w}{\frac{v + -1}{r}}\right) - 4.5\\
\end{array}
\end{array}
if v < -6.5999999999999996 or 1.5 < v Initial program 81.7%
Simplified88.0%
Taylor expanded in v around inf 83.4%
*-commutative83.4%
*-commutative83.4%
unpow283.4%
unpow283.4%
swap-sqr99.2%
unpow299.2%
*-commutative99.2%
Simplified99.2%
unpow299.2%
Applied egg-rr99.2%
if -6.5999999999999996 < v < 1.5Initial program 83.5%
associate-/l*83.5%
cancel-sign-sub-inv83.5%
metadata-eval83.5%
+-commutative83.5%
*-commutative83.5%
fma-undefine83.5%
*-commutative83.5%
*-commutative83.5%
associate-/l*83.5%
*-commutative83.5%
associate-*r/83.5%
associate-*r*83.5%
associate-*l*94.7%
associate-*r*99.8%
Applied egg-rr99.8%
Taylor expanded in v around 0 99.3%
Final simplification99.2%
(FPCore (v w r) :precision binary64 (+ (+ 3.0 (/ 2.0 (* r r))) (- (* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (/ w (/ (+ v -1.0) r)))) 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 / ((v + -1.0) / r)))) - 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 / ((v + (-1.0d0)) / r)))) - 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 / ((v + -1.0) / r)))) - 4.5);
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w / ((v + -1.0) / r)))) - 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(Float64(v + -1.0) / r)))) - 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 / ((v + -1.0) / r)))) - 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[(N[(v + -1.0), $MachinePrecision] / r), $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{w}{\frac{v + -1}{r}}\right) - 4.5\right)
\end{array}
Initial program 82.6%
Simplified86.1%
associate-/l*85.8%
*-commutative85.8%
associate-*r/85.6%
associate-*l*94.6%
associate-*r*99.7%
add-sqr-sqrt56.1%
associate-*l*56.1%
add-sqr-sqrt25.3%
sqrt-prod40.5%
sqrt-prod40.5%
sqrt-prod73.6%
*-commutative73.6%
sqrt-prod40.5%
*-commutative40.5%
sqrt-prod40.5%
sqrt-prod25.3%
add-sqr-sqrt56.1%
associate-*r*56.1%
add-sqr-sqrt99.7%
clear-num99.4%
un-div-inv99.4%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (v w r) :precision binary64 (+ (+ 3.0 (/ 2.0 (* r r))) (- (* (* 0.125 (+ 3.0 (* -2.0 v))) (* 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 + (-2.0 * v))) * (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 + ((-2.0d0) * v))) * (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 + (-2.0 * v))) * (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 + (-2.0 * v))) * (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(-2.0 * v))) * 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 + (-2.0 * v))) * (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[(-2.0 * v), $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 + -2 \cdot v\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.6%
Simplified86.1%
div-inv86.1%
*-commutative86.1%
associate-*r*86.0%
div-inv86.0%
*-commutative86.0%
associate-*l*95.8%
add-sqr-sqrt53.0%
associate-*r*53.0%
add-sqr-sqrt23.4%
sqrt-prod40.5%
sqrt-prod40.5%
*-commutative40.5%
sqrt-prod73.6%
*-commutative73.6%
associate-*l*73.6%
Applied egg-rr99.0%
Final simplification99.0%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (- -1.5 (* (* (* r w) (* r w)) 0.25))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - (((r * w) * (r * w)) * 0.25));
}
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) - (((r * w) * (r * w)) * 0.25d0))
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - (((r * w) * (r * w)) * 0.25));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 - (((r * w) * (r * w)) * 0.25))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 - Float64(Float64(Float64(r * w) * Float64(r * w)) * 0.25))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 - (((r * w) * (r * w)) * 0.25)); end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot 0.25\right)
\end{array}
Initial program 82.6%
Simplified85.7%
Taylor expanded in v around inf 78.7%
*-commutative78.7%
*-commutative78.7%
unpow278.7%
unpow278.7%
swap-sqr94.3%
unpow294.3%
*-commutative94.3%
Simplified94.3%
unpow294.3%
Applied egg-rr94.3%
Final simplification94.3%
(FPCore (v w r) :precision binary64 (- (+ 3.0 (/ 2.0 (* r r))) 4.5))
double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) - 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))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) - 4.5;
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) - 4.5
function code(v, w, r) return Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - 4.5) end
function tmp = code(v, w, r) tmp = (3.0 + (2.0 / (r * r))) - 4.5; end
code[v_, w_, r_] := N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \frac{2}{r \cdot r}\right) - 4.5
\end{array}
Initial program 82.6%
Simplified79.8%
Taylor expanded in r around 0 61.1%
Final simplification61.1%
(FPCore (v w r) :precision binary64 (+ -1.5 (/ (/ 2.0 r) r)))
double code(double v, double w, double r) {
return -1.5 + ((2.0 / r) / 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) + ((2.0d0 / r) / r)
end function
public static double code(double v, double w, double r) {
return -1.5 + ((2.0 / r) / r);
}
def code(v, w, r): return -1.5 + ((2.0 / r) / r)
function code(v, w, r) return Float64(-1.5 + Float64(Float64(2.0 / r) / r)) end
function tmp = code(v, w, r) tmp = -1.5 + ((2.0 / r) / r); end
code[v_, w_, r_] := N[(-1.5 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-1.5 + \frac{\frac{2}{r}}{r}
\end{array}
Initial program 82.6%
Simplified79.8%
Taylor expanded in r around 0 61.1%
associate--l+61.1%
div-inv61.1%
fmm-def61.1%
pow261.1%
pow-flip61.2%
metadata-eval61.2%
metadata-eval61.2%
Applied egg-rr61.2%
+-commutative61.2%
fma-undefine61.2%
associate-+l+61.2%
metadata-eval61.2%
Simplified61.2%
metadata-eval61.2%
pow-flip61.2%
pow261.2%
div-inv61.2%
associate-/r*61.1%
Applied egg-rr61.1%
Final simplification61.1%
(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 82.6%
Simplified79.8%
Taylor expanded in r around 0 61.1%
Taylor expanded in r around inf 14.4%
Final simplification14.4%
herbie shell --seed 2024095
(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))