
(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 13 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 86.6%
associate--l-86.6%
associate-*l*82.3%
sqr-neg82.3%
associate-*l*86.6%
associate-/l*90.2%
fma-define90.2%
Simplified90.2%
associate-/l*89.5%
*-commutative89.5%
associate-*r/89.5%
associate-*l*96.8%
associate-*r*99.8%
add-sqr-sqrt50.3%
sqrt-prod78.0%
add-sqr-sqrt35.4%
sqrt-prod67.8%
sqrt-prod67.8%
associate-*r*73.6%
*-commutative73.6%
sqrt-prod37.4%
*-commutative37.4%
sqrt-prod37.4%
sqrt-prod24.9%
add-sqr-sqrt50.3%
associate-*r*50.3%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r)))
(t_1
(- (+ 3.0 (* r (* (+ 0.375 (* v -0.25)) (/ (* w (* r w)) v)))) 4.5))
(t_2 (+ t_0 (+ -1.5 (* 0.375 (* r (* (* w w) (/ r (+ v -1.0)))))))))
(if (<= r 6.2e-77)
(+ t_0 -1.5)
(if (<= r 6.2e+80)
t_2
(if (<= r 4.5e+125)
t_1
(if (<= r 4.6e+230)
t_2
(if (<= r 5e+259)
t_1
(-
3.0
(+
4.5
(* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (* r w))))))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = (3.0 + (r * ((0.375 + (v * -0.25)) * ((w * (r * w)) / v)))) - 4.5;
double t_2 = t_0 + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0))))));
double tmp;
if (r <= 6.2e-77) {
tmp = t_0 + -1.5;
} else if (r <= 6.2e+80) {
tmp = t_2;
} else if (r <= 4.5e+125) {
tmp = t_1;
} else if (r <= 4.6e+230) {
tmp = t_2;
} else if (r <= 5e+259) {
tmp = t_1;
} 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) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
t_1 = (3.0d0 + (r * ((0.375d0 + (v * (-0.25d0))) * ((w * (r * w)) / v)))) - 4.5d0
t_2 = t_0 + ((-1.5d0) + (0.375d0 * (r * ((w * w) * (r / (v + (-1.0d0)))))))
if (r <= 6.2d-77) then
tmp = t_0 + (-1.5d0)
else if (r <= 6.2d+80) then
tmp = t_2
else if (r <= 4.5d+125) then
tmp = t_1
else if (r <= 4.6d+230) then
tmp = t_2
else if (r <= 5d+259) then
tmp = t_1
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 t_0 = 2.0 / (r * r);
double t_1 = (3.0 + (r * ((0.375 + (v * -0.25)) * ((w * (r * w)) / v)))) - 4.5;
double t_2 = t_0 + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0))))));
double tmp;
if (r <= 6.2e-77) {
tmp = t_0 + -1.5;
} else if (r <= 6.2e+80) {
tmp = t_2;
} else if (r <= 4.5e+125) {
tmp = t_1;
} else if (r <= 4.6e+230) {
tmp = t_2;
} else if (r <= 5e+259) {
tmp = t_1;
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (r * w))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = (3.0 + (r * ((0.375 + (v * -0.25)) * ((w * (r * w)) / v)))) - 4.5 t_2 = t_0 + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0)))))) tmp = 0 if r <= 6.2e-77: tmp = t_0 + -1.5 elif r <= 6.2e+80: tmp = t_2 elif r <= 4.5e+125: tmp = t_1 elif r <= 4.6e+230: tmp = t_2 elif r <= 5e+259: tmp = t_1 else: tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (r * w)))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) t_1 = Float64(Float64(3.0 + Float64(r * Float64(Float64(0.375 + Float64(v * -0.25)) * Float64(Float64(w * Float64(r * w)) / v)))) - 4.5) t_2 = Float64(t_0 + Float64(-1.5 + Float64(0.375 * Float64(r * Float64(Float64(w * w) * Float64(r / Float64(v + -1.0))))))) tmp = 0.0 if (r <= 6.2e-77) tmp = Float64(t_0 + -1.5); elseif (r <= 6.2e+80) tmp = t_2; elseif (r <= 4.5e+125) tmp = t_1; elseif (r <= 4.6e+230) tmp = t_2; elseif (r <= 5e+259) tmp = t_1; 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) t_0 = 2.0 / (r * r); t_1 = (3.0 + (r * ((0.375 + (v * -0.25)) * ((w * (r * w)) / v)))) - 4.5; t_2 = t_0 + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0)))))); tmp = 0.0; if (r <= 6.2e-77) tmp = t_0 + -1.5; elseif (r <= 6.2e+80) tmp = t_2; elseif (r <= 4.5e+125) tmp = t_1; elseif (r <= 4.6e+230) tmp = t_2; elseif (r <= 5e+259) tmp = t_1; 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_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(3.0 + N[(r * N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] * N[(N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]}, Block[{t$95$2 = 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]}, If[LessEqual[r, 6.2e-77], N[(t$95$0 + -1.5), $MachinePrecision], If[LessEqual[r, 6.2e+80], t$95$2, If[LessEqual[r, 4.5e+125], t$95$1, If[LessEqual[r, 4.6e+230], t$95$2, If[LessEqual[r, 5e+259], t$95$1, 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}
t_0 := \frac{2}{r \cdot r}\\
t_1 := \left(3 + r \cdot \left(\left(0.375 + v \cdot -0.25\right) \cdot \frac{w \cdot \left(r \cdot w\right)}{v}\right)\right) - 4.5\\
t_2 := 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{if}\;r \leq 6.2 \cdot 10^{-77}:\\
\;\;\;\;t\_0 + -1.5\\
\mathbf{elif}\;r \leq 6.2 \cdot 10^{+80}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;r \leq 4.5 \cdot 10^{+125}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;r \leq 4.6 \cdot 10^{+230}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;r \leq 5 \cdot 10^{+259}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;3 - \left(4.5 + \left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\
\end{array}
\end{array}
if r < 6.20000000000000016e-77Initial program 83.7%
Simplified86.4%
Applied egg-rr99.7%
Taylor expanded in w around 0 73.8%
if 6.20000000000000016e-77 < r < 6.19999999999999976e80 or 4.5e125 < r < 4.5999999999999996e230Initial program 97.9%
Simplified98.1%
Taylor expanded in v around 0 88.1%
if 6.19999999999999976e80 < r < 4.5e125 or 4.5999999999999996e230 < r < 5.00000000000000033e259Initial program 82.0%
Taylor expanded in r around inf 82.0%
associate-/l*99.1%
*-commutative99.1%
*-commutative99.1%
associate-/l*94.1%
*-commutative94.1%
associate-*r/94.0%
*-commutative94.0%
associate-*r*93.9%
Applied egg-rr94.0%
pow294.0%
associate-*r*94.0%
*-commutative94.0%
*-un-lft-identity94.0%
times-frac90.9%
Applied egg-rr90.9%
/-rgt-identity90.9%
associate-*r/94.0%
*-commutative94.0%
Simplified94.0%
Taylor expanded in v around inf 84.8%
neg-mul-184.8%
Simplified84.8%
if 5.00000000000000033e259 < r Initial program 92.0%
associate--l-92.0%
associate-*l*83.9%
sqr-neg83.9%
associate-*l*92.0%
associate-/l*92.0%
fma-define92.0%
Simplified92.0%
associate-/l*92.0%
*-commutative92.0%
associate-*r/92.0%
associate-*l*99.9%
associate-*r*99.9%
add-sqr-sqrt99.7%
sqrt-prod84.2%
add-sqr-sqrt59.2%
sqrt-prod58.9%
sqrt-prod58.9%
associate-*r*67.0%
*-commutative67.0%
sqrt-prod67.0%
*-commutative67.0%
sqrt-prod67.1%
sqrt-prod74.7%
add-sqr-sqrt99.9%
associate-*r*99.7%
add-sqr-sqrt99.9%
Applied egg-rr99.9%
Taylor expanded in v around 0 91.5%
Taylor expanded in r around inf 91.5%
Final simplification78.2%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* r (* (* w w) (/ r (+ v -1.0))))) (t_1 (/ 2.0 (* r r))))
(if (<= r 9e-90)
(+ t_1 -1.5)
(if (<= r 2.2e-5)
(+ t_1 (+ -1.5 (* (* v -0.25) t_0)))
(if (<= r 82000.0)
(+ t_1 (+ -1.5 (* 0.375 t_0)))
(+
3.0
(-
(* (* 0.125 (+ 3.0 (* -2.0 v))) (/ (* r (* w (* r w))) (+ v -1.0)))
4.5)))))))
double code(double v, double w, double r) {
double t_0 = r * ((w * w) * (r / (v + -1.0)));
double t_1 = 2.0 / (r * r);
double tmp;
if (r <= 9e-90) {
tmp = t_1 + -1.5;
} else if (r <= 2.2e-5) {
tmp = t_1 + (-1.5 + ((v * -0.25) * t_0));
} else if (r <= 82000.0) {
tmp = t_1 + (-1.5 + (0.375 * t_0));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * (w * (r * w))) / (v + -1.0))) - 4.5);
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: 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 (r <= 9d-90) then
tmp = t_1 + (-1.5d0)
else if (r <= 2.2d-5) then
tmp = t_1 + ((-1.5d0) + ((v * (-0.25d0)) * t_0))
else if (r <= 82000.0d0) then
tmp = t_1 + ((-1.5d0) + (0.375d0 * t_0))
else
tmp = 3.0d0 + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * (w * (r * w))) / (v + (-1.0d0)))) - 4.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = r * ((w * w) * (r / (v + -1.0)));
double t_1 = 2.0 / (r * r);
double tmp;
if (r <= 9e-90) {
tmp = t_1 + -1.5;
} else if (r <= 2.2e-5) {
tmp = t_1 + (-1.5 + ((v * -0.25) * t_0));
} else if (r <= 82000.0) {
tmp = t_1 + (-1.5 + (0.375 * t_0));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * (w * (r * w))) / (v + -1.0))) - 4.5);
}
return tmp;
}
def code(v, w, r): t_0 = r * ((w * w) * (r / (v + -1.0))) t_1 = 2.0 / (r * r) tmp = 0 if r <= 9e-90: tmp = t_1 + -1.5 elif r <= 2.2e-5: tmp = t_1 + (-1.5 + ((v * -0.25) * t_0)) elif r <= 82000.0: tmp = t_1 + (-1.5 + (0.375 * t_0)) else: tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * (w * (r * w))) / (v + -1.0))) - 4.5) return tmp
function code(v, w, r) 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 (r <= 9e-90) tmp = Float64(t_1 + -1.5); elseif (r <= 2.2e-5) tmp = Float64(t_1 + Float64(-1.5 + Float64(Float64(v * -0.25) * t_0))); elseif (r <= 82000.0) tmp = Float64(t_1 + Float64(-1.5 + Float64(0.375 * t_0))); else tmp = Float64(3.0 + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * Float64(w * Float64(r * w))) / Float64(v + -1.0))) - 4.5)); 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 (r <= 9e-90) tmp = t_1 + -1.5; elseif (r <= 2.2e-5) tmp = t_1 + (-1.5 + ((v * -0.25) * t_0)); elseif (r <= 82000.0) tmp = t_1 + (-1.5 + (0.375 * t_0)); else tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * (w * (r * w))) / (v + -1.0))) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := 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[LessEqual[r, 9e-90], N[(t$95$1 + -1.5), $MachinePrecision], If[LessEqual[r, 2.2e-5], N[(t$95$1 + N[(-1.5 + N[(N[(v * -0.25), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[r, 82000.0], N[(t$95$1 + N[(-1.5 + N[(0.375 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 + N[(N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $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}\;r \leq 9 \cdot 10^{-90}:\\
\;\;\;\;t\_1 + -1.5\\
\mathbf{elif}\;r \leq 2.2 \cdot 10^{-5}:\\
\;\;\;\;t\_1 + \left(-1.5 + \left(v \cdot -0.25\right) \cdot t\_0\right)\\
\mathbf{elif}\;r \leq 82000:\\
\;\;\;\;t\_1 + \left(-1.5 + 0.375 \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;3 + \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \frac{r \cdot \left(w \cdot \left(r \cdot w\right)\right)}{v + -1} - 4.5\right)\\
\end{array}
\end{array}
if r < 9.00000000000000017e-90Initial program 83.3%
Simplified86.1%
Applied egg-rr99.7%
Taylor expanded in w around 0 73.8%
if 9.00000000000000017e-90 < r < 2.1999999999999999e-5Initial program 99.8%
Simplified99.8%
Taylor expanded in v around inf 99.8%
*-commutative99.8%
Simplified99.8%
if 2.1999999999999999e-5 < r < 82000Initial program 86.6%
Simplified89.5%
Taylor expanded in v around 0 77.8%
if 82000 < r Initial program 92.0%
associate--l-92.0%
associate-*l*86.5%
sqr-neg86.5%
associate-*l*92.0%
associate-/l*98.3%
fma-define98.3%
Simplified98.3%
add-sqr-sqrt98.2%
pow298.2%
*-commutative98.2%
sqrt-prod98.2%
sqrt-prod52.6%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
unpow-prod-down98.3%
pow298.3%
pow298.3%
add-sqr-sqrt98.3%
associate-*l*99.8%
Applied egg-rr99.8%
Taylor expanded in r around inf 99.8%
Final simplification82.4%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))) (t_1 (/ r (+ v -1.0))))
(if (<= r 6.4e-90)
(+ t_0 -1.5)
(if (<= r 24.0)
(+ t_0 (+ -1.5 (* (* v -0.25) (* r (* (* w w) t_1)))))
(+
3.0
(- (* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (* 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 <= 6.4e-90) {
tmp = t_0 + -1.5;
} else if (r <= 24.0) {
tmp = t_0 + (-1.5 + ((v * -0.25) * (r * ((w * w) * t_1))));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (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 <= 6.4d-90) then
tmp = t_0 + (-1.5d0)
else if (r <= 24.0d0) 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))) * ((r * w) * (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 <= 6.4e-90) {
tmp = t_0 + -1.5;
} else if (r <= 24.0) {
tmp = t_0 + (-1.5 + ((v * -0.25) * (r * ((w * w) * t_1))));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (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 <= 6.4e-90: tmp = t_0 + -1.5 elif r <= 24.0: tmp = t_0 + (-1.5 + ((v * -0.25) * (r * ((w * w) * t_1)))) else: tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (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 <= 6.4e-90) tmp = Float64(t_0 + -1.5); elseif (r <= 24.0) 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(Float64(r * w) * 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 <= 6.4e-90) tmp = t_0 + -1.5; elseif (r <= 24.0) tmp = t_0 + (-1.5 + ((v * -0.25) * (r * ((w * w) * t_1)))); else tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (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, 6.4e-90], N[(t$95$0 + -1.5), $MachinePrecision], If[LessEqual[r, 24.0], 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[(N[(r * w), $MachinePrecision] * N[(w * t$95$1), $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 6.4 \cdot 10^{-90}:\\
\;\;\;\;t\_0 + -1.5\\
\mathbf{elif}\;r \leq 24:\\
\;\;\;\;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(\left(r \cdot w\right) \cdot \left(w \cdot t\_1\right)\right) - 4.5\right)\\
\end{array}
\end{array}
if r < 6.40000000000000014e-90Initial program 83.3%
Simplified86.1%
Applied egg-rr99.7%
Taylor expanded in w around 0 73.8%
if 6.40000000000000014e-90 < r < 24Initial program 99.8%
Simplified99.8%
Taylor expanded in v around inf 99.8%
*-commutative99.8%
Simplified99.8%
if 24 < r Initial program 92.0%
associate--l-92.0%
associate-*l*86.5%
sqr-neg86.5%
associate-*l*92.0%
associate-/l*98.3%
fma-define98.3%
Simplified98.3%
associate-/l*95.6%
*-commutative95.6%
associate-*r/95.6%
associate-*l*96.9%
associate-*r*99.7%
add-sqr-sqrt99.8%
sqrt-prod90.5%
add-sqr-sqrt47.4%
sqrt-prod56.7%
sqrt-prod56.8%
associate-*r*63.6%
*-commutative63.6%
sqrt-prod63.6%
*-commutative63.6%
sqrt-prod63.6%
sqrt-prod52.7%
add-sqr-sqrt99.8%
associate-*r*99.8%
add-sqr-sqrt99.7%
Applied egg-rr99.7%
Taylor expanded in r around inf 99.7%
Final simplification82.4%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= r 1.1e-89)
(+ t_0 -1.5)
(if (<= r 23.0)
(+ t_0 (+ -1.5 (* (* v -0.25) (* r (* (* w w) (/ r (+ v -1.0)))))))
(-
(+ 3.0 (* r (* (+ 0.375 (* v -0.25)) (/ (* w (* r w)) (+ 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.1e-89) {
tmp = t_0 + -1.5;
} else if (r <= 23.0) {
tmp = t_0 + (-1.5 + ((v * -0.25) * (r * ((w * w) * (r / (v + -1.0))))));
} else {
tmp = (3.0 + (r * ((0.375 + (v * -0.25)) * ((w * (r * w)) / (v + -1.0))))) - 4.5;
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if (r <= 1.1d-89) then
tmp = t_0 + (-1.5d0)
else if (r <= 23.0d0) then
tmp = t_0 + ((-1.5d0) + ((v * (-0.25d0)) * (r * ((w * w) * (r / (v + (-1.0d0)))))))
else
tmp = (3.0d0 + (r * ((0.375d0 + (v * (-0.25d0))) * ((w * (r * w)) / (v + (-1.0d0)))))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 1.1e-89) {
tmp = t_0 + -1.5;
} else if (r <= 23.0) {
tmp = t_0 + (-1.5 + ((v * -0.25) * (r * ((w * w) * (r / (v + -1.0))))));
} else {
tmp = (3.0 + (r * ((0.375 + (v * -0.25)) * ((w * (r * w)) / (v + -1.0))))) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if r <= 1.1e-89: tmp = t_0 + -1.5 elif r <= 23.0: tmp = t_0 + (-1.5 + ((v * -0.25) * (r * ((w * w) * (r / (v + -1.0)))))) else: tmp = (3.0 + (r * ((0.375 + (v * -0.25)) * ((w * (r * w)) / (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.1e-89) tmp = Float64(t_0 + -1.5); elseif (r <= 23.0) tmp = Float64(t_0 + Float64(-1.5 + Float64(Float64(v * -0.25) * Float64(r * Float64(Float64(w * w) * Float64(r / Float64(v + -1.0))))))); else tmp = Float64(Float64(3.0 + Float64(r * Float64(Float64(0.375 + Float64(v * -0.25)) * Float64(Float64(w * Float64(r * w)) / 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.1e-89) tmp = t_0 + -1.5; elseif (r <= 23.0) tmp = t_0 + (-1.5 + ((v * -0.25) * (r * ((w * w) * (r / (v + -1.0)))))); else tmp = (3.0 + (r * ((0.375 + (v * -0.25)) * ((w * (r * w)) / (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.1e-89], N[(t$95$0 + -1.5), $MachinePrecision], If[LessEqual[r, 23.0], N[(t$95$0 + N[(-1.5 + N[(N[(v * -0.25), $MachinePrecision] * N[(r * N[(N[(w * w), $MachinePrecision] * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(3.0 + N[(r * N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] * N[(N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision] / 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 1.1 \cdot 10^{-89}:\\
\;\;\;\;t\_0 + -1.5\\
\mathbf{elif}\;r \leq 23:\\
\;\;\;\;t\_0 + \left(-1.5 + \left(v \cdot -0.25\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{v + -1}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(3 + r \cdot \left(\left(0.375 + v \cdot -0.25\right) \cdot \frac{w \cdot \left(r \cdot w\right)}{v + -1}\right)\right) - 4.5\\
\end{array}
\end{array}
if r < 1.10000000000000006e-89Initial program 83.3%
Simplified86.1%
Applied egg-rr99.7%
Taylor expanded in w around 0 73.8%
if 1.10000000000000006e-89 < r < 23Initial program 99.8%
Simplified99.8%
Taylor expanded in v around inf 99.8%
*-commutative99.8%
Simplified99.8%
if 23 < r Initial program 92.0%
Taylor expanded in r around inf 92.0%
associate-/l*98.3%
*-commutative98.3%
*-commutative98.3%
associate-/l*95.7%
*-commutative95.7%
associate-*r/95.7%
*-commutative95.7%
associate-*r*95.7%
Applied egg-rr95.7%
pow295.7%
associate-*r*97.0%
*-commutative97.0%
*-un-lft-identity97.0%
times-frac96.1%
Applied egg-rr96.1%
/-rgt-identity96.1%
associate-*r/97.0%
*-commutative97.0%
Simplified97.0%
Final simplification81.6%
(FPCore (v w r)
:precision binary64
(if (<= r 1120000.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 (* r w))) (- 1.0 v)))))))
double code(double v, double w, double r) {
double tmp;
if (r <= 1120000.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 * (r * w))) / (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 <= 1120000.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 * (r * w))) / (1.0d0 - v))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 1120000.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 * (r * w))) / (1.0 - v))));
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 1120000.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 * (r * w))) / (1.0 - v)))) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 1120000.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 * Float64(w * Float64(r * w))) / Float64(1.0 - v))))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 1120000.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 * (r * w))) / (1.0 - v)))); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 1120000.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 * N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1120000:\\
\;\;\;\;\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 \frac{r \cdot \left(w \cdot \left(r \cdot w\right)\right)}{1 - v}\right)\\
\end{array}
\end{array}
if r < 1.12e6Initial program 84.5%
associate-/l*87.0%
cancel-sign-sub-inv87.0%
metadata-eval87.0%
+-commutative87.0%
*-commutative87.0%
fma-undefine87.0%
*-commutative87.0%
*-commutative87.0%
associate-/l*87.1%
*-commutative87.1%
associate-*r/87.1%
associate-*r*83.8%
associate-*l*93.5%
associate-*r*94.6%
Applied egg-rr94.6%
if 1.12e6 < r Initial program 92.0%
associate--l-92.0%
associate-*l*86.5%
sqr-neg86.5%
associate-*l*92.0%
associate-/l*98.3%
fma-define98.3%
Simplified98.3%
add-sqr-sqrt98.2%
pow298.2%
*-commutative98.2%
sqrt-prod98.2%
sqrt-prod52.6%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
unpow-prod-down98.3%
pow298.3%
pow298.3%
add-sqr-sqrt98.3%
associate-*l*99.8%
Applied egg-rr99.8%
Taylor expanded in r around inf 99.8%
Final simplification96.0%
(FPCore (v w r)
:precision binary64
(if (<= r 7.2e-22)
(+ (/ 2.0 (* r r)) -1.5)
(if (<= r 9e+261)
(- (+ 3.0 (* r (* (+ 0.375 (* v -0.25)) (/ (* w (* r w)) v)))) 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 <= 7.2e-22) {
tmp = (2.0 / (r * r)) + -1.5;
} else if (r <= 9e+261) {
tmp = (3.0 + (r * ((0.375 + (v * -0.25)) * ((w * (r * w)) / v)))) - 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 <= 7.2d-22) then
tmp = (2.0d0 / (r * r)) + (-1.5d0)
else if (r <= 9d+261) then
tmp = (3.0d0 + (r * ((0.375d0 + (v * (-0.25d0))) * ((w * (r * w)) / v)))) - 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 <= 7.2e-22) {
tmp = (2.0 / (r * r)) + -1.5;
} else if (r <= 9e+261) {
tmp = (3.0 + (r * ((0.375 + (v * -0.25)) * ((w * (r * w)) / v)))) - 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 <= 7.2e-22: tmp = (2.0 / (r * r)) + -1.5 elif r <= 9e+261: tmp = (3.0 + (r * ((0.375 + (v * -0.25)) * ((w * (r * w)) / v)))) - 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 <= 7.2e-22) tmp = Float64(Float64(2.0 / Float64(r * r)) + -1.5); elseif (r <= 9e+261) tmp = Float64(Float64(3.0 + Float64(r * Float64(Float64(0.375 + Float64(v * -0.25)) * Float64(Float64(w * Float64(r * w)) / v)))) - 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 <= 7.2e-22) tmp = (2.0 / (r * r)) + -1.5; elseif (r <= 9e+261) tmp = (3.0 + (r * ((0.375 + (v * -0.25)) * ((w * (r * w)) / v)))) - 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, 7.2e-22], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision], If[LessEqual[r, 9e+261], N[(N[(3.0 + N[(r * N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] * N[(N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision] / v), $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[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 7.2 \cdot 10^{-22}:\\
\;\;\;\;\frac{2}{r \cdot r} + -1.5\\
\mathbf{elif}\;r \leq 9 \cdot 10^{+261}:\\
\;\;\;\;\left(3 + r \cdot \left(\left(0.375 + v \cdot -0.25\right) \cdot \frac{w \cdot \left(r \cdot w\right)}{v}\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(r \cdot w\right)\right)\right)\\
\end{array}
\end{array}
if r < 7.1999999999999996e-22Initial program 84.4%
Simplified87.0%
Applied egg-rr99.7%
Taylor expanded in w around 0 74.4%
if 7.1999999999999996e-22 < r < 8.9999999999999998e261Initial program 92.2%
Taylor expanded in r around inf 92.2%
associate-/l*99.6%
*-commutative99.6%
*-commutative99.6%
associate-/l*96.5%
*-commutative96.5%
associate-*r/96.5%
*-commutative96.5%
associate-*r*96.5%
Applied egg-rr96.5%
pow296.5%
associate-*r*96.5%
*-commutative96.5%
*-un-lft-identity96.5%
times-frac95.4%
Applied egg-rr95.4%
/-rgt-identity95.4%
associate-*r/96.5%
*-commutative96.5%
Simplified96.5%
Taylor expanded in v around inf 72.6%
neg-mul-172.6%
Simplified72.6%
if 8.9999999999999998e261 < r Initial program 92.0%
associate--l-92.0%
associate-*l*83.9%
sqr-neg83.9%
associate-*l*92.0%
associate-/l*92.0%
fma-define92.0%
Simplified92.0%
associate-/l*92.0%
*-commutative92.0%
associate-*r/92.0%
associate-*l*99.9%
associate-*r*99.9%
add-sqr-sqrt99.7%
sqrt-prod84.2%
add-sqr-sqrt59.2%
sqrt-prod58.9%
sqrt-prod58.9%
associate-*r*67.0%
*-commutative67.0%
sqrt-prod67.0%
*-commutative67.0%
sqrt-prod67.1%
sqrt-prod74.7%
add-sqr-sqrt99.9%
associate-*r*99.7%
add-sqr-sqrt99.9%
Applied egg-rr99.9%
Taylor expanded in v around 0 91.5%
Taylor expanded in r around inf 91.5%
Final simplification74.8%
(FPCore (v w r)
:precision binary64
(if (<= r 9.5e-22)
(+ (/ 2.0 (* r r)) -1.5)
(-
(+ 3.0 (* r (* (+ 0.375 (* v -0.25)) (/ (* w (* r w)) (+ v -1.0)))))
4.5)))
double code(double v, double w, double r) {
double tmp;
if (r <= 9.5e-22) {
tmp = (2.0 / (r * r)) + -1.5;
} else {
tmp = (3.0 + (r * ((0.375 + (v * -0.25)) * ((w * (r * w)) / (v + -1.0))))) - 4.5;
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: tmp
if (r <= 9.5d-22) then
tmp = (2.0d0 / (r * r)) + (-1.5d0)
else
tmp = (3.0d0 + (r * ((0.375d0 + (v * (-0.25d0))) * ((w * (r * w)) / (v + (-1.0d0)))))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 9.5e-22) {
tmp = (2.0 / (r * r)) + -1.5;
} else {
tmp = (3.0 + (r * ((0.375 + (v * -0.25)) * ((w * (r * w)) / (v + -1.0))))) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 9.5e-22: tmp = (2.0 / (r * r)) + -1.5 else: tmp = (3.0 + (r * ((0.375 + (v * -0.25)) * ((w * (r * w)) / (v + -1.0))))) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 9.5e-22) tmp = Float64(Float64(2.0 / Float64(r * r)) + -1.5); else tmp = Float64(Float64(3.0 + Float64(r * Float64(Float64(0.375 + Float64(v * -0.25)) * Float64(Float64(w * Float64(r * w)) / Float64(v + -1.0))))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 9.5e-22) tmp = (2.0 / (r * r)) + -1.5; else tmp = (3.0 + (r * ((0.375 + (v * -0.25)) * ((w * (r * w)) / (v + -1.0))))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 9.5e-22], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision], N[(N[(3.0 + N[(r * N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] * N[(N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision] / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 9.5 \cdot 10^{-22}:\\
\;\;\;\;\frac{2}{r \cdot r} + -1.5\\
\mathbf{else}:\\
\;\;\;\;\left(3 + r \cdot \left(\left(0.375 + v \cdot -0.25\right) \cdot \frac{w \cdot \left(r \cdot w\right)}{v + -1}\right)\right) - 4.5\\
\end{array}
\end{array}
if r < 9.4999999999999994e-22Initial program 84.4%
Simplified87.0%
Applied egg-rr99.7%
Taylor expanded in w around 0 74.4%
if 9.4999999999999994e-22 < r Initial program 92.1%
Taylor expanded in r around inf 92.1%
associate-/l*98.3%
*-commutative98.3%
*-commutative98.3%
associate-/l*95.7%
*-commutative95.7%
associate-*r/95.7%
*-commutative95.7%
associate-*r*95.7%
Applied egg-rr95.7%
pow295.7%
associate-*r*97.0%
*-commutative97.0%
*-un-lft-identity97.0%
times-frac96.1%
Applied egg-rr96.1%
/-rgt-identity96.1%
associate-*r/97.0%
*-commutative97.0%
Simplified97.0%
Final simplification80.8%
(FPCore (v w r)
:precision binary64
(if (<= r 2.5e-39)
(+ (/ 2.0 (* r r)) -1.5)
(-
(+ 3.0 (* (* w (* r (+ 0.375 (* v -0.25)))) (* w (/ r (+ v -1.0)))))
4.5)))
double code(double v, double w, double r) {
double tmp;
if (r <= 2.5e-39) {
tmp = (2.0 / (r * r)) + -1.5;
} else {
tmp = (3.0 + ((w * (r * (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 <= 2.5d-39) then
tmp = (2.0d0 / (r * r)) + (-1.5d0)
else
tmp = (3.0d0 + ((w * (r * (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 <= 2.5e-39) {
tmp = (2.0 / (r * r)) + -1.5;
} else {
tmp = (3.0 + ((w * (r * (0.375 + (v * -0.25)))) * (w * (r / (v + -1.0))))) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 2.5e-39: tmp = (2.0 / (r * r)) + -1.5 else: tmp = (3.0 + ((w * (r * (0.375 + (v * -0.25)))) * (w * (r / (v + -1.0))))) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 2.5e-39) tmp = Float64(Float64(2.0 / Float64(r * r)) + -1.5); else tmp = Float64(Float64(3.0 + Float64(Float64(w * Float64(r * 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 <= 2.5e-39) tmp = (2.0 / (r * r)) + -1.5; else tmp = (3.0 + ((w * (r * (0.375 + (v * -0.25)))) * (w * (r / (v + -1.0))))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 2.5e-39], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision], N[(N[(3.0 + 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]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 2.5 \cdot 10^{-39}:\\
\;\;\;\;\frac{2}{r \cdot r} + -1.5\\
\mathbf{else}:\\
\;\;\;\;\left(3 + \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\\
\end{array}
\end{array}
if r < 2.4999999999999999e-39Initial program 84.2%
Simplified86.9%
Applied egg-rr99.7%
Taylor expanded in w around 0 74.1%
if 2.4999999999999999e-39 < r Initial program 92.3%
Taylor expanded in r around inf 89.7%
associate-/l*98.4%
cancel-sign-sub-inv98.4%
metadata-eval98.4%
+-commutative98.4%
*-commutative98.4%
fma-undefine98.4%
*-commutative98.4%
*-commutative98.4%
associate-/l*95.8%
*-commutative95.8%
associate-*r/95.8%
associate-*r*88.2%
associate-*l*89.5%
associate-*r*88.4%
Applied egg-rr85.7%
Final simplification77.5%
(FPCore (v w r) :precision binary64 (if (<= r 15.8) (+ (/ 2.0 (* r r)) -1.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 <= 15.8) {
tmp = (2.0 / (r * r)) + -1.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 <= 15.8d0) then
tmp = (2.0d0 / (r * r)) + (-1.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 <= 15.8) {
tmp = (2.0 / (r * r)) + -1.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 <= 15.8: tmp = (2.0 / (r * r)) + -1.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 <= 15.8) tmp = Float64(Float64(2.0 / Float64(r * r)) + -1.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 <= 15.8) tmp = (2.0 / (r * r)) + -1.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, 15.8], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.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 15.8:\\
\;\;\;\;\frac{2}{r \cdot r} + -1.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 < 15.800000000000001Initial program 84.5%
Simplified87.1%
Applied egg-rr99.7%
Taylor expanded in w around 0 74.0%
if 15.800000000000001 < r Initial program 92.0%
associate--l-92.0%
associate-*l*86.5%
sqr-neg86.5%
associate-*l*92.0%
associate-/l*98.3%
fma-define98.3%
Simplified98.3%
associate-/l*95.6%
*-commutative95.6%
associate-*r/95.6%
associate-*l*96.9%
associate-*r*99.7%
add-sqr-sqrt99.8%
sqrt-prod90.5%
add-sqr-sqrt47.4%
sqrt-prod56.7%
sqrt-prod56.8%
associate-*r*63.6%
*-commutative63.6%
sqrt-prod63.6%
*-commutative63.6%
sqrt-prod63.6%
sqrt-prod52.7%
add-sqr-sqrt99.8%
associate-*r*99.8%
add-sqr-sqrt99.7%
Applied egg-rr99.7%
Taylor expanded in v around 0 71.3%
Taylor expanded in r around inf 71.3%
Final simplification73.2%
(FPCore (v w r) :precision binary64 (if (<= r 0.065) (+ (/ 2.0 (* r r)) -1.5) (- (- 3.0 (* r (* (+ 0.375 (* v -0.25)) (* w (* r w))))) 4.5)))
double code(double v, double w, double r) {
double tmp;
if (r <= 0.065) {
tmp = (2.0 / (r * r)) + -1.5;
} else {
tmp = (3.0 - (r * ((0.375 + (v * -0.25)) * (w * (r * 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 <= 0.065d0) then
tmp = (2.0d0 / (r * r)) + (-1.5d0)
else
tmp = (3.0d0 - (r * ((0.375d0 + (v * (-0.25d0))) * (w * (r * w))))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 0.065) {
tmp = (2.0 / (r * r)) + -1.5;
} else {
tmp = (3.0 - (r * ((0.375 + (v * -0.25)) * (w * (r * w))))) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 0.065: tmp = (2.0 / (r * r)) + -1.5 else: tmp = (3.0 - (r * ((0.375 + (v * -0.25)) * (w * (r * w))))) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 0.065) tmp = Float64(Float64(2.0 / Float64(r * r)) + -1.5); else tmp = Float64(Float64(3.0 - Float64(r * Float64(Float64(0.375 + Float64(v * -0.25)) * Float64(w * Float64(r * w))))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 0.065) tmp = (2.0 / (r * r)) + -1.5; else tmp = (3.0 - (r * ((0.375 + (v * -0.25)) * (w * (r * w))))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 0.065], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision], N[(N[(3.0 - N[(r * N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 0.065:\\
\;\;\;\;\frac{2}{r \cdot r} + -1.5\\
\mathbf{else}:\\
\;\;\;\;\left(3 - r \cdot \left(\left(0.375 + v \cdot -0.25\right) \cdot \left(w \cdot \left(r \cdot w\right)\right)\right)\right) - 4.5\\
\end{array}
\end{array}
if r < 0.065000000000000002Initial program 84.5%
Simplified87.1%
Applied egg-rr99.7%
Taylor expanded in w around 0 74.0%
if 0.065000000000000002 < r Initial program 92.0%
Taylor expanded in r around inf 92.0%
associate-/l*98.3%
*-commutative98.3%
*-commutative98.3%
associate-/l*95.7%
*-commutative95.7%
associate-*r/95.7%
*-commutative95.7%
associate-*r*95.7%
Applied egg-rr95.7%
pow295.7%
associate-*r*97.0%
*-commutative97.0%
*-un-lft-identity97.0%
times-frac96.1%
Applied egg-rr96.1%
/-rgt-identity96.1%
associate-*r/97.0%
*-commutative97.0%
Simplified97.0%
Taylor expanded in v around 0 72.8%
Final simplification73.6%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) -1.5))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + -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 = (2.0d0 / (r * r)) + (-1.5d0)
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + -1.5;
}
def code(v, w, r): return (2.0 / (r * r)) + -1.5
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + -1.5) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + -1.5; end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + -1.5
\end{array}
Initial program 86.6%
Simplified89.5%
Applied egg-rr99.7%
Taylor expanded in w around 0 60.6%
(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 86.6%
Simplified83.1%
Taylor expanded in r around 0 60.6%
Taylor expanded in r around inf 16.2%
herbie shell --seed 2024110
(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))