
(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 18 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)))
(-
4.5
(*
(* 0.125 (+ 3.0 (* -2.0 v)))
(/ (/ (* r w) (- 1.0 v)) (/ -1.0 (* r w)))))))
double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) - (4.5 - ((0.125 * (3.0 + (-2.0 * v))) * (((r * w) / (1.0 - v)) / (-1.0 / (r * w)))));
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (3.0d0 + (2.0d0 / (r * r))) - (4.5d0 - ((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * (((r * w) / (1.0d0 - v)) / ((-1.0d0) / (r * w)))))
end function
public static double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) - (4.5 - ((0.125 * (3.0 + (-2.0 * v))) * (((r * w) / (1.0 - v)) / (-1.0 / (r * w)))));
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) - (4.5 - ((0.125 * (3.0 + (-2.0 * v))) * (((r * w) / (1.0 - v)) / (-1.0 / (r * w)))))
function code(v, w, r) return Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(4.5 - Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(Float64(r * w) / Float64(1.0 - v)) / Float64(-1.0 / Float64(r * w)))))) end
function tmp = code(v, w, r) tmp = (3.0 + (2.0 / (r * r))) - (4.5 - ((0.125 * (3.0 + (-2.0 * v))) * (((r * w) / (1.0 - v)) / (-1.0 / (r * w))))); end
code[v_, w_, r_] := N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(4.5 - N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(r * w), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] / N[(-1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \frac{2}{r \cdot r}\right) - \left(4.5 - \left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \frac{\frac{r \cdot w}{1 - v}}{\frac{-1}{r \cdot w}}\right)
\end{array}
Initial program 84.0%
associate--l-84.0%
associate-*l*80.0%
sqr-neg80.0%
associate-*l*84.0%
associate-/l*87.3%
fma-define87.3%
Simplified87.3%
associate-/l*87.3%
*-commutative87.3%
associate-*r/87.3%
associate-*l*96.4%
associate-*r*99.8%
Applied egg-rr99.8%
*-commutative99.8%
associate-*r/99.7%
*-commutative99.7%
remove-double-div99.7%
un-div-inv99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= r 8e-158)
(- (+ 3.0 t_0) 4.5)
(if (<= r 100000000.0)
(+
t_0
(-
-1.5
(/ 1.0 (/ (- 1.0 v) (* (+ 0.375 (* v -0.25)) (* (* r w) (* r w)))))))
(-
3.0
(+
4.5
(*
(* 0.125 (+ 3.0 (* -2.0 v)))
(* (* r w) (* w (/ r (- 1.0 v)))))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 8e-158) {
tmp = (3.0 + t_0) - 4.5;
} else if (r <= 100000000.0) {
tmp = t_0 + (-1.5 - (1.0 / ((1.0 - v) / ((0.375 + (v * -0.25)) * ((r * w) * (r * w))))));
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - v))))));
}
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 <= 8d-158) then
tmp = (3.0d0 + t_0) - 4.5d0
else if (r <= 100000000.0d0) then
tmp = t_0 + ((-1.5d0) - (1.0d0 / ((1.0d0 - v) / ((0.375d0 + (v * (-0.25d0))) * ((r * w) * (r * w))))))
else
tmp = 3.0d0 - (4.5d0 + ((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * (w * (r / (1.0d0 - v))))))
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 <= 8e-158) {
tmp = (3.0 + t_0) - 4.5;
} else if (r <= 100000000.0) {
tmp = t_0 + (-1.5 - (1.0 / ((1.0 - v) / ((0.375 + (v * -0.25)) * ((r * w) * (r * w))))));
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - v))))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if r <= 8e-158: tmp = (3.0 + t_0) - 4.5 elif r <= 100000000.0: tmp = t_0 + (-1.5 - (1.0 / ((1.0 - v) / ((0.375 + (v * -0.25)) * ((r * w) * (r * w)))))) else: tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - v)))))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 8e-158) tmp = Float64(Float64(3.0 + t_0) - 4.5); elseif (r <= 100000000.0) tmp = Float64(t_0 + Float64(-1.5 - Float64(1.0 / Float64(Float64(1.0 - v) / Float64(Float64(0.375 + Float64(v * -0.25)) * Float64(Float64(r * w) * Float64(r * w))))))); else tmp = Float64(3.0 - Float64(4.5 + Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) * Float64(w * Float64(r / Float64(1.0 - v))))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (r <= 8e-158) tmp = (3.0 + t_0) - 4.5; elseif (r <= 100000000.0) tmp = t_0 + (-1.5 - (1.0 / ((1.0 - v) / ((0.375 + (v * -0.25)) * ((r * w) * (r * w)))))); else tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - v)))))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 8e-158], N[(N[(3.0 + t$95$0), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 100000000.0], N[(t$95$0 + N[(-1.5 - N[(1.0 / N[(N[(1.0 - v), $MachinePrecision] / N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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[(w * N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 8 \cdot 10^{-158}:\\
\;\;\;\;\left(3 + t\_0\right) - 4.5\\
\mathbf{elif}\;r \leq 100000000:\\
\;\;\;\;t\_0 + \left(-1.5 - \frac{1}{\frac{1 - v}{\left(0.375 + v \cdot -0.25\right) \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)}}\right)\\
\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(w \cdot \frac{r}{1 - v}\right)\right)\right)\\
\end{array}
\end{array}
if r < 8.00000000000000052e-158Initial program 82.6%
Simplified80.3%
Taylor expanded in r around 0 69.8%
if 8.00000000000000052e-158 < r < 1e8Initial program 90.2%
Simplified90.2%
Applied egg-rr99.7%
unpow299.7%
Applied egg-rr99.7%
if 1e8 < r Initial program 83.4%
associate--l-83.4%
associate-*l*74.7%
sqr-neg74.7%
associate-*l*83.4%
associate-/l*91.9%
fma-define92.0%
Simplified91.9%
associate-/l*92.0%
*-commutative92.0%
associate-*r/92.0%
associate-*l*97.5%
associate-*r*99.8%
Applied egg-rr99.8%
Taylor expanded in r around inf 99.8%
Final simplification80.9%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ r (- 1.0 v))))
(if (<= r 9e-123)
(- (+ 3.0 (/ (/ 2.0 r) r)) 4.5)
(if (<= r 64000000.0)
(+ (/ 2.0 (* r r)) (- -1.5 (* 0.375 (* r (* t_0 (* w w))))))
(-
3.0
(+ 4.5 (* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (* w t_0)))))))))
double code(double v, double w, double r) {
double t_0 = r / (1.0 - v);
double tmp;
if (r <= 9e-123) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 64000000.0) {
tmp = (2.0 / (r * r)) + (-1.5 - (0.375 * (r * (t_0 * (w * w)))));
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * 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) :: tmp
t_0 = r / (1.0d0 - v)
if (r <= 9d-123) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else if (r <= 64000000.0d0) then
tmp = (2.0d0 / (r * r)) + ((-1.5d0) - (0.375d0 * (r * (t_0 * (w * w)))))
else
tmp = 3.0d0 - (4.5d0 + ((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * (w * t_0))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = r / (1.0 - v);
double tmp;
if (r <= 9e-123) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 64000000.0) {
tmp = (2.0 / (r * r)) + (-1.5 - (0.375 * (r * (t_0 * (w * w)))));
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * t_0))));
}
return tmp;
}
def code(v, w, r): t_0 = r / (1.0 - v) tmp = 0 if r <= 9e-123: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 elif r <= 64000000.0: tmp = (2.0 / (r * r)) + (-1.5 - (0.375 * (r * (t_0 * (w * w))))) else: tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * t_0)))) return tmp
function code(v, w, r) t_0 = Float64(r / Float64(1.0 - v)) tmp = 0.0 if (r <= 9e-123) tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); elseif (r <= 64000000.0) tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 - Float64(0.375 * Float64(r * Float64(t_0 * Float64(w * w)))))); else tmp = Float64(3.0 - Float64(4.5 + Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) * Float64(w * t_0))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = r / (1.0 - v); tmp = 0.0; if (r <= 9e-123) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; elseif (r <= 64000000.0) tmp = (2.0 / (r * r)) + (-1.5 - (0.375 * (r * (t_0 * (w * w))))); else tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * t_0)))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 9e-123], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 64000000.0], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[(0.375 * N[(r * N[(t$95$0 * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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[(w * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{r}{1 - v}\\
\mathbf{if}\;r \leq 9 \cdot 10^{-123}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{elif}\;r \leq 64000000:\\
\;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 - 0.375 \cdot \left(r \cdot \left(t\_0 \cdot \left(w \cdot w\right)\right)\right)\right)\\
\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(w \cdot t\_0\right)\right)\right)\\
\end{array}
\end{array}
if r < 8.99999999999999986e-123Initial program 81.9%
Simplified79.7%
Taylor expanded in r around 0 71.0%
associate-/r*71.0%
div-inv70.9%
Applied egg-rr70.9%
associate-*r/71.0%
*-rgt-identity71.0%
Simplified71.0%
if 8.99999999999999986e-123 < r < 6.4e7Initial program 96.7%
Simplified96.7%
Taylor expanded in v around 0 93.5%
if 6.4e7 < r Initial program 83.4%
associate--l-83.4%
associate-*l*74.7%
sqr-neg74.7%
associate-*l*83.4%
associate-/l*91.9%
fma-define92.0%
Simplified91.9%
associate-/l*92.0%
*-commutative92.0%
associate-*r/92.0%
associate-*l*97.5%
associate-*r*99.8%
Applied egg-rr99.8%
Taylor expanded in r around inf 99.8%
Final simplification79.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= r 3e-155)
(- (+ 3.0 t_0) 4.5)
(if (<= r 450000000000.0)
(+ t_0 (- -1.5 (* (* r (* (/ r (- 1.0 v)) (* w w))) (* v -0.25))))
(-
(+ 3.0 (* (* r (* w (+ 0.375 (* v -0.25)))) (* 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 <= 3e-155) {
tmp = (3.0 + t_0) - 4.5;
} else if (r <= 450000000000.0) {
tmp = t_0 + (-1.5 - ((r * ((r / (1.0 - v)) * (w * w))) * (v * -0.25)));
} else {
tmp = (3.0 + ((r * (w * (0.375 + (v * -0.25)))) * (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 <= 3d-155) then
tmp = (3.0d0 + t_0) - 4.5d0
else if (r <= 450000000000.0d0) then
tmp = t_0 + ((-1.5d0) - ((r * ((r / (1.0d0 - v)) * (w * w))) * (v * (-0.25d0))))
else
tmp = (3.0d0 + ((r * (w * (0.375d0 + (v * (-0.25d0))))) * (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 <= 3e-155) {
tmp = (3.0 + t_0) - 4.5;
} else if (r <= 450000000000.0) {
tmp = t_0 + (-1.5 - ((r * ((r / (1.0 - v)) * (w * w))) * (v * -0.25)));
} else {
tmp = (3.0 + ((r * (w * (0.375 + (v * -0.25)))) * (w * (r / (v + -1.0))))) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if r <= 3e-155: tmp = (3.0 + t_0) - 4.5 elif r <= 450000000000.0: tmp = t_0 + (-1.5 - ((r * ((r / (1.0 - v)) * (w * w))) * (v * -0.25))) else: tmp = (3.0 + ((r * (w * (0.375 + (v * -0.25)))) * (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 <= 3e-155) tmp = Float64(Float64(3.0 + t_0) - 4.5); elseif (r <= 450000000000.0) tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(r * Float64(Float64(r / Float64(1.0 - v)) * Float64(w * w))) * Float64(v * -0.25)))); else tmp = Float64(Float64(3.0 + Float64(Float64(r * Float64(w * Float64(0.375 + Float64(v * -0.25)))) * 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 <= 3e-155) tmp = (3.0 + t_0) - 4.5; elseif (r <= 450000000000.0) tmp = t_0 + (-1.5 - ((r * ((r / (1.0 - v)) * (w * w))) * (v * -0.25))); else tmp = (3.0 + ((r * (w * (0.375 + (v * -0.25)))) * (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, 3e-155], N[(N[(3.0 + t$95$0), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 450000000000.0], N[(t$95$0 + N[(-1.5 - N[(N[(r * N[(N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(v * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(3.0 + N[(N[(r * N[(w * N[(0.375 + N[(v * -0.25), $MachinePrecision]), $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}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 3 \cdot 10^{-155}:\\
\;\;\;\;\left(3 + t\_0\right) - 4.5\\
\mathbf{elif}\;r \leq 450000000000:\\
\;\;\;\;t\_0 + \left(-1.5 - \left(r \cdot \left(\frac{r}{1 - v} \cdot \left(w \cdot w\right)\right)\right) \cdot \left(v \cdot -0.25\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(3 + \left(r \cdot \left(w \cdot \left(0.375 + v \cdot -0.25\right)\right)\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\right) - 4.5\\
\end{array}
\end{array}
if r < 2.99999999999999984e-155Initial program 82.0%
Simplified79.7%
Taylor expanded in r around 0 70.7%
if 2.99999999999999984e-155 < r < 4.5e11Initial program 92.1%
Simplified94.7%
Taylor expanded in v around inf 89.6%
*-commutative89.6%
Simplified89.6%
if 4.5e11 < r Initial program 84.6%
Taylor expanded in r around inf 84.6%
associate-/l*91.6%
cancel-sign-sub-inv91.6%
metadata-eval91.6%
+-commutative91.6%
*-commutative91.6%
fma-undefine91.6%
*-commutative91.6%
*-commutative91.6%
associate-/l*91.7%
*-commutative91.7%
associate-*r/91.7%
associate-*r*83.1%
associate-*l*87.0%
associate-*r*85.3%
Applied egg-rr85.3%
Taylor expanded in r around 0 92.5%
Final simplification78.0%
(FPCore (v w r)
:precision binary64
(if (<= r 210000000.0)
(-
(+
(+ 3.0 (/ 2.0 (* r r)))
(* (* w (* r (+ 0.375 (* v -0.25)))) (* w (/ r (+ v -1.0)))))
4.5)
(-
3.0
(+
4.5
(* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (* w (/ r (- 1.0 v)))))))))
double code(double v, double w, double r) {
double tmp;
if (r <= 210000000.0) {
tmp = ((3.0 + (2.0 / (r * r))) + ((w * (r * (0.375 + (v * -0.25)))) * (w * (r / (v + -1.0))))) - 4.5;
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - v))))));
}
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 <= 210000000.0d0) then
tmp = ((3.0d0 + (2.0d0 / (r * r))) + ((w * (r * (0.375d0 + (v * (-0.25d0))))) * (w * (r / (v + (-1.0d0)))))) - 4.5d0
else
tmp = 3.0d0 - (4.5d0 + ((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * (w * (r / (1.0d0 - v))))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 210000000.0) {
tmp = ((3.0 + (2.0 / (r * r))) + ((w * (r * (0.375 + (v * -0.25)))) * (w * (r / (v + -1.0))))) - 4.5;
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - v))))));
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 210000000.0: tmp = ((3.0 + (2.0 / (r * r))) + ((w * (r * (0.375 + (v * -0.25)))) * (w * (r / (v + -1.0))))) - 4.5 else: tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - v)))))) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 210000000.0) tmp = Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) + Float64(Float64(w * Float64(r * Float64(0.375 + Float64(v * -0.25)))) * Float64(w * Float64(r / Float64(v + -1.0))))) - 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(w * Float64(r / Float64(1.0 - v))))))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 210000000.0) tmp = ((3.0 + (2.0 / (r * r))) + ((w * (r * (0.375 + (v * -0.25)))) * (w * (r / (v + -1.0))))) - 4.5; else tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - v)))))); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 210000000.0], N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(w * N[(r * N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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[(w * N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 210000000:\\
\;\;\;\;\left(\left(3 + \frac{2}{r \cdot r}\right) + \left(w \cdot \left(r \cdot \left(0.375 + v \cdot -0.25\right)\right)\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\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(w \cdot \frac{r}{1 - v}\right)\right)\right)\\
\end{array}
\end{array}
if r < 2.1e8Initial program 84.2%
associate-/l*86.0%
cancel-sign-sub-inv86.0%
metadata-eval86.0%
+-commutative86.0%
*-commutative86.0%
fma-undefine86.0%
*-commutative86.0%
*-commutative86.0%
associate-/l*86.0%
*-commutative86.0%
associate-*r/86.0%
associate-*r*83.6%
associate-*l*93.1%
associate-*r*94.6%
Applied egg-rr94.6%
if 2.1e8 < r Initial program 83.4%
associate--l-83.4%
associate-*l*74.7%
sqr-neg74.7%
associate-*l*83.4%
associate-/l*91.9%
fma-define92.0%
Simplified91.9%
associate-/l*92.0%
*-commutative92.0%
associate-*r/92.0%
associate-*l*97.5%
associate-*r*99.8%
Applied egg-rr99.8%
Taylor expanded in r around inf 99.8%
Final simplification95.7%
(FPCore (v w r)
:precision binary64
(if (<= r 3e-123)
(- (+ 3.0 (/ (/ 2.0 r) r)) 4.5)
(if (<= r 450000000000.0)
(+ (/ 2.0 (* r r)) (- -1.5 (* 0.375 (* r (* (/ r (- 1.0 v)) (* w w))))))
(-
(+ 3.0 (* (* r (* w (+ 0.375 (* v -0.25)))) (* w (/ r (+ v -1.0)))))
4.5))))
double code(double v, double w, double r) {
double tmp;
if (r <= 3e-123) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 450000000000.0) {
tmp = (2.0 / (r * r)) + (-1.5 - (0.375 * (r * ((r / (1.0 - v)) * (w * w)))));
} else {
tmp = (3.0 + ((r * (w * (0.375 + (v * -0.25)))) * (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 <= 3d-123) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else if (r <= 450000000000.0d0) then
tmp = (2.0d0 / (r * r)) + ((-1.5d0) - (0.375d0 * (r * ((r / (1.0d0 - v)) * (w * w)))))
else
tmp = (3.0d0 + ((r * (w * (0.375d0 + (v * (-0.25d0))))) * (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 <= 3e-123) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 450000000000.0) {
tmp = (2.0 / (r * r)) + (-1.5 - (0.375 * (r * ((r / (1.0 - v)) * (w * w)))));
} else {
tmp = (3.0 + ((r * (w * (0.375 + (v * -0.25)))) * (w * (r / (v + -1.0))))) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 3e-123: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 elif r <= 450000000000.0: tmp = (2.0 / (r * r)) + (-1.5 - (0.375 * (r * ((r / (1.0 - v)) * (w * w))))) else: tmp = (3.0 + ((r * (w * (0.375 + (v * -0.25)))) * (w * (r / (v + -1.0))))) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 3e-123) tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); elseif (r <= 450000000000.0) tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 - Float64(0.375 * Float64(r * Float64(Float64(r / Float64(1.0 - v)) * Float64(w * w)))))); else tmp = Float64(Float64(3.0 + Float64(Float64(r * Float64(w * Float64(0.375 + Float64(v * -0.25)))) * 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 <= 3e-123) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; elseif (r <= 450000000000.0) tmp = (2.0 / (r * r)) + (-1.5 - (0.375 * (r * ((r / (1.0 - v)) * (w * w))))); else tmp = (3.0 + ((r * (w * (0.375 + (v * -0.25)))) * (w * (r / (v + -1.0))))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 3e-123], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 450000000000.0], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + 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[(N[(3.0 + N[(N[(r * N[(w * N[(0.375 + N[(v * -0.25), $MachinePrecision]), $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 3 \cdot 10^{-123}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{elif}\;r \leq 450000000000:\\
\;\;\;\;\frac{2}{r \cdot r} + \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}:\\
\;\;\;\;\left(3 + \left(r \cdot \left(w \cdot \left(0.375 + v \cdot -0.25\right)\right)\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\right) - 4.5\\
\end{array}
\end{array}
if r < 2.99999999999999984e-123Initial program 81.9%
Simplified79.7%
Taylor expanded in r around 0 71.0%
associate-/r*71.0%
div-inv70.9%
Applied egg-rr70.9%
associate-*r/71.0%
*-rgt-identity71.0%
Simplified71.0%
if 2.99999999999999984e-123 < r < 4.5e11Initial program 94.0%
Simplified96.9%
Taylor expanded in v around 0 91.1%
if 4.5e11 < r Initial program 84.6%
Taylor expanded in r around inf 84.6%
associate-/l*91.6%
cancel-sign-sub-inv91.6%
metadata-eval91.6%
+-commutative91.6%
*-commutative91.6%
fma-undefine91.6%
*-commutative91.6%
*-commutative91.6%
associate-/l*91.7%
*-commutative91.7%
associate-*r/91.7%
associate-*r*83.1%
associate-*l*87.0%
associate-*r*85.3%
Applied egg-rr85.3%
Taylor expanded in r around 0 92.5%
Final simplification78.0%
(FPCore (v w r)
:precision binary64
(if (<= r 3e-123)
(- (+ 3.0 (/ (/ 2.0 r) r)) 4.5)
(if (<= r 1e+124)
(+ (/ 2.0 (* r r)) (- -1.5 (* 0.375 (* r (* (/ r (- 1.0 v)) (* w w))))))
(- (+ 3.0 (* (* -0.25 (* r (* v w))) (/ (* r w) v))) 4.5))))
double code(double v, double w, double r) {
double tmp;
if (r <= 3e-123) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 1e+124) {
tmp = (2.0 / (r * r)) + (-1.5 - (0.375 * (r * ((r / (1.0 - v)) * (w * w)))));
} else {
tmp = (3.0 + ((-0.25 * (r * (v * 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) :: tmp
if (r <= 3d-123) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else if (r <= 1d+124) then
tmp = (2.0d0 / (r * r)) + ((-1.5d0) - (0.375d0 * (r * ((r / (1.0d0 - v)) * (w * w)))))
else
tmp = (3.0d0 + (((-0.25d0) * (r * (v * w))) * ((r * w) / v))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 3e-123) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 1e+124) {
tmp = (2.0 / (r * r)) + (-1.5 - (0.375 * (r * ((r / (1.0 - v)) * (w * w)))));
} else {
tmp = (3.0 + ((-0.25 * (r * (v * w))) * ((r * w) / v))) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 3e-123: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 elif r <= 1e+124: tmp = (2.0 / (r * r)) + (-1.5 - (0.375 * (r * ((r / (1.0 - v)) * (w * w))))) else: tmp = (3.0 + ((-0.25 * (r * (v * w))) * ((r * w) / v))) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 3e-123) tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); elseif (r <= 1e+124) tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 - Float64(0.375 * Float64(r * Float64(Float64(r / Float64(1.0 - v)) * Float64(w * w)))))); else tmp = Float64(Float64(3.0 + Float64(Float64(-0.25 * Float64(r * Float64(v * w))) * Float64(Float64(r * w) / v))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 3e-123) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; elseif (r <= 1e+124) tmp = (2.0 / (r * r)) + (-1.5 - (0.375 * (r * ((r / (1.0 - v)) * (w * w))))); else tmp = (3.0 + ((-0.25 * (r * (v * w))) * ((r * w) / v))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 3e-123], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 1e+124], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + 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[(N[(3.0 + N[(N[(-0.25 * N[(r * N[(v * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 3 \cdot 10^{-123}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{elif}\;r \leq 10^{+124}:\\
\;\;\;\;\frac{2}{r \cdot r} + \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}:\\
\;\;\;\;\left(3 + \left(-0.25 \cdot \left(r \cdot \left(v \cdot w\right)\right)\right) \cdot \frac{r \cdot w}{v}\right) - 4.5\\
\end{array}
\end{array}
if r < 2.99999999999999984e-123Initial program 81.9%
Simplified79.7%
Taylor expanded in r around 0 71.0%
associate-/r*71.0%
div-inv70.9%
Applied egg-rr70.9%
associate-*r/71.0%
*-rgt-identity71.0%
Simplified71.0%
if 2.99999999999999984e-123 < r < 9.99999999999999948e123Initial program 94.4%
Simplified97.9%
Taylor expanded in v around 0 88.2%
if 9.99999999999999948e123 < r Initial program 78.0%
Taylor expanded in r around inf 78.0%
associate-/l*86.7%
cancel-sign-sub-inv86.7%
metadata-eval86.7%
+-commutative86.7%
*-commutative86.7%
fma-undefine86.7%
*-commutative86.7%
*-commutative86.7%
associate-/l*86.8%
*-commutative86.8%
associate-*r/86.8%
associate-*r*72.8%
associate-*l*78.9%
associate-*r*79.1%
Applied egg-rr79.1%
Taylor expanded in v around inf 76.8%
*-commutative76.8%
Simplified76.8%
Taylor expanded in v around inf 86.8%
associate-*r/86.8%
neg-mul-186.8%
distribute-rgt-neg-in86.8%
Simplified86.8%
Final simplification76.5%
(FPCore (v w r)
:precision binary64
(if (<= r 17000.0)
(+
(/ 2.0 (* r r))
(- -1.5 (/ 1.0 (/ 1.0 (* (+ 0.375 (* v -0.25)) (* (* r w) (* r w)))))))
(-
3.0
(+
4.5
(* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (* w (/ r (- 1.0 v)))))))))
double code(double v, double w, double r) {
double tmp;
if (r <= 17000.0) {
tmp = (2.0 / (r * r)) + (-1.5 - (1.0 / (1.0 / ((0.375 + (v * -0.25)) * ((r * w) * (r * w))))));
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - v))))));
}
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 <= 17000.0d0) then
tmp = (2.0d0 / (r * r)) + ((-1.5d0) - (1.0d0 / (1.0d0 / ((0.375d0 + (v * (-0.25d0))) * ((r * w) * (r * w))))))
else
tmp = 3.0d0 - (4.5d0 + ((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * (w * (r / (1.0d0 - v))))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 17000.0) {
tmp = (2.0 / (r * r)) + (-1.5 - (1.0 / (1.0 / ((0.375 + (v * -0.25)) * ((r * w) * (r * w))))));
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - v))))));
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 17000.0: tmp = (2.0 / (r * r)) + (-1.5 - (1.0 / (1.0 / ((0.375 + (v * -0.25)) * ((r * w) * (r * w)))))) else: tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - v)))))) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 17000.0) tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 - Float64(1.0 / Float64(1.0 / Float64(Float64(0.375 + Float64(v * -0.25)) * Float64(Float64(r * w) * Float64(r * w))))))); else tmp = Float64(3.0 - Float64(4.5 + Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) * Float64(w * Float64(r / Float64(1.0 - v))))))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 17000.0) tmp = (2.0 / (r * r)) + (-1.5 - (1.0 / (1.0 / ((0.375 + (v * -0.25)) * ((r * w) * (r * w)))))); else tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - v)))))); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 17000.0], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[(1.0 / N[(1.0 / N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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[(w * N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 17000:\\
\;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 - \frac{1}{\frac{1}{\left(0.375 + v \cdot -0.25\right) \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)}}\right)\\
\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(w \cdot \frac{r}{1 - v}\right)\right)\right)\\
\end{array}
\end{array}
if r < 17000Initial program 84.2%
Simplified86.0%
Applied egg-rr95.0%
unpow295.0%
Applied egg-rr95.0%
Taylor expanded in v around 0 86.0%
if 17000 < r Initial program 83.4%
associate--l-83.4%
associate-*l*74.7%
sqr-neg74.7%
associate-*l*83.4%
associate-/l*91.9%
fma-define92.0%
Simplified91.9%
associate-/l*92.0%
*-commutative92.0%
associate-*r/92.0%
associate-*l*97.5%
associate-*r*99.8%
Applied egg-rr99.8%
Taylor expanded in r around inf 99.8%
Final simplification88.9%
(FPCore (v w r) :precision binary64 (- (+ 3.0 (/ 2.0 (* r r))) (+ 4.5 (* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (* w (/ r (- 1.0 v))))))))
double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - v))))));
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (3.0d0 + (2.0d0 / (r * r))) - (4.5d0 + ((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * (w * (r / (1.0d0 - v))))))
end function
public static double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - v))))));
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - v))))))
function code(v, w, r) return Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(4.5 + Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) * Float64(w * Float64(r / Float64(1.0 - v))))))) end
function tmp = code(v, w, r) tmp = (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - v)))))); end
code[v_, w_, r_] := N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(4.5 + N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(w * N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \frac{2}{r \cdot r}\right) - \left(4.5 + \left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \left(w \cdot \frac{r}{1 - v}\right)\right)\right)
\end{array}
Initial program 84.0%
associate--l-84.0%
associate-*l*80.0%
sqr-neg80.0%
associate-*l*84.0%
associate-/l*87.3%
fma-define87.3%
Simplified87.3%
associate-/l*87.3%
*-commutative87.3%
associate-*r/87.3%
associate-*l*96.4%
associate-*r*99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(if (<= r 450000000000.0)
(- (+ 3.0 (/ (/ 2.0 r) r)) 4.5)
(if (<= r 4.2e+118)
(- (- 3.0 (* (* r w) (* w (* r (+ 0.375 (* v -0.25)))))) 4.5)
(- (+ 3.0 (* (* -0.25 (* r (* v w))) (* w (/ r v)))) 4.5))))
double code(double v, double w, double r) {
double tmp;
if (r <= 450000000000.0) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 4.2e+118) {
tmp = (3.0 - ((r * w) * (w * (r * (0.375 + (v * -0.25)))))) - 4.5;
} else {
tmp = (3.0 + ((-0.25 * (r * (v * w))) * (w * (r / 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) :: tmp
if (r <= 450000000000.0d0) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else if (r <= 4.2d+118) then
tmp = (3.0d0 - ((r * w) * (w * (r * (0.375d0 + (v * (-0.25d0))))))) - 4.5d0
else
tmp = (3.0d0 + (((-0.25d0) * (r * (v * w))) * (w * (r / v)))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 450000000000.0) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 4.2e+118) {
tmp = (3.0 - ((r * w) * (w * (r * (0.375 + (v * -0.25)))))) - 4.5;
} else {
tmp = (3.0 + ((-0.25 * (r * (v * w))) * (w * (r / v)))) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 450000000000.0: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 elif r <= 4.2e+118: tmp = (3.0 - ((r * w) * (w * (r * (0.375 + (v * -0.25)))))) - 4.5 else: tmp = (3.0 + ((-0.25 * (r * (v * w))) * (w * (r / v)))) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 450000000000.0) tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); elseif (r <= 4.2e+118) tmp = Float64(Float64(3.0 - Float64(Float64(r * w) * Float64(w * Float64(r * Float64(0.375 + Float64(v * -0.25)))))) - 4.5); else tmp = Float64(Float64(3.0 + Float64(Float64(-0.25 * Float64(r * Float64(v * w))) * Float64(w * Float64(r / v)))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 450000000000.0) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; elseif (r <= 4.2e+118) tmp = (3.0 - ((r * w) * (w * (r * (0.375 + (v * -0.25)))))) - 4.5; else tmp = (3.0 + ((-0.25 * (r * (v * w))) * (w * (r / v)))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 450000000000.0], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 4.2e+118], N[(N[(3.0 - N[(N[(r * w), $MachinePrecision] * N[(w * N[(r * N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(3.0 + N[(N[(-0.25 * N[(r * N[(v * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 450000000000:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{elif}\;r \leq 4.2 \cdot 10^{+118}:\\
\;\;\;\;\left(3 - \left(r \cdot w\right) \cdot \left(w \cdot \left(r \cdot \left(0.375 + v \cdot -0.25\right)\right)\right)\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(3 + \left(-0.25 \cdot \left(r \cdot \left(v \cdot w\right)\right)\right) \cdot \left(w \cdot \frac{r}{v}\right)\right) - 4.5\\
\end{array}
\end{array}
if r < 4.5e11Initial program 83.9%
Simplified82.5%
Taylor expanded in r around 0 71.8%
associate-/r*71.8%
div-inv71.7%
Applied egg-rr71.7%
associate-*r/71.8%
*-rgt-identity71.8%
Simplified71.8%
if 4.5e11 < r < 4.2e118Initial program 94.3%
Taylor expanded in r around inf 94.3%
associate-/l*99.5%
cancel-sign-sub-inv99.5%
metadata-eval99.5%
+-commutative99.5%
*-commutative99.5%
fma-undefine99.5%
*-commutative99.5%
*-commutative99.5%
associate-/l*99.5%
*-commutative99.5%
associate-*r/99.5%
associate-*r*99.7%
associate-*l*99.9%
associate-*r*94.5%
Applied egg-rr94.5%
Taylor expanded in v around 0 85.4%
if 4.2e118 < r Initial program 79.9%
Taylor expanded in r around inf 79.9%
associate-/l*87.8%
cancel-sign-sub-inv87.8%
metadata-eval87.8%
+-commutative87.8%
*-commutative87.8%
fma-undefine87.8%
*-commutative87.8%
*-commutative87.8%
associate-/l*87.9%
*-commutative87.9%
associate-*r/87.9%
associate-*r*75.1%
associate-*l*80.7%
associate-*r*80.8%
Applied egg-rr80.8%
Taylor expanded in v around inf 75.9%
*-commutative75.9%
Simplified75.9%
Taylor expanded in v around inf 79.2%
associate-*r/79.2%
mul-1-neg79.2%
Simplified79.2%
Final simplification73.7%
(FPCore (v w r) :precision binary64 (if (<= r 0.031) (- (+ 3.0 (/ (/ 2.0 r) r)) 4.5) (- (+ 3.0 (* (* -0.25 (* r (* v w))) (/ (* r w) v))) 4.5)))
double code(double v, double w, double r) {
double tmp;
if (r <= 0.031) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = (3.0 + ((-0.25 * (r * (v * 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) :: tmp
if (r <= 0.031d0) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else
tmp = (3.0d0 + (((-0.25d0) * (r * (v * w))) * ((r * w) / v))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 0.031) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = (3.0 + ((-0.25 * (r * (v * w))) * ((r * w) / v))) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 0.031: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 else: tmp = (3.0 + ((-0.25 * (r * (v * w))) * ((r * w) / v))) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 0.031) tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); else tmp = Float64(Float64(3.0 + Float64(Float64(-0.25 * Float64(r * Float64(v * w))) * Float64(Float64(r * w) / v))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 0.031) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; else tmp = (3.0 + ((-0.25 * (r * (v * w))) * ((r * w) / v))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 0.031], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(3.0 + N[(N[(-0.25 * N[(r * N[(v * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 0.031:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(3 + \left(-0.25 \cdot \left(r \cdot \left(v \cdot w\right)\right)\right) \cdot \frac{r \cdot w}{v}\right) - 4.5\\
\end{array}
\end{array}
if r < 0.031Initial program 84.2%
Simplified82.3%
Taylor expanded in r around 0 71.9%
associate-/r*72.0%
div-inv71.8%
Applied egg-rr71.8%
associate-*r/72.0%
*-rgt-identity72.0%
Simplified72.0%
if 0.031 < r Initial program 83.4%
Taylor expanded in r around inf 83.4%
associate-/l*91.9%
cancel-sign-sub-inv91.9%
metadata-eval91.9%
+-commutative91.9%
*-commutative91.9%
fma-undefine91.9%
*-commutative91.9%
*-commutative91.9%
associate-/l*92.0%
*-commutative92.0%
associate-*r/92.0%
associate-*r*83.8%
associate-*l*87.4%
associate-*r*84.1%
Applied egg-rr84.1%
Taylor expanded in v around inf 66.6%
*-commutative66.6%
Simplified66.6%
Taylor expanded in v around inf 79.2%
associate-*r/79.2%
neg-mul-179.2%
distribute-rgt-neg-in79.2%
Simplified79.2%
Final simplification73.5%
(FPCore (v w r) :precision binary64 (if (<= r 1.1e-13) (- (+ 3.0 (/ (/ 2.0 r) r)) 4.5) (- (- 3.0 (* (* w (/ r (- 1.0 v))) (* w (* r 0.375)))) 4.5)))
double code(double v, double w, double r) {
double tmp;
if (r <= 1.1e-13) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = (3.0 - ((w * (r / (1.0 - v))) * (w * (r * 0.375)))) - 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 <= 1.1d-13) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else
tmp = (3.0d0 - ((w * (r / (1.0d0 - v))) * (w * (r * 0.375d0)))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 1.1e-13) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = (3.0 - ((w * (r / (1.0 - v))) * (w * (r * 0.375)))) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 1.1e-13: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 else: tmp = (3.0 - ((w * (r / (1.0 - v))) * (w * (r * 0.375)))) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 1.1e-13) 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(1.0 - v))) * Float64(w * Float64(r * 0.375)))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 1.1e-13) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; else tmp = (3.0 - ((w * (r / (1.0 - v))) * (w * (r * 0.375)))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 1.1e-13], 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[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.1 \cdot 10^{-13}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(3 - \left(w \cdot \frac{r}{1 - v}\right) \cdot \left(w \cdot \left(r \cdot 0.375\right)\right)\right) - 4.5\\
\end{array}
\end{array}
if r < 1.09999999999999998e-13Initial program 83.9%
Simplified82.0%
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 1.09999999999999998e-13 < r Initial program 84.5%
Taylor expanded in r around inf 82.8%
associate-/l*92.5%
cancel-sign-sub-inv92.5%
metadata-eval92.5%
+-commutative92.5%
*-commutative92.5%
fma-undefine92.5%
*-commutative92.5%
*-commutative92.5%
associate-/l*92.5%
*-commutative92.5%
associate-*r/92.5%
associate-*r*84.9%
associate-*l*88.2%
associate-*r*85.1%
Applied egg-rr83.4%
Taylor expanded in v around 0 63.5%
*-commutative63.5%
Simplified63.5%
Final simplification70.8%
(FPCore (v w r) :precision binary64 (if (<= r 1.4e-13) (- (+ 3.0 (/ (/ 2.0 r) r)) 4.5) (- (- 3.0 (* (* w (/ r (- 1.0 v))) (* r (* w 0.375)))) 4.5)))
double code(double v, double w, double r) {
double tmp;
if (r <= 1.4e-13) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = (3.0 - ((w * (r / (1.0 - v))) * (r * (w * 0.375)))) - 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 <= 1.4d-13) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else
tmp = (3.0d0 - ((w * (r / (1.0d0 - v))) * (r * (w * 0.375d0)))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 1.4e-13) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = (3.0 - ((w * (r / (1.0 - v))) * (r * (w * 0.375)))) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 1.4e-13: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 else: tmp = (3.0 - ((w * (r / (1.0 - v))) * (r * (w * 0.375)))) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 1.4e-13) 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(1.0 - v))) * Float64(r * Float64(w * 0.375)))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 1.4e-13) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; else tmp = (3.0 - ((w * (r / (1.0 - v))) * (r * (w * 0.375)))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 1.4e-13], 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[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(r * N[(w * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.4 \cdot 10^{-13}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(3 - \left(w \cdot \frac{r}{1 - v}\right) \cdot \left(r \cdot \left(w \cdot 0.375\right)\right)\right) - 4.5\\
\end{array}
\end{array}
if r < 1.4000000000000001e-13Initial program 83.9%
Simplified82.0%
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 1.4000000000000001e-13 < r Initial program 84.5%
Taylor expanded in r around inf 82.8%
associate-/l*92.5%
cancel-sign-sub-inv92.5%
metadata-eval92.5%
+-commutative92.5%
*-commutative92.5%
fma-undefine92.5%
*-commutative92.5%
*-commutative92.5%
associate-/l*92.5%
*-commutative92.5%
associate-*r/92.5%
associate-*r*84.9%
associate-*l*88.2%
associate-*r*85.1%
Applied egg-rr83.4%
Taylor expanded in r around 0 89.9%
Taylor expanded in v around 0 63.4%
*-commutative63.4%
Simplified63.4%
Final simplification70.8%
(FPCore (v w r) :precision binary64 (if (<= r 1.75e-13) (- (+ 3.0 (/ (/ 2.0 r) r)) 4.5) (- (- 3.0 (* (* w (/ r (- 1.0 v))) (* (* r w) 0.375))) 4.5)))
double code(double v, double w, double r) {
double tmp;
if (r <= 1.75e-13) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = (3.0 - ((w * (r / (1.0 - v))) * ((r * w) * 0.375))) - 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 <= 1.75d-13) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else
tmp = (3.0d0 - ((w * (r / (1.0d0 - v))) * ((r * w) * 0.375d0))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 1.75e-13) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = (3.0 - ((w * (r / (1.0 - v))) * ((r * w) * 0.375))) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 1.75e-13: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 else: tmp = (3.0 - ((w * (r / (1.0 - v))) * ((r * w) * 0.375))) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 1.75e-13) 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(1.0 - v))) * Float64(Float64(r * w) * 0.375))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 1.75e-13) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; else tmp = (3.0 - ((w * (r / (1.0 - v))) * ((r * w) * 0.375))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 1.75e-13], 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[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.75 \cdot 10^{-13}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(3 - \left(w \cdot \frac{r}{1 - v}\right) \cdot \left(\left(r \cdot w\right) \cdot 0.375\right)\right) - 4.5\\
\end{array}
\end{array}
if r < 1.7500000000000001e-13Initial program 83.9%
Simplified82.0%
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 1.7500000000000001e-13 < r Initial program 84.5%
Taylor expanded in r around inf 82.8%
associate-/l*92.5%
cancel-sign-sub-inv92.5%
metadata-eval92.5%
+-commutative92.5%
*-commutative92.5%
fma-undefine92.5%
*-commutative92.5%
*-commutative92.5%
associate-/l*92.5%
*-commutative92.5%
associate-*r/92.5%
associate-*r*84.9%
associate-*l*88.2%
associate-*r*85.1%
Applied egg-rr83.4%
Taylor expanded in v around 0 63.5%
Final simplification70.8%
(FPCore (v w r) :precision binary64 (if (<= r 2050000000000.0) (- (+ 3.0 (/ (/ 2.0 r) r)) 4.5) (- (- 3.0 (* (* r w) (* -0.25 (* r (* v w))))) 4.5)))
double code(double v, double w, double r) {
double tmp;
if (r <= 2050000000000.0) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = (3.0 - ((r * w) * (-0.25 * (r * (v * w))))) - 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 <= 2050000000000.0d0) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else
tmp = (3.0d0 - ((r * w) * ((-0.25d0) * (r * (v * w))))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 2050000000000.0) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = (3.0 - ((r * w) * (-0.25 * (r * (v * w))))) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 2050000000000.0: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 else: tmp = (3.0 - ((r * w) * (-0.25 * (r * (v * w))))) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 2050000000000.0) tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); else tmp = Float64(Float64(3.0 - Float64(Float64(r * w) * Float64(-0.25 * Float64(r * Float64(v * w))))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 2050000000000.0) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; else tmp = (3.0 - ((r * w) * (-0.25 * (r * (v * w))))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 2050000000000.0], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(3.0 - N[(N[(r * w), $MachinePrecision] * N[(-0.25 * N[(r * N[(v * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 2050000000000:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(3 - \left(r \cdot w\right) \cdot \left(-0.25 \cdot \left(r \cdot \left(v \cdot w\right)\right)\right)\right) - 4.5\\
\end{array}
\end{array}
if r < 2.05e12Initial program 83.9%
Simplified82.5%
Taylor expanded in r around 0 71.8%
associate-/r*71.8%
div-inv71.7%
Applied egg-rr71.7%
associate-*r/71.8%
*-rgt-identity71.8%
Simplified71.8%
if 2.05e12 < r Initial program 84.6%
Taylor expanded in r around inf 84.6%
associate-/l*91.6%
cancel-sign-sub-inv91.6%
metadata-eval91.6%
+-commutative91.6%
*-commutative91.6%
fma-undefine91.6%
*-commutative91.6%
*-commutative91.6%
associate-/l*91.7%
*-commutative91.7%
associate-*r/91.7%
associate-*r*83.1%
associate-*l*87.0%
associate-*r*85.3%
Applied egg-rr85.3%
Taylor expanded in v around inf 67.1%
*-commutative67.1%
Simplified67.1%
Taylor expanded in v around 0 35.4%
Final simplification64.4%
(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 84.0%
Simplified80.8%
Taylor expanded in r around 0 61.0%
associate-/r*61.0%
div-inv60.9%
Applied egg-rr60.9%
associate-*r/61.0%
*-rgt-identity61.0%
Simplified61.0%
(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 84.0%
Simplified80.8%
Taylor expanded in r around 0 61.0%
(FPCore (v w r) :precision binary64 -1.5)
double code(double v, double w, double r) {
return -1.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = -1.5d0
end function
public static double code(double v, double w, double r) {
return -1.5;
}
def code(v, w, r): return -1.5
function code(v, w, r) return -1.5 end
function tmp = code(v, w, r) tmp = -1.5; end
code[v_, w_, r_] := -1.5
\begin{array}{l}
\\
-1.5
\end{array}
Initial program 84.0%
Simplified80.8%
Taylor expanded in r around 0 61.0%
Taylor expanded in r around inf 13.3%
herbie shell --seed 2024143
(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))