
(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 (+ (/ 2.0 (* r r)) (- -1.5 (/ (+ (* v -0.25) 0.375) (/ (- 1.0 v) (* (* r w) (* r w)))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - (((v * -0.25) + 0.375) / ((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) - (((v * (-0.25d0)) + 0.375d0) / ((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 - (((v * -0.25) + 0.375) / ((1.0 - v) / ((r * w) * (r * w)))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 - (((v * -0.25) + 0.375) / ((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(Float64(v * -0.25) + 0.375) / 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 - (((v * -0.25) + 0.375) / ((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[(N[(v * -0.25), $MachinePrecision] + 0.375), $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{v \cdot -0.25 + 0.375}{\frac{1 - v}{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}}\right)
\end{array}
Initial program 87.7%
Simplified89.1%
fma-undefine89.1%
*-commutative89.1%
+-commutative89.1%
associate-*r/89.5%
*-commutative89.5%
associate-/l*89.5%
clear-num89.5%
un-div-inv89.5%
+-commutative89.5%
distribute-rgt-in89.5%
*-commutative89.5%
associate-*l*89.5%
metadata-eval89.5%
metadata-eval89.5%
associate-*r*85.2%
pow285.2%
pow285.2%
pow-prod-down99.8%
Applied egg-rr99.8%
unpow299.8%
Applied egg-rr99.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* 0.125 (+ 3.0 (* v -2.0)))) (t_1 (/ 2.0 (* r r))))
(if (<= r 6.5e-117)
(- (+ t_1 3.0) 4.5)
(if (<= r 26500000000000.0)
(+ t_1 (- -1.5 (* 0.375 (* r (* (* w w) (/ r (- 1.0 v)))))))
(if (or (<= r 1.45e+153) (not (<= r 7.2e+261)))
(+ 3.0 (- (* t_0 (* w (* r (/ (* r w) v)))) 4.5))
(- 3.0 (+ 4.5 (* t_0 (* r (* r (* w w)))))))))))
double code(double v, double w, double r) {
double t_0 = 0.125 * (3.0 + (v * -2.0));
double t_1 = 2.0 / (r * r);
double tmp;
if (r <= 6.5e-117) {
tmp = (t_1 + 3.0) - 4.5;
} else if (r <= 26500000000000.0) {
tmp = t_1 + (-1.5 - (0.375 * (r * ((w * w) * (r / (1.0 - v))))));
} else if ((r <= 1.45e+153) || !(r <= 7.2e+261)) {
tmp = 3.0 + ((t_0 * (w * (r * ((r * w) / v)))) - 4.5);
} else {
tmp = 3.0 - (4.5 + (t_0 * (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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.125d0 * (3.0d0 + (v * (-2.0d0)))
t_1 = 2.0d0 / (r * r)
if (r <= 6.5d-117) then
tmp = (t_1 + 3.0d0) - 4.5d0
else if (r <= 26500000000000.0d0) then
tmp = t_1 + ((-1.5d0) - (0.375d0 * (r * ((w * w) * (r / (1.0d0 - v))))))
else if ((r <= 1.45d+153) .or. (.not. (r <= 7.2d+261))) then
tmp = 3.0d0 + ((t_0 * (w * (r * ((r * w) / v)))) - 4.5d0)
else
tmp = 3.0d0 - (4.5d0 + (t_0 * (r * (r * (w * 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 t_1 = 2.0 / (r * r);
double tmp;
if (r <= 6.5e-117) {
tmp = (t_1 + 3.0) - 4.5;
} else if (r <= 26500000000000.0) {
tmp = t_1 + (-1.5 - (0.375 * (r * ((w * w) * (r / (1.0 - v))))));
} else if ((r <= 1.45e+153) || !(r <= 7.2e+261)) {
tmp = 3.0 + ((t_0 * (w * (r * ((r * w) / v)))) - 4.5);
} else {
tmp = 3.0 - (4.5 + (t_0 * (r * (r * (w * w)))));
}
return tmp;
}
def code(v, w, r): t_0 = 0.125 * (3.0 + (v * -2.0)) t_1 = 2.0 / (r * r) tmp = 0 if r <= 6.5e-117: tmp = (t_1 + 3.0) - 4.5 elif r <= 26500000000000.0: tmp = t_1 + (-1.5 - (0.375 * (r * ((w * w) * (r / (1.0 - v)))))) elif (r <= 1.45e+153) or not (r <= 7.2e+261): tmp = 3.0 + ((t_0 * (w * (r * ((r * w) / v)))) - 4.5) else: tmp = 3.0 - (4.5 + (t_0 * (r * (r * (w * w))))) return tmp
function code(v, w, r) t_0 = Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) t_1 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 6.5e-117) tmp = Float64(Float64(t_1 + 3.0) - 4.5); elseif (r <= 26500000000000.0) tmp = Float64(t_1 + Float64(-1.5 - Float64(0.375 * Float64(r * Float64(Float64(w * w) * Float64(r / Float64(1.0 - v))))))); elseif ((r <= 1.45e+153) || !(r <= 7.2e+261)) tmp = Float64(3.0 + Float64(Float64(t_0 * Float64(w * Float64(r * Float64(Float64(r * w) / v)))) - 4.5)); else tmp = Float64(3.0 - Float64(4.5 + Float64(t_0 * Float64(r * Float64(r * Float64(w * w)))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 0.125 * (3.0 + (v * -2.0)); t_1 = 2.0 / (r * r); tmp = 0.0; if (r <= 6.5e-117) tmp = (t_1 + 3.0) - 4.5; elseif (r <= 26500000000000.0) tmp = t_1 + (-1.5 - (0.375 * (r * ((w * w) * (r / (1.0 - v)))))); elseif ((r <= 1.45e+153) || ~((r <= 7.2e+261))) tmp = 3.0 + ((t_0 * (w * (r * ((r * w) / v)))) - 4.5); else tmp = 3.0 - (4.5 + (t_0 * (r * (r * (w * 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]}, Block[{t$95$1 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 6.5e-117], N[(N[(t$95$1 + 3.0), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 26500000000000.0], N[(t$95$1 + 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[Or[LessEqual[r, 1.45e+153], N[Not[LessEqual[r, 7.2e+261]], $MachinePrecision]], N[(3.0 + N[(N[(t$95$0 * N[(w * N[(r * N[(N[(r * w), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision], N[(3.0 - N[(4.5 + N[(t$95$0 * N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.125 \cdot \left(3 + v \cdot -2\right)\\
t_1 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 6.5 \cdot 10^{-117}:\\
\;\;\;\;\left(t\_1 + 3\right) - 4.5\\
\mathbf{elif}\;r \leq 26500000000000:\\
\;\;\;\;t\_1 + \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 1.45 \cdot 10^{+153} \lor \neg \left(r \leq 7.2 \cdot 10^{+261}\right):\\
\;\;\;\;3 + \left(t\_0 \cdot \left(w \cdot \left(r \cdot \frac{r \cdot w}{v}\right)\right) - 4.5\right)\\
\mathbf{else}:\\
\;\;\;\;3 - \left(4.5 + t\_0 \cdot \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right)\right)\\
\end{array}
\end{array}
if r < 6.5000000000000001e-117Initial program 85.6%
Simplified85.0%
Taylor expanded in r around 0 68.7%
if 6.5000000000000001e-117 < r < 2.65e13Initial program 94.9%
Simplified94.9%
Taylor expanded in v around 0 94.9%
if 2.65e13 < r < 1.45000000000000001e153 or 7.20000000000000036e261 < r Initial program 95.3%
associate--l-95.3%
associate-*l*95.2%
sqr-neg95.2%
associate-*l*95.3%
associate-/l*97.6%
fma-define97.6%
Simplified97.6%
Taylor expanded in r around inf 97.6%
associate-/l*97.6%
*-commutative97.6%
associate-*r/97.5%
*-commutative97.5%
associate-*l*99.8%
associate-*l*99.8%
Applied egg-rr99.8%
Taylor expanded in v around inf 81.6%
associate-*r/81.6%
neg-mul-181.6%
distribute-lft-neg-in81.6%
Simplified81.6%
if 1.45000000000000001e153 < r < 7.20000000000000036e261Initial program 82.3%
associate--l-82.3%
associate-*l*45.9%
sqr-neg45.9%
associate-*l*82.3%
associate-/l*87.0%
fma-define87.0%
Simplified87.0%
Taylor expanded in r around inf 87.0%
Taylor expanded in v around 0 82.3%
Final simplification73.9%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* 0.125 (+ 3.0 (* v -2.0)))) (t_1 (/ 2.0 (* r r))))
(if (<= r 5e-117)
(- (+ t_1 3.0) 4.5)
(if (<= r 12000000000000.0)
(+ t_1 (- -1.5 (* 0.375 (* r (* (* w w) (/ r (- 1.0 v)))))))
(if (<= r 5.5e+119)
(+ 3.0 (- (* t_0 (* w (* r (* r (/ w v))))) 4.5))
(- 3.0 (+ 4.5 (* t_0 (* r (* r (* w w)))))))))))
double code(double v, double w, double r) {
double t_0 = 0.125 * (3.0 + (v * -2.0));
double t_1 = 2.0 / (r * r);
double tmp;
if (r <= 5e-117) {
tmp = (t_1 + 3.0) - 4.5;
} else if (r <= 12000000000000.0) {
tmp = t_1 + (-1.5 - (0.375 * (r * ((w * w) * (r / (1.0 - v))))));
} else if (r <= 5.5e+119) {
tmp = 3.0 + ((t_0 * (w * (r * (r * (w / v))))) - 4.5);
} else {
tmp = 3.0 - (4.5 + (t_0 * (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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.125d0 * (3.0d0 + (v * (-2.0d0)))
t_1 = 2.0d0 / (r * r)
if (r <= 5d-117) then
tmp = (t_1 + 3.0d0) - 4.5d0
else if (r <= 12000000000000.0d0) then
tmp = t_1 + ((-1.5d0) - (0.375d0 * (r * ((w * w) * (r / (1.0d0 - v))))))
else if (r <= 5.5d+119) then
tmp = 3.0d0 + ((t_0 * (w * (r * (r * (w / v))))) - 4.5d0)
else
tmp = 3.0d0 - (4.5d0 + (t_0 * (r * (r * (w * 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 t_1 = 2.0 / (r * r);
double tmp;
if (r <= 5e-117) {
tmp = (t_1 + 3.0) - 4.5;
} else if (r <= 12000000000000.0) {
tmp = t_1 + (-1.5 - (0.375 * (r * ((w * w) * (r / (1.0 - v))))));
} else if (r <= 5.5e+119) {
tmp = 3.0 + ((t_0 * (w * (r * (r * (w / v))))) - 4.5);
} else {
tmp = 3.0 - (4.5 + (t_0 * (r * (r * (w * w)))));
}
return tmp;
}
def code(v, w, r): t_0 = 0.125 * (3.0 + (v * -2.0)) t_1 = 2.0 / (r * r) tmp = 0 if r <= 5e-117: tmp = (t_1 + 3.0) - 4.5 elif r <= 12000000000000.0: tmp = t_1 + (-1.5 - (0.375 * (r * ((w * w) * (r / (1.0 - v)))))) elif r <= 5.5e+119: tmp = 3.0 + ((t_0 * (w * (r * (r * (w / v))))) - 4.5) else: tmp = 3.0 - (4.5 + (t_0 * (r * (r * (w * w))))) return tmp
function code(v, w, r) t_0 = Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) t_1 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 5e-117) tmp = Float64(Float64(t_1 + 3.0) - 4.5); elseif (r <= 12000000000000.0) tmp = Float64(t_1 + Float64(-1.5 - Float64(0.375 * Float64(r * Float64(Float64(w * w) * Float64(r / Float64(1.0 - v))))))); elseif (r <= 5.5e+119) tmp = Float64(3.0 + Float64(Float64(t_0 * Float64(w * Float64(r * Float64(r * Float64(w / v))))) - 4.5)); else tmp = Float64(3.0 - Float64(4.5 + Float64(t_0 * Float64(r * Float64(r * Float64(w * w)))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 0.125 * (3.0 + (v * -2.0)); t_1 = 2.0 / (r * r); tmp = 0.0; if (r <= 5e-117) tmp = (t_1 + 3.0) - 4.5; elseif (r <= 12000000000000.0) tmp = t_1 + (-1.5 - (0.375 * (r * ((w * w) * (r / (1.0 - v)))))); elseif (r <= 5.5e+119) tmp = 3.0 + ((t_0 * (w * (r * (r * (w / v))))) - 4.5); else tmp = 3.0 - (4.5 + (t_0 * (r * (r * (w * 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]}, Block[{t$95$1 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 5e-117], N[(N[(t$95$1 + 3.0), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 12000000000000.0], N[(t$95$1 + 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, 5.5e+119], N[(3.0 + N[(N[(t$95$0 * N[(w * N[(r * N[(r * N[(w / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision], N[(3.0 - N[(4.5 + N[(t$95$0 * N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.125 \cdot \left(3 + v \cdot -2\right)\\
t_1 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 5 \cdot 10^{-117}:\\
\;\;\;\;\left(t\_1 + 3\right) - 4.5\\
\mathbf{elif}\;r \leq 12000000000000:\\
\;\;\;\;t\_1 + \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 5.5 \cdot 10^{+119}:\\
\;\;\;\;3 + \left(t\_0 \cdot \left(w \cdot \left(r \cdot \left(r \cdot \frac{w}{v}\right)\right)\right) - 4.5\right)\\
\mathbf{else}:\\
\;\;\;\;3 - \left(4.5 + t\_0 \cdot \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right)\right)\\
\end{array}
\end{array}
if r < 5e-117Initial program 85.6%
Simplified85.0%
Taylor expanded in r around 0 68.7%
if 5e-117 < r < 1.2e13Initial program 94.9%
Simplified94.9%
Taylor expanded in v around 0 94.9%
if 1.2e13 < r < 5.5000000000000003e119Initial program 99.9%
associate--l-99.9%
associate-*l*99.9%
sqr-neg99.9%
associate-*l*99.9%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in r around inf 99.9%
associate-/l*99.9%
*-commutative99.9%
associate-*r/99.8%
*-commutative99.8%
associate-*l*99.9%
associate-*l*99.8%
Applied egg-rr99.8%
Taylor expanded in v around inf 84.3%
associate-*r/84.3%
neg-mul-184.3%
distribute-lft-neg-in84.3%
Simplified84.3%
Taylor expanded in r around 0 84.3%
associate-*r/84.3%
neg-mul-184.3%
distribute-rgt-neg-in84.3%
associate-/l*84.3%
Simplified84.3%
if 5.5000000000000003e119 < r Initial program 84.8%
associate--l-84.8%
associate-*l*64.5%
sqr-neg64.5%
associate-*l*84.8%
associate-/l*90.0%
fma-define90.0%
Simplified90.0%
Taylor expanded in r around inf 90.0%
Taylor expanded in v around 0 71.1%
Final simplification72.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))) (t_1 (/ r (- 1.0 v))))
(if (<= r 7.8e-118)
(- (+ t_0 3.0) 4.5)
(if (<= r 3e+136)
(+ t_0 (- -1.5 (* (+ (* v -0.25) 0.375) (* r (* (* w w) t_1)))))
(-
3.0
(+ 4.5 (* (* 0.125 (+ 3.0 (* v -2.0))) (* (* r w) (* w t_1)))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = r / (1.0 - v);
double tmp;
if (r <= 7.8e-118) {
tmp = (t_0 + 3.0) - 4.5;
} else if (r <= 3e+136) {
tmp = t_0 + (-1.5 - (((v * -0.25) + 0.375) * (r * ((w * w) * t_1))));
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (w * t_1))));
}
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 / (1.0d0 - v)
if (r <= 7.8d-118) then
tmp = (t_0 + 3.0d0) - 4.5d0
else if (r <= 3d+136) then
tmp = t_0 + ((-1.5d0) - (((v * (-0.25d0)) + 0.375d0) * (r * ((w * w) * t_1))))
else
tmp = 3.0d0 - (4.5d0 + ((0.125d0 * (3.0d0 + (v * (-2.0d0)))) * ((r * w) * (w * t_1))))
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 / (1.0 - v);
double tmp;
if (r <= 7.8e-118) {
tmp = (t_0 + 3.0) - 4.5;
} else if (r <= 3e+136) {
tmp = t_0 + (-1.5 - (((v * -0.25) + 0.375) * (r * ((w * w) * t_1))));
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (w * t_1))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = r / (1.0 - v) tmp = 0 if r <= 7.8e-118: tmp = (t_0 + 3.0) - 4.5 elif r <= 3e+136: tmp = t_0 + (-1.5 - (((v * -0.25) + 0.375) * (r * ((w * w) * t_1)))) else: tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (w * t_1)))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) t_1 = Float64(r / Float64(1.0 - v)) tmp = 0.0 if (r <= 7.8e-118) tmp = Float64(Float64(t_0 + 3.0) - 4.5); elseif (r <= 3e+136) tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(Float64(v * -0.25) + 0.375) * Float64(r * Float64(Float64(w * w) * t_1))))); else tmp = Float64(3.0 - Float64(4.5 + Float64(Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) * Float64(Float64(r * w) * Float64(w * t_1))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); t_1 = r / (1.0 - v); tmp = 0.0; if (r <= 7.8e-118) tmp = (t_0 + 3.0) - 4.5; elseif (r <= 3e+136) tmp = t_0 + (-1.5 - (((v * -0.25) + 0.375) * (r * ((w * w) * t_1)))); else tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (w * t_1)))); 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[(1.0 - v), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 7.8e-118], N[(N[(t$95$0 + 3.0), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 3e+136], N[(t$95$0 + N[(-1.5 - N[(N[(N[(v * -0.25), $MachinePrecision] + 0.375), $MachinePrecision] * N[(r * N[(N[(w * w), $MachinePrecision] * t$95$1), $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[(w * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := \frac{r}{1 - v}\\
\mathbf{if}\;r \leq 7.8 \cdot 10^{-118}:\\
\;\;\;\;\left(t\_0 + 3\right) - 4.5\\
\mathbf{elif}\;r \leq 3 \cdot 10^{+136}:\\
\;\;\;\;t\_0 + \left(-1.5 - \left(v \cdot -0.25 + 0.375\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot t\_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(w \cdot t\_1\right)\right)\right)\\
\end{array}
\end{array}
if r < 7.80000000000000002e-118Initial program 85.6%
Simplified85.0%
Taylor expanded in r around 0 68.7%
if 7.80000000000000002e-118 < r < 2.99999999999999979e136Initial program 97.8%
Simplified97.8%
fma-undefine97.8%
*-commutative97.8%
distribute-rgt-in97.8%
metadata-eval97.8%
*-commutative97.8%
associate-*l*97.8%
metadata-eval97.8%
Applied egg-rr97.8%
if 2.99999999999999979e136 < r Initial program 83.9%
associate--l-83.9%
associate-*l*62.4%
sqr-neg62.4%
associate-*l*83.9%
associate-/l*89.5%
fma-define89.5%
Simplified89.5%
Taylor expanded in r around inf 89.5%
associate-/l*89.4%
*-commutative89.4%
associate-*r/89.4%
associate-*l*99.8%
associate-*r*99.7%
Applied egg-rr99.7%
Final simplification78.3%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* r (* (* w w) (/ r (- 1.0 v))))) (t_1 (/ 2.0 (* r r))))
(if (or (<= v -2000.0) (not (<= v 235000000.0)))
(+ t_1 (- -1.5 (* (* v -0.25) t_0)))
(+ t_1 (- -1.5 (* 0.375 t_0))))))
double code(double v, double w, double r) {
double t_0 = r * ((w * w) * (r / (1.0 - v)));
double t_1 = 2.0 / (r * r);
double tmp;
if ((v <= -2000.0) || !(v <= 235000000.0)) {
tmp = t_1 + (-1.5 - ((v * -0.25) * t_0));
} else {
tmp = t_1 + (-1.5 - (0.375 * t_0));
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = r * ((w * w) * (r / (1.0d0 - v)))
t_1 = 2.0d0 / (r * r)
if ((v <= (-2000.0d0)) .or. (.not. (v <= 235000000.0d0))) then
tmp = t_1 + ((-1.5d0) - ((v * (-0.25d0)) * t_0))
else
tmp = t_1 + ((-1.5d0) - (0.375d0 * t_0))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = r * ((w * w) * (r / (1.0 - v)));
double t_1 = 2.0 / (r * r);
double tmp;
if ((v <= -2000.0) || !(v <= 235000000.0)) {
tmp = t_1 + (-1.5 - ((v * -0.25) * t_0));
} else {
tmp = t_1 + (-1.5 - (0.375 * t_0));
}
return tmp;
}
def code(v, w, r): t_0 = r * ((w * w) * (r / (1.0 - v))) t_1 = 2.0 / (r * r) tmp = 0 if (v <= -2000.0) or not (v <= 235000000.0): tmp = t_1 + (-1.5 - ((v * -0.25) * t_0)) else: tmp = t_1 + (-1.5 - (0.375 * t_0)) return tmp
function code(v, w, r) t_0 = Float64(r * Float64(Float64(w * w) * Float64(r / Float64(1.0 - v)))) t_1 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((v <= -2000.0) || !(v <= 235000000.0)) tmp = Float64(t_1 + Float64(-1.5 - Float64(Float64(v * -0.25) * t_0))); else tmp = Float64(t_1 + Float64(-1.5 - Float64(0.375 * t_0))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = r * ((w * w) * (r / (1.0 - v))); t_1 = 2.0 / (r * r); tmp = 0.0; if ((v <= -2000.0) || ~((v <= 235000000.0))) tmp = t_1 + (-1.5 - ((v * -0.25) * t_0)); else tmp = t_1 + (-1.5 - (0.375 * t_0)); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(r * N[(N[(w * w), $MachinePrecision] * N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -2000.0], N[Not[LessEqual[v, 235000000.0]], $MachinePrecision]], N[(t$95$1 + N[(-1.5 - N[(N[(v * -0.25), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(-1.5 - N[(0.375 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{1 - v}\right)\\
t_1 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -2000 \lor \neg \left(v \leq 235000000\right):\\
\;\;\;\;t\_1 + \left(-1.5 - \left(v \cdot -0.25\right) \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(-1.5 - 0.375 \cdot t\_0\right)\\
\end{array}
\end{array}
if v < -2e3 or 2.35e8 < v Initial program 88.0%
Simplified91.0%
Taylor expanded in v around inf 90.4%
*-commutative90.4%
Simplified90.4%
if -2e3 < v < 2.35e8Initial program 87.4%
Simplified87.4%
Taylor expanded in v around 0 86.9%
Final simplification88.6%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))) (t_1 (/ r (- 1.0 v))))
(if (<= r 2.55e-118)
(- (+ t_0 3.0) 4.5)
(if (<= r 52.0)
(+ t_0 (- -1.5 (* 0.375 (* r (* (* w w) t_1)))))
(-
3.0
(+ 4.5 (* (* 0.125 (+ 3.0 (* v -2.0))) (* (* r w) (* w t_1)))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = r / (1.0 - v);
double tmp;
if (r <= 2.55e-118) {
tmp = (t_0 + 3.0) - 4.5;
} else if (r <= 52.0) {
tmp = t_0 + (-1.5 - (0.375 * (r * ((w * w) * t_1))));
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (w * t_1))));
}
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 / (1.0d0 - v)
if (r <= 2.55d-118) then
tmp = (t_0 + 3.0d0) - 4.5d0
else if (r <= 52.0d0) then
tmp = t_0 + ((-1.5d0) - (0.375d0 * (r * ((w * w) * t_1))))
else
tmp = 3.0d0 - (4.5d0 + ((0.125d0 * (3.0d0 + (v * (-2.0d0)))) * ((r * w) * (w * t_1))))
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 / (1.0 - v);
double tmp;
if (r <= 2.55e-118) {
tmp = (t_0 + 3.0) - 4.5;
} else if (r <= 52.0) {
tmp = t_0 + (-1.5 - (0.375 * (r * ((w * w) * t_1))));
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (w * t_1))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = r / (1.0 - v) tmp = 0 if r <= 2.55e-118: tmp = (t_0 + 3.0) - 4.5 elif r <= 52.0: tmp = t_0 + (-1.5 - (0.375 * (r * ((w * w) * t_1)))) else: tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (w * t_1)))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) t_1 = Float64(r / Float64(1.0 - v)) tmp = 0.0 if (r <= 2.55e-118) tmp = Float64(Float64(t_0 + 3.0) - 4.5); elseif (r <= 52.0) tmp = Float64(t_0 + Float64(-1.5 - Float64(0.375 * Float64(r * Float64(Float64(w * w) * t_1))))); else tmp = Float64(3.0 - Float64(4.5 + Float64(Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) * Float64(Float64(r * w) * Float64(w * t_1))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); t_1 = r / (1.0 - v); tmp = 0.0; if (r <= 2.55e-118) tmp = (t_0 + 3.0) - 4.5; elseif (r <= 52.0) tmp = t_0 + (-1.5 - (0.375 * (r * ((w * w) * t_1)))); else tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (w * t_1)))); 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[(1.0 - v), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 2.55e-118], N[(N[(t$95$0 + 3.0), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 52.0], N[(t$95$0 + N[(-1.5 - N[(0.375 * N[(r * N[(N[(w * w), $MachinePrecision] * t$95$1), $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[(w * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := \frac{r}{1 - v}\\
\mathbf{if}\;r \leq 2.55 \cdot 10^{-118}:\\
\;\;\;\;\left(t\_0 + 3\right) - 4.5\\
\mathbf{elif}\;r \leq 52:\\
\;\;\;\;t\_0 + \left(-1.5 - 0.375 \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot t\_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(w \cdot t\_1\right)\right)\right)\\
\end{array}
\end{array}
if r < 2.54999999999999982e-118Initial program 85.6%
Simplified85.0%
Taylor expanded in r around 0 68.7%
if 2.54999999999999982e-118 < r < 52Initial program 94.4%
Simplified94.4%
Taylor expanded in v around 0 94.4%
if 52 < r Initial program 91.4%
associate--l-91.4%
associate-*l*80.0%
sqr-neg80.0%
associate-*l*91.4%
associate-/l*94.4%
fma-define94.4%
Simplified94.4%
Taylor expanded in r around inf 94.4%
associate-/l*94.3%
*-commutative94.3%
associate-*r/94.3%
associate-*l*99.9%
associate-*r*99.7%
Applied egg-rr99.7%
Final simplification78.3%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))) (t_1 (/ r (- 1.0 v))))
(if (<= r 1e-116)
(- (+ t_0 3.0) 4.5)
(if (<= r 7.6)
(+ t_0 (- -1.5 (* 0.375 (* r (* (* w w) t_1)))))
(-
3.0
(+ 4.5 (* (* 0.125 (+ 3.0 (* v -2.0))) (* w (* r (* w t_1))))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = r / (1.0 - v);
double tmp;
if (r <= 1e-116) {
tmp = (t_0 + 3.0) - 4.5;
} else if (r <= 7.6) {
tmp = t_0 + (-1.5 - (0.375 * (r * ((w * w) * t_1))));
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (v * -2.0))) * (w * (r * (w * t_1)))));
}
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 / (1.0d0 - v)
if (r <= 1d-116) then
tmp = (t_0 + 3.0d0) - 4.5d0
else if (r <= 7.6d0) then
tmp = t_0 + ((-1.5d0) - (0.375d0 * (r * ((w * w) * t_1))))
else
tmp = 3.0d0 - (4.5d0 + ((0.125d0 * (3.0d0 + (v * (-2.0d0)))) * (w * (r * (w * t_1)))))
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 / (1.0 - v);
double tmp;
if (r <= 1e-116) {
tmp = (t_0 + 3.0) - 4.5;
} else if (r <= 7.6) {
tmp = t_0 + (-1.5 - (0.375 * (r * ((w * w) * t_1))));
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (v * -2.0))) * (w * (r * (w * t_1)))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = r / (1.0 - v) tmp = 0 if r <= 1e-116: tmp = (t_0 + 3.0) - 4.5 elif r <= 7.6: tmp = t_0 + (-1.5 - (0.375 * (r * ((w * w) * t_1)))) else: tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (v * -2.0))) * (w * (r * (w * t_1))))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) t_1 = Float64(r / Float64(1.0 - v)) tmp = 0.0 if (r <= 1e-116) tmp = Float64(Float64(t_0 + 3.0) - 4.5); elseif (r <= 7.6) tmp = Float64(t_0 + Float64(-1.5 - Float64(0.375 * Float64(r * Float64(Float64(w * w) * t_1))))); else tmp = Float64(3.0 - Float64(4.5 + Float64(Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) * Float64(w * Float64(r * Float64(w * t_1)))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); t_1 = r / (1.0 - v); tmp = 0.0; if (r <= 1e-116) tmp = (t_0 + 3.0) - 4.5; elseif (r <= 7.6) tmp = t_0 + (-1.5 - (0.375 * (r * ((w * w) * t_1)))); else tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (v * -2.0))) * (w * (r * (w * t_1))))); 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[(1.0 - v), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 1e-116], N[(N[(t$95$0 + 3.0), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 7.6], N[(t$95$0 + N[(-1.5 - N[(0.375 * N[(r * N[(N[(w * w), $MachinePrecision] * t$95$1), $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[(w * N[(r * N[(w * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := \frac{r}{1 - v}\\
\mathbf{if}\;r \leq 10^{-116}:\\
\;\;\;\;\left(t\_0 + 3\right) - 4.5\\
\mathbf{elif}\;r \leq 7.6:\\
\;\;\;\;t\_0 + \left(-1.5 - 0.375 \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot t\_1\right)\right)\right)\\
\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(w \cdot t\_1\right)\right)\right)\right)\\
\end{array}
\end{array}
if r < 9.9999999999999999e-117Initial program 85.6%
Simplified85.0%
Taylor expanded in r around 0 68.7%
if 9.9999999999999999e-117 < r < 7.5999999999999996Initial program 94.4%
Simplified94.4%
Taylor expanded in v around 0 94.4%
if 7.5999999999999996 < r Initial program 91.4%
associate--l-91.4%
associate-*l*80.0%
sqr-neg80.0%
associate-*l*91.4%
associate-/l*94.4%
fma-define94.4%
Simplified94.4%
Taylor expanded in r around inf 94.4%
associate-/l*94.3%
*-commutative94.3%
associate-*r/94.3%
*-commutative94.3%
associate-*l*99.9%
associate-*l*98.4%
Applied egg-rr98.4%
Final simplification78.0%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= r 1.45e-116)
(- (+ t_0 3.0) 4.5)
(if (<= r 15000000000000.0)
(+ t_0 (- -1.5 (* 0.375 (* r (* (* w w) (/ r (- 1.0 v)))))))
(+
3.0
(- (* (* 0.125 (+ 3.0 (* v -2.0))) (/ (* r (* r (* w w))) v)) 4.5))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 1.45e-116) {
tmp = (t_0 + 3.0) - 4.5;
} else if (r <= 15000000000000.0) {
tmp = t_0 + (-1.5 - (0.375 * (r * ((w * w) * (r / (1.0 - v))))));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * ((r * (r * (w * w))) / v)) - 4.5);
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if (r <= 1.45d-116) then
tmp = (t_0 + 3.0d0) - 4.5d0
else if (r <= 15000000000000.0d0) then
tmp = t_0 + ((-1.5d0) - (0.375d0 * (r * ((w * w) * (r / (1.0d0 - v))))))
else
tmp = 3.0d0 + (((0.125d0 * (3.0d0 + (v * (-2.0d0)))) * ((r * (r * (w * w))) / v)) - 4.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 1.45e-116) {
tmp = (t_0 + 3.0) - 4.5;
} else if (r <= 15000000000000.0) {
tmp = t_0 + (-1.5 - (0.375 * (r * ((w * w) * (r / (1.0 - v))))));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * ((r * (r * (w * w))) / v)) - 4.5);
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if r <= 1.45e-116: tmp = (t_0 + 3.0) - 4.5 elif r <= 15000000000000.0: tmp = t_0 + (-1.5 - (0.375 * (r * ((w * w) * (r / (1.0 - v)))))) else: tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * ((r * (r * (w * w))) / v)) - 4.5) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 1.45e-116) tmp = Float64(Float64(t_0 + 3.0) - 4.5); elseif (r <= 15000000000000.0) tmp = Float64(t_0 + Float64(-1.5 - Float64(0.375 * Float64(r * Float64(Float64(w * w) * Float64(r / Float64(1.0 - v))))))); else tmp = Float64(3.0 + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) * Float64(Float64(r * Float64(r * Float64(w * w))) / v)) - 4.5)); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (r <= 1.45e-116) tmp = (t_0 + 3.0) - 4.5; elseif (r <= 15000000000000.0) tmp = t_0 + (-1.5 - (0.375 * (r * ((w * w) * (r / (1.0 - v)))))); else tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * ((r * (r * (w * w))) / v)) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 1.45e-116], N[(N[(t$95$0 + 3.0), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 15000000000000.0], N[(t$95$0 + 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], N[(3.0 + N[(N[(N[(0.125 * N[(3.0 + N[(v * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 1.45 \cdot 10^{-116}:\\
\;\;\;\;\left(t\_0 + 3\right) - 4.5\\
\mathbf{elif}\;r \leq 15000000000000:\\
\;\;\;\;t\_0 + \left(-1.5 - 0.375 \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{1 - v}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;3 + \left(\left(0.125 \cdot \left(3 + v \cdot -2\right)\right) \cdot \frac{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}{v} - 4.5\right)\\
\end{array}
\end{array}
if r < 1.4499999999999999e-116Initial program 85.6%
Simplified85.0%
Taylor expanded in r around 0 68.7%
if 1.4499999999999999e-116 < r < 1.5e13Initial program 94.9%
Simplified94.9%
Taylor expanded in v around 0 94.9%
if 1.5e13 < r Initial program 91.1%
associate--l-91.1%
associate-*l*79.3%
sqr-neg79.3%
associate-*l*91.1%
associate-/l*94.2%
fma-define94.2%
Simplified94.2%
Taylor expanded in r around inf 94.2%
Taylor expanded in v around inf 76.8%
neg-mul-176.8%
Simplified76.8%
Final simplification72.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= r 4.5e-118)
(- (+ t_0 3.0) 4.5)
(+ t_0 (- -1.5 (* 0.375 (* r (* (* w w) (/ r (- 1.0 v))))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 4.5e-118) {
tmp = (t_0 + 3.0) - 4.5;
} else {
tmp = t_0 + (-1.5 - (0.375 * (r * ((w * w) * (r / (1.0 - v))))));
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if (r <= 4.5d-118) then
tmp = (t_0 + 3.0d0) - 4.5d0
else
tmp = t_0 + ((-1.5d0) - (0.375d0 * (r * ((w * w) * (r / (1.0d0 - v))))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 4.5e-118) {
tmp = (t_0 + 3.0) - 4.5;
} else {
tmp = t_0 + (-1.5 - (0.375 * (r * ((w * w) * (r / (1.0 - v))))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if r <= 4.5e-118: tmp = (t_0 + 3.0) - 4.5 else: tmp = t_0 + (-1.5 - (0.375 * (r * ((w * w) * (r / (1.0 - v)))))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 4.5e-118) tmp = Float64(Float64(t_0 + 3.0) - 4.5); else tmp = Float64(t_0 + Float64(-1.5 - Float64(0.375 * Float64(r * Float64(Float64(w * w) * Float64(r / Float64(1.0 - v))))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (r <= 4.5e-118) tmp = (t_0 + 3.0) - 4.5; else tmp = t_0 + (-1.5 - (0.375 * (r * ((w * w) * (r / (1.0 - v)))))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 4.5e-118], N[(N[(t$95$0 + 3.0), $MachinePrecision] - 4.5), $MachinePrecision], N[(t$95$0 + N[(-1.5 - N[(0.375 * N[(r * N[(N[(w * w), $MachinePrecision] * N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 4.5 \cdot 10^{-118}:\\
\;\;\;\;\left(t\_0 + 3\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \left(-1.5 - 0.375 \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{1 - v}\right)\right)\right)\\
\end{array}
\end{array}
if r < 4.5e-118Initial program 85.6%
Simplified85.0%
Taylor expanded in r around 0 68.7%
if 4.5e-118 < r Initial program 92.0%
Simplified94.3%
Taylor expanded in v around 0 74.6%
Final simplification70.6%
(FPCore (v w r) :precision binary64 (if (<= r 116.0) (- (+ 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 <= 116.0) {
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 <= 116.0d0) 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 <= 116.0) {
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 <= 116.0: 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 <= 116.0) 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 <= 116.0) 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, 116.0], 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 116:\\
\;\;\;\;\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 < 116Initial program 86.4%
Simplified85.9%
Taylor expanded in r around 0 70.6%
associate-/r*70.6%
div-inv70.5%
Applied egg-rr70.5%
associate-*r/70.6%
*-rgt-identity70.6%
Simplified70.6%
if 116 < r Initial program 91.4%
associate--l-91.4%
associate-*l*80.0%
sqr-neg80.0%
associate-*l*91.4%
associate-/l*94.4%
fma-define94.4%
Simplified94.4%
Taylor expanded in r around inf 94.4%
associate-/l*94.3%
*-commutative94.3%
associate-*r/94.3%
*-commutative94.3%
associate-*l*99.9%
associate-*l*98.4%
Applied egg-rr98.4%
Taylor expanded in v around 0 68.2%
Final simplification70.0%
(FPCore (v w r) :precision binary64 (- (+ 3.0 (/ (/ 2.0 r) r)) 4.5))
double code(double v, double w, double r) {
return (3.0 + ((2.0 / r) / r)) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
end function
public static double code(double v, double w, double r) {
return (3.0 + ((2.0 / r) / r)) - 4.5;
}
def code(v, w, r): return (3.0 + ((2.0 / r) / r)) - 4.5
function code(v, w, r) return Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5) end
function tmp = code(v, w, r) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; end
code[v_, w_, r_] := N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5
\end{array}
Initial program 87.7%
Simplified84.0%
Taylor expanded in r around 0 61.8%
associate-/r*61.8%
div-inv61.8%
Applied egg-rr61.8%
associate-*r/61.8%
*-rgt-identity61.8%
Simplified61.8%
(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 87.7%
Simplified84.0%
Taylor expanded in r around 0 61.8%
Final simplification61.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 87.7%
Simplified84.0%
Taylor expanded in r around 0 61.8%
Taylor expanded in r around inf 14.8%
herbie shell --seed 2024137
(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))