
(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 12 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) (* 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 87.8%
associate--l-87.8%
associate-*l*80.5%
sqr-neg80.5%
associate-*l*87.8%
associate-/l*91.0%
fma-define91.0%
Simplified91.0%
associate-/l*90.0%
*-commutative90.0%
associate-*r/90.0%
associate-*l*95.9%
associate-*r*99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* r (* (* w w) (/ r (+ v -1.0))))) (t_1 (/ 2.0 (* r r))))
(if (or (<= v -2e+75) (not (<= v 0.18)))
(+ t_1 (+ -1.5 (* (* v -0.25) t_0)))
(+ t_1 (+ -1.5 (* 0.375 t_0))))))
double code(double v, double w, double r) {
double t_0 = r * ((w * w) * (r / (v + -1.0)));
double t_1 = 2.0 / (r * r);
double tmp;
if ((v <= -2e+75) || !(v <= 0.18)) {
tmp = t_1 + (-1.5 + ((v * -0.25) * t_0));
} else {
tmp = t_1 + (-1.5 + (0.375 * t_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) :: t_1
real(8) :: tmp
t_0 = r * ((w * w) * (r / (v + (-1.0d0))))
t_1 = 2.0d0 / (r * r)
if ((v <= (-2d+75)) .or. (.not. (v <= 0.18d0))) then
tmp = t_1 + ((-1.5d0) + ((v * (-0.25d0)) * t_0))
else
tmp = t_1 + ((-1.5d0) + (0.375d0 * t_0))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = r * ((w * w) * (r / (v + -1.0)));
double t_1 = 2.0 / (r * r);
double tmp;
if ((v <= -2e+75) || !(v <= 0.18)) {
tmp = t_1 + (-1.5 + ((v * -0.25) * t_0));
} else {
tmp = t_1 + (-1.5 + (0.375 * t_0));
}
return tmp;
}
def code(v, w, r): t_0 = r * ((w * w) * (r / (v + -1.0))) t_1 = 2.0 / (r * r) tmp = 0 if (v <= -2e+75) or not (v <= 0.18): tmp = t_1 + (-1.5 + ((v * -0.25) * t_0)) else: tmp = t_1 + (-1.5 + (0.375 * t_0)) return tmp
function code(v, w, r) t_0 = Float64(r * Float64(Float64(w * w) * Float64(r / Float64(v + -1.0)))) t_1 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((v <= -2e+75) || !(v <= 0.18)) tmp = Float64(t_1 + Float64(-1.5 + Float64(Float64(v * -0.25) * t_0))); else tmp = Float64(t_1 + Float64(-1.5 + Float64(0.375 * t_0))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = r * ((w * w) * (r / (v + -1.0))); t_1 = 2.0 / (r * r); tmp = 0.0; if ((v <= -2e+75) || ~((v <= 0.18))) tmp = t_1 + (-1.5 + ((v * -0.25) * t_0)); else tmp = t_1 + (-1.5 + (0.375 * t_0)); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(r * N[(N[(w * w), $MachinePrecision] * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -2e+75], N[Not[LessEqual[v, 0.18]], $MachinePrecision]], N[(t$95$1 + N[(-1.5 + N[(N[(v * -0.25), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(-1.5 + N[(0.375 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{v + -1}\right)\\
t_1 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -2 \cdot 10^{+75} \lor \neg \left(v \leq 0.18\right):\\
\;\;\;\;t\_1 + \left(-1.5 + \left(v \cdot -0.25\right) \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(-1.5 + 0.375 \cdot t\_0\right)\\
\end{array}
\end{array}
if v < -1.99999999999999985e75 or 0.17999999999999999 < v Initial program 82.3%
Simplified87.0%
Taylor expanded in v around inf 87.0%
*-commutative87.0%
Simplified87.0%
if -1.99999999999999985e75 < v < 0.17999999999999999Initial program 92.6%
Simplified92.6%
Taylor expanded in v around 0 92.6%
Final simplification90.0%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= r 1.15e-94)
(- (+ 3.0 t_0) 4.5)
(if (<= r 2.1e-17)
(+ t_0 (- -1.5 (* (* v -0.25) (* r (* (/ r (- 1.0 v)) (* w w))))))
(+
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 t_0 = 2.0 / (r * r);
double tmp;
if (r <= 1.15e-94) {
tmp = (3.0 + t_0) - 4.5;
} else if (r <= 2.1e-17) {
tmp = t_0 + (-1.5 - ((v * -0.25) * (r * ((r / (1.0 - v)) * (w * w)))));
} 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) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if (r <= 1.15d-94) then
tmp = (3.0d0 + t_0) - 4.5d0
else if (r <= 2.1d-17) then
tmp = t_0 + ((-1.5d0) - ((v * (-0.25d0)) * (r * ((r / (1.0d0 - v)) * (w * w)))))
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 t_0 = 2.0 / (r * r);
double tmp;
if (r <= 1.15e-94) {
tmp = (3.0 + t_0) - 4.5;
} else if (r <= 2.1e-17) {
tmp = t_0 + (-1.5 - ((v * -0.25) * (r * ((r / (1.0 - v)) * (w * w)))));
} 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): t_0 = 2.0 / (r * r) tmp = 0 if r <= 1.15e-94: tmp = (3.0 + t_0) - 4.5 elif r <= 2.1e-17: tmp = t_0 + (-1.5 - ((v * -0.25) * (r * ((r / (1.0 - v)) * (w * w))))) 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) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 1.15e-94) tmp = Float64(Float64(3.0 + t_0) - 4.5); elseif (r <= 2.1e-17) tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(v * -0.25) * Float64(r * Float64(Float64(r / Float64(1.0 - v)) * Float64(w * w)))))); 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) t_0 = 2.0 / (r * r); tmp = 0.0; if (r <= 1.15e-94) tmp = (3.0 + t_0) - 4.5; elseif (r <= 2.1e-17) tmp = t_0 + (-1.5 - ((v * -0.25) * (r * ((r / (1.0 - v)) * (w * w))))); 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_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 1.15e-94], N[(N[(3.0 + t$95$0), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 2.1e-17], N[(t$95$0 + N[(-1.5 - N[(N[(v * -0.25), $MachinePrecision] * N[(r * N[(N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 1.15 \cdot 10^{-94}:\\
\;\;\;\;\left(3 + t\_0\right) - 4.5\\
\mathbf{elif}\;r \leq 2.1 \cdot 10^{-17}:\\
\;\;\;\;t\_0 + \left(-1.5 - \left(v \cdot -0.25\right) \cdot \left(r \cdot \left(\frac{r}{1 - v} \cdot \left(w \cdot w\right)\right)\right)\right)\\
\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 < 1.15e-94Initial program 86.3%
Simplified79.0%
Taylor expanded in r around 0 66.0%
if 1.15e-94 < r < 2.09999999999999992e-17Initial program 99.7%
Simplified99.7%
Taylor expanded in v around inf 87.2%
*-commutative87.2%
Simplified87.2%
if 2.09999999999999992e-17 < r Initial program 89.2%
associate--l-89.2%
associate-*l*77.9%
sqr-neg77.9%
associate-*l*89.2%
associate-/l*95.3%
fma-define95.3%
Simplified95.3%
associate-/l*93.7%
*-commutative93.7%
associate-*r/93.7%
associate-*l*95.9%
associate-*r*99.8%
Applied egg-rr99.8%
Taylor expanded in r around inf 98.2%
Final simplification74.9%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))) (t_1 (/ r (+ v -1.0))))
(if (<= r 2.6e-95)
(- (+ 3.0 t_0) 4.5)
(if (<= r 2.1e-17)
(+ t_0 (+ -1.5 (* (* v -0.25) (* r (* (* w w) t_1)))))
(+
3.0
(- (* (* 0.125 (+ 3.0 (* -2.0 v))) (* w (* r (* w t_1)))) 4.5))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = r / (v + -1.0);
double tmp;
if (r <= 2.6e-95) {
tmp = (3.0 + t_0) - 4.5;
} else if (r <= 2.1e-17) {
tmp = t_0 + (-1.5 + ((v * -0.25) * (r * ((w * w) * t_1))));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * (w * (r * (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) :: tmp
t_0 = 2.0d0 / (r * r)
t_1 = r / (v + (-1.0d0))
if (r <= 2.6d-95) then
tmp = (3.0d0 + t_0) - 4.5d0
else if (r <= 2.1d-17) then
tmp = t_0 + ((-1.5d0) + ((v * (-0.25d0)) * (r * ((w * w) * t_1))))
else
tmp = 3.0d0 + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * (w * (r * (w * t_1)))) - 4.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = r / (v + -1.0);
double tmp;
if (r <= 2.6e-95) {
tmp = (3.0 + t_0) - 4.5;
} else if (r <= 2.1e-17) {
tmp = t_0 + (-1.5 + ((v * -0.25) * (r * ((w * w) * t_1))));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * (w * (r * (w * t_1)))) - 4.5);
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = r / (v + -1.0) tmp = 0 if r <= 2.6e-95: tmp = (3.0 + t_0) - 4.5 elif r <= 2.1e-17: tmp = t_0 + (-1.5 + ((v * -0.25) * (r * ((w * w) * t_1)))) else: tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * (w * (r * (w * t_1)))) - 4.5) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) t_1 = Float64(r / Float64(v + -1.0)) tmp = 0.0 if (r <= 2.6e-95) tmp = Float64(Float64(3.0 + t_0) - 4.5); elseif (r <= 2.1e-17) tmp = Float64(t_0 + Float64(-1.5 + Float64(Float64(v * -0.25) * Float64(r * Float64(Float64(w * w) * t_1))))); else tmp = Float64(3.0 + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(w * Float64(r * Float64(w * t_1)))) - 4.5)); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); t_1 = r / (v + -1.0); tmp = 0.0; if (r <= 2.6e-95) tmp = (3.0 + t_0) - 4.5; elseif (r <= 2.1e-17) tmp = t_0 + (-1.5 + ((v * -0.25) * (r * ((w * w) * t_1)))); else tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * (w * (r * (w * t_1)))) - 4.5); 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[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 2.6e-95], N[(N[(3.0 + t$95$0), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 2.1e-17], N[(t$95$0 + N[(-1.5 + N[(N[(v * -0.25), $MachinePrecision] * N[(r * N[(N[(w * w), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 + N[(N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r * N[(w * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := \frac{r}{v + -1}\\
\mathbf{if}\;r \leq 2.6 \cdot 10^{-95}:\\
\;\;\;\;\left(3 + t\_0\right) - 4.5\\
\mathbf{elif}\;r \leq 2.1 \cdot 10^{-17}:\\
\;\;\;\;t\_0 + \left(-1.5 + \left(v \cdot -0.25\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot t\_1\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;3 + \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(w \cdot \left(r \cdot \left(w \cdot t\_1\right)\right)\right) - 4.5\right)\\
\end{array}
\end{array}
if r < 2.60000000000000001e-95Initial program 86.3%
Simplified79.0%
Taylor expanded in r around 0 66.0%
if 2.60000000000000001e-95 < r < 2.09999999999999992e-17Initial program 99.7%
Simplified99.7%
Taylor expanded in v around inf 87.2%
*-commutative87.2%
Simplified87.2%
if 2.09999999999999992e-17 < r Initial program 89.2%
associate--l-89.2%
associate-*l*77.9%
sqr-neg77.9%
associate-*l*89.2%
associate-/l*95.3%
fma-define95.3%
Simplified95.3%
Taylor expanded in r around inf 93.6%
associate-/l*92.1%
*-commutative92.1%
associate-*r/92.1%
*-commutative92.1%
associate-*l*94.3%
associate-*l*92.0%
Applied egg-rr92.0%
Final simplification73.4%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= r 8.5e-95)
(- (+ 3.0 t_0) 4.5)
(if (<= r 6.8e+242)
(+ t_0 (+ -1.5 (* 0.375 (* r (* (* w w) (/ r (+ v -1.0)))))))
(+
3.0
(- (* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (/ (* r w) v))) 4.5))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 8.5e-95) {
tmp = (3.0 + t_0) - 4.5;
} else if (r <= 6.8e+242) {
tmp = t_0 + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0))))));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / v))) - 4.5);
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if (r <= 8.5d-95) then
tmp = (3.0d0 + t_0) - 4.5d0
else if (r <= 6.8d+242) then
tmp = t_0 + ((-1.5d0) + (0.375d0 * (r * ((w * w) * (r / (v + (-1.0d0)))))))
else
tmp = 3.0d0 + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * ((r * w) / v))) - 4.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 8.5e-95) {
tmp = (3.0 + t_0) - 4.5;
} else if (r <= 6.8e+242) {
tmp = t_0 + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0))))));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / v))) - 4.5);
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if r <= 8.5e-95: tmp = (3.0 + t_0) - 4.5 elif r <= 6.8e+242: tmp = t_0 + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0)))))) else: tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / v))) - 4.5) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 8.5e-95) tmp = Float64(Float64(3.0 + t_0) - 4.5); elseif (r <= 6.8e+242) tmp = Float64(t_0 + Float64(-1.5 + Float64(0.375 * Float64(r * Float64(Float64(w * w) * Float64(r / Float64(v + -1.0))))))); 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) / v))) - 4.5)); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (r <= 8.5e-95) tmp = (3.0 + t_0) - 4.5; elseif (r <= 6.8e+242) tmp = t_0 + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0)))))); else tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / v))) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 8.5e-95], N[(N[(3.0 + t$95$0), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 6.8e+242], N[(t$95$0 + 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], 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] / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 8.5 \cdot 10^{-95}:\\
\;\;\;\;\left(3 + t\_0\right) - 4.5\\
\mathbf{elif}\;r \leq 6.8 \cdot 10^{+242}:\\
\;\;\;\;t\_0 + \left(-1.5 + 0.375 \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{v + -1}\right)\right)\right)\\
\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}\right) - 4.5\right)\\
\end{array}
\end{array}
if r < 8.4999999999999995e-95Initial program 86.3%
Simplified79.0%
Taylor expanded in r around 0 66.0%
if 8.4999999999999995e-95 < r < 6.79999999999999964e242Initial program 93.3%
Simplified97.2%
Taylor expanded in v around 0 79.0%
if 6.79999999999999964e242 < r Initial program 68.6%
associate--l-68.6%
associate-*l*50.0%
sqr-neg50.0%
associate-*l*68.6%
associate-/l*68.6%
fma-define68.6%
Simplified68.6%
associate-/l*68.6%
*-commutative68.6%
associate-*r/68.6%
associate-*l*76.4%
associate-*r*100.0%
Applied egg-rr100.0%
Taylor expanded in r around inf 100.0%
Taylor expanded in v around inf 99.7%
associate-*r/99.7%
neg-mul-199.7%
distribute-lft-neg-in99.7%
Simplified99.7%
Final simplification70.3%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= r 3.2e-95)
(- (+ 3.0 t_0) 4.5)
(if (<= r 2.1e+243)
(+ t_0 (- -1.5 (* 0.375 (* r (* (/ r (- 1.0 v)) (* w w))))))
(+
3.0
(- (* (* 0.125 (+ 3.0 (* -2.0 v))) (* w (* r (/ (* r w) v)))) 4.5))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 3.2e-95) {
tmp = (3.0 + t_0) - 4.5;
} else if (r <= 2.1e+243) {
tmp = t_0 + (-1.5 - (0.375 * (r * ((r / (1.0 - v)) * (w * w)))));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * (w * (r * ((r * w) / v)))) - 4.5);
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if (r <= 3.2d-95) then
tmp = (3.0d0 + t_0) - 4.5d0
else if (r <= 2.1d+243) then
tmp = t_0 + ((-1.5d0) - (0.375d0 * (r * ((r / (1.0d0 - v)) * (w * w)))))
else
tmp = 3.0d0 + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * (w * (r * ((r * w) / v)))) - 4.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 3.2e-95) {
tmp = (3.0 + t_0) - 4.5;
} else if (r <= 2.1e+243) {
tmp = t_0 + (-1.5 - (0.375 * (r * ((r / (1.0 - v)) * (w * w)))));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * (w * (r * ((r * w) / v)))) - 4.5);
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if r <= 3.2e-95: tmp = (3.0 + t_0) - 4.5 elif r <= 2.1e+243: tmp = t_0 + (-1.5 - (0.375 * (r * ((r / (1.0 - v)) * (w * w))))) else: tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * (w * (r * ((r * w) / v)))) - 4.5) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 3.2e-95) tmp = Float64(Float64(3.0 + t_0) - 4.5); elseif (r <= 2.1e+243) tmp = Float64(t_0 + Float64(-1.5 - Float64(0.375 * Float64(r * Float64(Float64(r / Float64(1.0 - v)) * Float64(w * w)))))); else tmp = Float64(3.0 + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(w * Float64(r * Float64(Float64(r * w) / v)))) - 4.5)); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (r <= 3.2e-95) tmp = (3.0 + t_0) - 4.5; elseif (r <= 2.1e+243) tmp = t_0 + (-1.5 - (0.375 * (r * ((r / (1.0 - v)) * (w * w))))); else tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * (w * (r * ((r * w) / v)))) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 3.2e-95], N[(N[(3.0 + t$95$0), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 2.1e+243], N[(t$95$0 + N[(-1.5 - N[(0.375 * N[(r * N[(N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 + N[(N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r * N[(N[(r * w), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 3.2 \cdot 10^{-95}:\\
\;\;\;\;\left(3 + t\_0\right) - 4.5\\
\mathbf{elif}\;r \leq 2.1 \cdot 10^{+243}:\\
\;\;\;\;t\_0 + \left(-1.5 - 0.375 \cdot \left(r \cdot \left(\frac{r}{1 - v} \cdot \left(w \cdot w\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;3 + \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(w \cdot \left(r \cdot \frac{r \cdot w}{v}\right)\right) - 4.5\right)\\
\end{array}
\end{array}
if r < 3.1999999999999997e-95Initial program 86.3%
Simplified79.0%
Taylor expanded in r around 0 66.0%
if 3.1999999999999997e-95 < r < 2.0999999999999999e243Initial program 93.3%
Simplified97.2%
Taylor expanded in v around 0 79.0%
if 2.0999999999999999e243 < r Initial program 68.6%
associate--l-68.6%
associate-*l*50.0%
sqr-neg50.0%
associate-*l*68.6%
associate-/l*68.6%
fma-define68.6%
Simplified68.6%
Taylor expanded in r around inf 68.6%
associate-/l*68.6%
*-commutative68.6%
associate-*r/68.6%
*-commutative68.6%
associate-*l*76.4%
associate-*l*99.7%
Applied egg-rr99.7%
Taylor expanded in v around inf 100.0%
associate-*r/99.7%
neg-mul-199.7%
distribute-lft-neg-in99.7%
Simplified100.0%
Final simplification70.3%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= r 3.5e-95)
(- (+ 3.0 t_0) 4.5)
(+ t_0 (+ -1.5 (* 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 <= 3.5e-95) {
tmp = (3.0 + t_0) - 4.5;
} else {
tmp = t_0 + (-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) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if (r <= 3.5d-95) then
tmp = (3.0d0 + t_0) - 4.5d0
else
tmp = t_0 + ((-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 t_0 = 2.0 / (r * r);
double tmp;
if (r <= 3.5e-95) {
tmp = (3.0 + t_0) - 4.5;
} else {
tmp = t_0 + (-1.5 + (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 <= 3.5e-95: tmp = (3.0 + t_0) - 4.5 else: tmp = t_0 + (-1.5 + (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 <= 3.5e-95) tmp = Float64(Float64(3.0 + t_0) - 4.5); else tmp = Float64(t_0 + 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) t_0 = 2.0 / (r * r); tmp = 0.0; if (r <= 3.5e-95) tmp = (3.0 + t_0) - 4.5; else tmp = t_0 + (-1.5 + (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, 3.5e-95], N[(N[(3.0 + t$95$0), $MachinePrecision] - 4.5), $MachinePrecision], N[(t$95$0 + 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}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 3.5 \cdot 10^{-95}:\\
\;\;\;\;\left(3 + t\_0\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \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 < 3.4999999999999997e-95Initial program 86.3%
Simplified79.0%
Taylor expanded in r around 0 66.0%
if 3.4999999999999997e-95 < r Initial program 91.4%
Simplified95.0%
Taylor expanded in v around 0 76.9%
Final simplification69.2%
(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(2.0 / Float64(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[(2.0 / N[(r * r), $MachinePrecision]), $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{2}{r \cdot 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 87.8%
Simplified90.0%
fma-undefine90.0%
*-commutative90.0%
+-commutative90.0%
associate-*r/90.0%
*-commutative90.0%
associate-/l*91.1%
clear-num91.0%
un-div-inv91.1%
+-commutative91.1%
distribute-rgt-in91.1%
metadata-eval91.1%
*-commutative91.1%
associate-*l*91.1%
metadata-eval91.1%
associate-*r*82.4%
pow282.4%
pow282.4%
pow-prod-down99.8%
Applied egg-rr99.8%
unpow299.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (if (<= r 1.9e+21) (- (+ 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 <= 1.9e+21) {
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 <= 1.9d+21) 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 <= 1.9e+21) {
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 <= 1.9e+21: 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 <= 1.9e+21) 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 <= 1.9e+21) 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, 1.9e+21], 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 1.9 \cdot 10^{+21}:\\
\;\;\;\;\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 < 1.9e21Initial program 86.9%
Simplified80.8%
Taylor expanded in r around 0 66.7%
associate-/r*66.7%
div-inv66.6%
Applied egg-rr66.6%
associate-*r/66.7%
*-rgt-identity66.7%
Simplified66.7%
if 1.9e21 < r Initial program 91.3%
associate--l-91.3%
associate-*l*78.9%
sqr-neg78.9%
associate-*l*91.3%
associate-/l*96.4%
fma-define96.4%
Simplified96.4%
Taylor expanded in r around inf 96.4%
Taylor expanded in v around 0 72.7%
/-rgt-identity72.7%
associate-*r*60.2%
swap-sqr71.8%
Applied egg-rr71.8%
Final simplification67.8%
(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 87.8%
Simplified80.8%
Taylor expanded in r around 0 57.5%
associate-/r*57.6%
div-inv57.5%
Applied egg-rr57.5%
associate-*r/57.6%
*-rgt-identity57.6%
Simplified57.6%
(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 87.8%
Simplified80.8%
Taylor expanded in r around 0 57.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 87.8%
Simplified80.8%
Taylor expanded in r around 0 57.5%
Taylor expanded in r around inf 16.2%
herbie shell --seed 2024145
(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))