
(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 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5
\end{array}
(FPCore (v w r) :precision binary64 (- (+ 3.0 (/ 2.0 (* r r))) (+ 4.5 (* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (/ (* r w) (- 1.0 v)))))))
double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / (1.0 - v)))));
}
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 + ((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * ((r * w) / (1.0d0 - v)))))
end function
public static double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / (1.0 - v)))));
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / (1.0 - v)))))
function code(v, w, r) return Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(4.5 + Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) * Float64(Float64(r * w) / Float64(1.0 - v)))))) end
function tmp = code(v, w, r) tmp = (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / (1.0 - v))))); end
code[v_, w_, r_] := N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(4.5 + N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \frac{2}{r \cdot r}\right) - \left(4.5 + \left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \frac{r \cdot w}{1 - v}\right)\right)
\end{array}
Initial program 81.5%
associate--l-81.5%
associate-*l*75.5%
sqr-neg75.5%
associate-*l*81.5%
associate-/l*84.7%
fma-define84.7%
Simplified84.7%
add-sqr-sqrt84.7%
*-un-lft-identity84.7%
times-frac84.7%
*-commutative84.7%
sqrt-prod34.4%
*-commutative34.4%
sqrt-prod34.4%
sqrt-prod16.4%
add-sqr-sqrt25.9%
associate-*r*25.9%
add-sqr-sqrt67.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (+ 0.375 (* v -0.25)))
(t_1 (* (* r w) (* r w)))
(t_2 (/ 2.0 (* r r))))
(if (or (<= v -2.3e+47) (not (<= v 0.0009)))
(+ t_2 (+ -1.5 (/ t_0 (/ v t_1))))
(+ t_2 (- -1.5 (/ t_0 (/ 1.0 t_1)))))))
double code(double v, double w, double r) {
double t_0 = 0.375 + (v * -0.25);
double t_1 = (r * w) * (r * w);
double t_2 = 2.0 / (r * r);
double tmp;
if ((v <= -2.3e+47) || !(v <= 0.0009)) {
tmp = t_2 + (-1.5 + (t_0 / (v / t_1)));
} else {
tmp = t_2 + (-1.5 - (t_0 / (1.0 / 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) :: t_2
real(8) :: tmp
t_0 = 0.375d0 + (v * (-0.25d0))
t_1 = (r * w) * (r * w)
t_2 = 2.0d0 / (r * r)
if ((v <= (-2.3d+47)) .or. (.not. (v <= 0.0009d0))) then
tmp = t_2 + ((-1.5d0) + (t_0 / (v / t_1)))
else
tmp = t_2 + ((-1.5d0) - (t_0 / (1.0d0 / t_1)))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 0.375 + (v * -0.25);
double t_1 = (r * w) * (r * w);
double t_2 = 2.0 / (r * r);
double tmp;
if ((v <= -2.3e+47) || !(v <= 0.0009)) {
tmp = t_2 + (-1.5 + (t_0 / (v / t_1)));
} else {
tmp = t_2 + (-1.5 - (t_0 / (1.0 / t_1)));
}
return tmp;
}
def code(v, w, r): t_0 = 0.375 + (v * -0.25) t_1 = (r * w) * (r * w) t_2 = 2.0 / (r * r) tmp = 0 if (v <= -2.3e+47) or not (v <= 0.0009): tmp = t_2 + (-1.5 + (t_0 / (v / t_1))) else: tmp = t_2 + (-1.5 - (t_0 / (1.0 / t_1))) return tmp
function code(v, w, r) t_0 = Float64(0.375 + Float64(v * -0.25)) t_1 = Float64(Float64(r * w) * Float64(r * w)) t_2 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((v <= -2.3e+47) || !(v <= 0.0009)) tmp = Float64(t_2 + Float64(-1.5 + Float64(t_0 / Float64(v / t_1)))); else tmp = Float64(t_2 + Float64(-1.5 - Float64(t_0 / Float64(1.0 / t_1)))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 0.375 + (v * -0.25); t_1 = (r * w) * (r * w); t_2 = 2.0 / (r * r); tmp = 0.0; if ((v <= -2.3e+47) || ~((v <= 0.0009))) tmp = t_2 + (-1.5 + (t_0 / (v / t_1))); else tmp = t_2 + (-1.5 - (t_0 / (1.0 / t_1))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -2.3e+47], N[Not[LessEqual[v, 0.0009]], $MachinePrecision]], N[(t$95$2 + N[(-1.5 + N[(t$95$0 / N[(v / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(-1.5 - N[(t$95$0 / N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.375 + v \cdot -0.25\\
t_1 := \left(r \cdot w\right) \cdot \left(r \cdot w\right)\\
t_2 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -2.3 \cdot 10^{+47} \lor \neg \left(v \leq 0.0009\right):\\
\;\;\;\;t\_2 + \left(-1.5 + \frac{t\_0}{\frac{v}{t\_1}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2 + \left(-1.5 - \frac{t\_0}{\frac{1}{t\_1}}\right)\\
\end{array}
\end{array}
if v < -2.2999999999999999e47 or 8.9999999999999998e-4 < v Initial program 75.6%
Simplified81.4%
associate-*l*81.4%
fma-undefine81.4%
*-commutative81.4%
+-commutative81.4%
metadata-eval81.4%
cancel-sign-sub-inv81.4%
associate-*r/82.3%
*-commutative82.3%
associate-/l*83.1%
associate-*l*83.1%
clear-num83.1%
un-div-inv83.2%
Applied egg-rr99.8%
unpow299.8%
Applied egg-rr99.8%
Taylor expanded in v around inf 99.8%
neg-mul-199.8%
Simplified99.8%
if -2.2999999999999999e47 < v < 8.9999999999999998e-4Initial program 86.0%
Simplified86.0%
associate-*l*86.0%
fma-undefine86.0%
*-commutative86.0%
+-commutative86.0%
metadata-eval86.0%
cancel-sign-sub-inv86.0%
associate-*r/86.0%
*-commutative86.0%
associate-/l*86.0%
associate-*l*86.0%
clear-num86.0%
un-div-inv86.0%
Applied egg-rr99.3%
unpow299.3%
Applied egg-rr99.3%
Taylor expanded in v around 0 98.8%
Final simplification99.2%
(FPCore (v w r)
:precision binary64
(if (<= r 1.75e-118)
(+ -1.5 (/ (/ 2.0 r) r))
(if (<= r 240.0)
(+
(/ 2.0 (* r r))
(- -1.5 (* (* v -0.25) (* r (* (* w w) (/ r (- 1.0 v)))))))
(-
3.0
(+
4.5
(* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (/ (* r w) (- 1.0 v)))))))))
double code(double v, double w, double r) {
double tmp;
if (r <= 1.75e-118) {
tmp = -1.5 + ((2.0 / r) / r);
} else if (r <= 240.0) {
tmp = (2.0 / (r * r)) + (-1.5 - ((v * -0.25) * (r * ((w * w) * (r / (1.0 - v))))));
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / (1.0 - v)))));
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: tmp
if (r <= 1.75d-118) then
tmp = (-1.5d0) + ((2.0d0 / r) / r)
else if (r <= 240.0d0) then
tmp = (2.0d0 / (r * r)) + ((-1.5d0) - ((v * (-0.25d0)) * (r * ((w * w) * (r / (1.0d0 - v))))))
else
tmp = 3.0d0 - (4.5d0 + ((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * ((r * w) / (1.0d0 - v)))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 1.75e-118) {
tmp = -1.5 + ((2.0 / r) / r);
} else if (r <= 240.0) {
tmp = (2.0 / (r * r)) + (-1.5 - ((v * -0.25) * (r * ((w * w) * (r / (1.0 - v))))));
} else {
tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / (1.0 - v)))));
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 1.75e-118: tmp = -1.5 + ((2.0 / r) / r) elif r <= 240.0: tmp = (2.0 / (r * r)) + (-1.5 - ((v * -0.25) * (r * ((w * w) * (r / (1.0 - v)))))) else: tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / (1.0 - v))))) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 1.75e-118) tmp = Float64(-1.5 + Float64(Float64(2.0 / r) / r)); elseif (r <= 240.0) tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 - Float64(Float64(v * -0.25) * Float64(r * Float64(Float64(w * w) * Float64(r / Float64(1.0 - v))))))); else tmp = Float64(3.0 - Float64(4.5 + Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) * Float64(Float64(r * w) / Float64(1.0 - v)))))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 1.75e-118) tmp = -1.5 + ((2.0 / r) / r); elseif (r <= 240.0) tmp = (2.0 / (r * r)) + (-1.5 - ((v * -0.25) * (r * ((w * w) * (r / (1.0 - v)))))); else tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / (1.0 - v))))); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 1.75e-118], N[(-1.5 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision], If[LessEqual[r, 240.0], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[(N[(v * -0.25), $MachinePrecision] * N[(r * N[(N[(w * w), $MachinePrecision] * N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 - N[(4.5 + N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.75 \cdot 10^{-118}:\\
\;\;\;\;-1.5 + \frac{\frac{2}{r}}{r}\\
\mathbf{elif}\;r \leq 240:\\
\;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 - \left(v \cdot -0.25\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{1 - v}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;3 - \left(4.5 + \left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \frac{r \cdot w}{1 - v}\right)\right)\\
\end{array}
\end{array}
if r < 1.75e-118Initial program 78.2%
Simplified74.3%
Taylor expanded in r around 0 66.0%
+-commutative66.0%
associate--l+66.0%
div-inv66.0%
pow266.0%
pow-flip66.1%
metadata-eval66.1%
metadata-eval66.1%
Applied egg-rr66.1%
metadata-eval66.1%
pow-flip66.0%
pow266.0%
div-inv66.0%
associate-/r*66.1%
Applied egg-rr66.1%
if 1.75e-118 < r < 240Initial program 84.4%
Simplified92.1%
Taylor expanded in v around inf 83.7%
*-commutative83.7%
Simplified83.7%
if 240 < r Initial program 92.7%
associate--l-92.7%
associate-*l*83.1%
sqr-neg83.1%
associate-*l*92.7%
associate-/l*96.3%
fma-define96.4%
Simplified96.3%
add-sqr-sqrt96.2%
*-un-lft-identity96.2%
times-frac96.2%
*-commutative96.2%
sqrt-prod96.2%
*-commutative96.2%
sqrt-prod96.1%
sqrt-prod42.2%
add-sqr-sqrt52.2%
associate-*r*52.3%
add-sqr-sqrt52.3%
Applied egg-rr99.8%
Taylor expanded in r around inf 99.8%
/-rgt-identity99.8%
Applied egg-rr99.8%
Final simplification73.7%
(FPCore (v w r)
:precision binary64
(if (<= r 1.32e-118)
(+ -1.5 (/ (/ 2.0 r) r))
(if (<= r 11.8)
(+
(/ 2.0 (* r r))
(- -1.5 (* (* v -0.25) (* r (* (* w w) (/ r (- 1.0 v)))))))
(-
(+ 3.0 (* (* r (* w (+ 0.375 (* v -0.25)))) (* w (/ r (+ v -1.0)))))
4.5))))
double code(double v, double w, double r) {
double tmp;
if (r <= 1.32e-118) {
tmp = -1.5 + ((2.0 / r) / r);
} else if (r <= 11.8) {
tmp = (2.0 / (r * r)) + (-1.5 - ((v * -0.25) * (r * ((w * w) * (r / (1.0 - v))))));
} else {
tmp = (3.0 + ((r * (w * (0.375 + (v * -0.25)))) * (w * (r / (v + -1.0))))) - 4.5;
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: tmp
if (r <= 1.32d-118) then
tmp = (-1.5d0) + ((2.0d0 / r) / r)
else if (r <= 11.8d0) then
tmp = (2.0d0 / (r * r)) + ((-1.5d0) - ((v * (-0.25d0)) * (r * ((w * w) * (r / (1.0d0 - v))))))
else
tmp = (3.0d0 + ((r * (w * (0.375d0 + (v * (-0.25d0))))) * (w * (r / (v + (-1.0d0)))))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 1.32e-118) {
tmp = -1.5 + ((2.0 / r) / r);
} else if (r <= 11.8) {
tmp = (2.0 / (r * r)) + (-1.5 - ((v * -0.25) * (r * ((w * w) * (r / (1.0 - v))))));
} else {
tmp = (3.0 + ((r * (w * (0.375 + (v * -0.25)))) * (w * (r / (v + -1.0))))) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 1.32e-118: tmp = -1.5 + ((2.0 / r) / r) elif r <= 11.8: tmp = (2.0 / (r * r)) + (-1.5 - ((v * -0.25) * (r * ((w * w) * (r / (1.0 - v)))))) else: tmp = (3.0 + ((r * (w * (0.375 + (v * -0.25)))) * (w * (r / (v + -1.0))))) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 1.32e-118) tmp = Float64(-1.5 + Float64(Float64(2.0 / r) / r)); elseif (r <= 11.8) tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 - Float64(Float64(v * -0.25) * Float64(r * Float64(Float64(w * w) * Float64(r / Float64(1.0 - v))))))); else tmp = Float64(Float64(3.0 + Float64(Float64(r * Float64(w * Float64(0.375 + Float64(v * -0.25)))) * Float64(w * Float64(r / Float64(v + -1.0))))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 1.32e-118) tmp = -1.5 + ((2.0 / r) / r); elseif (r <= 11.8) tmp = (2.0 / (r * r)) + (-1.5 - ((v * -0.25) * (r * ((w * w) * (r / (1.0 - v)))))); else tmp = (3.0 + ((r * (w * (0.375 + (v * -0.25)))) * (w * (r / (v + -1.0))))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 1.32e-118], N[(-1.5 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision], If[LessEqual[r, 11.8], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[(N[(v * -0.25), $MachinePrecision] * N[(r * N[(N[(w * w), $MachinePrecision] * N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(3.0 + N[(N[(r * N[(w * N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.32 \cdot 10^{-118}:\\
\;\;\;\;-1.5 + \frac{\frac{2}{r}}{r}\\
\mathbf{elif}\;r \leq 11.8:\\
\;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 - \left(v \cdot -0.25\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{1 - v}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(3 + \left(r \cdot \left(w \cdot \left(0.375 + v \cdot -0.25\right)\right)\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\right) - 4.5\\
\end{array}
\end{array}
if r < 1.32000000000000003e-118Initial program 78.2%
Simplified74.3%
Taylor expanded in r around 0 66.0%
+-commutative66.0%
associate--l+66.0%
div-inv66.0%
pow266.0%
pow-flip66.1%
metadata-eval66.1%
metadata-eval66.1%
Applied egg-rr66.1%
metadata-eval66.1%
pow-flip66.0%
pow266.0%
div-inv66.0%
associate-/r*66.1%
Applied egg-rr66.1%
if 1.32000000000000003e-118 < r < 11.800000000000001Initial program 84.4%
Simplified92.1%
Taylor expanded in v around inf 83.7%
*-commutative83.7%
Simplified83.7%
if 11.800000000000001 < r Initial program 92.7%
Taylor expanded in r around inf 92.7%
associate-/l*96.3%
cancel-sign-sub-inv96.3%
metadata-eval96.3%
+-commutative96.3%
*-commutative96.3%
fma-undefine96.3%
*-commutative96.3%
*-commutative96.3%
associate-/l*94.5%
*-commutative94.5%
associate-*r/94.6%
associate-*r*86.7%
associate-*l*88.5%
associate-*r*88.7%
Applied egg-rr88.7%
Taylor expanded in r around 0 98.0%
Final simplification73.4%
(FPCore (v w r)
:precision binary64
(if (<= r 1.22e-118)
(+ -1.5 (/ (/ 2.0 r) r))
(if (<= r 4.1e+23)
(+ (/ 2.0 (* r r)) (+ -1.5 (* 0.375 (* r (* (* w w) (/ r (+ v -1.0)))))))
(- (+ 3.0 (* (* (* r -0.25) (* v w)) (* r (/ w v)))) 4.5))))
double code(double v, double w, double r) {
double tmp;
if (r <= 1.22e-118) {
tmp = -1.5 + ((2.0 / r) / r);
} else if (r <= 4.1e+23) {
tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0))))));
} else {
tmp = (3.0 + (((r * -0.25) * (v * 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.22d-118) then
tmp = (-1.5d0) + ((2.0d0 / r) / r)
else if (r <= 4.1d+23) then
tmp = (2.0d0 / (r * r)) + ((-1.5d0) + (0.375d0 * (r * ((w * w) * (r / (v + (-1.0d0)))))))
else
tmp = (3.0d0 + (((r * (-0.25d0)) * (v * 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.22e-118) {
tmp = -1.5 + ((2.0 / r) / r);
} else if (r <= 4.1e+23) {
tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0))))));
} else {
tmp = (3.0 + (((r * -0.25) * (v * w)) * (r * (w / v)))) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 1.22e-118: tmp = -1.5 + ((2.0 / r) / r) elif r <= 4.1e+23: tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0)))))) else: tmp = (3.0 + (((r * -0.25) * (v * w)) * (r * (w / v)))) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 1.22e-118) tmp = Float64(-1.5 + Float64(Float64(2.0 / r) / r)); elseif (r <= 4.1e+23) 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(Float64(3.0 + Float64(Float64(Float64(r * -0.25) * Float64(v * 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.22e-118) tmp = -1.5 + ((2.0 / r) / r); elseif (r <= 4.1e+23) tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0)))))); else tmp = (3.0 + (((r * -0.25) * (v * w)) * (r * (w / v)))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 1.22e-118], N[(-1.5 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision], If[LessEqual[r, 4.1e+23], 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[(N[(3.0 + N[(N[(N[(r * -0.25), $MachinePrecision] * N[(v * w), $MachinePrecision]), $MachinePrecision] * N[(r * N[(w / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.22 \cdot 10^{-118}:\\
\;\;\;\;-1.5 + \frac{\frac{2}{r}}{r}\\
\mathbf{elif}\;r \leq 4.1 \cdot 10^{+23}:\\
\;\;\;\;\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}:\\
\;\;\;\;\left(3 + \left(\left(r \cdot -0.25\right) \cdot \left(v \cdot w\right)\right) \cdot \left(r \cdot \frac{w}{v}\right)\right) - 4.5\\
\end{array}
\end{array}
if r < 1.2200000000000001e-118Initial program 78.2%
Simplified74.3%
Taylor expanded in r around 0 66.0%
+-commutative66.0%
associate--l+66.0%
div-inv66.0%
pow266.0%
pow-flip66.1%
metadata-eval66.1%
metadata-eval66.1%
Applied egg-rr66.1%
metadata-eval66.1%
pow-flip66.0%
pow266.0%
div-inv66.0%
associate-/r*66.1%
Applied egg-rr66.1%
if 1.2200000000000001e-118 < r < 4.09999999999999996e23Initial program 86.7%
Simplified93.2%
Taylor expanded in v around 0 64.8%
if 4.09999999999999996e23 < r Initial program 92.4%
Taylor expanded in r around inf 92.4%
associate-/l*96.2%
cancel-sign-sub-inv96.2%
metadata-eval96.2%
+-commutative96.2%
*-commutative96.2%
fma-undefine96.2%
*-commutative96.2%
*-commutative96.2%
associate-/l*94.3%
*-commutative94.3%
associate-*r/94.3%
associate-*r*86.2%
associate-*l*88.0%
associate-*r*88.3%
Applied egg-rr88.3%
Taylor expanded in v around inf 73.1%
associate-*r*73.1%
*-commutative73.1%
*-commutative73.1%
Simplified73.1%
Taylor expanded in v around inf 86.3%
mul-1-neg86.3%
associate-/l*82.7%
distribute-lft-neg-in82.7%
Simplified82.7%
Final simplification69.2%
(FPCore (v w r)
:precision binary64
(if (<= r 4.5)
(+ -1.5 (/ (/ 2.0 r) r))
(-
(+ 3.0 (* (* r (* w (+ 0.375 (* v -0.25)))) (* w (/ r (+ v -1.0)))))
4.5)))
double code(double v, double w, double r) {
double tmp;
if (r <= 4.5) {
tmp = -1.5 + ((2.0 / r) / r);
} else {
tmp = (3.0 + ((r * (w * (0.375 + (v * -0.25)))) * (w * (r / (v + -1.0))))) - 4.5;
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: tmp
if (r <= 4.5d0) then
tmp = (-1.5d0) + ((2.0d0 / r) / r)
else
tmp = (3.0d0 + ((r * (w * (0.375d0 + (v * (-0.25d0))))) * (w * (r / (v + (-1.0d0)))))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 4.5) {
tmp = -1.5 + ((2.0 / r) / r);
} else {
tmp = (3.0 + ((r * (w * (0.375 + (v * -0.25)))) * (w * (r / (v + -1.0))))) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 4.5: tmp = -1.5 + ((2.0 / r) / r) else: tmp = (3.0 + ((r * (w * (0.375 + (v * -0.25)))) * (w * (r / (v + -1.0))))) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 4.5) tmp = Float64(-1.5 + Float64(Float64(2.0 / r) / r)); else tmp = Float64(Float64(3.0 + Float64(Float64(r * Float64(w * Float64(0.375 + Float64(v * -0.25)))) * Float64(w * Float64(r / Float64(v + -1.0))))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 4.5) tmp = -1.5 + ((2.0 / r) / r); else tmp = (3.0 + ((r * (w * (0.375 + (v * -0.25)))) * (w * (r / (v + -1.0))))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 4.5], N[(-1.5 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision], N[(N[(3.0 + N[(N[(r * N[(w * N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 4.5:\\
\;\;\;\;-1.5 + \frac{\frac{2}{r}}{r}\\
\mathbf{else}:\\
\;\;\;\;\left(3 + \left(r \cdot \left(w \cdot \left(0.375 + v \cdot -0.25\right)\right)\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\right) - 4.5\\
\end{array}
\end{array}
if r < 4.5Initial program 78.6%
Simplified75.3%
Taylor expanded in r around 0 65.1%
+-commutative65.1%
associate--l+65.1%
div-inv65.1%
pow265.1%
pow-flip65.2%
metadata-eval65.2%
metadata-eval65.2%
Applied egg-rr65.2%
metadata-eval65.2%
pow-flip65.1%
pow265.1%
div-inv65.1%
associate-/r*65.1%
Applied egg-rr65.1%
if 4.5 < r Initial program 92.7%
Taylor expanded in r around inf 92.7%
associate-/l*96.3%
cancel-sign-sub-inv96.3%
metadata-eval96.3%
+-commutative96.3%
*-commutative96.3%
fma-undefine96.3%
*-commutative96.3%
*-commutative96.3%
associate-/l*94.5%
*-commutative94.5%
associate-*r/94.6%
associate-*r*86.7%
associate-*l*88.5%
associate-*r*88.7%
Applied egg-rr88.7%
Taylor expanded in r around 0 98.0%
Final simplification71.8%
(FPCore (v w r)
:precision binary64
(if (<= r 0.00025)
(+ -1.5 (/ (/ 2.0 r) r))
(-
3.0
(+ 4.5 (/ (* (* r w) (+ 0.375 (* v -0.25))) (/ (- 1.0 v) (* r w)))))))
double code(double v, double w, double r) {
double tmp;
if (r <= 0.00025) {
tmp = -1.5 + ((2.0 / r) / r);
} else {
tmp = 3.0 - (4.5 + (((r * w) * (0.375 + (v * -0.25))) / ((1.0 - v) / (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 <= 0.00025d0) then
tmp = (-1.5d0) + ((2.0d0 / r) / r)
else
tmp = 3.0d0 - (4.5d0 + (((r * w) * (0.375d0 + (v * (-0.25d0)))) / ((1.0d0 - v) / (r * w))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 0.00025) {
tmp = -1.5 + ((2.0 / r) / r);
} else {
tmp = 3.0 - (4.5 + (((r * w) * (0.375 + (v * -0.25))) / ((1.0 - v) / (r * w))));
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 0.00025: tmp = -1.5 + ((2.0 / r) / r) else: tmp = 3.0 - (4.5 + (((r * w) * (0.375 + (v * -0.25))) / ((1.0 - v) / (r * w)))) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 0.00025) tmp = Float64(-1.5 + Float64(Float64(2.0 / r) / r)); else tmp = Float64(3.0 - Float64(4.5 + Float64(Float64(Float64(r * w) * Float64(0.375 + Float64(v * -0.25))) / Float64(Float64(1.0 - v) / Float64(r * w))))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 0.00025) tmp = -1.5 + ((2.0 / r) / r); else tmp = 3.0 - (4.5 + (((r * w) * (0.375 + (v * -0.25))) / ((1.0 - v) / (r * w)))); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 0.00025], N[(-1.5 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision], N[(3.0 - N[(4.5 + N[(N[(N[(r * w), $MachinePrecision] * N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 - v), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 0.00025:\\
\;\;\;\;-1.5 + \frac{\frac{2}{r}}{r}\\
\mathbf{else}:\\
\;\;\;\;3 - \left(4.5 + \frac{\left(r \cdot w\right) \cdot \left(0.375 + v \cdot -0.25\right)}{\frac{1 - v}{r \cdot w}}\right)\\
\end{array}
\end{array}
if r < 2.5000000000000001e-4Initial program 78.6%
Simplified75.3%
Taylor expanded in r around 0 65.1%
+-commutative65.1%
associate--l+65.1%
div-inv65.1%
pow265.1%
pow-flip65.2%
metadata-eval65.2%
metadata-eval65.2%
Applied egg-rr65.2%
metadata-eval65.2%
pow-flip65.1%
pow265.1%
div-inv65.1%
associate-/r*65.1%
Applied egg-rr65.1%
if 2.5000000000000001e-4 < r Initial program 92.7%
associate--l-92.7%
associate-*l*83.1%
sqr-neg83.1%
associate-*l*92.7%
associate-/l*96.3%
fma-define96.4%
Simplified96.3%
add-sqr-sqrt96.2%
*-un-lft-identity96.2%
times-frac96.2%
*-commutative96.2%
sqrt-prod96.2%
*-commutative96.2%
sqrt-prod96.1%
sqrt-prod42.2%
add-sqr-sqrt52.2%
associate-*r*52.3%
add-sqr-sqrt52.3%
Applied egg-rr99.8%
Taylor expanded in r around inf 99.8%
/-rgt-identity99.8%
associate-*r*98.0%
clear-num98.1%
un-div-inv98.0%
distribute-rgt-in98.0%
metadata-eval98.0%
*-commutative98.0%
associate-*l*98.0%
metadata-eval98.0%
Applied egg-rr98.0%
Final simplification71.8%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (- -1.5 (/ (+ 0.375 (* v -0.25)) (/ (- 1.0 v) (* (* r w) (* r w)))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - ((0.375 + (v * -0.25)) / ((1.0 - v) / ((r * w) * (r * w)))));
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (2.0d0 / (r * r)) + ((-1.5d0) - ((0.375d0 + (v * (-0.25d0))) / ((1.0d0 - v) / ((r * w) * (r * w)))))
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - ((0.375 + (v * -0.25)) / ((1.0 - v) / ((r * w) * (r * w)))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 - ((0.375 + (v * -0.25)) / ((1.0 - v) / ((r * w) * (r * w)))))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 - Float64(Float64(0.375 + Float64(v * -0.25)) / Float64(Float64(1.0 - v) / Float64(Float64(r * w) * Float64(r * w)))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 - ((0.375 + (v * -0.25)) / ((1.0 - v) / ((r * w) * (r * w))))); end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 - v), $MachinePrecision] / N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 - \frac{0.375 + v \cdot -0.25}{\frac{1 - v}{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}}\right)
\end{array}
Initial program 81.5%
Simplified84.0%
associate-*l*84.0%
fma-undefine84.0%
*-commutative84.0%
+-commutative84.0%
metadata-eval84.0%
cancel-sign-sub-inv84.0%
associate-*r/84.4%
*-commutative84.4%
associate-/l*84.7%
associate-*l*84.7%
clear-num84.7%
un-div-inv84.8%
Applied egg-rr99.5%
unpow299.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (v w r) :precision binary64 (if (<= r 4.5) (+ -1.5 (/ (/ 2.0 r) r)) (- (+ 3.0 (* (* (* r -0.25) (* v w)) (* r (/ w v)))) 4.5)))
double code(double v, double w, double r) {
double tmp;
if (r <= 4.5) {
tmp = -1.5 + ((2.0 / r) / r);
} else {
tmp = (3.0 + (((r * -0.25) * (v * 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 <= 4.5d0) then
tmp = (-1.5d0) + ((2.0d0 / r) / r)
else
tmp = (3.0d0 + (((r * (-0.25d0)) * (v * 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 <= 4.5) {
tmp = -1.5 + ((2.0 / r) / r);
} else {
tmp = (3.0 + (((r * -0.25) * (v * w)) * (r * (w / v)))) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 4.5: tmp = -1.5 + ((2.0 / r) / r) else: tmp = (3.0 + (((r * -0.25) * (v * w)) * (r * (w / v)))) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 4.5) tmp = Float64(-1.5 + Float64(Float64(2.0 / r) / r)); else tmp = Float64(Float64(3.0 + Float64(Float64(Float64(r * -0.25) * Float64(v * w)) * Float64(r * Float64(w / v)))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 4.5) tmp = -1.5 + ((2.0 / r) / r); else tmp = (3.0 + (((r * -0.25) * (v * w)) * (r * (w / v)))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 4.5], N[(-1.5 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision], N[(N[(3.0 + N[(N[(N[(r * -0.25), $MachinePrecision] * N[(v * w), $MachinePrecision]), $MachinePrecision] * N[(r * N[(w / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 4.5:\\
\;\;\;\;-1.5 + \frac{\frac{2}{r}}{r}\\
\mathbf{else}:\\
\;\;\;\;\left(3 + \left(\left(r \cdot -0.25\right) \cdot \left(v \cdot w\right)\right) \cdot \left(r \cdot \frac{w}{v}\right)\right) - 4.5\\
\end{array}
\end{array}
if r < 4.5Initial program 78.6%
Simplified75.3%
Taylor expanded in r around 0 65.1%
+-commutative65.1%
associate--l+65.1%
div-inv65.1%
pow265.1%
pow-flip65.2%
metadata-eval65.2%
metadata-eval65.2%
Applied egg-rr65.2%
metadata-eval65.2%
pow-flip65.1%
pow265.1%
div-inv65.1%
associate-/r*65.1%
Applied egg-rr65.1%
if 4.5 < r Initial program 92.7%
Taylor expanded in r around inf 92.7%
associate-/l*96.3%
cancel-sign-sub-inv96.3%
metadata-eval96.3%
+-commutative96.3%
*-commutative96.3%
fma-undefine96.3%
*-commutative96.3%
*-commutative96.3%
associate-/l*94.5%
*-commutative94.5%
associate-*r/94.6%
associate-*r*86.7%
associate-*l*88.5%
associate-*r*88.7%
Applied egg-rr88.7%
Taylor expanded in v around inf 72.2%
associate-*r*72.2%
*-commutative72.2%
*-commutative72.2%
Simplified72.2%
Taylor expanded in v around inf 85.3%
mul-1-neg85.3%
associate-/l*81.8%
distribute-lft-neg-in81.8%
Simplified81.8%
Final simplification68.5%
(FPCore (v w r) :precision binary64 (if (<= r 25.5) (+ -1.5 (/ (/ 2.0 r) r)) (- (+ 3.0 (* (* (* r -0.25) (* v w)) (* w (/ r v)))) 4.5)))
double code(double v, double w, double r) {
double tmp;
if (r <= 25.5) {
tmp = -1.5 + ((2.0 / r) / r);
} else {
tmp = (3.0 + (((r * -0.25) * (v * w)) * (w * (r / 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 <= 25.5d0) then
tmp = (-1.5d0) + ((2.0d0 / r) / r)
else
tmp = (3.0d0 + (((r * (-0.25d0)) * (v * w)) * (w * (r / v)))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 25.5) {
tmp = -1.5 + ((2.0 / r) / r);
} else {
tmp = (3.0 + (((r * -0.25) * (v * w)) * (w * (r / v)))) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 25.5: tmp = -1.5 + ((2.0 / r) / r) else: tmp = (3.0 + (((r * -0.25) * (v * w)) * (w * (r / v)))) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 25.5) tmp = Float64(-1.5 + Float64(Float64(2.0 / r) / r)); else tmp = Float64(Float64(3.0 + Float64(Float64(Float64(r * -0.25) * Float64(v * w)) * Float64(w * Float64(r / v)))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 25.5) tmp = -1.5 + ((2.0 / r) / r); else tmp = (3.0 + (((r * -0.25) * (v * w)) * (w * (r / v)))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 25.5], N[(-1.5 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision], N[(N[(3.0 + N[(N[(N[(r * -0.25), $MachinePrecision] * N[(v * w), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 25.5:\\
\;\;\;\;-1.5 + \frac{\frac{2}{r}}{r}\\
\mathbf{else}:\\
\;\;\;\;\left(3 + \left(\left(r \cdot -0.25\right) \cdot \left(v \cdot w\right)\right) \cdot \left(w \cdot \frac{r}{v}\right)\right) - 4.5\\
\end{array}
\end{array}
if r < 25.5Initial program 78.6%
Simplified75.3%
Taylor expanded in r around 0 65.1%
+-commutative65.1%
associate--l+65.1%
div-inv65.1%
pow265.1%
pow-flip65.2%
metadata-eval65.2%
metadata-eval65.2%
Applied egg-rr65.2%
metadata-eval65.2%
pow-flip65.1%
pow265.1%
div-inv65.1%
associate-/r*65.1%
Applied egg-rr65.1%
if 25.5 < r Initial program 92.7%
Taylor expanded in r around inf 92.7%
associate-/l*96.3%
cancel-sign-sub-inv96.3%
metadata-eval96.3%
+-commutative96.3%
*-commutative96.3%
fma-undefine96.3%
*-commutative96.3%
*-commutative96.3%
associate-/l*94.5%
*-commutative94.5%
associate-*r/94.6%
associate-*r*86.7%
associate-*l*88.5%
associate-*r*88.7%
Applied egg-rr88.7%
Taylor expanded in v around inf 72.2%
associate-*r*72.2%
*-commutative72.2%
*-commutative72.2%
Simplified72.2%
Taylor expanded in v around inf 83.2%
associate-*r/83.2%
neg-mul-183.2%
Simplified83.2%
Final simplification68.8%
(FPCore (v w r) :precision binary64 (if (<= r 1.95e-6) (+ -1.5 (/ (/ 2.0 r) r)) (- (+ 3.0 (* (* (* r w) 0.375) (* w (/ r (+ v -1.0))))) 4.5)))
double code(double v, double w, double r) {
double tmp;
if (r <= 1.95e-6) {
tmp = -1.5 + ((2.0 / r) / r);
} else {
tmp = (3.0 + (((r * w) * 0.375) * (w * (r / (v + -1.0))))) - 4.5;
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: tmp
if (r <= 1.95d-6) then
tmp = (-1.5d0) + ((2.0d0 / r) / r)
else
tmp = (3.0d0 + (((r * w) * 0.375d0) * (w * (r / (v + (-1.0d0)))))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 1.95e-6) {
tmp = -1.5 + ((2.0 / r) / r);
} else {
tmp = (3.0 + (((r * w) * 0.375) * (w * (r / (v + -1.0))))) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 1.95e-6: tmp = -1.5 + ((2.0 / r) / r) else: tmp = (3.0 + (((r * w) * 0.375) * (w * (r / (v + -1.0))))) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 1.95e-6) tmp = Float64(-1.5 + Float64(Float64(2.0 / r) / r)); else tmp = Float64(Float64(3.0 + Float64(Float64(Float64(r * w) * 0.375) * 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 <= 1.95e-6) tmp = -1.5 + ((2.0 / r) / r); else tmp = (3.0 + (((r * w) * 0.375) * (w * (r / (v + -1.0))))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 1.95e-6], N[(-1.5 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision], N[(N[(3.0 + N[(N[(N[(r * w), $MachinePrecision] * 0.375), $MachinePrecision] * N[(w * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.95 \cdot 10^{-6}:\\
\;\;\;\;-1.5 + \frac{\frac{2}{r}}{r}\\
\mathbf{else}:\\
\;\;\;\;\left(3 + \left(\left(r \cdot w\right) \cdot 0.375\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\right) - 4.5\\
\end{array}
\end{array}
if r < 1.95e-6Initial program 78.6%
Simplified75.3%
Taylor expanded in r around 0 65.1%
+-commutative65.1%
associate--l+65.1%
div-inv65.1%
pow265.1%
pow-flip65.2%
metadata-eval65.2%
metadata-eval65.2%
Applied egg-rr65.2%
metadata-eval65.2%
pow-flip65.1%
pow265.1%
div-inv65.1%
associate-/r*65.1%
Applied egg-rr65.1%
if 1.95e-6 < r Initial program 92.7%
Taylor expanded in r around inf 92.7%
associate-/l*96.3%
cancel-sign-sub-inv96.3%
metadata-eval96.3%
+-commutative96.3%
*-commutative96.3%
fma-undefine96.3%
*-commutative96.3%
*-commutative96.3%
associate-/l*94.5%
*-commutative94.5%
associate-*r/94.6%
associate-*r*86.7%
associate-*l*88.5%
associate-*r*88.7%
Applied egg-rr88.7%
Taylor expanded in v around 0 74.2%
Final simplification67.0%
(FPCore (v w r) :precision binary64 (if (<= r 122.0) (+ -1.5 (/ (/ 2.0 r) r)) (+ 3.0 (- (/ (* r (* w 0.375)) (/ (+ v -1.0) (* r w))) 4.5))))
double code(double v, double w, double r) {
double tmp;
if (r <= 122.0) {
tmp = -1.5 + ((2.0 / r) / r);
} else {
tmp = 3.0 + (((r * (w * 0.375)) / ((v + -1.0) / (r * w))) - 4.5);
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: tmp
if (r <= 122.0d0) then
tmp = (-1.5d0) + ((2.0d0 / r) / r)
else
tmp = 3.0d0 + (((r * (w * 0.375d0)) / ((v + (-1.0d0)) / (r * w))) - 4.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 122.0) {
tmp = -1.5 + ((2.0 / r) / r);
} else {
tmp = 3.0 + (((r * (w * 0.375)) / ((v + -1.0) / (r * w))) - 4.5);
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 122.0: tmp = -1.5 + ((2.0 / r) / r) else: tmp = 3.0 + (((r * (w * 0.375)) / ((v + -1.0) / (r * w))) - 4.5) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 122.0) tmp = Float64(-1.5 + Float64(Float64(2.0 / r) / r)); else tmp = Float64(3.0 + Float64(Float64(Float64(r * Float64(w * 0.375)) / Float64(Float64(v + -1.0) / Float64(r * w))) - 4.5)); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 122.0) tmp = -1.5 + ((2.0 / r) / r); else tmp = 3.0 + (((r * (w * 0.375)) / ((v + -1.0) / (r * w))) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 122.0], N[(-1.5 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision], N[(3.0 + N[(N[(N[(r * N[(w * 0.375), $MachinePrecision]), $MachinePrecision] / N[(N[(v + -1.0), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 122:\\
\;\;\;\;-1.5 + \frac{\frac{2}{r}}{r}\\
\mathbf{else}:\\
\;\;\;\;3 + \left(\frac{r \cdot \left(w \cdot 0.375\right)}{\frac{v + -1}{r \cdot w}} - 4.5\right)\\
\end{array}
\end{array}
if r < 122Initial program 78.6%
Simplified75.3%
Taylor expanded in r around 0 65.1%
+-commutative65.1%
associate--l+65.1%
div-inv65.1%
pow265.1%
pow-flip65.2%
metadata-eval65.2%
metadata-eval65.2%
Applied egg-rr65.2%
metadata-eval65.2%
pow-flip65.1%
pow265.1%
div-inv65.1%
associate-/r*65.1%
Applied egg-rr65.1%
if 122 < r Initial program 92.7%
associate--l-92.7%
associate-*l*83.1%
sqr-neg83.1%
associate-*l*92.7%
associate-/l*96.3%
fma-define96.4%
Simplified96.3%
add-sqr-sqrt96.2%
*-un-lft-identity96.2%
times-frac96.2%
*-commutative96.2%
sqrt-prod96.2%
*-commutative96.2%
sqrt-prod96.1%
sqrt-prod42.2%
add-sqr-sqrt52.2%
associate-*r*52.3%
add-sqr-sqrt52.3%
Applied egg-rr99.8%
Taylor expanded in r around inf 99.8%
/-rgt-identity99.8%
associate-*r*98.0%
clear-num98.1%
un-div-inv98.0%
distribute-rgt-in98.0%
metadata-eval98.0%
*-commutative98.0%
associate-*l*98.0%
metadata-eval98.0%
Applied egg-rr98.0%
Taylor expanded in v around 0 74.2%
*-commutative74.2%
associate-*l*74.2%
Simplified74.2%
Final simplification67.0%
(FPCore (v w r) :precision binary64 (if (<= r 240.0) (+ -1.5 (/ (/ 2.0 r) r)) (- (- 3.0 (* (* r w) (* (* r -0.25) (* v w)))) 4.5)))
double code(double v, double w, double r) {
double tmp;
if (r <= 240.0) {
tmp = -1.5 + ((2.0 / r) / r);
} else {
tmp = (3.0 - ((r * w) * ((r * -0.25) * (v * w)))) - 4.5;
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: tmp
if (r <= 240.0d0) then
tmp = (-1.5d0) + ((2.0d0 / r) / r)
else
tmp = (3.0d0 - ((r * w) * ((r * (-0.25d0)) * (v * w)))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 240.0) {
tmp = -1.5 + ((2.0 / r) / r);
} else {
tmp = (3.0 - ((r * w) * ((r * -0.25) * (v * w)))) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 240.0: tmp = -1.5 + ((2.0 / r) / r) else: tmp = (3.0 - ((r * w) * ((r * -0.25) * (v * w)))) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 240.0) tmp = Float64(-1.5 + Float64(Float64(2.0 / r) / r)); else tmp = Float64(Float64(3.0 - Float64(Float64(r * w) * Float64(Float64(r * -0.25) * Float64(v * w)))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 240.0) tmp = -1.5 + ((2.0 / r) / r); else tmp = (3.0 - ((r * w) * ((r * -0.25) * (v * w)))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 240.0], N[(-1.5 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision], N[(N[(3.0 - N[(N[(r * w), $MachinePrecision] * N[(N[(r * -0.25), $MachinePrecision] * N[(v * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 240:\\
\;\;\;\;-1.5 + \frac{\frac{2}{r}}{r}\\
\mathbf{else}:\\
\;\;\;\;\left(3 - \left(r \cdot w\right) \cdot \left(\left(r \cdot -0.25\right) \cdot \left(v \cdot w\right)\right)\right) - 4.5\\
\end{array}
\end{array}
if r < 240Initial program 78.6%
Simplified75.3%
Taylor expanded in r around 0 65.1%
+-commutative65.1%
associate--l+65.1%
div-inv65.1%
pow265.1%
pow-flip65.2%
metadata-eval65.2%
metadata-eval65.2%
Applied egg-rr65.2%
metadata-eval65.2%
pow-flip65.1%
pow265.1%
div-inv65.1%
associate-/r*65.1%
Applied egg-rr65.1%
if 240 < r Initial program 92.7%
Taylor expanded in r around inf 92.7%
associate-/l*96.3%
cancel-sign-sub-inv96.3%
metadata-eval96.3%
+-commutative96.3%
*-commutative96.3%
fma-undefine96.3%
*-commutative96.3%
*-commutative96.3%
associate-/l*94.5%
*-commutative94.5%
associate-*r/94.6%
associate-*r*86.7%
associate-*l*88.5%
associate-*r*88.7%
Applied egg-rr88.7%
Taylor expanded in v around inf 72.2%
associate-*r*72.2%
*-commutative72.2%
*-commutative72.2%
Simplified72.2%
Taylor expanded in v around 0 45.7%
Final simplification61.2%
(FPCore (v w r) :precision binary64 (+ -1.5 (/ (/ 2.0 r) r)))
double code(double v, double w, double r) {
return -1.5 + ((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) + ((2.0d0 / r) / r)
end function
public static double code(double v, double w, double r) {
return -1.5 + ((2.0 / r) / r);
}
def code(v, w, r): return -1.5 + ((2.0 / r) / r)
function code(v, w, r) return Float64(-1.5 + Float64(Float64(2.0 / r) / r)) end
function tmp = code(v, w, r) tmp = -1.5 + ((2.0 / r) / r); end
code[v_, w_, r_] := N[(-1.5 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-1.5 + \frac{\frac{2}{r}}{r}
\end{array}
Initial program 81.5%
Simplified76.9%
Taylor expanded in r around 0 56.4%
+-commutative56.4%
associate--l+56.4%
div-inv56.4%
pow256.4%
pow-flip56.5%
metadata-eval56.5%
metadata-eval56.5%
Applied egg-rr56.5%
metadata-eval56.5%
pow-flip56.4%
pow256.4%
div-inv56.4%
associate-/r*56.4%
Applied egg-rr56.4%
Final simplification56.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 81.5%
Simplified76.9%
Taylor expanded in r around 0 56.4%
Taylor expanded in r around inf 13.8%
herbie shell --seed 2024119
(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))