
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5
\end{array}
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (- -1.5 (/ (+ 0.375 (* v -0.25)) (/ (- 1.0 v) (* (* r w) (* r w)))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - ((0.375 + (v * -0.25)) / ((1.0 - v) / ((r * w) * (r * w)))));
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (2.0d0 / (r * r)) + ((-1.5d0) - ((0.375d0 + (v * (-0.25d0))) / ((1.0d0 - v) / ((r * w) * (r * w)))))
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - ((0.375 + (v * -0.25)) / ((1.0 - v) / ((r * w) * (r * w)))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 - ((0.375 + (v * -0.25)) / ((1.0 - v) / ((r * w) * (r * w)))))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 - Float64(Float64(0.375 + Float64(v * -0.25)) / Float64(Float64(1.0 - v) / Float64(Float64(r * w) * Float64(r * w)))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 - ((0.375 + (v * -0.25)) / ((1.0 - v) / ((r * w) * (r * w))))); end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 - v), $MachinePrecision] / N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 - \frac{0.375 + v \cdot -0.25}{\frac{1 - v}{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}}\right)
\end{array}
Initial program 80.7%
Simplified83.9%
fma-undefine83.9%
*-commutative83.9%
+-commutative83.9%
associate-*r/84.7%
*-commutative84.7%
associate-/l*84.7%
clear-num84.6%
un-div-inv84.6%
distribute-rgt-in84.6%
metadata-eval84.6%
*-commutative84.6%
associate-*l*84.6%
metadata-eval84.6%
associate-*r*77.1%
pow277.1%
pow277.1%
pow-prod-down99.7%
*-commutative99.7%
Applied egg-rr99.7%
unpow299.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r)))
(t_1 (* r (* (* w w) (/ r (- 1.0 v)))))
(t_2 (* 0.125 (+ 3.0 (* v -2.0)))))
(if (<= r 1.45e-90)
(- (+ 3.0 (/ (/ 2.0 r) r)) 4.5)
(if (<= r 1.22e+145)
(+ t_0 (- -1.5 (* (* v -0.25) t_1)))
(if (<= r 4.7e+200)
(+ t_0 (- -1.5 (* 0.375 t_1)))
(if (<= r 9.5e+254)
(- 3.0 (- 4.5 (* t_2 (* w (* r (/ (* r w) v))))))
(- 3.0 (+ 4.5 (* t_2 (* (* r w) (* r w)))))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = r * ((w * w) * (r / (1.0 - v)));
double t_2 = 0.125 * (3.0 + (v * -2.0));
double tmp;
if (r <= 1.45e-90) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 1.22e+145) {
tmp = t_0 + (-1.5 - ((v * -0.25) * t_1));
} else if (r <= 4.7e+200) {
tmp = t_0 + (-1.5 - (0.375 * t_1));
} else if (r <= 9.5e+254) {
tmp = 3.0 - (4.5 - (t_2 * (w * (r * ((r * w) / v)))));
} else {
tmp = 3.0 - (4.5 + (t_2 * ((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 = r * ((w * w) * (r / (1.0d0 - v)))
t_2 = 0.125d0 * (3.0d0 + (v * (-2.0d0)))
if (r <= 1.45d-90) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else if (r <= 1.22d+145) then
tmp = t_0 + ((-1.5d0) - ((v * (-0.25d0)) * t_1))
else if (r <= 4.7d+200) then
tmp = t_0 + ((-1.5d0) - (0.375d0 * t_1))
else if (r <= 9.5d+254) then
tmp = 3.0d0 - (4.5d0 - (t_2 * (w * (r * ((r * w) / v)))))
else
tmp = 3.0d0 - (4.5d0 + (t_2 * ((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 = r * ((w * w) * (r / (1.0 - v)));
double t_2 = 0.125 * (3.0 + (v * -2.0));
double tmp;
if (r <= 1.45e-90) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 1.22e+145) {
tmp = t_0 + (-1.5 - ((v * -0.25) * t_1));
} else if (r <= 4.7e+200) {
tmp = t_0 + (-1.5 - (0.375 * t_1));
} else if (r <= 9.5e+254) {
tmp = 3.0 - (4.5 - (t_2 * (w * (r * ((r * w) / v)))));
} else {
tmp = 3.0 - (4.5 + (t_2 * ((r * w) * (r * w))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = r * ((w * w) * (r / (1.0 - v))) t_2 = 0.125 * (3.0 + (v * -2.0)) tmp = 0 if r <= 1.45e-90: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 elif r <= 1.22e+145: tmp = t_0 + (-1.5 - ((v * -0.25) * t_1)) elif r <= 4.7e+200: tmp = t_0 + (-1.5 - (0.375 * t_1)) elif r <= 9.5e+254: tmp = 3.0 - (4.5 - (t_2 * (w * (r * ((r * w) / v))))) else: tmp = 3.0 - (4.5 + (t_2 * ((r * w) * (r * w)))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) t_1 = Float64(r * Float64(Float64(w * w) * Float64(r / Float64(1.0 - v)))) t_2 = Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) tmp = 0.0 if (r <= 1.45e-90) tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); elseif (r <= 1.22e+145) tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(v * -0.25) * t_1))); elseif (r <= 4.7e+200) tmp = Float64(t_0 + Float64(-1.5 - Float64(0.375 * t_1))); elseif (r <= 9.5e+254) tmp = Float64(3.0 - Float64(4.5 - Float64(t_2 * Float64(w * Float64(r * Float64(Float64(r * w) / v)))))); else tmp = Float64(3.0 - Float64(4.5 + Float64(t_2 * 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 = r * ((w * w) * (r / (1.0 - v))); t_2 = 0.125 * (3.0 + (v * -2.0)); tmp = 0.0; if (r <= 1.45e-90) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; elseif (r <= 1.22e+145) tmp = t_0 + (-1.5 - ((v * -0.25) * t_1)); elseif (r <= 4.7e+200) tmp = t_0 + (-1.5 - (0.375 * t_1)); elseif (r <= 9.5e+254) tmp = 3.0 - (4.5 - (t_2 * (w * (r * ((r * w) / v))))); else tmp = 3.0 - (4.5 + (t_2 * ((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[(r * N[(N[(w * w), $MachinePrecision] * N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.125 * N[(3.0 + N[(v * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 1.45e-90], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 1.22e+145], N[(t$95$0 + N[(-1.5 - N[(N[(v * -0.25), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[r, 4.7e+200], N[(t$95$0 + N[(-1.5 - N[(0.375 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[r, 9.5e+254], N[(3.0 - N[(4.5 - N[(t$95$2 * N[(w * N[(r * N[(N[(r * w), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 - N[(4.5 + N[(t$95$2 * 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 := r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{1 - v}\right)\\
t_2 := 0.125 \cdot \left(3 + v \cdot -2\right)\\
\mathbf{if}\;r \leq 1.45 \cdot 10^{-90}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{elif}\;r \leq 1.22 \cdot 10^{+145}:\\
\;\;\;\;t\_0 + \left(-1.5 - \left(v \cdot -0.25\right) \cdot t\_1\right)\\
\mathbf{elif}\;r \leq 4.7 \cdot 10^{+200}:\\
\;\;\;\;t\_0 + \left(-1.5 - 0.375 \cdot t\_1\right)\\
\mathbf{elif}\;r \leq 9.5 \cdot 10^{+254}:\\
\;\;\;\;3 - \left(4.5 - t\_2 \cdot \left(w \cdot \left(r \cdot \frac{r \cdot w}{v}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;3 - \left(4.5 + t\_2 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\
\end{array}
\end{array}
if r < 1.44999999999999992e-90Initial program 77.3%
Simplified75.8%
Taylor expanded in r around 0 69.7%
associate-/r*69.8%
div-inv69.7%
Applied egg-rr69.7%
un-div-inv69.8%
Applied egg-rr69.8%
if 1.44999999999999992e-90 < r < 1.21999999999999994e145Initial program 92.2%
Simplified95.6%
Taylor expanded in v around inf 77.8%
*-commutative77.8%
Simplified77.8%
if 1.21999999999999994e145 < r < 4.6999999999999998e200Initial program 99.9%
Simplified99.9%
Taylor expanded in v around 0 93.2%
if 4.6999999999999998e200 < r < 9.4999999999999998e254Initial program 67.7%
associate--l-67.7%
associate-*l*38.7%
sqr-neg38.7%
associate-*l*67.7%
associate-/l*67.7%
fma-define67.7%
Simplified67.7%
associate-/l*67.7%
*-commutative67.7%
associate-*r/67.7%
*-commutative67.7%
associate-*l*76.9%
associate-*l*87.9%
Applied egg-rr87.9%
Taylor expanded in r around inf 87.9%
Taylor expanded in v around inf 88.1%
associate-*r/88.1%
mul-1-neg88.1%
Simplified88.1%
if 9.4999999999999998e254 < r Initial program 65.9%
associate--l-65.9%
associate-*l*45.5%
sqr-neg45.5%
associate-*l*65.9%
associate-/l*65.9%
fma-define65.9%
Simplified65.9%
associate-/l*65.9%
*-commutative65.9%
associate-*r/65.9%
associate-*l*99.7%
associate-*r*99.6%
*-commutative99.6%
Applied egg-rr99.6%
Taylor expanded in r around inf 99.6%
Taylor expanded in v around 0 82.0%
Final simplification73.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* 0.125 (+ 3.0 (* v -2.0)))))
(if (<= r 8.5e-91)
(- (+ 3.0 (/ (/ 2.0 r) r)) 4.5)
(if (<= r 2.4e+201)
(+ (/ 2.0 (* r r)) (- -1.5 (* 0.375 (* r (* (* w w) (/ r (- 1.0 v)))))))
(if (<= r 3.4e+255)
(- 3.0 (- 4.5 (* t_0 (* w (* r (/ (* r w) v))))))
(- 3.0 (+ 4.5 (* t_0 (* (* r w) (* r w))))))))))
double code(double v, double w, double r) {
double t_0 = 0.125 * (3.0 + (v * -2.0));
double tmp;
if (r <= 8.5e-91) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 2.4e+201) {
tmp = (2.0 / (r * r)) + (-1.5 - (0.375 * (r * ((w * w) * (r / (1.0 - v))))));
} else if (r <= 3.4e+255) {
tmp = 3.0 - (4.5 - (t_0 * (w * (r * ((r * w) / v)))));
} else {
tmp = 3.0 - (4.5 + (t_0 * ((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) :: tmp
t_0 = 0.125d0 * (3.0d0 + (v * (-2.0d0)))
if (r <= 8.5d-91) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else if (r <= 2.4d+201) then
tmp = (2.0d0 / (r * r)) + ((-1.5d0) - (0.375d0 * (r * ((w * w) * (r / (1.0d0 - v))))))
else if (r <= 3.4d+255) then
tmp = 3.0d0 - (4.5d0 - (t_0 * (w * (r * ((r * w) / v)))))
else
tmp = 3.0d0 - (4.5d0 + (t_0 * ((r * w) * (r * w))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 0.125 * (3.0 + (v * -2.0));
double tmp;
if (r <= 8.5e-91) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 2.4e+201) {
tmp = (2.0 / (r * r)) + (-1.5 - (0.375 * (r * ((w * w) * (r / (1.0 - v))))));
} else if (r <= 3.4e+255) {
tmp = 3.0 - (4.5 - (t_0 * (w * (r * ((r * w) / v)))));
} else {
tmp = 3.0 - (4.5 + (t_0 * ((r * w) * (r * w))));
}
return tmp;
}
def code(v, w, r): t_0 = 0.125 * (3.0 + (v * -2.0)) tmp = 0 if r <= 8.5e-91: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 elif r <= 2.4e+201: tmp = (2.0 / (r * r)) + (-1.5 - (0.375 * (r * ((w * w) * (r / (1.0 - v)))))) elif r <= 3.4e+255: tmp = 3.0 - (4.5 - (t_0 * (w * (r * ((r * w) / v))))) else: tmp = 3.0 - (4.5 + (t_0 * ((r * w) * (r * w)))) return tmp
function code(v, w, r) t_0 = Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) tmp = 0.0 if (r <= 8.5e-91) tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); elseif (r <= 2.4e+201) tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 - Float64(0.375 * Float64(r * Float64(Float64(w * w) * Float64(r / Float64(1.0 - v))))))); elseif (r <= 3.4e+255) tmp = Float64(3.0 - Float64(4.5 - Float64(t_0 * Float64(w * Float64(r * Float64(Float64(r * w) / v)))))); else tmp = Float64(3.0 - Float64(4.5 + Float64(t_0 * Float64(Float64(r * w) * Float64(r * w))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 0.125 * (3.0 + (v * -2.0)); tmp = 0.0; if (r <= 8.5e-91) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; elseif (r <= 2.4e+201) tmp = (2.0 / (r * r)) + (-1.5 - (0.375 * (r * ((w * w) * (r / (1.0 - v)))))); elseif (r <= 3.4e+255) tmp = 3.0 - (4.5 - (t_0 * (w * (r * ((r * w) / v))))); else tmp = 3.0 - (4.5 + (t_0 * ((r * w) * (r * w)))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(0.125 * N[(3.0 + N[(v * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 8.5e-91], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 2.4e+201], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[(0.375 * N[(r * N[(N[(w * w), $MachinePrecision] * N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[r, 3.4e+255], N[(3.0 - N[(4.5 - N[(t$95$0 * N[(w * N[(r * N[(N[(r * w), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 - N[(4.5 + N[(t$95$0 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.125 \cdot \left(3 + v \cdot -2\right)\\
\mathbf{if}\;r \leq 8.5 \cdot 10^{-91}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{elif}\;r \leq 2.4 \cdot 10^{+201}:\\
\;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 - 0.375 \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{1 - v}\right)\right)\right)\\
\mathbf{elif}\;r \leq 3.4 \cdot 10^{+255}:\\
\;\;\;\;3 - \left(4.5 - t\_0 \cdot \left(w \cdot \left(r \cdot \frac{r \cdot w}{v}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;3 - \left(4.5 + t\_0 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\
\end{array}
\end{array}
if r < 8.49999999999999985e-91Initial program 77.3%
Simplified75.8%
Taylor expanded in r around 0 69.7%
associate-/r*69.8%
div-inv69.7%
Applied egg-rr69.7%
un-div-inv69.8%
Applied egg-rr69.8%
if 8.49999999999999985e-91 < r < 2.39999999999999993e201Initial program 94.0%
Simplified96.6%
Taylor expanded in v around 0 78.3%
if 2.39999999999999993e201 < r < 3.3999999999999998e255Initial program 67.7%
associate--l-67.7%
associate-*l*38.7%
sqr-neg38.7%
associate-*l*67.7%
associate-/l*67.7%
fma-define67.7%
Simplified67.7%
associate-/l*67.7%
*-commutative67.7%
associate-*r/67.7%
*-commutative67.7%
associate-*l*76.9%
associate-*l*87.9%
Applied egg-rr87.9%
Taylor expanded in r around inf 87.9%
Taylor expanded in v around inf 88.1%
associate-*r/88.1%
mul-1-neg88.1%
Simplified88.1%
if 3.3999999999999998e255 < r Initial program 65.9%
associate--l-65.9%
associate-*l*45.5%
sqr-neg45.5%
associate-*l*65.9%
associate-/l*65.9%
fma-define65.9%
Simplified65.9%
associate-/l*65.9%
*-commutative65.9%
associate-*r/65.9%
associate-*l*99.7%
associate-*r*99.6%
*-commutative99.6%
Applied egg-rr99.6%
Taylor expanded in r around inf 99.6%
Taylor expanded in v around 0 82.0%
Final simplification73.0%
(FPCore (v w r)
:precision binary64
(if (<= r 5.8e-92)
(- (+ 3.0 (/ (/ 2.0 r) r)) 4.5)
(if (<= r 1.75)
(+ (/ 2.0 (* r r)) (+ -1.5 (* 0.375 (* r (* (* w w) (/ r (+ v -1.0)))))))
(+
3.0
(-
(* (* 0.125 (+ 3.0 (* v -2.0))) (* (* r w) (/ (* r w) (+ v -1.0))))
4.5)))))
double code(double v, double w, double r) {
double tmp;
if (r <= 5.8e-92) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 1.75) {
tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0))))));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * ((r * w) * ((r * w) / (v + -1.0)))) - 4.5);
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: tmp
if (r <= 5.8d-92) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else if (r <= 1.75d0) then
tmp = (2.0d0 / (r * r)) + ((-1.5d0) + (0.375d0 * (r * ((w * w) * (r / (v + (-1.0d0)))))))
else
tmp = 3.0d0 + (((0.125d0 * (3.0d0 + (v * (-2.0d0)))) * ((r * w) * ((r * w) / (v + (-1.0d0))))) - 4.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 5.8e-92) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 1.75) {
tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0))))));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * ((r * w) * ((r * w) / (v + -1.0)))) - 4.5);
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 5.8e-92: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 elif r <= 1.75: tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0)))))) else: tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * ((r * w) * ((r * w) / (v + -1.0)))) - 4.5) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 5.8e-92) tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); elseif (r <= 1.75) tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(0.375 * Float64(r * Float64(Float64(w * w) * Float64(r / Float64(v + -1.0))))))); else tmp = Float64(3.0 + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) * Float64(Float64(r * w) * Float64(Float64(r * w) / Float64(v + -1.0)))) - 4.5)); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 5.8e-92) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; elseif (r <= 1.75) tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0)))))); else tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * ((r * w) * ((r * w) / (v + -1.0)))) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 5.8e-92], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 1.75], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(0.375 * N[(r * N[(N[(w * w), $MachinePrecision] * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 + N[(N[(N[(0.125 * N[(3.0 + N[(v * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 5.8 \cdot 10^{-92}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{elif}\;r \leq 1.75:\\
\;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 + 0.375 \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{v + -1}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;3 + \left(\left(0.125 \cdot \left(3 + v \cdot -2\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \frac{r \cdot w}{v + -1}\right) - 4.5\right)\\
\end{array}
\end{array}
if r < 5.79999999999999969e-92Initial program 77.3%
Simplified75.8%
Taylor expanded in r around 0 69.7%
associate-/r*69.8%
div-inv69.7%
Applied egg-rr69.7%
un-div-inv69.8%
Applied egg-rr69.8%
if 5.79999999999999969e-92 < r < 1.75Initial program 88.4%
Simplified87.6%
Taylor expanded in v around 0 70.6%
if 1.75 < r Initial program 87.6%
associate--l-87.6%
associate-*l*70.4%
sqr-neg70.4%
associate-*l*87.6%
associate-/l*90.3%
fma-define90.3%
Simplified90.3%
associate-/l*90.3%
*-commutative90.3%
associate-*r/90.3%
associate-*l*97.0%
associate-*r*99.7%
*-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in r around inf 99.0%
associate-*r/99.1%
associate-*r/99.0%
clear-num99.1%
add-sqr-sqrt79.4%
frac-times79.3%
associate-/r*79.3%
clear-num79.3%
Applied egg-rr79.3%
associate-/l/79.4%
associate-*l/79.4%
rem-square-sqrt99.1%
associate-/r/99.1%
*-commutative99.1%
*-commutative99.1%
Simplified99.1%
Final simplification77.4%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ r (+ v -1.0))))
(if (<= r 7.6e-92)
(- (+ 3.0 (/ (/ 2.0 r) r)) 4.5)
(if (<= r 1.75)
(+ (/ 2.0 (* r r)) (+ -1.5 (* 0.375 (* r (* (* w w) t_0)))))
(+
3.0
(- (* (* 0.125 (+ 3.0 (* v -2.0))) (* (* r w) (* w t_0))) 4.5))))))
double code(double v, double w, double r) {
double t_0 = r / (v + -1.0);
double tmp;
if (r <= 7.6e-92) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 1.75) {
tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * t_0))));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (w * t_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 = r / (v + (-1.0d0))
if (r <= 7.6d-92) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else if (r <= 1.75d0) then
tmp = (2.0d0 / (r * r)) + ((-1.5d0) + (0.375d0 * (r * ((w * w) * t_0))))
else
tmp = 3.0d0 + (((0.125d0 * (3.0d0 + (v * (-2.0d0)))) * ((r * w) * (w * t_0))) - 4.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = r / (v + -1.0);
double tmp;
if (r <= 7.6e-92) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 1.75) {
tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * t_0))));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (w * t_0))) - 4.5);
}
return tmp;
}
def code(v, w, r): t_0 = r / (v + -1.0) tmp = 0 if r <= 7.6e-92: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 elif r <= 1.75: tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * t_0)))) else: tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (w * t_0))) - 4.5) return tmp
function code(v, w, r) t_0 = Float64(r / Float64(v + -1.0)) tmp = 0.0 if (r <= 7.6e-92) tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); elseif (r <= 1.75) tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(0.375 * Float64(r * Float64(Float64(w * w) * t_0))))); else tmp = Float64(3.0 + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) * Float64(Float64(r * w) * Float64(w * t_0))) - 4.5)); end return tmp end
function tmp_2 = code(v, w, r) t_0 = r / (v + -1.0); tmp = 0.0; if (r <= 7.6e-92) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; elseif (r <= 1.75) tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * t_0)))); else tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (w * t_0))) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 7.6e-92], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 1.75], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(0.375 * N[(r * N[(N[(w * w), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 + N[(N[(N[(0.125 * N[(3.0 + N[(v * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(w * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{r}{v + -1}\\
\mathbf{if}\;r \leq 7.6 \cdot 10^{-92}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{elif}\;r \leq 1.75:\\
\;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 + 0.375 \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot t\_0\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;3 + \left(\left(0.125 \cdot \left(3 + v \cdot -2\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \left(w \cdot t\_0\right)\right) - 4.5\right)\\
\end{array}
\end{array}
if r < 7.6000000000000001e-92Initial program 77.3%
Simplified75.8%
Taylor expanded in r around 0 69.7%
associate-/r*69.8%
div-inv69.7%
Applied egg-rr69.7%
un-div-inv69.8%
Applied egg-rr69.8%
if 7.6000000000000001e-92 < r < 1.75Initial program 88.4%
Simplified87.6%
Taylor expanded in v around 0 70.6%
if 1.75 < r Initial program 87.6%
associate--l-87.6%
associate-*l*70.4%
sqr-neg70.4%
associate-*l*87.6%
associate-/l*90.3%
fma-define90.3%
Simplified90.3%
associate-/l*90.3%
*-commutative90.3%
associate-*r/90.3%
associate-*l*97.0%
associate-*r*99.7%
*-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in r around inf 99.0%
Final simplification77.4%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ r (+ v -1.0))))
(if (<= r 1.08e-89)
(- (+ 3.0 (/ (/ 2.0 r) r)) 4.5)
(if (<= r 2.0)
(+ (/ 2.0 (* r r)) (+ -1.5 (* 0.375 (* r (* (* w w) t_0)))))
(+
3.0
(- (* (* 0.125 (+ 3.0 (* v -2.0))) (* w (* r (* w t_0)))) 4.5))))))
double code(double v, double w, double r) {
double t_0 = r / (v + -1.0);
double tmp;
if (r <= 1.08e-89) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 2.0) {
tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * t_0))));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * (w * (r * (w * t_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 = r / (v + (-1.0d0))
if (r <= 1.08d-89) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else if (r <= 2.0d0) then
tmp = (2.0d0 / (r * r)) + ((-1.5d0) + (0.375d0 * (r * ((w * w) * t_0))))
else
tmp = 3.0d0 + (((0.125d0 * (3.0d0 + (v * (-2.0d0)))) * (w * (r * (w * t_0)))) - 4.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = r / (v + -1.0);
double tmp;
if (r <= 1.08e-89) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 2.0) {
tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * t_0))));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * (w * (r * (w * t_0)))) - 4.5);
}
return tmp;
}
def code(v, w, r): t_0 = r / (v + -1.0) tmp = 0 if r <= 1.08e-89: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 elif r <= 2.0: tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * t_0)))) else: tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * (w * (r * (w * t_0)))) - 4.5) return tmp
function code(v, w, r) t_0 = Float64(r / Float64(v + -1.0)) tmp = 0.0 if (r <= 1.08e-89) tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); elseif (r <= 2.0) tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(0.375 * Float64(r * Float64(Float64(w * w) * t_0))))); else tmp = Float64(3.0 + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) * Float64(w * Float64(r * Float64(w * t_0)))) - 4.5)); end return tmp end
function tmp_2 = code(v, w, r) t_0 = r / (v + -1.0); tmp = 0.0; if (r <= 1.08e-89) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; elseif (r <= 2.0) tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * t_0)))); else tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * (w * (r * (w * t_0)))) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 1.08e-89], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 2.0], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(0.375 * N[(r * N[(N[(w * w), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 + N[(N[(N[(0.125 * N[(3.0 + N[(v * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r * N[(w * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{r}{v + -1}\\
\mathbf{if}\;r \leq 1.08 \cdot 10^{-89}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{elif}\;r \leq 2:\\
\;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 + 0.375 \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot t\_0\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;3 + \left(\left(0.125 \cdot \left(3 + v \cdot -2\right)\right) \cdot \left(w \cdot \left(r \cdot \left(w \cdot t\_0\right)\right)\right) - 4.5\right)\\
\end{array}
\end{array}
if r < 1.07999999999999999e-89Initial program 77.3%
Simplified75.8%
Taylor expanded in r around 0 69.7%
associate-/r*69.8%
div-inv69.7%
Applied egg-rr69.7%
un-div-inv69.8%
Applied egg-rr69.8%
if 1.07999999999999999e-89 < r < 2Initial program 88.4%
Simplified87.6%
Taylor expanded in v around 0 70.6%
if 2 < r Initial program 87.6%
associate--l-87.6%
associate-*l*70.4%
sqr-neg70.4%
associate-*l*87.6%
associate-/l*90.3%
fma-define90.3%
Simplified90.3%
associate-/l*90.3%
*-commutative90.3%
associate-*r/90.3%
*-commutative90.3%
associate-*l*97.0%
associate-*l*95.5%
Applied egg-rr95.5%
Taylor expanded in r around inf 94.8%
Final simplification76.3%
(FPCore (v w r)
:precision binary64
(if (<= r 1.6e-90)
(- (+ 3.0 (/ (/ 2.0 r) r)) 4.5)
(if (<= r 1.08e+254)
(+ (/ 2.0 (* r r)) (+ -1.5 (* 0.375 (* r (* (* w w) (/ r (+ v -1.0)))))))
(- 3.0 (+ 4.5 (* (* 0.125 (+ 3.0 (* v -2.0))) (* (* r w) (* r w))))))))
double code(double v, double w, double r) {
double tmp;
if (r <= 1.6e-90) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 1.08e+254) {
tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0))))));
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (r * w))));
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: tmp
if (r <= 1.6d-90) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else if (r <= 1.08d+254) then
tmp = (2.0d0 / (r * r)) + ((-1.5d0) + (0.375d0 * (r * ((w * w) * (r / (v + (-1.0d0)))))))
else
tmp = 3.0d0 - (4.5d0 + ((0.125d0 * (3.0d0 + (v * (-2.0d0)))) * ((r * w) * (r * w))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 1.6e-90) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 1.08e+254) {
tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0))))));
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (r * w))));
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 1.6e-90: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 elif r <= 1.08e+254: tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0)))))) else: tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (r * w)))) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 1.6e-90) tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); elseif (r <= 1.08e+254) tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(0.375 * Float64(r * Float64(Float64(w * w) * Float64(r / Float64(v + -1.0))))))); else tmp = Float64(3.0 - Float64(4.5 + Float64(Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) * Float64(Float64(r * w) * Float64(r * w))))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 1.6e-90) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; elseif (r <= 1.08e+254) tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0)))))); else tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (r * w)))); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 1.6e-90], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 1.08e+254], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(0.375 * N[(r * N[(N[(w * w), $MachinePrecision] * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 - N[(4.5 + N[(N[(0.125 * N[(3.0 + N[(v * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.6 \cdot 10^{-90}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{elif}\;r \leq 1.08 \cdot 10^{+254}:\\
\;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 + 0.375 \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{v + -1}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;3 - \left(4.5 + \left(0.125 \cdot \left(3 + v \cdot -2\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\
\end{array}
\end{array}
if r < 1.60000000000000004e-90Initial program 77.3%
Simplified75.8%
Taylor expanded in r around 0 69.7%
associate-/r*69.8%
div-inv69.7%
Applied egg-rr69.7%
un-div-inv69.8%
Applied egg-rr69.8%
if 1.60000000000000004e-90 < r < 1.08000000000000001e254Initial program 91.1%
Simplified93.4%
Taylor expanded in v around 0 74.6%
if 1.08000000000000001e254 < r Initial program 65.9%
associate--l-65.9%
associate-*l*45.5%
sqr-neg45.5%
associate-*l*65.9%
associate-/l*65.9%
fma-define65.9%
Simplified65.9%
associate-/l*65.9%
*-commutative65.9%
associate-*r/65.9%
associate-*l*99.7%
associate-*r*99.6%
*-commutative99.6%
Applied egg-rr99.6%
Taylor expanded in r around inf 99.6%
Taylor expanded in v around 0 82.0%
Final simplification71.7%
(FPCore (v w r) :precision binary64 (if (<= r 1.28e-26) (- (+ 3.0 (/ (/ 2.0 r) r)) 4.5) (- 3.0 (+ 4.5 (* (* 0.125 (+ 3.0 (* v -2.0))) (* (* r w) (* r w)))))))
double code(double v, double w, double r) {
double tmp;
if (r <= 1.28e-26) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (r * w))));
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: tmp
if (r <= 1.28d-26) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else
tmp = 3.0d0 - (4.5d0 + ((0.125d0 * (3.0d0 + (v * (-2.0d0)))) * ((r * w) * (r * w))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 1.28e-26) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (r * w))));
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 1.28e-26: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 else: tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (r * w)))) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 1.28e-26) tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); else tmp = Float64(3.0 - Float64(4.5 + Float64(Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) * Float64(Float64(r * w) * Float64(r * w))))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 1.28e-26) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; else tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (r * w)))); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 1.28e-26], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(3.0 - N[(4.5 + N[(N[(0.125 * N[(3.0 + N[(v * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.28 \cdot 10^{-26}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;3 - \left(4.5 + \left(0.125 \cdot \left(3 + v \cdot -2\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\
\end{array}
\end{array}
if r < 1.27999999999999996e-26Initial program 77.5%
Simplified77.1%
Taylor expanded in r around 0 68.7%
associate-/r*68.7%
div-inv68.6%
Applied egg-rr68.6%
un-div-inv68.7%
Applied egg-rr68.7%
if 1.27999999999999996e-26 < r Initial program 88.7%
associate--l-88.7%
associate-*l*73.2%
sqr-neg73.2%
associate-*l*88.7%
associate-/l*91.2%
fma-define91.2%
Simplified91.2%
associate-/l*91.2%
*-commutative91.2%
associate-*r/91.1%
associate-*l*97.2%
associate-*r*99.7%
*-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in r around inf 96.4%
Taylor expanded in v around 0 69.8%
Final simplification69.0%
(FPCore (v w r) :precision binary64 (if (<= r 1.12e-26) (- (+ 3.0 (/ (/ 2.0 r) r)) 4.5) (- 3.0 (+ 4.5 (* (* 0.125 (+ 3.0 (* v -2.0))) (* w (* r (* r w))))))))
double code(double v, double w, double r) {
double tmp;
if (r <= 1.12e-26) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (v * -2.0))) * (w * (r * (r * w)))));
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: tmp
if (r <= 1.12d-26) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else
tmp = 3.0d0 - (4.5d0 + ((0.125d0 * (3.0d0 + (v * (-2.0d0)))) * (w * (r * (r * w)))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 1.12e-26) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (v * -2.0))) * (w * (r * (r * w)))));
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 1.12e-26: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 else: tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (v * -2.0))) * (w * (r * (r * w))))) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 1.12e-26) tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); else tmp = Float64(3.0 - Float64(4.5 + Float64(Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) * Float64(w * Float64(r * Float64(r * w)))))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 1.12e-26) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; else tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (v * -2.0))) * (w * (r * (r * w))))); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 1.12e-26], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(3.0 - N[(4.5 + N[(N[(0.125 * N[(3.0 + N[(v * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.12 \cdot 10^{-26}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;3 - \left(4.5 + \left(0.125 \cdot \left(3 + v \cdot -2\right)\right) \cdot \left(w \cdot \left(r \cdot \left(r \cdot w\right)\right)\right)\right)\\
\end{array}
\end{array}
if r < 1.12e-26Initial program 77.5%
Simplified77.1%
Taylor expanded in r around 0 68.7%
associate-/r*68.7%
div-inv68.6%
Applied egg-rr68.6%
un-div-inv68.7%
Applied egg-rr68.7%
if 1.12e-26 < r Initial program 88.7%
associate--l-88.7%
associate-*l*73.2%
sqr-neg73.2%
associate-*l*88.7%
associate-/l*91.2%
fma-define91.2%
Simplified91.2%
associate-/l*91.2%
*-commutative91.2%
associate-*r/91.1%
*-commutative91.1%
associate-*l*97.2%
associate-*l*95.8%
Applied egg-rr95.8%
Taylor expanded in r around inf 92.6%
Taylor expanded in v around 0 66.0%
Final simplification67.9%
(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 80.7%
Simplified76.3%
Taylor expanded in r around 0 58.8%
associate-/r*58.9%
div-inv58.8%
Applied egg-rr58.8%
un-div-inv58.9%
Applied egg-rr58.9%
(FPCore (v w r) :precision binary64 (- (+ (/ 2.0 (* r r)) 3.0) 4.5))
double code(double v, double w, double r) {
return ((2.0 / (r * r)) + 3.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 = ((2.0d0 / (r * r)) + 3.0d0) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((2.0 / (r * r)) + 3.0) - 4.5;
}
def code(v, w, r): return ((2.0 / (r * r)) + 3.0) - 4.5
function code(v, w, r) return Float64(Float64(Float64(2.0 / Float64(r * r)) + 3.0) - 4.5) end
function tmp = code(v, w, r) tmp = ((2.0 / (r * r)) + 3.0) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{2}{r \cdot r} + 3\right) - 4.5
\end{array}
Initial program 80.7%
Simplified76.3%
Taylor expanded in r around 0 58.8%
Final simplification58.8%
(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 80.7%
Simplified76.3%
Taylor expanded in r around 0 58.8%
Taylor expanded in r around inf 16.3%
herbie shell --seed 2024112
(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))