
(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 14 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(Float64(2.0 / 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[(N[(2.0 / r), $MachinePrecision] / r), $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{\frac{2}{r}}{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 84.6%
Simplified88.5%
fma-undefine88.5%
*-commutative88.5%
+-commutative88.5%
associate-*r/88.9%
*-commutative88.9%
associate-/l*88.9%
clear-num89.0%
un-div-inv88.9%
+-commutative88.9%
distribute-rgt-in88.9%
*-commutative88.9%
associate-*l*88.9%
metadata-eval88.9%
metadata-eval88.9%
associate-*r*81.5%
pow281.5%
pow281.5%
pow-prod-down99.8%
Applied egg-rr99.8%
unpow299.8%
Applied egg-rr99.8%
associate-/r*99.8%
div-inv99.7%
Applied egg-rr99.7%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (+ (* v -0.25) 0.375)) (t_1 (/ 2.0 (* r r))))
(if (or (<= v -10000000.0) (not (<= v 1.0)))
(+ t_1 (+ -1.5 (/ t_0 (/ (/ v (* r w)) (* r w)))))
(+ t_1 (+ -1.5 (/ t_0 (/ (/ (/ -1.0 r) w) (* r w))))))))
double code(double v, double w, double r) {
double t_0 = (v * -0.25) + 0.375;
double t_1 = 2.0 / (r * r);
double tmp;
if ((v <= -10000000.0) || !(v <= 1.0)) {
tmp = t_1 + (-1.5 + (t_0 / ((v / (r * w)) / (r * w))));
} else {
tmp = t_1 + (-1.5 + (t_0 / (((-1.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) :: t_1
real(8) :: tmp
t_0 = (v * (-0.25d0)) + 0.375d0
t_1 = 2.0d0 / (r * r)
if ((v <= (-10000000.0d0)) .or. (.not. (v <= 1.0d0))) then
tmp = t_1 + ((-1.5d0) + (t_0 / ((v / (r * w)) / (r * w))))
else
tmp = t_1 + ((-1.5d0) + (t_0 / ((((-1.0d0) / r) / w) / (r * w))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = (v * -0.25) + 0.375;
double t_1 = 2.0 / (r * r);
double tmp;
if ((v <= -10000000.0) || !(v <= 1.0)) {
tmp = t_1 + (-1.5 + (t_0 / ((v / (r * w)) / (r * w))));
} else {
tmp = t_1 + (-1.5 + (t_0 / (((-1.0 / r) / w) / (r * w))));
}
return tmp;
}
def code(v, w, r): t_0 = (v * -0.25) + 0.375 t_1 = 2.0 / (r * r) tmp = 0 if (v <= -10000000.0) or not (v <= 1.0): tmp = t_1 + (-1.5 + (t_0 / ((v / (r * w)) / (r * w)))) else: tmp = t_1 + (-1.5 + (t_0 / (((-1.0 / r) / w) / (r * w)))) return tmp
function code(v, w, r) t_0 = Float64(Float64(v * -0.25) + 0.375) t_1 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((v <= -10000000.0) || !(v <= 1.0)) tmp = Float64(t_1 + Float64(-1.5 + Float64(t_0 / Float64(Float64(v / Float64(r * w)) / Float64(r * w))))); else tmp = Float64(t_1 + Float64(-1.5 + Float64(t_0 / Float64(Float64(Float64(-1.0 / r) / w) / Float64(r * w))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = (v * -0.25) + 0.375; t_1 = 2.0 / (r * r); tmp = 0.0; if ((v <= -10000000.0) || ~((v <= 1.0))) tmp = t_1 + (-1.5 + (t_0 / ((v / (r * w)) / (r * w)))); else tmp = t_1 + (-1.5 + (t_0 / (((-1.0 / r) / w) / (r * w)))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(v * -0.25), $MachinePrecision] + 0.375), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -10000000.0], N[Not[LessEqual[v, 1.0]], $MachinePrecision]], N[(t$95$1 + N[(-1.5 + N[(t$95$0 / N[(N[(v / N[(r * w), $MachinePrecision]), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(-1.5 + N[(t$95$0 / N[(N[(N[(-1.0 / r), $MachinePrecision] / w), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := v \cdot -0.25 + 0.375\\
t_1 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -10000000 \lor \neg \left(v \leq 1\right):\\
\;\;\;\;t\_1 + \left(-1.5 + \frac{t\_0}{\frac{\frac{v}{r \cdot w}}{r \cdot w}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(-1.5 + \frac{t\_0}{\frac{\frac{\frac{-1}{r}}{w}}{r \cdot w}}\right)\\
\end{array}
\end{array}
if v < -1e7 or 1 < v Initial program 81.8%
Simplified89.4%
fma-undefine89.4%
*-commutative89.4%
+-commutative89.4%
associate-*r/90.2%
*-commutative90.2%
associate-/l*90.2%
clear-num90.3%
un-div-inv90.2%
+-commutative90.2%
distribute-rgt-in90.2%
*-commutative90.2%
associate-*l*90.2%
metadata-eval90.2%
metadata-eval90.2%
associate-*r*84.3%
pow284.3%
pow284.3%
pow-prod-down99.8%
Applied egg-rr99.8%
*-un-lft-identity99.8%
div-inv99.7%
pow-flip99.7%
metadata-eval99.7%
Applied egg-rr99.7%
*-lft-identity99.7%
Simplified99.7%
sqr-pow99.7%
pow-prod-down99.7%
metadata-eval99.7%
inv-pow99.7%
div-inv99.8%
associate-/r*99.7%
Applied egg-rr99.7%
Taylor expanded in v around inf 99.5%
neg-mul-199.5%
distribute-neg-frac299.5%
distribute-rgt-neg-in99.5%
Simplified99.5%
if -1e7 < v < 1Initial program 87.6%
Simplified87.6%
fma-undefine87.6%
*-commutative87.6%
+-commutative87.6%
associate-*r/87.6%
*-commutative87.6%
associate-/l*87.6%
clear-num87.6%
un-div-inv87.6%
+-commutative87.6%
distribute-rgt-in87.6%
*-commutative87.6%
associate-*l*87.6%
metadata-eval87.6%
metadata-eval87.6%
associate-*r*78.5%
pow278.5%
pow278.5%
pow-prod-down99.8%
Applied egg-rr99.8%
*-un-lft-identity99.8%
div-inv99.8%
pow-flip99.8%
metadata-eval99.8%
Applied egg-rr99.8%
*-lft-identity99.8%
Simplified99.8%
sqr-pow99.7%
pow-prod-down99.8%
metadata-eval99.8%
inv-pow99.8%
div-inv99.8%
associate-/r*99.8%
Applied egg-rr99.8%
Taylor expanded in v around 0 99.8%
associate-/r*99.8%
Simplified99.8%
Final simplification99.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (or (<= v -2.9e+35) (not (<= v 550000.0)))
(+ t_0 (+ -1.5 (* (* v -0.25) (* r (* (* w w) (/ r (+ v -1.0)))))))
(+ t_0 (+ -1.5 (/ (+ (* v -0.25) 0.375) (/ (/ (/ -1.0 r) w) (* r w))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((v <= -2.9e+35) || !(v <= 550000.0)) {
tmp = t_0 + (-1.5 + ((v * -0.25) * (r * ((w * w) * (r / (v + -1.0))))));
} else {
tmp = t_0 + (-1.5 + (((v * -0.25) + 0.375) / (((-1.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 = 2.0d0 / (r * r)
if ((v <= (-2.9d+35)) .or. (.not. (v <= 550000.0d0))) then
tmp = t_0 + ((-1.5d0) + ((v * (-0.25d0)) * (r * ((w * w) * (r / (v + (-1.0d0)))))))
else
tmp = t_0 + ((-1.5d0) + (((v * (-0.25d0)) + 0.375d0) / ((((-1.0d0) / 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 tmp;
if ((v <= -2.9e+35) || !(v <= 550000.0)) {
tmp = t_0 + (-1.5 + ((v * -0.25) * (r * ((w * w) * (r / (v + -1.0))))));
} else {
tmp = t_0 + (-1.5 + (((v * -0.25) + 0.375) / (((-1.0 / r) / w) / (r * w))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if (v <= -2.9e+35) or not (v <= 550000.0): tmp = t_0 + (-1.5 + ((v * -0.25) * (r * ((w * w) * (r / (v + -1.0)))))) else: tmp = t_0 + (-1.5 + (((v * -0.25) + 0.375) / (((-1.0 / r) / w) / (r * w)))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((v <= -2.9e+35) || !(v <= 550000.0)) tmp = Float64(t_0 + Float64(-1.5 + Float64(Float64(v * -0.25) * Float64(r * Float64(Float64(w * w) * Float64(r / Float64(v + -1.0))))))); else tmp = Float64(t_0 + Float64(-1.5 + Float64(Float64(Float64(v * -0.25) + 0.375) / Float64(Float64(Float64(-1.0 / r) / w) / Float64(r * w))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if ((v <= -2.9e+35) || ~((v <= 550000.0))) tmp = t_0 + (-1.5 + ((v * -0.25) * (r * ((w * w) * (r / (v + -1.0)))))); else tmp = t_0 + (-1.5 + (((v * -0.25) + 0.375) / (((-1.0 / 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]}, If[Or[LessEqual[v, -2.9e+35], N[Not[LessEqual[v, 550000.0]], $MachinePrecision]], N[(t$95$0 + N[(-1.5 + N[(N[(v * -0.25), $MachinePrecision] * N[(r * N[(N[(w * w), $MachinePrecision] * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.5 + N[(N[(N[(v * -0.25), $MachinePrecision] + 0.375), $MachinePrecision] / N[(N[(N[(-1.0 / r), $MachinePrecision] / w), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -2.9 \cdot 10^{+35} \lor \neg \left(v \leq 550000\right):\\
\;\;\;\;t\_0 + \left(-1.5 + \left(v \cdot -0.25\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{v + -1}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \left(-1.5 + \frac{v \cdot -0.25 + 0.375}{\frac{\frac{\frac{-1}{r}}{w}}{r \cdot w}}\right)\\
\end{array}
\end{array}
if v < -2.89999999999999995e35 or 5.5e5 < v Initial program 82.6%
Simplified90.5%
Taylor expanded in v around inf 90.5%
*-commutative90.5%
Simplified90.5%
if -2.89999999999999995e35 < v < 5.5e5Initial program 86.6%
Simplified86.6%
fma-undefine86.6%
*-commutative86.6%
+-commutative86.6%
associate-*r/86.6%
*-commutative86.6%
associate-/l*86.6%
clear-num86.6%
un-div-inv86.6%
+-commutative86.6%
distribute-rgt-in86.6%
*-commutative86.6%
associate-*l*86.6%
metadata-eval86.6%
metadata-eval86.6%
associate-*r*77.9%
pow277.9%
pow277.9%
pow-prod-down99.8%
Applied egg-rr99.8%
*-un-lft-identity99.8%
div-inv99.8%
pow-flip99.8%
metadata-eval99.8%
Applied egg-rr99.8%
*-lft-identity99.8%
Simplified99.8%
sqr-pow99.7%
pow-prod-down99.8%
metadata-eval99.8%
inv-pow99.8%
div-inv99.8%
associate-/r*99.8%
Applied egg-rr99.8%
Taylor expanded in v around 0 99.1%
associate-/r*99.2%
Simplified99.2%
Final simplification94.9%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* r (* (* w w) (/ r (+ v -1.0))))) (t_1 (/ 2.0 (* r r))))
(if (or (<= v -3100.0) (not (<= v 550000.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 / (v + -1.0)));
double t_1 = 2.0 / (r * r);
double tmp;
if ((v <= -3100.0) || !(v <= 550000.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 / (v + (-1.0d0))))
t_1 = 2.0d0 / (r * r)
if ((v <= (-3100.0d0)) .or. (.not. (v <= 550000.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 / (v + -1.0)));
double t_1 = 2.0 / (r * r);
double tmp;
if ((v <= -3100.0) || !(v <= 550000.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 / (v + -1.0))) t_1 = 2.0 / (r * r) tmp = 0 if (v <= -3100.0) or not (v <= 550000.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(v + -1.0)))) t_1 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((v <= -3100.0) || !(v <= 550000.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 / (v + -1.0))); t_1 = 2.0 / (r * r); tmp = 0.0; if ((v <= -3100.0) || ~((v <= 550000.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[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -3100.0], N[Not[LessEqual[v, 550000.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}{v + -1}\right)\\
t_1 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -3100 \lor \neg \left(v \leq 550000\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 < -3100 or 5.5e5 < v Initial program 82.5%
Simplified90.1%
Taylor expanded in v around inf 89.9%
*-commutative89.9%
Simplified89.9%
if -3100 < v < 5.5e5Initial program 86.9%
Simplified86.9%
Taylor expanded in v around 0 87.7%
Final simplification88.8%
(FPCore (v w r)
:precision binary64
(if (<= r 1.15e-86)
(- (+ (/ (/ 2.0 r) r) 3.0) 4.5)
(if (<= r 7.8e+264)
(+ (/ 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))) 4.5)))))
double code(double v, double w, double r) {
double tmp;
if (r <= 1.15e-86) {
tmp = (((2.0 / r) / r) + 3.0) - 4.5;
} else if (r <= 7.8e+264) {
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))) - 4.5);
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: tmp
if (r <= 1.15d-86) then
tmp = (((2.0d0 / r) / r) + 3.0d0) - 4.5d0
else if (r <= 7.8d+264) 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))) - 4.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 1.15e-86) {
tmp = (((2.0 / r) / r) + 3.0) - 4.5;
} else if (r <= 7.8e+264) {
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))) - 4.5);
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 1.15e-86: tmp = (((2.0 / r) / r) + 3.0) - 4.5 elif r <= 7.8e+264: 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))) - 4.5) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 1.15e-86) tmp = Float64(Float64(Float64(Float64(2.0 / r) / r) + 3.0) - 4.5); elseif (r <= 7.8e+264) 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) / v))) - 4.5)); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 1.15e-86) tmp = (((2.0 / r) / r) + 3.0) - 4.5; elseif (r <= 7.8e+264) 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))) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 1.15e-86], N[(N[(N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision] + 3.0), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 7.8e+264], 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] / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.15 \cdot 10^{-86}:\\
\;\;\;\;\left(\frac{\frac{2}{r}}{r} + 3\right) - 4.5\\
\mathbf{elif}\;r \leq 7.8 \cdot 10^{+264}:\\
\;\;\;\;\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}\right) - 4.5\right)\\
\end{array}
\end{array}
if r < 1.14999999999999998e-86Initial program 80.8%
Simplified77.0%
Taylor expanded in r around 0 64.1%
associate-/r*99.8%
div-inv99.8%
Applied egg-rr64.0%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified64.1%
if 1.14999999999999998e-86 < r < 7.79999999999999987e264Initial program 95.3%
Simplified99.8%
Taylor expanded in v around 0 79.5%
if 7.79999999999999987e264 < r Initial program 87.2%
associate--l-87.2%
associate-*l*86.8%
sqr-neg86.8%
associate-*l*87.2%
associate-/l*93.3%
fma-define93.3%
Simplified93.3%
associate-/r*99.8%
div-inv99.8%
Applied egg-rr93.3%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified93.3%
associate-/l*93.3%
*-commutative93.3%
associate-*r/93.3%
associate-*l*99.9%
associate-*r*99.9%
Applied egg-rr99.9%
Taylor expanded in r around inf 99.9%
Taylor expanded in v around inf 92.6%
associate-*r/92.6%
neg-mul-192.6%
distribute-rgt-neg-in92.6%
Simplified92.6%
Final simplification69.3%
(FPCore (v w r)
:precision binary64
(if (<= r 1.25e-86)
(- (+ (/ (/ 2.0 r) r) 3.0) 4.5)
(if (<= r 7.2e+263)
(+ (/ 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)))) 4.5)))))
double code(double v, double w, double r) {
double tmp;
if (r <= 1.25e-86) {
tmp = (((2.0 / r) / r) + 3.0) - 4.5;
} else if (r <= 7.2e+263) {
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)))) - 4.5);
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: tmp
if (r <= 1.25d-86) then
tmp = (((2.0d0 / r) / r) + 3.0d0) - 4.5d0
else if (r <= 7.2d+263) 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)))) - 4.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 1.25e-86) {
tmp = (((2.0 / r) / r) + 3.0) - 4.5;
} else if (r <= 7.2e+263) {
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)))) - 4.5);
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 1.25e-86: tmp = (((2.0 / r) / r) + 3.0) - 4.5 elif r <= 7.2e+263: 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)))) - 4.5) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 1.25e-86) tmp = Float64(Float64(Float64(Float64(2.0 / r) / r) + 3.0) - 4.5); elseif (r <= 7.2e+263) 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(r * Float64(w / v)))) - 4.5)); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 1.25e-86) tmp = (((2.0 / r) / r) + 3.0) - 4.5; elseif (r <= 7.2e+263) 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)))) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 1.25e-86], N[(N[(N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision] + 3.0), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 7.2e+263], 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[(r * N[(w / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.25 \cdot 10^{-86}:\\
\;\;\;\;\left(\frac{\frac{2}{r}}{r} + 3\right) - 4.5\\
\mathbf{elif}\;r \leq 7.2 \cdot 10^{+263}:\\
\;\;\;\;\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 \left(r \cdot \frac{w}{v}\right)\right) - 4.5\right)\\
\end{array}
\end{array}
if r < 1.25e-86Initial program 80.8%
Simplified77.0%
Taylor expanded in r around 0 64.1%
associate-/r*99.8%
div-inv99.8%
Applied egg-rr64.0%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified64.1%
if 1.25e-86 < r < 7.19999999999999956e263Initial program 95.3%
Simplified99.8%
Taylor expanded in v around 0 79.5%
if 7.19999999999999956e263 < r Initial program 87.2%
associate--l-87.2%
associate-*l*86.8%
sqr-neg86.8%
associate-*l*87.2%
associate-/l*93.3%
fma-define93.3%
Simplified93.3%
associate-/r*99.8%
div-inv99.8%
Applied egg-rr93.3%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified93.3%
associate-/l*93.3%
*-commutative93.3%
associate-*r/93.3%
associate-*l*99.9%
associate-*r*99.9%
Applied egg-rr99.9%
Taylor expanded in r around inf 99.9%
Taylor expanded in v around inf 92.6%
mul-1-neg92.6%
associate-/l*79.1%
distribute-lft-neg-in79.1%
Simplified79.1%
Final simplification68.6%
(FPCore (v w r)
:precision binary64
(if (<= r 2.6e-86)
(- (+ (/ (/ 2.0 r) r) 3.0) 4.5)
(if (<= r 3.2e+237)
(+ (/ 2.0 (* r r)) (+ -1.5 (* 0.375 (* r (* (* w w) (/ r (+ v -1.0)))))))
(- 3.0 (+ 4.5 (* (* (* r w) (* r w)) (* 0.125 (+ 3.0 (* v -2.0)))))))))
double code(double v, double w, double r) {
double tmp;
if (r <= 2.6e-86) {
tmp = (((2.0 / r) / r) + 3.0) - 4.5;
} else if (r <= 3.2e+237) {
tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0))))));
} else {
tmp = 3.0 - (4.5 + (((r * w) * (r * w)) * (0.125 * (3.0 + (v * -2.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) :: tmp
if (r <= 2.6d-86) then
tmp = (((2.0d0 / r) / r) + 3.0d0) - 4.5d0
else if (r <= 3.2d+237) then
tmp = (2.0d0 / (r * r)) + ((-1.5d0) + (0.375d0 * (r * ((w * w) * (r / (v + (-1.0d0)))))))
else
tmp = 3.0d0 - (4.5d0 + (((r * w) * (r * w)) * (0.125d0 * (3.0d0 + (v * (-2.0d0))))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 2.6e-86) {
tmp = (((2.0 / r) / r) + 3.0) - 4.5;
} else if (r <= 3.2e+237) {
tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0))))));
} else {
tmp = 3.0 - (4.5 + (((r * w) * (r * w)) * (0.125 * (3.0 + (v * -2.0)))));
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 2.6e-86: tmp = (((2.0 / r) / r) + 3.0) - 4.5 elif r <= 3.2e+237: tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0)))))) else: tmp = 3.0 - (4.5 + (((r * w) * (r * w)) * (0.125 * (3.0 + (v * -2.0))))) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 2.6e-86) tmp = Float64(Float64(Float64(Float64(2.0 / r) / r) + 3.0) - 4.5); elseif (r <= 3.2e+237) 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(Float64(r * w) * Float64(r * w)) * Float64(0.125 * Float64(3.0 + Float64(v * -2.0)))))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 2.6e-86) tmp = (((2.0 / r) / r) + 3.0) - 4.5; elseif (r <= 3.2e+237) tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0)))))); else tmp = 3.0 - (4.5 + (((r * w) * (r * w)) * (0.125 * (3.0 + (v * -2.0))))); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 2.6e-86], N[(N[(N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision] + 3.0), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 3.2e+237], 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[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] * N[(0.125 * N[(3.0 + N[(v * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 2.6 \cdot 10^{-86}:\\
\;\;\;\;\left(\frac{\frac{2}{r}}{r} + 3\right) - 4.5\\
\mathbf{elif}\;r \leq 3.2 \cdot 10^{+237}:\\
\;\;\;\;\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(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot \left(0.125 \cdot \left(3 + v \cdot -2\right)\right)\right)\\
\end{array}
\end{array}
if r < 2.6000000000000001e-86Initial program 80.8%
Simplified77.0%
Taylor expanded in r around 0 64.1%
associate-/r*99.8%
div-inv99.8%
Applied egg-rr64.0%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified64.1%
if 2.6000000000000001e-86 < r < 3.20000000000000017e237Initial program 95.0%
Simplified99.8%
Taylor expanded in v around 0 81.8%
if 3.20000000000000017e237 < r Initial program 89.4%
associate--l-89.4%
associate-*l*89.1%
sqr-neg89.1%
associate-*l*89.4%
associate-/l*94.5%
fma-define94.5%
Simplified94.5%
associate-/r*99.8%
div-inv99.8%
Applied egg-rr94.5%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified94.5%
associate-/l*94.5%
*-commutative94.5%
associate-*r/94.5%
associate-*l*99.9%
associate-*r*99.9%
Applied egg-rr99.9%
Taylor expanded in r around inf 99.9%
Taylor expanded in v around 0 42.1%
Final simplification66.6%
(FPCore (v w r)
:precision binary64
(if (<= r 5.9e-6)
(+
(/ 2.0 (* r r))
(+ -1.5 (/ (+ (* v -0.25) 0.375) (/ (/ (/ -1.0 r) w) (* r w)))))
(-
3.0
(+
(* (* 0.125 (+ 3.0 (* v -2.0))) (* (* r w) (/ w (/ (- 1.0 v) r))))
4.5))))
double code(double v, double w, double r) {
double tmp;
if (r <= 5.9e-6) {
tmp = (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) / (((-1.0 / r) / w) / (r * w))));
} else {
tmp = 3.0 - (((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (w / ((1.0 - v) / r)))) + 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.9d-6) then
tmp = (2.0d0 / (r * r)) + ((-1.5d0) + (((v * (-0.25d0)) + 0.375d0) / ((((-1.0d0) / r) / w) / (r * w))))
else
tmp = 3.0d0 - (((0.125d0 * (3.0d0 + (v * (-2.0d0)))) * ((r * w) * (w / ((1.0d0 - v) / r)))) + 4.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 5.9e-6) {
tmp = (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) / (((-1.0 / r) / w) / (r * w))));
} else {
tmp = 3.0 - (((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (w / ((1.0 - v) / r)))) + 4.5);
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 5.9e-6: tmp = (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) / (((-1.0 / r) / w) / (r * w)))) else: tmp = 3.0 - (((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (w / ((1.0 - v) / r)))) + 4.5) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 5.9e-6) tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(Float64(Float64(v * -0.25) + 0.375) / Float64(Float64(Float64(-1.0 / r) / w) / Float64(r * w))))); else tmp = Float64(3.0 - Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) * Float64(Float64(r * w) * Float64(w / Float64(Float64(1.0 - v) / r)))) + 4.5)); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 5.9e-6) tmp = (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) / (((-1.0 / r) / w) / (r * w)))); else tmp = 3.0 - (((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (w / ((1.0 - v) / r)))) + 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 5.9e-6], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(N[(N[(v * -0.25), $MachinePrecision] + 0.375), $MachinePrecision] / N[(N[(N[(-1.0 / r), $MachinePrecision] / w), $MachinePrecision] / N[(r * w), $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 / N[(N[(1.0 - v), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 4.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 5.9 \cdot 10^{-6}:\\
\;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 + \frac{v \cdot -0.25 + 0.375}{\frac{\frac{\frac{-1}{r}}{w}}{r \cdot w}}\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{w}{\frac{1 - v}{r}}\right) + 4.5\right)\\
\end{array}
\end{array}
if r < 5.90000000000000026e-6Initial program 81.8%
Simplified85.2%
fma-undefine85.2%
*-commutative85.2%
+-commutative85.2%
associate-*r/85.7%
*-commutative85.7%
associate-/l*85.7%
clear-num85.7%
un-div-inv85.7%
+-commutative85.7%
distribute-rgt-in85.7%
*-commutative85.7%
associate-*l*85.7%
metadata-eval85.7%
metadata-eval85.7%
associate-*r*79.3%
pow279.3%
pow279.3%
pow-prod-down99.8%
Applied egg-rr99.8%
*-un-lft-identity99.8%
div-inv99.8%
pow-flip99.8%
metadata-eval99.8%
Applied egg-rr99.8%
*-lft-identity99.8%
Simplified99.8%
sqr-pow99.7%
pow-prod-down99.8%
metadata-eval99.8%
inv-pow99.8%
div-inv99.8%
associate-/r*99.8%
Applied egg-rr99.8%
Taylor expanded in v around 0 84.3%
associate-/r*84.4%
Simplified84.4%
if 5.90000000000000026e-6 < r Initial program 92.9%
associate--l-92.9%
associate-*l*85.0%
sqr-neg85.0%
associate-*l*92.9%
associate-/l*98.4%
fma-define98.4%
Simplified98.4%
associate-/r*99.8%
div-inv99.8%
Applied egg-rr98.4%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified98.4%
associate-/l*98.4%
*-commutative98.4%
associate-*r/98.4%
associate-*l*99.8%
associate-*r*99.8%
Applied egg-rr99.8%
Taylor expanded in r around inf 98.4%
clear-num98.3%
un-div-inv98.3%
Applied egg-rr98.3%
Final simplification87.9%
(FPCore (v w r)
:precision binary64
(if (<= r 5.9e-6)
(+
(/ 2.0 (* r r))
(+ -1.5 (/ (+ (* v -0.25) 0.375) (/ (/ (/ -1.0 r) w) (* r w)))))
(+
3.0
(-
(* (* 0.125 (+ 3.0 (* v -2.0))) (* (* r w) (* w (/ r (+ v -1.0)))))
4.5))))
double code(double v, double w, double r) {
double tmp;
if (r <= 5.9e-6) {
tmp = (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) / (((-1.0 / r) / w) / (r * w))));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (w * (r / (v + -1.0))))) - 4.5);
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: tmp
if (r <= 5.9d-6) then
tmp = (2.0d0 / (r * r)) + ((-1.5d0) + (((v * (-0.25d0)) + 0.375d0) / ((((-1.0d0) / r) / w) / (r * w))))
else
tmp = 3.0d0 + (((0.125d0 * (3.0d0 + (v * (-2.0d0)))) * ((r * w) * (w * (r / (v + (-1.0d0)))))) - 4.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 5.9e-6) {
tmp = (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) / (((-1.0 / r) / w) / (r * w))));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (w * (r / (v + -1.0))))) - 4.5);
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 5.9e-6: tmp = (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) / (((-1.0 / r) / w) / (r * w)))) else: tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (w * (r / (v + -1.0))))) - 4.5) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 5.9e-6) tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(Float64(Float64(v * -0.25) + 0.375) / Float64(Float64(Float64(-1.0 / r) / w) / Float64(r * w))))); else tmp = Float64(3.0 + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) * Float64(Float64(r * w) * Float64(w * Float64(r / Float64(v + -1.0))))) - 4.5)); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 5.9e-6) tmp = (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) / (((-1.0 / r) / w) / (r * w)))); else tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * ((r * w) * (w * (r / (v + -1.0))))) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 5.9e-6], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(N[(N[(v * -0.25), $MachinePrecision] + 0.375), $MachinePrecision] / N[(N[(N[(-1.0 / r), $MachinePrecision] / w), $MachinePrecision] / N[(r * w), $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 * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 5.9 \cdot 10^{-6}:\\
\;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 + \frac{v \cdot -0.25 + 0.375}{\frac{\frac{\frac{-1}{r}}{w}}{r \cdot w}}\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 \frac{r}{v + -1}\right)\right) - 4.5\right)\\
\end{array}
\end{array}
if r < 5.90000000000000026e-6Initial program 81.8%
Simplified85.2%
fma-undefine85.2%
*-commutative85.2%
+-commutative85.2%
associate-*r/85.7%
*-commutative85.7%
associate-/l*85.7%
clear-num85.7%
un-div-inv85.7%
+-commutative85.7%
distribute-rgt-in85.7%
*-commutative85.7%
associate-*l*85.7%
metadata-eval85.7%
metadata-eval85.7%
associate-*r*79.3%
pow279.3%
pow279.3%
pow-prod-down99.8%
Applied egg-rr99.8%
*-un-lft-identity99.8%
div-inv99.8%
pow-flip99.8%
metadata-eval99.8%
Applied egg-rr99.8%
*-lft-identity99.8%
Simplified99.8%
sqr-pow99.7%
pow-prod-down99.8%
metadata-eval99.8%
inv-pow99.8%
div-inv99.8%
associate-/r*99.8%
Applied egg-rr99.8%
Taylor expanded in v around 0 84.3%
associate-/r*84.4%
Simplified84.4%
if 5.90000000000000026e-6 < r Initial program 92.9%
associate--l-92.9%
associate-*l*85.0%
sqr-neg85.0%
associate-*l*92.9%
associate-/l*98.4%
fma-define98.4%
Simplified98.4%
associate-/r*99.8%
div-inv99.8%
Applied egg-rr98.4%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified98.4%
associate-/l*98.4%
*-commutative98.4%
associate-*r/98.4%
associate-*l*99.8%
associate-*r*99.8%
Applied egg-rr99.8%
Taylor expanded in r around inf 98.4%
Final simplification87.9%
(FPCore (v w r) :precision binary64 (+ (- -1.5 (/ (+ (* v -0.25) 0.375) (/ (- 1.0 v) (* (* r w) (* r w))))) (/ 2.0 (* r r))))
double code(double v, double w, double r) {
return (-1.5 - (((v * -0.25) + 0.375) / ((1.0 - v) / ((r * w) * (r * w))))) + (2.0 / (r * r));
}
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) - (((v * (-0.25d0)) + 0.375d0) / ((1.0d0 - v) / ((r * w) * (r * w))))) + (2.0d0 / (r * r))
end function
public static double code(double v, double w, double r) {
return (-1.5 - (((v * -0.25) + 0.375) / ((1.0 - v) / ((r * w) * (r * w))))) + (2.0 / (r * r));
}
def code(v, w, r): return (-1.5 - (((v * -0.25) + 0.375) / ((1.0 - v) / ((r * w) * (r * w))))) + (2.0 / (r * r))
function code(v, w, r) return Float64(Float64(-1.5 - Float64(Float64(Float64(v * -0.25) + 0.375) / Float64(Float64(1.0 - v) / Float64(Float64(r * w) * Float64(r * w))))) + Float64(2.0 / Float64(r * r))) end
function tmp = code(v, w, r) tmp = (-1.5 - (((v * -0.25) + 0.375) / ((1.0 - v) / ((r * w) * (r * w))))) + (2.0 / (r * r)); end
code[v_, w_, r_] := N[(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] + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\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) + \frac{2}{r \cdot r}
\end{array}
Initial program 84.6%
Simplified88.5%
fma-undefine88.5%
*-commutative88.5%
+-commutative88.5%
associate-*r/88.9%
*-commutative88.9%
associate-/l*88.9%
clear-num89.0%
un-div-inv88.9%
+-commutative88.9%
distribute-rgt-in88.9%
*-commutative88.9%
associate-*l*88.9%
metadata-eval88.9%
metadata-eval88.9%
associate-*r*81.5%
pow281.5%
pow281.5%
pow-prod-down99.8%
Applied egg-rr99.8%
unpow299.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (if (<= r 5800000.0) (- (+ (/ (/ 2.0 r) r) 3.0) 4.5) (- 3.0 (+ 4.5 (* (* (* r w) (* r w)) (* 0.125 (+ 3.0 (* v -2.0))))))))
double code(double v, double w, double r) {
double tmp;
if (r <= 5800000.0) {
tmp = (((2.0 / r) / r) + 3.0) - 4.5;
} else {
tmp = 3.0 - (4.5 + (((r * w) * (r * w)) * (0.125 * (3.0 + (v * -2.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) :: tmp
if (r <= 5800000.0d0) then
tmp = (((2.0d0 / r) / r) + 3.0d0) - 4.5d0
else
tmp = 3.0d0 - (4.5d0 + (((r * w) * (r * w)) * (0.125d0 * (3.0d0 + (v * (-2.0d0))))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 5800000.0) {
tmp = (((2.0 / r) / r) + 3.0) - 4.5;
} else {
tmp = 3.0 - (4.5 + (((r * w) * (r * w)) * (0.125 * (3.0 + (v * -2.0)))));
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 5800000.0: tmp = (((2.0 / r) / r) + 3.0) - 4.5 else: tmp = 3.0 - (4.5 + (((r * w) * (r * w)) * (0.125 * (3.0 + (v * -2.0))))) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 5800000.0) tmp = Float64(Float64(Float64(Float64(2.0 / r) / r) + 3.0) - 4.5); else tmp = Float64(3.0 - Float64(4.5 + Float64(Float64(Float64(r * w) * Float64(r * w)) * Float64(0.125 * Float64(3.0 + Float64(v * -2.0)))))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 5800000.0) tmp = (((2.0 / r) / r) + 3.0) - 4.5; else tmp = 3.0 - (4.5 + (((r * w) * (r * w)) * (0.125 * (3.0 + (v * -2.0))))); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 5800000.0], N[(N[(N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision] + 3.0), $MachinePrecision] - 4.5), $MachinePrecision], N[(3.0 - N[(4.5 + N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] * N[(0.125 * N[(3.0 + N[(v * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 5800000:\\
\;\;\;\;\left(\frac{\frac{2}{r}}{r} + 3\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;3 - \left(4.5 + \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot \left(0.125 \cdot \left(3 + v \cdot -2\right)\right)\right)\\
\end{array}
\end{array}
if r < 5.8e6Initial program 82.1%
Simplified78.5%
Taylor expanded in r around 0 64.4%
associate-/r*99.8%
div-inv99.7%
Applied egg-rr64.3%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified64.4%
if 5.8e6 < r Initial program 92.5%
associate--l-92.5%
associate-*l*84.3%
sqr-neg84.3%
associate-*l*92.5%
associate-/l*98.4%
fma-define98.4%
Simplified98.4%
associate-/r*99.8%
div-inv99.8%
Applied egg-rr98.4%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified98.4%
associate-/l*98.4%
*-commutative98.4%
associate-*r/98.3%
associate-*l*99.8%
associate-*r*99.9%
Applied egg-rr99.9%
Taylor expanded in r around inf 99.9%
Taylor expanded in v around 0 64.6%
Final simplification64.5%
(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(Float64(2.0 / 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[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision] + 3.0), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{\frac{2}{r}}{r} + 3\right) - 4.5
\end{array}
Initial program 84.6%
Simplified79.1%
Taylor expanded in r around 0 55.4%
associate-/r*99.8%
div-inv99.7%
Applied egg-rr55.3%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified55.4%
Final simplification55.4%
(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 84.6%
Simplified79.1%
Taylor expanded in r around 0 55.4%
Final simplification55.4%
(FPCore (v w r) :precision binary64 -1.5)
double code(double v, double w, double r) {
return -1.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = -1.5d0
end function
public static double code(double v, double w, double r) {
return -1.5;
}
def code(v, w, r): return -1.5
function code(v, w, r) return -1.5 end
function tmp = code(v, w, r) tmp = -1.5; end
code[v_, w_, r_] := -1.5
\begin{array}{l}
\\
-1.5
\end{array}
Initial program 84.6%
Simplified79.1%
Taylor expanded in r around 0 55.4%
Taylor expanded in r around inf 14.3%
herbie shell --seed 2024170
(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))