
(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 7 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))) (t_1 (+ (* v -0.25) 0.375)))
(if (<= v -2e+89)
(+ (+ t_0 3.0) (- (* (* v -0.25) (* (* r w) (/ (* r w) v))) 4.5))
(if (<= v 6.8e-22)
(+ t_0 (+ -1.5 (/ t_1 (/ (/ (/ -1.0 r) w) (* r w)))))
(+ t_0 (+ -1.5 (/ t_1 (/ (/ v (* r w)) (* r w)))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = (v * -0.25) + 0.375;
double tmp;
if (v <= -2e+89) {
tmp = (t_0 + 3.0) + (((v * -0.25) * ((r * w) * ((r * w) / v))) - 4.5);
} else if (v <= 6.8e-22) {
tmp = t_0 + (-1.5 + (t_1 / (((-1.0 / r) / w) / (r * w))));
} else {
tmp = t_0 + (-1.5 + (t_1 / ((v / (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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
t_1 = (v * (-0.25d0)) + 0.375d0
if (v <= (-2d+89)) then
tmp = (t_0 + 3.0d0) + (((v * (-0.25d0)) * ((r * w) * ((r * w) / v))) - 4.5d0)
else if (v <= 6.8d-22) then
tmp = t_0 + ((-1.5d0) + (t_1 / ((((-1.0d0) / r) / w) / (r * w))))
else
tmp = t_0 + ((-1.5d0) + (t_1 / ((v / (r * w)) / (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 t_1 = (v * -0.25) + 0.375;
double tmp;
if (v <= -2e+89) {
tmp = (t_0 + 3.0) + (((v * -0.25) * ((r * w) * ((r * w) / v))) - 4.5);
} else if (v <= 6.8e-22) {
tmp = t_0 + (-1.5 + (t_1 / (((-1.0 / r) / w) / (r * w))));
} else {
tmp = t_0 + (-1.5 + (t_1 / ((v / (r * w)) / (r * w))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = (v * -0.25) + 0.375 tmp = 0 if v <= -2e+89: tmp = (t_0 + 3.0) + (((v * -0.25) * ((r * w) * ((r * w) / v))) - 4.5) elif v <= 6.8e-22: tmp = t_0 + (-1.5 + (t_1 / (((-1.0 / r) / w) / (r * w)))) else: tmp = t_0 + (-1.5 + (t_1 / ((v / (r * w)) / (r * w)))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) t_1 = Float64(Float64(v * -0.25) + 0.375) tmp = 0.0 if (v <= -2e+89) tmp = Float64(Float64(t_0 + 3.0) + Float64(Float64(Float64(v * -0.25) * Float64(Float64(r * w) * Float64(Float64(r * w) / v))) - 4.5)); elseif (v <= 6.8e-22) tmp = Float64(t_0 + Float64(-1.5 + Float64(t_1 / Float64(Float64(Float64(-1.0 / r) / w) / Float64(r * w))))); else tmp = Float64(t_0 + Float64(-1.5 + Float64(t_1 / Float64(Float64(v / Float64(r * w)) / Float64(r * w))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); t_1 = (v * -0.25) + 0.375; tmp = 0.0; if (v <= -2e+89) tmp = (t_0 + 3.0) + (((v * -0.25) * ((r * w) * ((r * w) / v))) - 4.5); elseif (v <= 6.8e-22) tmp = t_0 + (-1.5 + (t_1 / (((-1.0 / r) / w) / (r * w)))); else tmp = t_0 + (-1.5 + (t_1 / ((v / (r * w)) / (r * w)))); 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[(v * -0.25), $MachinePrecision] + 0.375), $MachinePrecision]}, If[LessEqual[v, -2e+89], N[(N[(t$95$0 + 3.0), $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], If[LessEqual[v, 6.8e-22], N[(t$95$0 + N[(-1.5 + N[(t$95$1 / N[(N[(N[(-1.0 / r), $MachinePrecision] / w), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.5 + N[(t$95$1 / N[(N[(v / N[(r * w), $MachinePrecision]), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := v \cdot -0.25 + 0.375\\
\mathbf{if}\;v \leq -2 \cdot 10^{+89}:\\
\;\;\;\;\left(t\_0 + 3\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{elif}\;v \leq 6.8 \cdot 10^{-22}:\\
\;\;\;\;t\_0 + \left(-1.5 + \frac{t\_1}{\frac{\frac{\frac{-1}{r}}{w}}{r \cdot w}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \left(-1.5 + \frac{t\_1}{\frac{\frac{v}{r \cdot w}}{r \cdot w}}\right)\\
\end{array}
\end{array}
if v < -1.99999999999999999e89Initial program 78.0%
Simplified86.8%
associate-/l*86.8%
*-commutative86.8%
associate-*r/86.6%
associate-*l*96.1%
associate-*r*96.1%
*-commutative96.1%
Applied egg-rr96.1%
Taylor expanded in v around inf 98.0%
*-commutative98.0%
Simplified98.0%
Taylor expanded in v around inf 99.8%
associate-*r/99.8%
mul-1-neg99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
Simplified99.8%
if -1.99999999999999999e89 < v < 6.7999999999999997e-22Initial program 91.1%
Simplified91.1%
fma-undefine91.1%
*-commutative91.1%
+-commutative91.1%
metadata-eval91.1%
cancel-sign-sub-inv91.1%
associate-*r/91.1%
*-commutative91.1%
associate-/l*91.1%
clear-num91.1%
un-div-inv91.1%
cancel-sign-sub-inv91.1%
metadata-eval91.1%
+-commutative91.1%
distribute-rgt-in91.1%
*-commutative91.1%
associate-*l*91.1%
metadata-eval91.1%
metadata-eval91.1%
Applied egg-rr99.8%
*-un-lft-identity99.8%
unpow299.8%
times-frac99.7%
Applied egg-rr99.7%
associate-*l/99.8%
*-lft-identity99.8%
*-commutative99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in v around 0 99.8%
associate-/r*99.8%
Simplified99.8%
if 6.7999999999999997e-22 < v Initial program 85.9%
Simplified89.9%
fma-undefine89.9%
*-commutative89.9%
+-commutative89.9%
metadata-eval89.9%
cancel-sign-sub-inv89.9%
associate-*r/89.9%
*-commutative89.9%
associate-/l*89.9%
clear-num89.9%
un-div-inv89.9%
cancel-sign-sub-inv89.9%
metadata-eval89.9%
+-commutative89.9%
distribute-rgt-in89.9%
*-commutative89.9%
associate-*l*89.9%
metadata-eval89.9%
metadata-eval89.9%
Applied egg-rr99.8%
*-un-lft-identity99.8%
unpow299.8%
times-frac99.9%
Applied egg-rr99.9%
associate-*l/99.9%
*-lft-identity99.9%
*-commutative99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in v around inf 99.9%
mul-1-neg99.9%
distribute-neg-frac299.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
Simplified99.9%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (+ (* v -0.25) 0.375)) (t_1 (/ 2.0 (* r r))))
(if (or (<= v -6.5e+87) (not (<= v 6.8e-22)))
(+ t_1 (+ -1.5 (/ t_0 (/ (/ v (* r w)) (* r w)))))
(+ t_1 (+ -1.5 (/ t_0 (/ (/ (/ -1.0 r) w) (* r w))))))))
double code(double v, double w, double r) {
double t_0 = (v * -0.25) + 0.375;
double t_1 = 2.0 / (r * r);
double tmp;
if ((v <= -6.5e+87) || !(v <= 6.8e-22)) {
tmp = t_1 + (-1.5 + (t_0 / ((v / (r * w)) / (r * w))));
} else {
tmp = t_1 + (-1.5 + (t_0 / (((-1.0 / 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (v * (-0.25d0)) + 0.375d0
t_1 = 2.0d0 / (r * r)
if ((v <= (-6.5d+87)) .or. (.not. (v <= 6.8d-22))) then
tmp = t_1 + ((-1.5d0) + (t_0 / ((v / (r * w)) / (r * w))))
else
tmp = t_1 + ((-1.5d0) + (t_0 / ((((-1.0d0) / r) / w) / (r * w))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = (v * -0.25) + 0.375;
double t_1 = 2.0 / (r * r);
double tmp;
if ((v <= -6.5e+87) || !(v <= 6.8e-22)) {
tmp = t_1 + (-1.5 + (t_0 / ((v / (r * w)) / (r * w))));
} else {
tmp = t_1 + (-1.5 + (t_0 / (((-1.0 / r) / w) / (r * w))));
}
return tmp;
}
def code(v, w, r): t_0 = (v * -0.25) + 0.375 t_1 = 2.0 / (r * r) tmp = 0 if (v <= -6.5e+87) or not (v <= 6.8e-22): tmp = t_1 + (-1.5 + (t_0 / ((v / (r * w)) / (r * w)))) else: tmp = t_1 + (-1.5 + (t_0 / (((-1.0 / r) / w) / (r * w)))) return tmp
function code(v, w, r) t_0 = Float64(Float64(v * -0.25) + 0.375) t_1 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((v <= -6.5e+87) || !(v <= 6.8e-22)) tmp = Float64(t_1 + Float64(-1.5 + Float64(t_0 / Float64(Float64(v / Float64(r * w)) / Float64(r * w))))); else tmp = Float64(t_1 + Float64(-1.5 + Float64(t_0 / Float64(Float64(Float64(-1.0 / r) / w) / Float64(r * w))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = (v * -0.25) + 0.375; t_1 = 2.0 / (r * r); tmp = 0.0; if ((v <= -6.5e+87) || ~((v <= 6.8e-22))) tmp = t_1 + (-1.5 + (t_0 / ((v / (r * w)) / (r * w)))); else tmp = t_1 + (-1.5 + (t_0 / (((-1.0 / r) / w) / (r * w)))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(v * -0.25), $MachinePrecision] + 0.375), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -6.5e+87], N[Not[LessEqual[v, 6.8e-22]], $MachinePrecision]], N[(t$95$1 + N[(-1.5 + N[(t$95$0 / N[(N[(v / N[(r * w), $MachinePrecision]), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(-1.5 + N[(t$95$0 / N[(N[(N[(-1.0 / r), $MachinePrecision] / w), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := v \cdot -0.25 + 0.375\\
t_1 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -6.5 \cdot 10^{+87} \lor \neg \left(v \leq 6.8 \cdot 10^{-22}\right):\\
\;\;\;\;t\_1 + \left(-1.5 + \frac{t\_0}{\frac{\frac{v}{r \cdot w}}{r \cdot w}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(-1.5 + \frac{t\_0}{\frac{\frac{\frac{-1}{r}}{w}}{r \cdot w}}\right)\\
\end{array}
\end{array}
if v < -6.5000000000000002e87 or 6.7999999999999997e-22 < v Initial program 82.5%
Simplified88.5%
fma-undefine88.5%
*-commutative88.5%
+-commutative88.5%
metadata-eval88.5%
cancel-sign-sub-inv88.5%
associate-*r/88.6%
*-commutative88.6%
associate-/l*88.6%
clear-num88.6%
un-div-inv88.6%
cancel-sign-sub-inv88.6%
metadata-eval88.6%
+-commutative88.6%
distribute-rgt-in88.6%
*-commutative88.6%
associate-*l*89.4%
metadata-eval89.4%
metadata-eval89.4%
Applied egg-rr99.8%
*-un-lft-identity99.8%
unpow299.8%
times-frac99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-lft-identity99.8%
*-commutative99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in v around inf 99.8%
mul-1-neg99.8%
distribute-neg-frac299.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
Simplified99.8%
if -6.5000000000000002e87 < v < 6.7999999999999997e-22Initial program 91.1%
Simplified91.1%
fma-undefine91.1%
*-commutative91.1%
+-commutative91.1%
metadata-eval91.1%
cancel-sign-sub-inv91.1%
associate-*r/91.1%
*-commutative91.1%
associate-/l*91.1%
clear-num91.1%
un-div-inv91.1%
cancel-sign-sub-inv91.1%
metadata-eval91.1%
+-commutative91.1%
distribute-rgt-in91.1%
*-commutative91.1%
associate-*l*91.1%
metadata-eval91.1%
metadata-eval91.1%
Applied egg-rr99.8%
*-un-lft-identity99.8%
unpow299.8%
times-frac99.7%
Applied egg-rr99.7%
associate-*l/99.8%
*-lft-identity99.8%
*-commutative99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in v around 0 99.8%
associate-/r*99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (+ -1.5 (/ 1.0 (/ (/ (/ (+ v -1.0) (* r w)) (* r w)) (+ (* v -0.25) 0.375))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + (1.0 / ((((v + -1.0) / (r * w)) / (r * w)) / ((v * -0.25) + 0.375))));
}
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) + (1.0d0 / ((((v + (-1.0d0)) / (r * w)) / (r * w)) / ((v * (-0.25d0)) + 0.375d0))))
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + (1.0 / ((((v + -1.0) / (r * w)) / (r * w)) / ((v * -0.25) + 0.375))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 + (1.0 / ((((v + -1.0) / (r * w)) / (r * w)) / ((v * -0.25) + 0.375))))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(1.0 / Float64(Float64(Float64(Float64(v + -1.0) / Float64(r * w)) / Float64(r * w)) / Float64(Float64(v * -0.25) + 0.375))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 + (1.0 / ((((v + -1.0) / (r * w)) / (r * w)) / ((v * -0.25) + 0.375)))); end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(1.0 / N[(N[(N[(N[(v + -1.0), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision] / N[(N[(v * -0.25), $MachinePrecision] + 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 + \frac{1}{\frac{\frac{\frac{v + -1}{r \cdot w}}{r \cdot w}}{v \cdot -0.25 + 0.375}}\right)
\end{array}
Initial program 87.0%
Simplified89.9%
Applied egg-rr99.8%
*-un-lft-identity99.8%
unpow299.8%
times-frac99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-lft-identity99.8%
*-commutative99.8%
*-commutative99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (- -1.5 (/ (+ (* v -0.25) 0.375) (/ (- 1.0 v) (* (* r w) (* r w)))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - (((v * -0.25) + 0.375) / ((1.0 - v) / ((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) / ((1.0d0 - v) / ((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) / ((1.0 - v) / ((r * w) * (r * w)))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 - (((v * -0.25) + 0.375) / ((1.0 - v) / ((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(1.0 - v) / 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) / ((1.0 - v) / ((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[(1.0 - v), $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{1 - v}{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}}\right)
\end{array}
Initial program 87.0%
Simplified89.9%
fma-undefine89.9%
*-commutative89.9%
+-commutative89.9%
metadata-eval89.9%
cancel-sign-sub-inv89.9%
associate-*r/89.9%
*-commutative89.9%
associate-/l*89.9%
clear-num89.9%
un-div-inv89.9%
cancel-sign-sub-inv89.9%
metadata-eval89.9%
+-commutative89.9%
distribute-rgt-in89.9%
*-commutative89.9%
associate-*l*90.3%
metadata-eval90.3%
metadata-eval90.3%
Applied egg-rr99.8%
unpow299.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (- (+ (/ 2.0 (* r r)) 3.0) (+ 4.5 (* 0.375 (* (* r w) (* r w))))))
double code(double v, double w, double r) {
return ((2.0 / (r * r)) + 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 = ((2.0d0 / (r * r)) + 3.0d0) - (4.5d0 + (0.375d0 * ((r * w) * (r * w))))
end function
public static double code(double v, double w, double r) {
return ((2.0 / (r * r)) + 3.0) - (4.5 + (0.375 * ((r * w) * (r * w))));
}
def code(v, w, r): return ((2.0 / (r * r)) + 3.0) - (4.5 + (0.375 * ((r * w) * (r * w))))
function code(v, w, r) return Float64(Float64(Float64(2.0 / Float64(r * r)) + 3.0) - Float64(4.5 + Float64(0.375 * Float64(Float64(r * w) * Float64(r * w))))) end
function tmp = code(v, w, r) tmp = ((2.0 / (r * r)) + 3.0) - (4.5 + (0.375 * ((r * w) * (r * w)))); end
code[v_, w_, r_] := N[(N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision] - N[(4.5 + N[(0.375 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{2}{r \cdot r} + 3\right) - \left(4.5 + 0.375 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)
\end{array}
Initial program 87.0%
Simplified89.9%
associate-/l*89.9%
*-commutative89.9%
associate-*r/89.9%
associate-*l*98.3%
associate-*r*99.0%
*-commutative99.0%
Applied egg-rr99.0%
Taylor expanded in v around 0 82.7%
Taylor expanded in v around 0 95.1%
Final simplification95.1%
(FPCore (v w r) :precision binary64 (- (- (+ (/ 2.0 (* r r)) 3.0) (* (* r w) (* r (* w 0.375)))) 4.5))
double code(double v, double w, double r) {
return (((2.0 / (r * r)) + 3.0) - ((r * w) * (r * (w * 0.375)))) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (((2.0d0 / (r * r)) + 3.0d0) - ((r * w) * (r * (w * 0.375d0)))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return (((2.0 / (r * r)) + 3.0) - ((r * w) * (r * (w * 0.375)))) - 4.5;
}
def code(v, w, r): return (((2.0 / (r * r)) + 3.0) - ((r * w) * (r * (w * 0.375)))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(Float64(2.0 / Float64(r * r)) + 3.0) - Float64(Float64(r * w) * Float64(r * Float64(w * 0.375)))) - 4.5) end
function tmp = code(v, w, r) tmp = (((2.0 / (r * r)) + 3.0) - ((r * w) * (r * (w * 0.375)))) - 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[(r * N[(w * 0.375), $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(r \cdot \left(w \cdot 0.375\right)\right)\right) - 4.5
\end{array}
Initial program 87.0%
Applied egg-rr94.9%
Taylor expanded in v around 0 82.6%
associate-*r*82.6%
*-commutative82.6%
associate-*l*82.7%
Simplified82.7%
Taylor expanded in v around 0 95.1%
Final simplification95.1%
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ (/ 2.0 r) r)) (* (* r w) (* r (* w 0.375)))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + ((2.0 / r) / r)) - ((r * w) * (r * (w * 0.375)))) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((3.0d0 + ((2.0d0 / r) / r)) - ((r * w) * (r * (w * 0.375d0)))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + ((2.0 / r) / r)) - ((r * w) * (r * (w * 0.375)))) - 4.5;
}
def code(v, w, r): return ((3.0 + ((2.0 / r) / r)) - ((r * w) * (r * (w * 0.375)))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - Float64(Float64(r * w) * Float64(r * Float64(w * 0.375)))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + ((2.0 / r) / r)) - ((r * w) * (r * (w * 0.375)))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - N[(N[(r * w), $MachinePrecision] * N[(r * N[(w * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{\frac{2}{r}}{r}\right) - \left(r \cdot w\right) \cdot \left(r \cdot \left(w \cdot 0.375\right)\right)\right) - 4.5
\end{array}
Initial program 87.0%
Applied egg-rr94.9%
Taylor expanded in v around 0 82.6%
associate-*r*82.6%
*-commutative82.6%
associate-*l*82.7%
Simplified82.7%
associate-/r*82.7%
div-inv82.6%
Applied egg-rr82.6%
associate-*r/82.7%
*-rgt-identity82.7%
Simplified82.7%
Taylor expanded in v around 0 95.1%
Final simplification95.1%
herbie shell --seed 2024055
(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))