
(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 14 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 (+ (+ 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 89.1%
associate--l-89.1%
associate-*l*85.2%
sqr-neg85.2%
associate-*l*89.1%
associate-/l*90.6%
fma-define90.6%
Simplified90.6%
*-un-lft-identity90.6%
add-sqr-sqrt90.5%
times-frac90.5%
*-commutative90.5%
sqrt-prod49.6%
*-commutative49.6%
sqrt-prod49.6%
sqrt-prod22.3%
add-sqr-sqrt39.5%
associate-*r*39.5%
add-sqr-sqrt75.2%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (+ (* v -0.25) 0.375))
(t_1 (/ r (+ v -1.0)))
(t_2 (/ 2.0 (* r r))))
(if (<= (* w w) 2e+303)
(+ t_2 (+ -1.5 (* t_0 (* r (* (* w w) t_1)))))
(- (+ (+ 3.0 t_2) (* (* w (* r t_0)) (* w t_1))) 4.5))))
double code(double v, double w, double r) {
double t_0 = (v * -0.25) + 0.375;
double t_1 = r / (v + -1.0);
double t_2 = 2.0 / (r * r);
double tmp;
if ((w * w) <= 2e+303) {
tmp = t_2 + (-1.5 + (t_0 * (r * ((w * w) * t_1))));
} else {
tmp = ((3.0 + t_2) + ((w * (r * t_0)) * (w * t_1))) - 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (v * (-0.25d0)) + 0.375d0
t_1 = r / (v + (-1.0d0))
t_2 = 2.0d0 / (r * r)
if ((w * w) <= 2d+303) then
tmp = t_2 + ((-1.5d0) + (t_0 * (r * ((w * w) * t_1))))
else
tmp = ((3.0d0 + t_2) + ((w * (r * t_0)) * (w * t_1))) - 4.5d0
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 = r / (v + -1.0);
double t_2 = 2.0 / (r * r);
double tmp;
if ((w * w) <= 2e+303) {
tmp = t_2 + (-1.5 + (t_0 * (r * ((w * w) * t_1))));
} else {
tmp = ((3.0 + t_2) + ((w * (r * t_0)) * (w * t_1))) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = (v * -0.25) + 0.375 t_1 = r / (v + -1.0) t_2 = 2.0 / (r * r) tmp = 0 if (w * w) <= 2e+303: tmp = t_2 + (-1.5 + (t_0 * (r * ((w * w) * t_1)))) else: tmp = ((3.0 + t_2) + ((w * (r * t_0)) * (w * t_1))) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(Float64(v * -0.25) + 0.375) t_1 = Float64(r / Float64(v + -1.0)) t_2 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (Float64(w * w) <= 2e+303) tmp = Float64(t_2 + Float64(-1.5 + Float64(t_0 * Float64(r * Float64(Float64(w * w) * t_1))))); else tmp = Float64(Float64(Float64(3.0 + t_2) + Float64(Float64(w * Float64(r * t_0)) * Float64(w * t_1))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = (v * -0.25) + 0.375; t_1 = r / (v + -1.0); t_2 = 2.0 / (r * r); tmp = 0.0; if ((w * w) <= 2e+303) tmp = t_2 + (-1.5 + (t_0 * (r * ((w * w) * t_1)))); else tmp = ((3.0 + t_2) + ((w * (r * t_0)) * (w * t_1))) - 4.5; 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[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(w * w), $MachinePrecision], 2e+303], N[(t$95$2 + N[(-1.5 + N[(t$95$0 * N[(r * N[(N[(w * w), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(3.0 + t$95$2), $MachinePrecision] + N[(N[(w * N[(r * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(w * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := v \cdot -0.25 + 0.375\\
t_1 := \frac{r}{v + -1}\\
t_2 := \frac{2}{r \cdot r}\\
\mathbf{if}\;w \cdot w \leq 2 \cdot 10^{+303}:\\
\;\;\;\;t\_2 + \left(-1.5 + t\_0 \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot t\_1\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(3 + t\_2\right) + \left(w \cdot \left(r \cdot t\_0\right)\right) \cdot \left(w \cdot t\_1\right)\right) - 4.5\\
\end{array}
\end{array}
if (*.f64 w w) < 2e303Initial program 97.2%
Simplified99.2%
fma-undefine99.2%
*-commutative99.2%
distribute-lft-in99.2%
associate-*r*99.2%
metadata-eval99.2%
metadata-eval99.2%
Applied egg-rr99.2%
if 2e303 < (*.f64 w w) Initial program 64.1%
associate-/l*64.1%
cancel-sign-sub-inv64.1%
metadata-eval64.1%
+-commutative64.1%
*-commutative64.1%
fma-undefine64.1%
*-commutative64.1%
*-commutative64.1%
associate-/l*64.1%
*-commutative64.1%
associate-*r/63.9%
associate-*r*63.9%
associate-*l*93.9%
associate-*r*98.4%
Applied egg-rr98.4%
Final simplification99.0%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= r 6e-55)
(-
(+ 3.0 t_0)
(+ 4.5 (* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (* r w)))))
(+
t_0
(+ -1.5 (* (+ (* v -0.25) 0.375) (* r (* (* w w) (/ r (+ v -1.0))))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 6e-55) {
tmp = (3.0 + t_0) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (r * w))));
} else {
tmp = t_0 + (-1.5 + (((v * -0.25) + 0.375) * (r * ((w * w) * (r / (v + -1.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) :: tmp
t_0 = 2.0d0 / (r * r)
if (r <= 6d-55) then
tmp = (3.0d0 + t_0) - (4.5d0 + ((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * (r * w))))
else
tmp = t_0 + ((-1.5d0) + (((v * (-0.25d0)) + 0.375d0) * (r * ((w * w) * (r / (v + (-1.0d0)))))))
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 (r <= 6e-55) {
tmp = (3.0 + t_0) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (r * w))));
} else {
tmp = t_0 + (-1.5 + (((v * -0.25) + 0.375) * (r * ((w * w) * (r / (v + -1.0))))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if r <= 6e-55: tmp = (3.0 + t_0) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (r * w)))) else: tmp = t_0 + (-1.5 + (((v * -0.25) + 0.375) * (r * ((w * w) * (r / (v + -1.0)))))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 6e-55) tmp = Float64(Float64(3.0 + t_0) - Float64(4.5 + Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) * Float64(r * w))))); else tmp = Float64(t_0 + Float64(-1.5 + Float64(Float64(Float64(v * -0.25) + 0.375) * Float64(r * Float64(Float64(w * w) * Float64(r / Float64(v + -1.0))))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (r <= 6e-55) tmp = (3.0 + t_0) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (r * w)))); else tmp = t_0 + (-1.5 + (((v * -0.25) + 0.375) * (r * ((w * w) * (r / (v + -1.0)))))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 6e-55], N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(4.5 + N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.5 + N[(N[(N[(v * -0.25), $MachinePrecision] + 0.375), $MachinePrecision] * N[(r * N[(N[(w * w), $MachinePrecision] * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 6 \cdot 10^{-55}:\\
\;\;\;\;\left(3 + t\_0\right) - \left(4.5 + \left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \left(-1.5 + \left(v \cdot -0.25 + 0.375\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{v + -1}\right)\right)\right)\\
\end{array}
\end{array}
if r < 6.00000000000000033e-55Initial program 86.0%
associate--l-86.0%
associate-*l*82.3%
sqr-neg82.3%
associate-*l*86.0%
associate-/l*87.5%
fma-define87.5%
Simplified87.5%
*-un-lft-identity87.5%
add-sqr-sqrt87.5%
times-frac87.5%
*-commutative87.5%
sqrt-prod30.9%
*-commutative30.9%
sqrt-prod30.9%
sqrt-prod15.2%
add-sqr-sqrt32.0%
associate-*r*32.0%
add-sqr-sqrt81.4%
Applied egg-rr99.8%
Taylor expanded in v around 0 90.5%
/-rgt-identity90.5%
Applied egg-rr90.5%
if 6.00000000000000033e-55 < r Initial program 97.2%
Simplified98.5%
fma-undefine98.5%
*-commutative98.5%
distribute-lft-in98.5%
associate-*r*98.5%
metadata-eval98.5%
metadata-eval98.5%
Applied egg-rr98.5%
Final simplification92.7%
(FPCore (v w r)
:precision binary64
(if (<= r 1.3e-91)
(- (+ 3.0 (/ (/ 2.0 r) r)) 4.5)
(+
(/ 2.0 (* r r))
(+ -1.5 (* (+ (* v -0.25) 0.375) (* r (* (* w w) (/ r (+ v -1.0)))))))))
double code(double v, double w, double r) {
double tmp;
if (r <= 1.3e-91) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) * (r * ((w * w) * (r / (v + -1.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) :: tmp
if (r <= 1.3d-91) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else
tmp = (2.0d0 / (r * r)) + ((-1.5d0) + (((v * (-0.25d0)) + 0.375d0) * (r * ((w * w) * (r / (v + (-1.0d0)))))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 1.3e-91) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) * (r * ((w * w) * (r / (v + -1.0))))));
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 1.3e-91: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 else: tmp = (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) * (r * ((w * w) * (r / (v + -1.0)))))) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 1.3e-91) tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); else tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(Float64(Float64(v * -0.25) + 0.375) * Float64(r * Float64(Float64(w * w) * Float64(r / Float64(v + -1.0))))))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 1.3e-91) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; else tmp = (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) * (r * ((w * w) * (r / (v + -1.0)))))); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 1.3e-91], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(N[(N[(v * -0.25), $MachinePrecision] + 0.375), $MachinePrecision] * N[(r * N[(N[(w * w), $MachinePrecision] * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.3 \cdot 10^{-91}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 + \left(v \cdot -0.25 + 0.375\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{v + -1}\right)\right)\right)\\
\end{array}
\end{array}
if r < 1.30000000000000007e-91Initial program 86.4%
Simplified83.5%
Taylor expanded in r around 0 72.1%
associate-/r*72.1%
div-inv72.0%
Applied egg-rr72.0%
associate-*r/72.1%
*-rgt-identity72.1%
Simplified72.1%
if 1.30000000000000007e-91 < r Initial program 94.3%
Simplified95.4%
fma-undefine95.4%
*-commutative95.4%
distribute-lft-in95.4%
associate-*r*95.4%
metadata-eval95.4%
metadata-eval95.4%
Applied egg-rr95.4%
Final simplification79.9%
(FPCore (v w r) :precision binary64 (+ (+ 3.0 (/ 2.0 (* r r))) (- (* (* 0.125 (+ 3.0 (* -2.0 v))) (/ (* r w) (/ (+ 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))) * ((r * w) / ((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))) * ((r * w) / ((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))) * ((r * w) / ((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))) * ((r * w) / ((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(Float64(r * w) / 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))) * ((r * w) / ((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[(N[(r * w), $MachinePrecision] / N[(N[(v + -1.0), $MachinePrecision] / N[(r * w), $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 \frac{r \cdot w}{\frac{v + -1}{r \cdot w}} - 4.5\right)
\end{array}
Initial program 89.1%
associate--l-89.1%
associate-*l*85.2%
sqr-neg85.2%
associate-*l*89.1%
associate-/l*90.6%
fma-define90.6%
Simplified90.6%
*-un-lft-identity90.6%
add-sqr-sqrt90.5%
times-frac90.5%
*-commutative90.5%
sqrt-prod49.6%
*-commutative49.6%
sqrt-prod49.6%
sqrt-prod22.3%
add-sqr-sqrt39.5%
associate-*r*39.5%
add-sqr-sqrt75.2%
Applied egg-rr99.8%
/-rgt-identity99.8%
clear-num99.8%
un-div-inv99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (+ (+ 3.0 (/ 2.0 (* r r))) (- (* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (* 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))) * ((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 + (2.0d0 / (r * r))) + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * (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))) * ((r * w) * (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))) * ((r * w) * (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(Float64(r * w) * Float64(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))) * ((r * w) * (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[(N[(r * w), $MachinePrecision] * N[(w * 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(\left(r \cdot w\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\right) - 4.5\right)
\end{array}
Initial program 89.1%
associate--l-89.1%
associate-*l*85.2%
sqr-neg85.2%
associate-*l*89.1%
associate-/l*90.6%
fma-define90.6%
Simplified90.6%
associate-/l*90.6%
*-commutative90.6%
associate-*r/90.5%
associate-*l*98.3%
associate-*r*99.4%
add-sqr-sqrt55.3%
sqrt-prod77.7%
add-sqr-sqrt37.4%
sqrt-prod68.6%
sqrt-prod68.6%
associate-*r*73.6%
*-commutative73.6%
sqrt-prod39.5%
*-commutative39.5%
sqrt-prod39.4%
sqrt-prod26.1%
add-sqr-sqrt55.3%
associate-*r*55.3%
add-sqr-sqrt99.4%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (v w r)
:precision binary64
(if (<= r 4.6e-35)
(- (+ 3.0 (/ (/ 2.0 r) r)) 4.5)
(+
3.0
(-
(* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (/ (* r w) (+ v -1.0))))
4.5))))
double code(double v, double w, double r) {
double tmp;
if (r <= 4.6e-35) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((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) :: tmp
if (r <= 4.6d-35) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else
tmp = 3.0d0 + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * ((r * w) / (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 <= 4.6e-35) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / (v + -1.0)))) - 4.5);
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 4.6e-35: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 else: tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / (v + -1.0)))) - 4.5) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 4.6e-35) tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); else tmp = Float64(3.0 + 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 return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 4.6e-35) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; else tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / (v + -1.0)))) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 4.6e-35], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(3.0 + 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}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 4.6 \cdot 10^{-35}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;3 + \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}
\end{array}
if r < 4.5999999999999998e-35Initial program 86.3%
Simplified83.7%
Taylor expanded in r around 0 72.9%
associate-/r*72.9%
div-inv72.8%
Applied egg-rr72.8%
associate-*r/72.9%
*-rgt-identity72.9%
Simplified72.9%
if 4.5999999999999998e-35 < r Initial program 97.0%
associate--l-97.0%
associate-*l*92.4%
sqr-neg92.4%
associate-*l*97.0%
associate-/l*98.5%
fma-define98.5%
Simplified98.5%
associate-/l*98.5%
*-commutative98.5%
associate-*r/98.5%
associate-*l*99.8%
associate-*r*99.8%
add-sqr-sqrt99.8%
sqrt-prod94.0%
add-sqr-sqrt38.0%
sqrt-prod51.5%
sqrt-prod51.5%
associate-*r*56.1%
*-commutative56.1%
sqrt-prod56.0%
*-commutative56.0%
sqrt-prod56.0%
sqrt-prod42.3%
add-sqr-sqrt99.8%
associate-*r*99.8%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
Taylor expanded in r around inf 96.7%
associate-*r/96.7%
Applied egg-rr96.7%
Final simplification79.0%
(FPCore (v w r)
:precision binary64
(if (<= r 2.4e-35)
(- (+ 3.0 (/ (/ 2.0 r) r)) 4.5)
(+
3.0
(-
(* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (* w (/ r (+ v -1.0)))))
4.5))))
double code(double v, double w, double r) {
double tmp;
if (r <= 2.4e-35) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((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 <= 2.4d-35) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else
tmp = 3.0d0 + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((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 <= 2.4e-35) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (v + -1.0))))) - 4.5);
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 2.4e-35: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 else: tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (v + -1.0))))) - 4.5) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 2.4e-35) tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); else tmp = Float64(3.0 + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * 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 <= 2.4e-35) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; else tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (v + -1.0))))) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 2.4e-35], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(3.0 + N[(N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $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 2.4 \cdot 10^{-35}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;3 + \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\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 < 2.4000000000000001e-35Initial program 86.3%
Simplified83.7%
Taylor expanded in r around 0 72.9%
associate-/r*72.9%
div-inv72.8%
Applied egg-rr72.8%
associate-*r/72.9%
*-rgt-identity72.9%
Simplified72.9%
if 2.4000000000000001e-35 < r Initial program 97.0%
associate--l-97.0%
associate-*l*92.4%
sqr-neg92.4%
associate-*l*97.0%
associate-/l*98.5%
fma-define98.5%
Simplified98.5%
associate-/l*98.5%
*-commutative98.5%
associate-*r/98.5%
associate-*l*99.8%
associate-*r*99.8%
add-sqr-sqrt99.8%
sqrt-prod94.0%
add-sqr-sqrt38.0%
sqrt-prod51.5%
sqrt-prod51.5%
associate-*r*56.1%
*-commutative56.1%
sqrt-prod56.0%
*-commutative56.0%
sqrt-prod56.0%
sqrt-prod42.3%
add-sqr-sqrt99.8%
associate-*r*99.8%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
Taylor expanded in r around inf 96.7%
Final simplification79.0%
(FPCore (v w r)
:precision binary64
(if (<= r 4.4e-35)
(- (+ 3.0 (/ (/ 2.0 r) r)) 4.5)
(-
(+ 3.0 (* (* w (* r (+ (* v -0.25) 0.375))) (* w (/ r (+ v -1.0)))))
4.5)))
double code(double v, double w, double r) {
double tmp;
if (r <= 4.4e-35) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = (3.0 + ((w * (r * ((v * -0.25) + 0.375))) * (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 <= 4.4d-35) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else
tmp = (3.0d0 + ((w * (r * ((v * (-0.25d0)) + 0.375d0))) * (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 <= 4.4e-35) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = (3.0 + ((w * (r * ((v * -0.25) + 0.375))) * (w * (r / (v + -1.0))))) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 4.4e-35: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 else: tmp = (3.0 + ((w * (r * ((v * -0.25) + 0.375))) * (w * (r / (v + -1.0))))) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 4.4e-35) tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); else tmp = Float64(Float64(3.0 + Float64(Float64(w * Float64(r * Float64(Float64(v * -0.25) + 0.375))) * 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 <= 4.4e-35) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; else tmp = (3.0 + ((w * (r * ((v * -0.25) + 0.375))) * (w * (r / (v + -1.0))))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 4.4e-35], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(3.0 + N[(N[(w * N[(r * N[(N[(v * -0.25), $MachinePrecision] + 0.375), $MachinePrecision]), $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}\;r \leq 4.4 \cdot 10^{-35}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(3 + \left(w \cdot \left(r \cdot \left(v \cdot -0.25 + 0.375\right)\right)\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\right) - 4.5\\
\end{array}
\end{array}
if r < 4.39999999999999987e-35Initial program 86.3%
Simplified83.7%
Taylor expanded in r around 0 72.9%
associate-/r*72.9%
div-inv72.8%
Applied egg-rr72.8%
associate-*r/72.9%
*-rgt-identity72.9%
Simplified72.9%
if 4.39999999999999987e-35 < r Initial program 97.0%
associate-/l*98.5%
cancel-sign-sub-inv98.5%
metadata-eval98.5%
+-commutative98.5%
*-commutative98.5%
fma-undefine98.5%
*-commutative98.5%
*-commutative98.5%
associate-/l*98.5%
*-commutative98.5%
associate-*r/98.5%
associate-*r*91.0%
associate-*l*92.3%
associate-*r*92.4%
Applied egg-rr92.4%
Taylor expanded in r around inf 89.3%
Final simplification77.1%
(FPCore (v w r) :precision binary64 (if (<= r 7e-93) (- (+ 3.0 (/ (/ 2.0 r) r)) 4.5) (+ (/ 2.0 (* r r)) (+ -1.5 (* 0.375 (* r (* (* w w) (/ r (+ v -1.0)))))))))
double code(double v, double w, double r) {
double tmp;
if (r <= 7e-93) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.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) :: tmp
if (r <= 7d-93) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else
tmp = (2.0d0 / (r * r)) + ((-1.5d0) + (0.375d0 * (r * ((w * w) * (r / (v + (-1.0d0)))))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 7e-93) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0))))));
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 7e-93: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 else: tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0)))))) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 7e-93) tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); else tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(0.375 * Float64(r * Float64(Float64(w * w) * Float64(r / Float64(v + -1.0))))))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 7e-93) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; else tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0)))))); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 7e-93], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(0.375 * N[(r * N[(N[(w * w), $MachinePrecision] * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 7 \cdot 10^{-93}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 + 0.375 \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{v + -1}\right)\right)\right)\\
\end{array}
\end{array}
if r < 7e-93Initial program 86.4%
Simplified83.5%
Taylor expanded in r around 0 72.1%
associate-/r*72.1%
div-inv72.0%
Applied egg-rr72.0%
associate-*r/72.1%
*-rgt-identity72.1%
Simplified72.1%
if 7e-93 < r Initial program 94.3%
Simplified95.4%
Taylor expanded in v around 0 77.7%
Final simplification74.0%
(FPCore (v w r) :precision binary64 (if (<= r 6.6e-34) (- (+ 3.0 (/ (/ 2.0 r) r)) 4.5) (- 3.0 (+ 4.5 (* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (* r w)))))))
double code(double v, double w, double r) {
double tmp;
if (r <= 6.6e-34) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * 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) :: tmp
if (r <= 6.6d-34) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else
tmp = 3.0d0 - (4.5d0 + ((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * (r * w))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 6.6e-34) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (r * w))));
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 6.6e-34: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 else: tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (r * w)))) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 6.6e-34) tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); else tmp = Float64(3.0 - Float64(4.5 + Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) * Float64(r * w))))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 6.6e-34) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; else tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (r * w)))); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 6.6e-34], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(3.0 - N[(4.5 + N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 6.6 \cdot 10^{-34}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;3 - \left(4.5 + \left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\
\end{array}
\end{array}
if r < 6.59999999999999965e-34Initial program 86.3%
Simplified83.7%
Taylor expanded in r around 0 72.9%
associate-/r*72.9%
div-inv72.8%
Applied egg-rr72.8%
associate-*r/72.9%
*-rgt-identity72.9%
Simplified72.9%
if 6.59999999999999965e-34 < r Initial program 97.0%
associate--l-97.0%
associate-*l*92.4%
sqr-neg92.4%
associate-*l*97.0%
associate-/l*98.5%
fma-define98.5%
Simplified98.5%
associate-/l*98.5%
*-commutative98.5%
associate-*r/98.5%
associate-*l*99.8%
associate-*r*99.8%
add-sqr-sqrt99.8%
sqrt-prod94.0%
add-sqr-sqrt38.0%
sqrt-prod51.5%
sqrt-prod51.5%
associate-*r*56.1%
*-commutative56.1%
sqrt-prod56.0%
*-commutative56.0%
sqrt-prod56.0%
sqrt-prod42.3%
add-sqr-sqrt99.8%
associate-*r*99.8%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
Taylor expanded in r around inf 96.7%
Taylor expanded in v around 0 70.8%
Final simplification72.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(Float64(2.0 / 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[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5
\end{array}
Initial program 89.1%
Simplified85.2%
Taylor expanded in r around 0 62.5%
associate-/r*62.5%
div-inv62.4%
Applied egg-rr62.4%
associate-*r/62.5%
*-rgt-identity62.5%
Simplified62.5%
(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 89.1%
Simplified85.2%
Taylor expanded in r around 0 62.5%
(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 89.1%
Simplified85.2%
Taylor expanded in r around 0 62.5%
Taylor expanded in r around inf 16.1%
herbie shell --seed 2024118
(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))