
(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 5 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 (* -0.25 (* (* r w) (* r w)))))
(if (<= v -5e+66)
(+ -1.5 (+ t_0 t_1))
(if (<= v 7.6e+15)
(+
t_0
(- -1.5 (* (* r w) (/ (* r (+ -0.375 (* v 0.25))) (/ (+ v -1.0) w)))))
(+ -1.5 (+ t_1 (/ 2.0 (* r r))))))))
double code(double v, double w, double r) {
double t_0 = (2.0 / r) / r;
double t_1 = -0.25 * ((r * w) * (r * w));
double tmp;
if (v <= -5e+66) {
tmp = -1.5 + (t_0 + t_1);
} else if (v <= 7.6e+15) {
tmp = t_0 + (-1.5 - ((r * w) * ((r * (-0.375 + (v * 0.25))) / ((v + -1.0) / w))));
} else {
tmp = -1.5 + (t_1 + (2.0 / (r * r)));
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (2.0d0 / r) / r
t_1 = (-0.25d0) * ((r * w) * (r * w))
if (v <= (-5d+66)) then
tmp = (-1.5d0) + (t_0 + t_1)
else if (v <= 7.6d+15) then
tmp = t_0 + ((-1.5d0) - ((r * w) * ((r * ((-0.375d0) + (v * 0.25d0))) / ((v + (-1.0d0)) / w))))
else
tmp = (-1.5d0) + (t_1 + (2.0d0 / (r * r)))
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 = -0.25 * ((r * w) * (r * w));
double tmp;
if (v <= -5e+66) {
tmp = -1.5 + (t_0 + t_1);
} else if (v <= 7.6e+15) {
tmp = t_0 + (-1.5 - ((r * w) * ((r * (-0.375 + (v * 0.25))) / ((v + -1.0) / w))));
} else {
tmp = -1.5 + (t_1 + (2.0 / (r * r)));
}
return tmp;
}
def code(v, w, r): t_0 = (2.0 / r) / r t_1 = -0.25 * ((r * w) * (r * w)) tmp = 0 if v <= -5e+66: tmp = -1.5 + (t_0 + t_1) elif v <= 7.6e+15: tmp = t_0 + (-1.5 - ((r * w) * ((r * (-0.375 + (v * 0.25))) / ((v + -1.0) / w)))) else: tmp = -1.5 + (t_1 + (2.0 / (r * r))) return tmp
function code(v, w, r) t_0 = Float64(Float64(2.0 / r) / r) t_1 = Float64(-0.25 * Float64(Float64(r * w) * Float64(r * w))) tmp = 0.0 if (v <= -5e+66) tmp = Float64(-1.5 + Float64(t_0 + t_1)); elseif (v <= 7.6e+15) tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(r * w) * Float64(Float64(r * Float64(-0.375 + Float64(v * 0.25))) / Float64(Float64(v + -1.0) / w))))); else tmp = Float64(-1.5 + Float64(t_1 + Float64(2.0 / Float64(r * r)))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = (2.0 / r) / r; t_1 = -0.25 * ((r * w) * (r * w)); tmp = 0.0; if (v <= -5e+66) tmp = -1.5 + (t_0 + t_1); elseif (v <= 7.6e+15) tmp = t_0 + (-1.5 - ((r * w) * ((r * (-0.375 + (v * 0.25))) / ((v + -1.0) / w)))); else tmp = -1.5 + (t_1 + (2.0 / (r * r))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]}, Block[{t$95$1 = N[(-0.25 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, -5e+66], N[(-1.5 + N[(t$95$0 + t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[v, 7.6e+15], N[(t$95$0 + N[(-1.5 - N[(N[(r * w), $MachinePrecision] * N[(N[(r * N[(-0.375 + N[(v * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(v + -1.0), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.5 + N[(t$95$1 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{2}{r}}{r}\\
t_1 := -0.25 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\\
\mathbf{if}\;v \leq -5 \cdot 10^{+66}:\\
\;\;\;\;-1.5 + \left(t_0 + t_1\right)\\
\mathbf{elif}\;v \leq 7.6 \cdot 10^{+15}:\\
\;\;\;\;t_0 + \left(-1.5 - \left(r \cdot w\right) \cdot \frac{r \cdot \left(-0.375 + v \cdot 0.25\right)}{\frac{v + -1}{w}}\right)\\
\mathbf{else}:\\
\;\;\;\;-1.5 + \left(t_1 + \frac{2}{r \cdot r}\right)\\
\end{array}
\end{array}
if v < -4.99999999999999991e66Initial program 78.8%
Simplified82.5%
Taylor expanded in v around inf 83.0%
*-commutative83.0%
*-commutative83.0%
unpow283.0%
unpow283.0%
swap-sqr99.8%
unpow299.8%
*-commutative99.8%
Simplified99.8%
unpow299.8%
Applied egg-rr99.8%
associate-/r*99.8%
div-inv99.7%
Applied egg-rr99.7%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
if -4.99999999999999991e66 < v < 7.6e15Initial program 87.7%
Simplified97.6%
frac-2neg97.6%
*-commutative97.6%
associate-*r*87.8%
div-inv87.7%
associate-*r*97.6%
*-commutative97.6%
associate-*r*99.8%
pow299.8%
*-commutative99.8%
Applied egg-rr99.8%
associate-*r/99.8%
*-rgt-identity99.8%
neg-sub099.8%
fma-udef99.8%
*-commutative99.8%
+-commutative99.8%
associate--r+99.8%
metadata-eval99.8%
*-commutative99.8%
distribute-neg-frac99.8%
neg-sub099.8%
associate--r-99.8%
metadata-eval99.8%
*-commutative99.8%
Simplified99.8%
expm1-log1p-u40.6%
expm1-udef5.0%
div-inv5.0%
pow-flip5.0%
metadata-eval5.0%
Applied egg-rr5.0%
expm1-def40.5%
expm1-log1p99.8%
Simplified99.8%
metadata-eval99.8%
pow-flip99.8%
pow299.8%
div-inv99.8%
associate-/r*99.8%
Applied egg-rr99.8%
associate-/r/99.8%
*-commutative99.8%
div-inv99.8%
sub-neg99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
clear-num99.8%
associate-/l*99.9%
Applied egg-rr99.9%
associate-*r/99.9%
Simplified99.9%
if 7.6e15 < v Initial program 79.1%
Simplified81.0%
Taylor expanded in v around inf 88.8%
*-commutative88.8%
*-commutative88.8%
unpow288.8%
unpow288.8%
swap-sqr99.8%
unpow299.8%
*-commutative99.8%
Simplified99.8%
unpow299.8%
Applied egg-rr99.8%
Final simplification99.9%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ (/ 2.0 r) r)) (t_1 (* -0.25 (* (* r w) (* r w)))))
(if (<= v -4e+41)
(+ -1.5 (+ t_0 t_1))
(if (<= v 8.5e-19)
(+ t_0 (+ -1.5 (/ (- (* v -0.25) -0.375) (/ (/ (/ -1.0 r) w) (* r w)))))
(+ -1.5 (+ t_1 (/ 2.0 (* r r))))))))
double code(double v, double w, double r) {
double t_0 = (2.0 / r) / r;
double t_1 = -0.25 * ((r * w) * (r * w));
double tmp;
if (v <= -4e+41) {
tmp = -1.5 + (t_0 + t_1);
} else if (v <= 8.5e-19) {
tmp = t_0 + (-1.5 + (((v * -0.25) - -0.375) / (((-1.0 / r) / w) / (r * w))));
} else {
tmp = -1.5 + (t_1 + (2.0 / (r * r)));
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (2.0d0 / r) / r
t_1 = (-0.25d0) * ((r * w) * (r * w))
if (v <= (-4d+41)) then
tmp = (-1.5d0) + (t_0 + t_1)
else if (v <= 8.5d-19) then
tmp = t_0 + ((-1.5d0) + (((v * (-0.25d0)) - (-0.375d0)) / ((((-1.0d0) / r) / w) / (r * w))))
else
tmp = (-1.5d0) + (t_1 + (2.0d0 / (r * r)))
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 = -0.25 * ((r * w) * (r * w));
double tmp;
if (v <= -4e+41) {
tmp = -1.5 + (t_0 + t_1);
} else if (v <= 8.5e-19) {
tmp = t_0 + (-1.5 + (((v * -0.25) - -0.375) / (((-1.0 / r) / w) / (r * w))));
} else {
tmp = -1.5 + (t_1 + (2.0 / (r * r)));
}
return tmp;
}
def code(v, w, r): t_0 = (2.0 / r) / r t_1 = -0.25 * ((r * w) * (r * w)) tmp = 0 if v <= -4e+41: tmp = -1.5 + (t_0 + t_1) elif v <= 8.5e-19: tmp = t_0 + (-1.5 + (((v * -0.25) - -0.375) / (((-1.0 / r) / w) / (r * w)))) else: tmp = -1.5 + (t_1 + (2.0 / (r * r))) return tmp
function code(v, w, r) t_0 = Float64(Float64(2.0 / r) / r) t_1 = Float64(-0.25 * Float64(Float64(r * w) * Float64(r * w))) tmp = 0.0 if (v <= -4e+41) tmp = Float64(-1.5 + Float64(t_0 + t_1)); elseif (v <= 8.5e-19) tmp = Float64(t_0 + Float64(-1.5 + Float64(Float64(Float64(v * -0.25) - -0.375) / Float64(Float64(Float64(-1.0 / r) / w) / Float64(r * w))))); else tmp = Float64(-1.5 + Float64(t_1 + Float64(2.0 / Float64(r * r)))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = (2.0 / r) / r; t_1 = -0.25 * ((r * w) * (r * w)); tmp = 0.0; if (v <= -4e+41) tmp = -1.5 + (t_0 + t_1); elseif (v <= 8.5e-19) tmp = t_0 + (-1.5 + (((v * -0.25) - -0.375) / (((-1.0 / r) / w) / (r * w)))); else tmp = -1.5 + (t_1 + (2.0 / (r * r))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]}, Block[{t$95$1 = N[(-0.25 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, -4e+41], N[(-1.5 + N[(t$95$0 + t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[v, 8.5e-19], N[(t$95$0 + N[(-1.5 + N[(N[(N[(v * -0.25), $MachinePrecision] - -0.375), $MachinePrecision] / N[(N[(N[(-1.0 / r), $MachinePrecision] / w), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.5 + N[(t$95$1 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{2}{r}}{r}\\
t_1 := -0.25 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\\
\mathbf{if}\;v \leq -4 \cdot 10^{+41}:\\
\;\;\;\;-1.5 + \left(t_0 + t_1\right)\\
\mathbf{elif}\;v \leq 8.5 \cdot 10^{-19}:\\
\;\;\;\;t_0 + \left(-1.5 + \frac{v \cdot -0.25 - -0.375}{\frac{\frac{\frac{-1}{r}}{w}}{r \cdot w}}\right)\\
\mathbf{else}:\\
\;\;\;\;-1.5 + \left(t_1 + \frac{2}{r \cdot r}\right)\\
\end{array}
\end{array}
if v < -4.00000000000000002e41Initial program 80.2%
Simplified83.6%
Taylor expanded in v around inf 84.1%
*-commutative84.1%
*-commutative84.1%
unpow284.1%
unpow284.1%
swap-sqr99.8%
unpow299.8%
*-commutative99.8%
Simplified99.8%
unpow299.8%
Applied egg-rr99.8%
associate-/r*99.8%
div-inv99.7%
Applied egg-rr99.7%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
if -4.00000000000000002e41 < v < 8.50000000000000003e-19Initial program 87.2%
Simplified97.5%
frac-2neg97.5%
*-commutative97.5%
associate-*r*87.3%
div-inv87.3%
associate-*r*97.4%
*-commutative97.4%
associate-*r*99.8%
pow299.8%
*-commutative99.8%
Applied egg-rr99.8%
associate-*r/99.8%
*-rgt-identity99.8%
neg-sub099.8%
fma-udef99.8%
*-commutative99.8%
+-commutative99.8%
associate--r+99.8%
metadata-eval99.8%
*-commutative99.8%
distribute-neg-frac99.8%
neg-sub099.8%
associate--r-99.8%
metadata-eval99.8%
*-commutative99.8%
Simplified99.8%
expm1-log1p-u40.0%
expm1-udef4.5%
div-inv4.5%
pow-flip4.5%
metadata-eval4.5%
Applied egg-rr4.5%
expm1-def40.0%
expm1-log1p99.8%
Simplified99.8%
metadata-eval99.8%
pow-flip99.8%
pow299.8%
div-inv99.8%
associate-/r*99.8%
Applied egg-rr99.8%
Taylor expanded in v around 0 99.8%
associate-/r*99.8%
Simplified99.8%
if 8.50000000000000003e-19 < v Initial program 79.7%
Simplified80.6%
Taylor expanded in v around inf 88.0%
*-commutative88.0%
*-commutative88.0%
unpow288.0%
unpow288.0%
swap-sqr99.7%
unpow299.7%
*-commutative99.7%
Simplified99.7%
unpow299.7%
Applied egg-rr99.7%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (+ (/ (/ 2.0 r) r) (+ -1.5 (/ (- (* v -0.25) -0.375) (/ (+ v -1.0) (* (* r w) (* r w)))))))
double code(double v, double w, double r) {
return ((2.0 / r) / r) + (-1.5 + (((v * -0.25) - -0.375) / ((v + -1.0) / ((r * w) * (r * w)))));
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((2.0d0 / r) / r) + ((-1.5d0) + (((v * (-0.25d0)) - (-0.375d0)) / ((v + (-1.0d0)) / ((r * w) * (r * w)))))
end function
public static double code(double v, double w, double r) {
return ((2.0 / r) / r) + (-1.5 + (((v * -0.25) - -0.375) / ((v + -1.0) / ((r * w) * (r * w)))));
}
def code(v, w, r): return ((2.0 / r) / r) + (-1.5 + (((v * -0.25) - -0.375) / ((v + -1.0) / ((r * w) * (r * w)))))
function code(v, w, r) return Float64(Float64(Float64(2.0 / r) / r) + Float64(-1.5 + Float64(Float64(Float64(v * -0.25) - -0.375) / Float64(Float64(v + -1.0) / Float64(Float64(r * w) * Float64(r * w)))))) end
function tmp = code(v, w, r) tmp = ((2.0 / r) / r) + (-1.5 + (((v * -0.25) - -0.375) / ((v + -1.0) / ((r * w) * (r * w))))); end
code[v_, w_, r_] := N[(N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision] + N[(-1.5 + N[(N[(N[(v * -0.25), $MachinePrecision] - -0.375), $MachinePrecision] / N[(N[(v + -1.0), $MachinePrecision] / N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{2}{r}}{r} + \left(-1.5 + \frac{v \cdot -0.25 - -0.375}{\frac{v + -1}{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}}\right)
\end{array}
Initial program 83.6%
Simplified97.9%
frac-2neg97.9%
*-commutative97.9%
associate-*r*89.1%
div-inv89.0%
associate-*r*97.9%
*-commutative97.9%
associate-*r*99.8%
pow299.8%
*-commutative99.8%
Applied egg-rr99.8%
associate-*r/99.8%
*-rgt-identity99.8%
neg-sub099.8%
fma-udef99.8%
*-commutative99.8%
+-commutative99.8%
associate--r+99.8%
metadata-eval99.8%
*-commutative99.8%
distribute-neg-frac99.8%
neg-sub099.8%
associate--r-99.8%
metadata-eval99.8%
*-commutative99.8%
Simplified99.8%
unpow294.5%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (+ -1.5 (+ (* -0.25 (* (* r w) (* r w))) (/ 2.0 (* r r)))))
double code(double v, double w, double r) {
return -1.5 + ((-0.25 * ((r * w) * (r * w))) + (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) + (((-0.25d0) * ((r * w) * (r * w))) + (2.0d0 / (r * r)))
end function
public static double code(double v, double w, double r) {
return -1.5 + ((-0.25 * ((r * w) * (r * w))) + (2.0 / (r * r)));
}
def code(v, w, r): return -1.5 + ((-0.25 * ((r * w) * (r * w))) + (2.0 / (r * r)))
function code(v, w, r) return Float64(-1.5 + Float64(Float64(-0.25 * Float64(Float64(r * w) * Float64(r * w))) + Float64(2.0 / Float64(r * r)))) end
function tmp = code(v, w, r) tmp = -1.5 + ((-0.25 * ((r * w) * (r * w))) + (2.0 / (r * r))); end
code[v_, w_, r_] := N[(-1.5 + N[(N[(-0.25 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-1.5 + \left(-0.25 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) + \frac{2}{r \cdot r}\right)
\end{array}
Initial program 83.6%
Simplified82.4%
Taylor expanded in v around inf 81.6%
*-commutative81.6%
*-commutative81.6%
unpow281.6%
unpow281.6%
swap-sqr94.5%
unpow294.5%
*-commutative94.5%
Simplified94.5%
unpow294.5%
Applied egg-rr94.5%
Final simplification94.5%
(FPCore (v w r) :precision binary64 (+ -1.5 (+ (/ (/ 2.0 r) r) (* -0.25 (* (* r w) (* r w))))))
double code(double v, double w, double r) {
return -1.5 + (((2.0 / r) / r) + (-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 = (-1.5d0) + (((2.0d0 / r) / r) + ((-0.25d0) * ((r * w) * (r * w))))
end function
public static double code(double v, double w, double r) {
return -1.5 + (((2.0 / r) / r) + (-0.25 * ((r * w) * (r * w))));
}
def code(v, w, r): return -1.5 + (((2.0 / r) / r) + (-0.25 * ((r * w) * (r * w))))
function code(v, w, r) return Float64(-1.5 + Float64(Float64(Float64(2.0 / r) / r) + Float64(-0.25 * Float64(Float64(r * w) * Float64(r * w))))) end
function tmp = code(v, w, r) tmp = -1.5 + (((2.0 / r) / r) + (-0.25 * ((r * w) * (r * w)))); end
code[v_, w_, r_] := N[(-1.5 + N[(N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision] + N[(-0.25 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-1.5 + \left(\frac{\frac{2}{r}}{r} + -0.25 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)
\end{array}
Initial program 83.6%
Simplified82.4%
Taylor expanded in v around inf 81.6%
*-commutative81.6%
*-commutative81.6%
unpow281.6%
unpow281.6%
swap-sqr94.5%
unpow294.5%
*-commutative94.5%
Simplified94.5%
unpow294.5%
Applied egg-rr94.5%
associate-/r*94.5%
div-inv94.4%
Applied egg-rr94.4%
associate-*r/94.5%
*-rgt-identity94.5%
Simplified94.5%
Final simplification94.5%
herbie shell --seed 2024021
(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))