
(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 11 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
(let* ((t_0 (/ 2.0 (* r r))) (t_1 (+ 3.0 t_0)))
(if (<= v -4e+28)
(+ t_1 (- (* (* v -0.25) (* (* r w) (* w (/ r v)))) 4.5))
(if (<= v 3e+108)
(-
(+ t_1 (* (* w (* r (+ (* v -0.25) 0.375))) (* w (/ r (+ v -1.0)))))
4.5)
(+ t_0 (- -1.5 (* (* r w) (* (* r w) (* -0.25 (/ v (- 1.0 v)))))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = 3.0 + t_0;
double tmp;
if (v <= -4e+28) {
tmp = t_1 + (((v * -0.25) * ((r * w) * (w * (r / v)))) - 4.5);
} else if (v <= 3e+108) {
tmp = (t_1 + ((w * (r * ((v * -0.25) + 0.375))) * (w * (r / (v + -1.0))))) - 4.5;
} else {
tmp = t_0 + (-1.5 - ((r * w) * ((r * w) * (-0.25 * (v / (1.0 - v))))));
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
t_1 = 3.0d0 + t_0
if (v <= (-4d+28)) then
tmp = t_1 + (((v * (-0.25d0)) * ((r * w) * (w * (r / v)))) - 4.5d0)
else if (v <= 3d+108) then
tmp = (t_1 + ((w * (r * ((v * (-0.25d0)) + 0.375d0))) * (w * (r / (v + (-1.0d0)))))) - 4.5d0
else
tmp = t_0 + ((-1.5d0) - ((r * w) * ((r * w) * ((-0.25d0) * (v / (1.0d0 - v))))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = 3.0 + t_0;
double tmp;
if (v <= -4e+28) {
tmp = t_1 + (((v * -0.25) * ((r * w) * (w * (r / v)))) - 4.5);
} else if (v <= 3e+108) {
tmp = (t_1 + ((w * (r * ((v * -0.25) + 0.375))) * (w * (r / (v + -1.0))))) - 4.5;
} else {
tmp = t_0 + (-1.5 - ((r * w) * ((r * w) * (-0.25 * (v / (1.0 - v))))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = 3.0 + t_0 tmp = 0 if v <= -4e+28: tmp = t_1 + (((v * -0.25) * ((r * w) * (w * (r / v)))) - 4.5) elif v <= 3e+108: tmp = (t_1 + ((w * (r * ((v * -0.25) + 0.375))) * (w * (r / (v + -1.0))))) - 4.5 else: tmp = t_0 + (-1.5 - ((r * w) * ((r * w) * (-0.25 * (v / (1.0 - v)))))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) t_1 = Float64(3.0 + t_0) tmp = 0.0 if (v <= -4e+28) tmp = Float64(t_1 + Float64(Float64(Float64(v * -0.25) * Float64(Float64(r * w) * Float64(w * Float64(r / v)))) - 4.5)); elseif (v <= 3e+108) tmp = Float64(Float64(t_1 + Float64(Float64(w * Float64(r * Float64(Float64(v * -0.25) + 0.375))) * Float64(w * Float64(r / Float64(v + -1.0))))) - 4.5); else tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(r * w) * Float64(Float64(r * w) * Float64(-0.25 * Float64(v / Float64(1.0 - v))))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); t_1 = 3.0 + t_0; tmp = 0.0; if (v <= -4e+28) tmp = t_1 + (((v * -0.25) * ((r * w) * (w * (r / v)))) - 4.5); elseif (v <= 3e+108) tmp = (t_1 + ((w * (r * ((v * -0.25) + 0.375))) * (w * (r / (v + -1.0))))) - 4.5; else tmp = t_0 + (-1.5 - ((r * w) * ((r * w) * (-0.25 * (v / (1.0 - v)))))); 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[(3.0 + t$95$0), $MachinePrecision]}, If[LessEqual[v, -4e+28], N[(t$95$1 + N[(N[(N[(v * -0.25), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(w * N[(r / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[v, 3e+108], N[(N[(t$95$1 + N[(N[(w * N[(r * N[(N[(v * -0.25), $MachinePrecision] + 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(t$95$0 + N[(-1.5 - N[(N[(r * w), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(-0.25 * N[(v / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := 3 + t\_0\\
\mathbf{if}\;v \leq -4 \cdot 10^{+28}:\\
\;\;\;\;t\_1 + \left(\left(v \cdot -0.25\right) \cdot \left(\left(r \cdot w\right) \cdot \left(w \cdot \frac{r}{v}\right)\right) - 4.5\right)\\
\mathbf{elif}\;v \leq 3 \cdot 10^{+108}:\\
\;\;\;\;\left(t\_1 + \left(w \cdot \left(r \cdot \left(v \cdot -0.25 + 0.375\right)\right)\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \left(-1.5 - \left(r \cdot w\right) \cdot \left(\left(r \cdot w\right) \cdot \left(-0.25 \cdot \frac{v}{1 - v}\right)\right)\right)\\
\end{array}
\end{array}
if v < -3.99999999999999983e28Initial program 79.2%
Simplified84.1%
associate-/l*84.1%
*-commutative84.1%
associate-*r/84.1%
associate-*l*98.1%
associate-*r*99.7%
Applied egg-rr99.7%
Taylor expanded in v around inf 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in v around inf 99.7%
associate-*r/99.7%
neg-mul-199.7%
Simplified99.7%
if -3.99999999999999983e28 < v < 2.99999999999999984e108Initial program 85.2%
associate-/l*85.8%
cancel-sign-sub-inv85.8%
metadata-eval85.8%
+-commutative85.8%
*-commutative85.8%
fma-undefine85.8%
*-commutative85.8%
*-commutative85.8%
associate-/l*85.8%
*-commutative85.8%
associate-*r/85.8%
associate-*r*85.8%
associate-*l*98.0%
associate-*r*99.8%
Applied egg-rr99.8%
if 2.99999999999999984e108 < v Initial program 81.2%
Simplified86.6%
Taylor expanded in v around inf 89.0%
*-commutative89.0%
Simplified89.0%
Taylor expanded in r around 0 76.6%
associate-*r/76.6%
*-commutative76.6%
associate-*r*78.9%
associate-*l*78.9%
*-commutative78.9%
associate-*l*78.9%
unpow278.9%
unpow278.9%
swap-sqr86.0%
unpow286.0%
*-commutative86.0%
Simplified86.0%
associate-/l*99.9%
unpow299.9%
associate-*l*99.9%
*-commutative99.9%
*-un-lft-identity99.9%
times-frac99.9%
metadata-eval99.9%
Applied egg-rr99.9%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (- (+ 3.0 (* 2.0 (pow r -2.0))) (+ (* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (* w (/ r (- 1.0 v))))) 4.5)))
double code(double v, double w, double r) {
return (3.0 + (2.0 * pow(r, -2.0))) - (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (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 ** (-2.0d0)))) - (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * (w * (r / (1.0d0 - v))))) + 4.5d0)
end function
public static double code(double v, double w, double r) {
return (3.0 + (2.0 * Math.pow(r, -2.0))) - (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - v))))) + 4.5);
}
def code(v, w, r): return (3.0 + (2.0 * math.pow(r, -2.0))) - (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - v))))) + 4.5)
function code(v, w, r) return Float64(Float64(3.0 + Float64(2.0 * (r ^ -2.0))) - Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) * Float64(w * Float64(r / Float64(1.0 - v))))) + 4.5)) end
function tmp = code(v, w, r) tmp = (3.0 + (2.0 * (r ^ -2.0))) - (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (1.0 - v))))) + 4.5); end
code[v_, w_, r_] := N[(N[(3.0 + N[(2.0 * N[Power[r, -2.0], $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[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 4.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + 2 \cdot {r}^{-2}\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}{1 - v}\right)\right) + 4.5\right)
\end{array}
Initial program 83.3%
Simplified85.8%
associate-/l*85.6%
*-commutative85.6%
associate-*r/85.5%
associate-*l*97.7%
associate-*r*99.4%
Applied egg-rr99.4%
*-un-lft-identity99.4%
div-inv99.4%
pow299.4%
pow-flip99.5%
metadata-eval99.5%
Applied egg-rr99.5%
*-lft-identity99.5%
Simplified99.5%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (or (<= v -6800000.0) (not (<= v 2.3e-9)))
(+ t_0 (+ -1.5 (* (* r w) (* (* r w) (* -0.25 (/ v (+ v -1.0)))))))
(- (+ (+ 3.0 t_0) (* (* w (* r 0.375)) (* w (/ r (+ v -1.0))))) 4.5))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((v <= -6800000.0) || !(v <= 2.3e-9)) {
tmp = t_0 + (-1.5 + ((r * w) * ((r * w) * (-0.25 * (v / (v + -1.0))))));
} else {
tmp = ((3.0 + t_0) + ((w * (r * 0.375)) * (w * (r / (v + -1.0))))) - 4.5;
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if ((v <= (-6800000.0d0)) .or. (.not. (v <= 2.3d-9))) then
tmp = t_0 + ((-1.5d0) + ((r * w) * ((r * w) * ((-0.25d0) * (v / (v + (-1.0d0)))))))
else
tmp = ((3.0d0 + t_0) + ((w * (r * 0.375d0)) * (w * (r / (v + (-1.0d0)))))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((v <= -6800000.0) || !(v <= 2.3e-9)) {
tmp = t_0 + (-1.5 + ((r * w) * ((r * w) * (-0.25 * (v / (v + -1.0))))));
} else {
tmp = ((3.0 + t_0) + ((w * (r * 0.375)) * (w * (r / (v + -1.0))))) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if (v <= -6800000.0) or not (v <= 2.3e-9): tmp = t_0 + (-1.5 + ((r * w) * ((r * w) * (-0.25 * (v / (v + -1.0)))))) else: tmp = ((3.0 + t_0) + ((w * (r * 0.375)) * (w * (r / (v + -1.0))))) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((v <= -6800000.0) || !(v <= 2.3e-9)) tmp = Float64(t_0 + Float64(-1.5 + Float64(Float64(r * w) * Float64(Float64(r * w) * Float64(-0.25 * Float64(v / Float64(v + -1.0))))))); else tmp = Float64(Float64(Float64(3.0 + t_0) + Float64(Float64(w * Float64(r * 0.375)) * Float64(w * Float64(r / Float64(v + -1.0))))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if ((v <= -6800000.0) || ~((v <= 2.3e-9))) tmp = t_0 + (-1.5 + ((r * w) * ((r * w) * (-0.25 * (v / (v + -1.0)))))); else tmp = ((3.0 + t_0) + ((w * (r * 0.375)) * (w * (r / (v + -1.0))))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -6800000.0], N[Not[LessEqual[v, 2.3e-9]], $MachinePrecision]], N[(t$95$0 + N[(-1.5 + N[(N[(r * w), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(-0.25 * N[(v / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(3.0 + t$95$0), $MachinePrecision] + N[(N[(w * N[(r * 0.375), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -6800000 \lor \neg \left(v \leq 2.3 \cdot 10^{-9}\right):\\
\;\;\;\;t\_0 + \left(-1.5 + \left(r \cdot w\right) \cdot \left(\left(r \cdot w\right) \cdot \left(-0.25 \cdot \frac{v}{v + -1}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(3 + t\_0\right) + \left(w \cdot \left(r \cdot 0.375\right)\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\right) - 4.5\\
\end{array}
\end{array}
if v < -6.8e6 or 2.2999999999999999e-9 < v Initial program 81.2%
Simplified85.9%
Taylor expanded in v around inf 85.9%
*-commutative85.9%
Simplified85.9%
Taylor expanded in r around 0 75.6%
associate-*r/75.6%
*-commutative75.6%
associate-*r*77.2%
associate-*l*77.2%
*-commutative77.2%
associate-*l*77.2%
unpow277.2%
unpow277.2%
swap-sqr89.0%
unpow289.0%
*-commutative89.0%
Simplified89.0%
associate-/l*98.9%
unpow298.9%
associate-*l*98.9%
*-commutative98.9%
*-un-lft-identity98.9%
times-frac98.9%
metadata-eval98.9%
Applied egg-rr98.9%
if -6.8e6 < v < 2.2999999999999999e-9Initial program 85.2%
associate-/l*85.2%
cancel-sign-sub-inv85.2%
metadata-eval85.2%
+-commutative85.2%
*-commutative85.2%
fma-undefine85.2%
*-commutative85.2%
*-commutative85.2%
associate-/l*85.2%
*-commutative85.2%
associate-*r/85.2%
associate-*r*85.2%
associate-*l*97.7%
associate-*r*99.9%
Applied egg-rr99.9%
Taylor expanded in v around 0 99.7%
associate-*r*99.7%
*-commutative99.7%
Simplified99.7%
Final simplification99.3%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (or (<= v -6800000.0) (not (<= v 2.3e-9)))
(+ t_0 (+ -1.5 (* (* r w) (* (* r w) (* -0.25 (/ v (+ v -1.0)))))))
(+ t_0 (+ -1.5 (* 0.375 (* (* r w) (/ (* r w) (+ v -1.0)))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((v <= -6800000.0) || !(v <= 2.3e-9)) {
tmp = t_0 + (-1.5 + ((r * w) * ((r * w) * (-0.25 * (v / (v + -1.0))))));
} else {
tmp = t_0 + (-1.5 + (0.375 * ((r * w) * ((r * w) / (v + -1.0)))));
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if ((v <= (-6800000.0d0)) .or. (.not. (v <= 2.3d-9))) then
tmp = t_0 + ((-1.5d0) + ((r * w) * ((r * w) * ((-0.25d0) * (v / (v + (-1.0d0)))))))
else
tmp = t_0 + ((-1.5d0) + (0.375d0 * ((r * w) * ((r * w) / (v + (-1.0d0))))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((v <= -6800000.0) || !(v <= 2.3e-9)) {
tmp = t_0 + (-1.5 + ((r * w) * ((r * w) * (-0.25 * (v / (v + -1.0))))));
} else {
tmp = t_0 + (-1.5 + (0.375 * ((r * w) * ((r * w) / (v + -1.0)))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if (v <= -6800000.0) or not (v <= 2.3e-9): tmp = t_0 + (-1.5 + ((r * w) * ((r * w) * (-0.25 * (v / (v + -1.0)))))) else: tmp = t_0 + (-1.5 + (0.375 * ((r * w) * ((r * w) / (v + -1.0))))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((v <= -6800000.0) || !(v <= 2.3e-9)) tmp = Float64(t_0 + Float64(-1.5 + Float64(Float64(r * w) * Float64(Float64(r * w) * Float64(-0.25 * Float64(v / Float64(v + -1.0))))))); else tmp = Float64(t_0 + Float64(-1.5 + Float64(0.375 * Float64(Float64(r * w) * Float64(Float64(r * w) / Float64(v + -1.0)))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if ((v <= -6800000.0) || ~((v <= 2.3e-9))) tmp = t_0 + (-1.5 + ((r * w) * ((r * w) * (-0.25 * (v / (v + -1.0)))))); else tmp = t_0 + (-1.5 + (0.375 * ((r * w) * ((r * w) / (v + -1.0))))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -6800000.0], N[Not[LessEqual[v, 2.3e-9]], $MachinePrecision]], N[(t$95$0 + N[(-1.5 + N[(N[(r * w), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(-0.25 * N[(v / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.5 + N[(0.375 * N[(N[(r * w), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -6800000 \lor \neg \left(v \leq 2.3 \cdot 10^{-9}\right):\\
\;\;\;\;t\_0 + \left(-1.5 + \left(r \cdot w\right) \cdot \left(\left(r \cdot w\right) \cdot \left(-0.25 \cdot \frac{v}{v + -1}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \left(-1.5 + 0.375 \cdot \left(\left(r \cdot w\right) \cdot \frac{r \cdot w}{v + -1}\right)\right)\\
\end{array}
\end{array}
if v < -6.8e6 or 2.2999999999999999e-9 < v Initial program 81.2%
Simplified85.9%
Taylor expanded in v around inf 85.9%
*-commutative85.9%
Simplified85.9%
Taylor expanded in r around 0 75.6%
associate-*r/75.6%
*-commutative75.6%
associate-*r*77.2%
associate-*l*77.2%
*-commutative77.2%
associate-*l*77.2%
unpow277.2%
unpow277.2%
swap-sqr89.0%
unpow289.0%
*-commutative89.0%
Simplified89.0%
associate-/l*98.9%
unpow298.9%
associate-*l*98.9%
*-commutative98.9%
*-un-lft-identity98.9%
times-frac98.9%
metadata-eval98.9%
Applied egg-rr98.9%
if -6.8e6 < v < 2.2999999999999999e-9Initial program 85.2%
Simplified85.2%
Taylor expanded in v around 0 85.2%
add-sqr-sqrt85.2%
*-un-lft-identity85.2%
times-frac85.2%
associate-*r*76.0%
sqrt-prod75.9%
sqrt-prod39.0%
add-sqr-sqrt66.3%
sqrt-prod35.7%
add-sqr-sqrt66.4%
associate-*r*55.3%
sqrt-prod55.3%
sqrt-prod31.7%
add-sqr-sqrt70.3%
sqrt-prod55.5%
add-sqr-sqrt99.7%
Applied egg-rr99.7%
Final simplification99.3%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (or (<= v -1.24e+67) (not (<= v 2.3e-9)))
(+ t_0 (+ -1.5 (* (* v -0.25) (/ (* r (* r (* w w))) (+ v -1.0)))))
(+ t_0 (+ -1.5 (* 0.375 (* (* r w) (/ (* r w) (+ v -1.0)))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((v <= -1.24e+67) || !(v <= 2.3e-9)) {
tmp = t_0 + (-1.5 + ((v * -0.25) * ((r * (r * (w * w))) / (v + -1.0))));
} else {
tmp = t_0 + (-1.5 + (0.375 * ((r * w) * ((r * w) / (v + -1.0)))));
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if ((v <= (-1.24d+67)) .or. (.not. (v <= 2.3d-9))) then
tmp = t_0 + ((-1.5d0) + ((v * (-0.25d0)) * ((r * (r * (w * w))) / (v + (-1.0d0)))))
else
tmp = t_0 + ((-1.5d0) + (0.375d0 * ((r * w) * ((r * w) / (v + (-1.0d0))))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((v <= -1.24e+67) || !(v <= 2.3e-9)) {
tmp = t_0 + (-1.5 + ((v * -0.25) * ((r * (r * (w * w))) / (v + -1.0))));
} else {
tmp = t_0 + (-1.5 + (0.375 * ((r * w) * ((r * w) / (v + -1.0)))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if (v <= -1.24e+67) or not (v <= 2.3e-9): tmp = t_0 + (-1.5 + ((v * -0.25) * ((r * (r * (w * w))) / (v + -1.0)))) else: tmp = t_0 + (-1.5 + (0.375 * ((r * w) * ((r * w) / (v + -1.0))))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((v <= -1.24e+67) || !(v <= 2.3e-9)) tmp = Float64(t_0 + Float64(-1.5 + Float64(Float64(v * -0.25) * Float64(Float64(r * Float64(r * Float64(w * w))) / Float64(v + -1.0))))); else tmp = Float64(t_0 + Float64(-1.5 + Float64(0.375 * Float64(Float64(r * w) * Float64(Float64(r * w) / Float64(v + -1.0)))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if ((v <= -1.24e+67) || ~((v <= 2.3e-9))) tmp = t_0 + (-1.5 + ((v * -0.25) * ((r * (r * (w * w))) / (v + -1.0)))); else tmp = t_0 + (-1.5 + (0.375 * ((r * w) * ((r * w) / (v + -1.0))))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -1.24e+67], N[Not[LessEqual[v, 2.3e-9]], $MachinePrecision]], N[(t$95$0 + N[(-1.5 + N[(N[(v * -0.25), $MachinePrecision] * N[(N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.5 + N[(0.375 * N[(N[(r * w), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -1.24 \cdot 10^{+67} \lor \neg \left(v \leq 2.3 \cdot 10^{-9}\right):\\
\;\;\;\;t\_0 + \left(-1.5 + \left(v \cdot -0.25\right) \cdot \frac{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}{v + -1}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \left(-1.5 + 0.375 \cdot \left(\left(r \cdot w\right) \cdot \frac{r \cdot w}{v + -1}\right)\right)\\
\end{array}
\end{array}
if v < -1.24000000000000007e67 or 2.2999999999999999e-9 < v Initial program 81.7%
Simplified87.5%
Taylor expanded in v around inf 87.8%
*-commutative87.2%
Simplified87.8%
if -1.24000000000000007e67 < v < 2.2999999999999999e-9Initial program 84.5%
Simplified84.5%
Taylor expanded in v around 0 83.2%
add-sqr-sqrt83.2%
*-un-lft-identity83.2%
times-frac83.2%
associate-*r*74.8%
sqrt-prod74.8%
sqrt-prod37.7%
add-sqr-sqrt64.6%
sqrt-prod36.1%
add-sqr-sqrt66.2%
associate-*r*56.0%
sqrt-prod56.0%
sqrt-prod31.0%
add-sqr-sqrt68.2%
sqrt-prod54.8%
add-sqr-sqrt97.8%
Applied egg-rr97.8%
Final simplification93.4%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))) (t_1 (+ 3.0 t_0)))
(if (<= v -6800000.0)
(+ t_1 (- (* (* v -0.25) (* (* r w) (* w (/ r v)))) 4.5))
(if (<= v 2.3e-9)
(- (+ t_1 (* (* w (* r 0.375)) (* w (/ r (+ v -1.0))))) 4.5)
(+ t_0 (+ -1.5 (* (* r w) (* (* r w) (* -0.25 (/ v (+ v -1.0)))))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = 3.0 + t_0;
double tmp;
if (v <= -6800000.0) {
tmp = t_1 + (((v * -0.25) * ((r * w) * (w * (r / v)))) - 4.5);
} else if (v <= 2.3e-9) {
tmp = (t_1 + ((w * (r * 0.375)) * (w * (r / (v + -1.0))))) - 4.5;
} else {
tmp = t_0 + (-1.5 + ((r * w) * ((r * w) * (-0.25 * (v / (v + -1.0))))));
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
t_1 = 3.0d0 + t_0
if (v <= (-6800000.0d0)) then
tmp = t_1 + (((v * (-0.25d0)) * ((r * w) * (w * (r / v)))) - 4.5d0)
else if (v <= 2.3d-9) then
tmp = (t_1 + ((w * (r * 0.375d0)) * (w * (r / (v + (-1.0d0)))))) - 4.5d0
else
tmp = t_0 + ((-1.5d0) + ((r * w) * ((r * w) * ((-0.25d0) * (v / (v + (-1.0d0)))))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = 3.0 + t_0;
double tmp;
if (v <= -6800000.0) {
tmp = t_1 + (((v * -0.25) * ((r * w) * (w * (r / v)))) - 4.5);
} else if (v <= 2.3e-9) {
tmp = (t_1 + ((w * (r * 0.375)) * (w * (r / (v + -1.0))))) - 4.5;
} else {
tmp = t_0 + (-1.5 + ((r * w) * ((r * w) * (-0.25 * (v / (v + -1.0))))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = 3.0 + t_0 tmp = 0 if v <= -6800000.0: tmp = t_1 + (((v * -0.25) * ((r * w) * (w * (r / v)))) - 4.5) elif v <= 2.3e-9: tmp = (t_1 + ((w * (r * 0.375)) * (w * (r / (v + -1.0))))) - 4.5 else: tmp = t_0 + (-1.5 + ((r * w) * ((r * w) * (-0.25 * (v / (v + -1.0)))))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) t_1 = Float64(3.0 + t_0) tmp = 0.0 if (v <= -6800000.0) tmp = Float64(t_1 + Float64(Float64(Float64(v * -0.25) * Float64(Float64(r * w) * Float64(w * Float64(r / v)))) - 4.5)); elseif (v <= 2.3e-9) tmp = Float64(Float64(t_1 + Float64(Float64(w * Float64(r * 0.375)) * Float64(w * Float64(r / Float64(v + -1.0))))) - 4.5); else tmp = Float64(t_0 + Float64(-1.5 + Float64(Float64(r * w) * Float64(Float64(r * w) * Float64(-0.25 * Float64(v / Float64(v + -1.0))))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); t_1 = 3.0 + t_0; tmp = 0.0; if (v <= -6800000.0) tmp = t_1 + (((v * -0.25) * ((r * w) * (w * (r / v)))) - 4.5); elseif (v <= 2.3e-9) tmp = (t_1 + ((w * (r * 0.375)) * (w * (r / (v + -1.0))))) - 4.5; else tmp = t_0 + (-1.5 + ((r * w) * ((r * w) * (-0.25 * (v / (v + -1.0)))))); 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[(3.0 + t$95$0), $MachinePrecision]}, If[LessEqual[v, -6800000.0], N[(t$95$1 + N[(N[(N[(v * -0.25), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(w * N[(r / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[v, 2.3e-9], N[(N[(t$95$1 + N[(N[(w * N[(r * 0.375), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(t$95$0 + N[(-1.5 + N[(N[(r * w), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(-0.25 * N[(v / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := 3 + t\_0\\
\mathbf{if}\;v \leq -6800000:\\
\;\;\;\;t\_1 + \left(\left(v \cdot -0.25\right) \cdot \left(\left(r \cdot w\right) \cdot \left(w \cdot \frac{r}{v}\right)\right) - 4.5\right)\\
\mathbf{elif}\;v \leq 2.3 \cdot 10^{-9}:\\
\;\;\;\;\left(t\_1 + \left(w \cdot \left(r \cdot 0.375\right)\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \left(-1.5 + \left(r \cdot w\right) \cdot \left(\left(r \cdot w\right) \cdot \left(-0.25 \cdot \frac{v}{v + -1}\right)\right)\right)\\
\end{array}
\end{array}
if v < -6.8e6Initial program 80.5%
Simplified85.1%
associate-/l*85.1%
*-commutative85.1%
associate-*r/85.1%
associate-*l*98.1%
associate-*r*99.7%
Applied egg-rr99.7%
Taylor expanded in v around inf 99.1%
*-commutative99.1%
Simplified99.1%
Taylor expanded in v around inf 99.2%
associate-*r/99.2%
neg-mul-199.2%
Simplified99.2%
if -6.8e6 < v < 2.2999999999999999e-9Initial program 85.2%
associate-/l*85.2%
cancel-sign-sub-inv85.2%
metadata-eval85.2%
+-commutative85.2%
*-commutative85.2%
fma-undefine85.2%
*-commutative85.2%
*-commutative85.2%
associate-/l*85.2%
*-commutative85.2%
associate-*r/85.2%
associate-*r*85.2%
associate-*l*97.7%
associate-*r*99.9%
Applied egg-rr99.9%
Taylor expanded in v around 0 99.7%
associate-*r*99.7%
*-commutative99.7%
Simplified99.7%
if 2.2999999999999999e-9 < v Initial program 81.9%
Simplified86.6%
Taylor expanded in v around inf 87.2%
*-commutative87.2%
Simplified87.2%
Taylor expanded in r around 0 76.5%
associate-*r/76.5%
*-commutative76.5%
associate-*r*78.0%
associate-*l*78.0%
*-commutative78.0%
associate-*l*78.0%
unpow278.0%
unpow278.0%
swap-sqr88.5%
unpow288.5%
*-commutative88.5%
Simplified88.5%
associate-/l*98.8%
unpow298.8%
associate-*l*98.8%
*-commutative98.8%
*-un-lft-identity98.8%
times-frac98.8%
metadata-eval98.8%
Applied egg-rr98.8%
Final simplification99.3%
(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 83.3%
Simplified85.8%
associate-/l*85.6%
*-commutative85.6%
associate-*r/85.5%
associate-*l*97.7%
associate-*r*99.4%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (v w r) :precision binary64 (if (<= r 2.35e-63) (+ (/ 2.0 (* r r)) (+ -1.5 (* 0.375 (* (* r w) (/ (* r w) (+ v -1.0)))))) (+ (* (/ 2.0 r) (/ 1.0 r)) (- -1.5 (* 0.375 (* r (* r (* w w))))))))
double code(double v, double w, double r) {
double tmp;
if (r <= 2.35e-63) {
tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * ((r * w) * ((r * w) / (v + -1.0)))));
} else {
tmp = ((2.0 / r) * (1.0 / r)) + (-1.5 - (0.375 * (r * (r * (w * 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 <= 2.35d-63) then
tmp = (2.0d0 / (r * r)) + ((-1.5d0) + (0.375d0 * ((r * w) * ((r * w) / (v + (-1.0d0))))))
else
tmp = ((2.0d0 / r) * (1.0d0 / r)) + ((-1.5d0) - (0.375d0 * (r * (r * (w * w)))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 2.35e-63) {
tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * ((r * w) * ((r * w) / (v + -1.0)))));
} else {
tmp = ((2.0 / r) * (1.0 / r)) + (-1.5 - (0.375 * (r * (r * (w * w)))));
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 2.35e-63: tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * ((r * w) * ((r * w) / (v + -1.0))))) else: tmp = ((2.0 / r) * (1.0 / r)) + (-1.5 - (0.375 * (r * (r * (w * w))))) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 2.35e-63) tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(0.375 * Float64(Float64(r * w) * Float64(Float64(r * w) / Float64(v + -1.0)))))); else tmp = Float64(Float64(Float64(2.0 / r) * Float64(1.0 / r)) + Float64(-1.5 - Float64(0.375 * Float64(r * Float64(r * Float64(w * w)))))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 2.35e-63) tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * ((r * w) * ((r * w) / (v + -1.0))))); else tmp = ((2.0 / r) * (1.0 / r)) + (-1.5 - (0.375 * (r * (r * (w * w))))); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 2.35e-63], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(0.375 * N[(N[(r * w), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 / r), $MachinePrecision] * N[(1.0 / r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[(0.375 * N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 2.35 \cdot 10^{-63}:\\
\;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 + 0.375 \cdot \left(\left(r \cdot w\right) \cdot \frac{r \cdot w}{v + -1}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{r} \cdot \frac{1}{r} + \left(-1.5 - 0.375 \cdot \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right)\right)\\
\end{array}
\end{array}
if r < 2.35e-63Initial program 80.9%
Simplified82.5%
Taylor expanded in v around 0 77.6%
add-sqr-sqrt77.6%
*-un-lft-identity77.6%
times-frac77.6%
associate-*r*70.5%
sqrt-prod70.5%
sqrt-prod20.0%
add-sqr-sqrt64.0%
sqrt-prod36.5%
add-sqr-sqrt73.2%
associate-*r*63.3%
sqrt-prod63.3%
sqrt-prod20.7%
add-sqr-sqrt69.1%
sqrt-prod48.0%
add-sqr-sqrt89.3%
Applied egg-rr89.3%
if 2.35e-63 < r Initial program 88.4%
Simplified92.1%
Taylor expanded in v around 0 68.1%
associate-/r*68.1%
div-inv68.1%
Applied egg-rr68.1%
Taylor expanded in v around 0 85.4%
Final simplification88.1%
(FPCore (v w r) :precision binary64 (if (<= r 1.25e-95) (- (+ 3.0 (/ 2.0 (* r r))) (+ 4.5 (* (* v -0.25) (* (* r w) (* r w))))) (+ (* (/ 2.0 r) (/ 1.0 r)) (- -1.5 (* 0.375 (* r (* r (* w w))))))))
double code(double v, double w, double r) {
double tmp;
if (r <= 1.25e-95) {
tmp = (3.0 + (2.0 / (r * r))) - (4.5 + ((v * -0.25) * ((r * w) * (r * w))));
} else {
tmp = ((2.0 / r) * (1.0 / r)) + (-1.5 - (0.375 * (r * (r * (w * 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.25d-95) then
tmp = (3.0d0 + (2.0d0 / (r * r))) - (4.5d0 + ((v * (-0.25d0)) * ((r * w) * (r * w))))
else
tmp = ((2.0d0 / r) * (1.0d0 / r)) + ((-1.5d0) - (0.375d0 * (r * (r * (w * w)))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 1.25e-95) {
tmp = (3.0 + (2.0 / (r * r))) - (4.5 + ((v * -0.25) * ((r * w) * (r * w))));
} else {
tmp = ((2.0 / r) * (1.0 / r)) + (-1.5 - (0.375 * (r * (r * (w * w)))));
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 1.25e-95: tmp = (3.0 + (2.0 / (r * r))) - (4.5 + ((v * -0.25) * ((r * w) * (r * w)))) else: tmp = ((2.0 / r) * (1.0 / r)) + (-1.5 - (0.375 * (r * (r * (w * w))))) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 1.25e-95) tmp = Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(4.5 + Float64(Float64(v * -0.25) * Float64(Float64(r * w) * Float64(r * w))))); else tmp = Float64(Float64(Float64(2.0 / r) * Float64(1.0 / r)) + Float64(-1.5 - Float64(0.375 * Float64(r * Float64(r * Float64(w * w)))))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 1.25e-95) tmp = (3.0 + (2.0 / (r * r))) - (4.5 + ((v * -0.25) * ((r * w) * (r * w)))); else tmp = ((2.0 / r) * (1.0 / r)) + (-1.5 - (0.375 * (r * (r * (w * w))))); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 1.25e-95], N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(4.5 + N[(N[(v * -0.25), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 / r), $MachinePrecision] * N[(1.0 / r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[(0.375 * N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.25 \cdot 10^{-95}:\\
\;\;\;\;\left(3 + \frac{2}{r \cdot r}\right) - \left(4.5 + \left(v \cdot -0.25\right) \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{r} \cdot \frac{1}{r} + \left(-1.5 - 0.375 \cdot \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right)\right)\\
\end{array}
\end{array}
if r < 1.2499999999999999e-95Initial program 81.0%
Simplified82.1%
associate-/l*82.1%
*-commutative82.1%
associate-*r/82.1%
associate-*l*97.6%
associate-*r*99.3%
Applied egg-rr99.3%
Taylor expanded in v around inf 87.6%
*-commutative87.6%
Simplified87.6%
Taylor expanded in v around 0 74.5%
if 1.2499999999999999e-95 < r Initial program 87.7%
Simplified92.5%
Taylor expanded in v around 0 69.6%
associate-/r*69.6%
div-inv69.6%
Applied egg-rr69.6%
Taylor expanded in v around 0 86.0%
Final simplification78.3%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* r (* r (* w w)))))
(if (<= r 2e-64)
(+ (/ 2.0 (* r r)) (+ -1.5 (* 0.375 (/ t_0 (+ v -1.0)))))
(+ (* (/ 2.0 r) (/ 1.0 r)) (- -1.5 (* 0.375 t_0))))))
double code(double v, double w, double r) {
double t_0 = r * (r * (w * w));
double tmp;
if (r <= 2e-64) {
tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (t_0 / (v + -1.0))));
} else {
tmp = ((2.0 / r) * (1.0 / r)) + (-1.5 - (0.375 * t_0));
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = r * (r * (w * w))
if (r <= 2d-64) then
tmp = (2.0d0 / (r * r)) + ((-1.5d0) + (0.375d0 * (t_0 / (v + (-1.0d0)))))
else
tmp = ((2.0d0 / r) * (1.0d0 / r)) + ((-1.5d0) - (0.375d0 * t_0))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = r * (r * (w * w));
double tmp;
if (r <= 2e-64) {
tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (t_0 / (v + -1.0))));
} else {
tmp = ((2.0 / r) * (1.0 / r)) + (-1.5 - (0.375 * t_0));
}
return tmp;
}
def code(v, w, r): t_0 = r * (r * (w * w)) tmp = 0 if r <= 2e-64: tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (t_0 / (v + -1.0)))) else: tmp = ((2.0 / r) * (1.0 / r)) + (-1.5 - (0.375 * t_0)) return tmp
function code(v, w, r) t_0 = Float64(r * Float64(r * Float64(w * w))) tmp = 0.0 if (r <= 2e-64) tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(0.375 * Float64(t_0 / Float64(v + -1.0))))); else tmp = Float64(Float64(Float64(2.0 / r) * Float64(1.0 / r)) + Float64(-1.5 - Float64(0.375 * t_0))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = r * (r * (w * w)); tmp = 0.0; if (r <= 2e-64) tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (t_0 / (v + -1.0)))); else tmp = ((2.0 / r) * (1.0 / r)) + (-1.5 - (0.375 * t_0)); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 2e-64], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(0.375 * N[(t$95$0 / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 / r), $MachinePrecision] * N[(1.0 / r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[(0.375 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := r \cdot \left(r \cdot \left(w \cdot w\right)\right)\\
\mathbf{if}\;r \leq 2 \cdot 10^{-64}:\\
\;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 + 0.375 \cdot \frac{t\_0}{v + -1}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{r} \cdot \frac{1}{r} + \left(-1.5 - 0.375 \cdot t\_0\right)\\
\end{array}
\end{array}
if r < 1.99999999999999993e-64Initial program 80.9%
Simplified82.5%
Taylor expanded in v around 0 77.6%
if 1.99999999999999993e-64 < r Initial program 88.4%
Simplified92.1%
Taylor expanded in v around 0 68.1%
associate-/r*68.1%
div-inv68.1%
Applied egg-rr68.1%
Taylor expanded in v around 0 85.4%
Final simplification80.1%
(FPCore (v w r) :precision binary64 (+ (* (/ 2.0 r) (/ 1.0 r)) (- -1.5 (* 0.375 (* r (* r (* w w)))))))
double code(double v, double w, double r) {
return ((2.0 / r) * (1.0 / r)) + (-1.5 - (0.375 * (r * (r * (w * 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) * (1.0d0 / r)) + ((-1.5d0) - (0.375d0 * (r * (r * (w * w)))))
end function
public static double code(double v, double w, double r) {
return ((2.0 / r) * (1.0 / r)) + (-1.5 - (0.375 * (r * (r * (w * w)))));
}
def code(v, w, r): return ((2.0 / r) * (1.0 / r)) + (-1.5 - (0.375 * (r * (r * (w * w)))))
function code(v, w, r) return Float64(Float64(Float64(2.0 / r) * Float64(1.0 / r)) + Float64(-1.5 - Float64(0.375 * Float64(r * Float64(r * Float64(w * w)))))) end
function tmp = code(v, w, r) tmp = ((2.0 / r) * (1.0 / r)) + (-1.5 - (0.375 * (r * (r * (w * w))))); end
code[v_, w_, r_] := N[(N[(N[(2.0 / r), $MachinePrecision] * N[(1.0 / r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[(0.375 * N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r} \cdot \frac{1}{r} + \left(-1.5 - 0.375 \cdot \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right)\right)
\end{array}
Initial program 83.3%
Simplified85.5%
Taylor expanded in v around 0 73.0%
associate-/r*73.0%
div-inv73.0%
Applied egg-rr73.0%
Taylor expanded in v around 0 81.6%
Final simplification81.6%
herbie shell --seed 2024106
(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))