
(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 (+ (/ 2.0 (* r r)) (+ -1.5 (/ (+ 0.375 (* v -0.25)) (* (/ (- 1.0 v) (* r w)) (/ -1.0 (* r w)))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + ((0.375 + (v * -0.25)) / (((1.0 - v) / (r * w)) * (-1.0 / (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.375d0 + (v * (-0.25d0))) / (((1.0d0 - v) / (r * w)) * ((-1.0d0) / (r * w)))))
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + ((0.375 + (v * -0.25)) / (((1.0 - v) / (r * w)) * (-1.0 / (r * w)))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 + ((0.375 + (v * -0.25)) / (((1.0 - v) / (r * w)) * (-1.0 / (r * w)))))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(Float64(0.375 + Float64(v * -0.25)) / Float64(Float64(Float64(1.0 - v) / Float64(r * w)) * Float64(-1.0 / Float64(r * w)))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 + ((0.375 + (v * -0.25)) / (((1.0 - v) / (r * w)) * (-1.0 / (r * w))))); end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(1.0 - v), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 + \frac{0.375 + v \cdot -0.25}{\frac{1 - v}{r \cdot w} \cdot \frac{-1}{r \cdot w}}\right)
\end{array}
Initial program 86.2%
Simplified88.4%
fma-undefine88.4%
*-commutative88.4%
+-commutative88.4%
metadata-eval88.4%
cancel-sign-sub-inv88.4%
associate-*r/88.4%
*-commutative88.4%
associate-/l*89.4%
clear-num89.4%
un-div-inv89.4%
cancel-sign-sub-inv89.4%
metadata-eval89.4%
distribute-rgt-in89.4%
metadata-eval89.4%
*-commutative89.4%
associate-*l*89.8%
metadata-eval89.8%
Applied egg-rr99.4%
*-un-lft-identity99.4%
*-commutative99.4%
unpow299.4%
times-frac99.8%
*-commutative99.8%
*-commutative99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (if (or (<= v -18.5) (not (<= v 300000.0))) (+ 3.0 (- (* (* v -0.25) (/ (* r (* r (* w w))) (+ v -1.0))) 4.5)) (- (+ 3.0 (* (* 0.375 (* r w)) (* w (/ r (+ v -1.0))))) 4.5)))
double code(double v, double w, double r) {
double tmp;
if ((v <= -18.5) || !(v <= 300000.0)) {
tmp = 3.0 + (((v * -0.25) * ((r * (r * (w * w))) / (v + -1.0))) - 4.5);
} else {
tmp = (3.0 + ((0.375 * (r * w)) * (w * (r / (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) :: tmp
if ((v <= (-18.5d0)) .or. (.not. (v <= 300000.0d0))) then
tmp = 3.0d0 + (((v * (-0.25d0)) * ((r * (r * (w * w))) / (v + (-1.0d0)))) - 4.5d0)
else
tmp = (3.0d0 + ((0.375d0 * (r * w)) * (w * (r / (v + (-1.0d0)))))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if ((v <= -18.5) || !(v <= 300000.0)) {
tmp = 3.0 + (((v * -0.25) * ((r * (r * (w * w))) / (v + -1.0))) - 4.5);
} else {
tmp = (3.0 + ((0.375 * (r * w)) * (w * (r / (v + -1.0))))) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if (v <= -18.5) or not (v <= 300000.0): tmp = 3.0 + (((v * -0.25) * ((r * (r * (w * w))) / (v + -1.0))) - 4.5) else: tmp = (3.0 + ((0.375 * (r * w)) * (w * (r / (v + -1.0))))) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if ((v <= -18.5) || !(v <= 300000.0)) tmp = Float64(3.0 + Float64(Float64(Float64(v * -0.25) * Float64(Float64(r * Float64(r * Float64(w * w))) / Float64(v + -1.0))) - 4.5)); else tmp = Float64(Float64(3.0 + Float64(Float64(0.375 * Float64(r * w)) * Float64(w * Float64(r / Float64(v + -1.0))))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if ((v <= -18.5) || ~((v <= 300000.0))) tmp = 3.0 + (((v * -0.25) * ((r * (r * (w * w))) / (v + -1.0))) - 4.5); else tmp = (3.0 + ((0.375 * (r * w)) * (w * (r / (v + -1.0))))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[Or[LessEqual[v, -18.5], N[Not[LessEqual[v, 300000.0]], $MachinePrecision]], N[(3.0 + N[(N[(N[(v * -0.25), $MachinePrecision] * N[(N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision], N[(N[(3.0 + N[(N[(0.375 * N[(r * w), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq -18.5 \lor \neg \left(v \leq 300000\right):\\
\;\;\;\;3 + \left(\left(v \cdot -0.25\right) \cdot \frac{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}{v + -1} - 4.5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(3 + \left(0.375 \cdot \left(r \cdot w\right)\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\right) - 4.5\\
\end{array}
\end{array}
if v < -18.5 or 3e5 < v Initial program 82.5%
associate--l-82.5%
associate-*l*76.2%
sqr-neg76.2%
associate-*l*82.5%
associate-/l*89.3%
fma-define89.3%
Simplified89.3%
Taylor expanded in r around inf 50.6%
Taylor expanded in v around inf 50.3%
*-commutative50.3%
Simplified50.3%
if -18.5 < v < 3e5Initial program 89.5%
Applied egg-rr99.7%
Taylor expanded in v around 0 99.1%
Taylor expanded in r around inf 52.3%
Final simplification51.4%
(FPCore (v w r)
:precision binary64
(if (<= r 15.0)
(- (- (+ (/ 2.0 (* r r)) 3.0) (* (* r w) (* 0.375 (* r w)))) 4.5)
(+
3.0
(- (* (+ 0.375 (* v -0.25)) (* (* r w) (* w (/ r (+ v -1.0))))) 4.5))))
double code(double v, double w, double r) {
double tmp;
if (r <= 15.0) {
tmp = (((2.0 / (r * r)) + 3.0) - ((r * w) * (0.375 * (r * w)))) - 4.5;
} else {
tmp = 3.0 + (((0.375 + (v * -0.25)) * ((r * w) * (w * (r / (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) :: tmp
if (r <= 15.0d0) then
tmp = (((2.0d0 / (r * r)) + 3.0d0) - ((r * w) * (0.375d0 * (r * w)))) - 4.5d0
else
tmp = 3.0d0 + (((0.375d0 + (v * (-0.25d0))) * ((r * w) * (w * (r / (v + (-1.0d0)))))) - 4.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 15.0) {
tmp = (((2.0 / (r * r)) + 3.0) - ((r * w) * (0.375 * (r * w)))) - 4.5;
} else {
tmp = 3.0 + (((0.375 + (v * -0.25)) * ((r * w) * (w * (r / (v + -1.0))))) - 4.5);
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 15.0: tmp = (((2.0 / (r * r)) + 3.0) - ((r * w) * (0.375 * (r * w)))) - 4.5 else: tmp = 3.0 + (((0.375 + (v * -0.25)) * ((r * w) * (w * (r / (v + -1.0))))) - 4.5) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 15.0) tmp = Float64(Float64(Float64(Float64(2.0 / Float64(r * r)) + 3.0) - Float64(Float64(r * w) * Float64(0.375 * Float64(r * w)))) - 4.5); else tmp = Float64(3.0 + Float64(Float64(Float64(0.375 + Float64(v * -0.25)) * Float64(Float64(r * w) * Float64(w * Float64(r / Float64(v + -1.0))))) - 4.5)); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 15.0) tmp = (((2.0 / (r * r)) + 3.0) - ((r * w) * (0.375 * (r * w)))) - 4.5; else tmp = 3.0 + (((0.375 + (v * -0.25)) * ((r * w) * (w * (r / (v + -1.0))))) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 15.0], N[(N[(N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision] - N[(N[(r * w), $MachinePrecision] * N[(0.375 * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(3.0 + N[(N[(N[(0.375 + N[(v * -0.25), $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}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 15:\\
\;\;\;\;\left(\left(\frac{2}{r \cdot r} + 3\right) - \left(r \cdot w\right) \cdot \left(0.375 \cdot \left(r \cdot w\right)\right)\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;3 + \left(\left(0.375 + v \cdot -0.25\right) \cdot \left(\left(r \cdot w\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\right) - 4.5\right)\\
\end{array}
\end{array}
if r < 15Initial program 85.0%
Applied egg-rr95.9%
Taylor expanded in v around 0 87.4%
Taylor expanded in v around 0 94.9%
if 15 < r Initial program 90.0%
associate--l-90.0%
associate-*l*73.6%
sqr-neg73.6%
associate-*l*90.0%
associate-/l*93.2%
fma-define93.2%
Simplified93.2%
Taylor expanded in r around inf 93.1%
Taylor expanded in v around 0 93.1%
associate-/l*91.5%
*-commutative91.5%
associate-*r/91.5%
associate-*l*96.1%
associate-*r*99.7%
*-commutative99.7%
Applied egg-rr99.7%
Final simplification96.0%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (+ -1.5 (/ (+ 0.375 (* v -0.25)) (/ (+ v -1.0) (* (* r w) (* r w)))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + ((0.375 + (v * -0.25)) / ((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) + ((0.375d0 + (v * (-0.25d0))) / ((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 + ((0.375 + (v * -0.25)) / ((v + -1.0) / ((r * w) * (r * w)))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 + ((0.375 + (v * -0.25)) / ((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(0.375 + Float64(v * -0.25)) / 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 + ((0.375 + (v * -0.25)) / ((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[(0.375 + N[(v * -0.25), $MachinePrecision]), $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{0.375 + v \cdot -0.25}{\frac{v + -1}{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}}\right)
\end{array}
Initial program 86.2%
Simplified88.4%
fma-undefine88.4%
*-commutative88.4%
+-commutative88.4%
metadata-eval88.4%
cancel-sign-sub-inv88.4%
associate-*r/88.4%
*-commutative88.4%
associate-/l*89.4%
clear-num89.4%
un-div-inv89.4%
cancel-sign-sub-inv89.4%
metadata-eval89.4%
distribute-rgt-in89.4%
metadata-eval89.4%
*-commutative89.4%
associate-*l*89.8%
metadata-eval89.8%
Applied egg-rr99.4%
unpow299.4%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (v w r) :precision binary64 (- (- (+ (/ 2.0 (* r r)) 3.0) (* (* r w) (* 0.375 (* r w)))) 4.5))
double code(double v, double w, double r) {
return (((2.0 / (r * r)) + 3.0) - ((r * w) * (0.375 * (r * w)))) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (((2.0d0 / (r * r)) + 3.0d0) - ((r * w) * (0.375d0 * (r * w)))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return (((2.0 / (r * r)) + 3.0) - ((r * w) * (0.375 * (r * w)))) - 4.5;
}
def code(v, w, r): return (((2.0 / (r * r)) + 3.0) - ((r * w) * (0.375 * (r * w)))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(Float64(2.0 / Float64(r * r)) + 3.0) - Float64(Float64(r * w) * Float64(0.375 * Float64(r * w)))) - 4.5) end
function tmp = code(v, w, r) tmp = (((2.0 / (r * r)) + 3.0) - ((r * w) * (0.375 * (r * w)))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision] - N[(N[(r * w), $MachinePrecision] * N[(0.375 * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\frac{2}{r \cdot r} + 3\right) - \left(r \cdot w\right) \cdot \left(0.375 \cdot \left(r \cdot w\right)\right)\right) - 4.5
\end{array}
Initial program 86.2%
Applied egg-rr93.0%
Taylor expanded in v around 0 83.8%
Taylor expanded in v around 0 93.7%
Final simplification93.7%
(FPCore (v w r) :precision binary64 (- (+ 3.0 (* (* 0.375 (* r w)) (* w (/ r (+ v -1.0))))) 4.5))
double code(double v, double w, double r) {
return (3.0 + ((0.375 * (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 + ((0.375d0 * (r * w)) * (w * (r / (v + (-1.0d0)))))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return (3.0 + ((0.375 * (r * w)) * (w * (r / (v + -1.0))))) - 4.5;
}
def code(v, w, r): return (3.0 + ((0.375 * (r * w)) * (w * (r / (v + -1.0))))) - 4.5
function code(v, w, r) return Float64(Float64(3.0 + Float64(Float64(0.375 * Float64(r * w)) * Float64(w * Float64(r / Float64(v + -1.0))))) - 4.5) end
function tmp = code(v, w, r) tmp = (3.0 + ((0.375 * (r * w)) * (w * (r / (v + -1.0))))) - 4.5; end
code[v_, w_, r_] := N[(N[(3.0 + N[(N[(0.375 * N[(r * w), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \left(0.375 \cdot \left(r \cdot w\right)\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\right) - 4.5
\end{array}
Initial program 86.2%
Applied egg-rr93.0%
Taylor expanded in v around 0 83.8%
Taylor expanded in r around inf 37.4%
Final simplification37.4%
(FPCore (v w r) :precision binary64 (- 3.0 (+ 4.5 (* 0.375 (/ (* r (* r (* w w))) (- 1.0 v))))))
double code(double v, double w, double r) {
return 3.0 - (4.5 + (0.375 * ((r * (r * (w * w))) / (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 - (4.5d0 + (0.375d0 * ((r * (r * (w * w))) / (1.0d0 - v))))
end function
public static double code(double v, double w, double r) {
return 3.0 - (4.5 + (0.375 * ((r * (r * (w * w))) / (1.0 - v))));
}
def code(v, w, r): return 3.0 - (4.5 + (0.375 * ((r * (r * (w * w))) / (1.0 - v))))
function code(v, w, r) return Float64(3.0 - Float64(4.5 + Float64(0.375 * Float64(Float64(r * Float64(r * Float64(w * w))) / Float64(1.0 - v))))) end
function tmp = code(v, w, r) tmp = 3.0 - (4.5 + (0.375 * ((r * (r * (w * w))) / (1.0 - v)))); end
code[v_, w_, r_] := N[(3.0 - N[(4.5 + N[(0.375 * N[(N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
3 - \left(4.5 + 0.375 \cdot \frac{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}{1 - v}\right)
\end{array}
Initial program 86.2%
associate--l-86.2%
associate-*l*79.7%
sqr-neg79.7%
associate-*l*86.2%
associate-/l*89.4%
fma-define89.4%
Simplified89.4%
Taylor expanded in r around inf 50.0%
Taylor expanded in v around 0 37.1%
Final simplification37.1%
(FPCore (v w r) :precision binary64 (+ 3.0 (- (* 0.375 (* w (* (* r w) (/ r (+ v -1.0))))) 4.5)))
double code(double v, double w, double r) {
return 3.0 + ((0.375 * (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 + ((0.375d0 * (w * ((r * w) * (r / (v + (-1.0d0)))))) - 4.5d0)
end function
public static double code(double v, double w, double r) {
return 3.0 + ((0.375 * (w * ((r * w) * (r / (v + -1.0))))) - 4.5);
}
def code(v, w, r): return 3.0 + ((0.375 * (w * ((r * w) * (r / (v + -1.0))))) - 4.5)
function code(v, w, r) return Float64(3.0 + Float64(Float64(0.375 * Float64(w * Float64(Float64(r * w) * Float64(r / Float64(v + -1.0))))) - 4.5)) end
function tmp = code(v, w, r) tmp = 3.0 + ((0.375 * (w * ((r * w) * (r / (v + -1.0))))) - 4.5); end
code[v_, w_, r_] := N[(3.0 + N[(N[(0.375 * 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}
\\
3 + \left(0.375 \cdot \left(w \cdot \left(\left(r \cdot w\right) \cdot \frac{r}{v + -1}\right)\right) - 4.5\right)
\end{array}
Initial program 86.2%
associate--l-86.2%
associate-*l*79.7%
sqr-neg79.7%
associate-*l*86.2%
associate-/l*89.4%
fma-define89.4%
Simplified89.4%
Taylor expanded in r around inf 50.0%
Taylor expanded in v around 0 37.1%
associate-/l*36.4%
*-commutative36.4%
associate-*r/36.4%
associate-*l*37.9%
associate-*r*37.1%
add-sqr-sqrt19.4%
sqrt-prod22.3%
add-sqr-sqrt9.3%
sqrt-prod23.3%
sqrt-prod23.3%
associate-*r*30.1%
associate-*l*30.1%
*-commutative30.1%
associate-*l*29.7%
Applied egg-rr36.0%
Final simplification36.0%
(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 86.2%
associate--l-86.2%
associate-*l*79.7%
sqr-neg79.7%
associate-*l*86.2%
associate-/l*89.4%
fma-define89.4%
Simplified89.4%
Taylor expanded in r around inf 50.0%
Taylor expanded in v around 0 37.1%
Taylor expanded in r around 0 15.0%
herbie shell --seed 2024123
(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))