
(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
(let* ((t_0 (+ 3.0 (/ 2.0 (* r r)))))
(if (or (<= v -10000.0) (not (<= v 7.5e-25)))
(+ t_0 (- (* (* 0.125 (+ 3.0 (* -2.0 v))) (/ (* r w) (/ v (* r w)))) 4.5))
(- (+ t_0 (* (* r (* w 0.375)) (* w (/ r (- v 1.0))))) 4.5))))
double code(double v, double w, double r) {
double t_0 = 3.0 + (2.0 / (r * r));
double tmp;
if ((v <= -10000.0) || !(v <= 7.5e-25)) {
tmp = t_0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) / (v / (r * w)))) - 4.5);
} else {
tmp = (t_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) :: t_0
real(8) :: tmp
t_0 = 3.0d0 + (2.0d0 / (r * r))
if ((v <= (-10000.0d0)) .or. (.not. (v <= 7.5d-25))) then
tmp = t_0 + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) / (v / (r * w)))) - 4.5d0)
else
tmp = (t_0 + ((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 t_0 = 3.0 + (2.0 / (r * r));
double tmp;
if ((v <= -10000.0) || !(v <= 7.5e-25)) {
tmp = t_0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) / (v / (r * w)))) - 4.5);
} else {
tmp = (t_0 + ((r * (w * 0.375)) * (w * (r / (v - 1.0))))) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = 3.0 + (2.0 / (r * r)) tmp = 0 if (v <= -10000.0) or not (v <= 7.5e-25): tmp = t_0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) / (v / (r * w)))) - 4.5) else: tmp = (t_0 + ((r * (w * 0.375)) * (w * (r / (v - 1.0))))) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(3.0 + Float64(2.0 / Float64(r * r))) tmp = 0.0 if ((v <= -10000.0) || !(v <= 7.5e-25)) tmp = Float64(t_0 + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) / Float64(v / Float64(r * w)))) - 4.5)); else tmp = Float64(Float64(t_0 + Float64(Float64(r * Float64(w * 0.375)) * Float64(w * Float64(r / Float64(v - 1.0))))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 3.0 + (2.0 / (r * r)); tmp = 0.0; if ((v <= -10000.0) || ~((v <= 7.5e-25))) tmp = t_0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) / (v / (r * w)))) - 4.5); else tmp = (t_0 + ((r * (w * 0.375)) * (w * (r / (v - 1.0))))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -10000.0], N[Not[LessEqual[v, 7.5e-25]], $MachinePrecision]], N[(t$95$0 + N[(N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] / N[(v / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 + N[(N[(r * N[(w * 0.375), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r / N[(v - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 3 + \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -10000 \lor \neg \left(v \leq 7.5 \cdot 10^{-25}\right):\\
\;\;\;\;t\_0 + \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \frac{r \cdot w}{\frac{v}{r \cdot w}} - 4.5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 + \left(r \cdot \left(w \cdot 0.375\right)\right) \cdot \left(w \cdot \frac{r}{v - 1}\right)\right) - 4.5\\
\end{array}
\end{array}
if v < -1e4 or 7.49999999999999989e-25 < v Initial program 77.8%
associate--l-77.8%
associate-*l*73.9%
sqr-neg73.9%
associate-*l*77.8%
associate-/l*84.0%
fma-define84.0%
Simplified84.0%
add-sqr-sqrt83.9%
*-un-lft-identity83.9%
times-frac83.9%
associate-*r*78.0%
sqrt-prod78.0%
sqrt-prod42.1%
add-sqr-sqrt69.5%
sqrt-prod35.4%
add-sqr-sqrt69.5%
associate-*r*61.1%
sqrt-prod61.1%
sqrt-prod35.5%
add-sqr-sqrt71.0%
sqrt-prod49.1%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
div-inv99.8%
Applied egg-rr99.8%
div-inv99.8%
clear-num99.8%
frac-times99.8%
metadata-eval99.8%
div-inv99.8%
/-rgt-identity99.8%
*-un-lft-identity99.8%
Applied egg-rr99.8%
Taylor expanded in v around inf 99.7%
associate-*r/99.7%
neg-mul-199.7%
Simplified99.7%
if -1e4 < v < 7.49999999999999989e-25Initial program 85.4%
associate-/l*85.4%
cancel-sign-sub-inv85.4%
metadata-eval85.4%
+-commutative85.4%
*-commutative85.4%
fma-undefine85.4%
*-commutative85.4%
*-commutative85.4%
associate-/l*85.4%
*-commutative85.4%
associate-*r/85.4%
associate-*r*85.4%
associate-*l*96.6%
associate-*r*99.8%
Applied egg-rr99.8%
Taylor expanded in v around 0 99.8%
*-commutative99.8%
associate-*l*99.9%
Simplified99.9%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(if (<= r 3.9e-100)
(- (+ 3.0 (/ (/ 2.0 r) r)) 4.5)
(if (<= r 600000.0)
(+ (/ 2.0 (* r r)) (+ -1.5 (* (* r (* (* w w) (/ r (- v 1.0)))) 0.375)))
(+
3.0
(-
(* (* 0.125 (+ 3.0 (* -2.0 v))) (/ (* r w) (/ (- v 1.0) (* r w))))
4.5)))))
double code(double v, double w, double r) {
double tmp;
if (r <= 3.9e-100) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 600000.0) {
tmp = (2.0 / (r * r)) + (-1.5 + ((r * ((w * w) * (r / (v - 1.0)))) * 0.375));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) / ((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 <= 3.9d-100) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else if (r <= 600000.0d0) then
tmp = (2.0d0 / (r * r)) + ((-1.5d0) + ((r * ((w * w) * (r / (v - 1.0d0)))) * 0.375d0))
else
tmp = 3.0d0 + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) / ((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 <= 3.9e-100) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 600000.0) {
tmp = (2.0 / (r * r)) + (-1.5 + ((r * ((w * w) * (r / (v - 1.0)))) * 0.375));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) / ((v - 1.0) / (r * w)))) - 4.5);
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 3.9e-100: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 elif r <= 600000.0: tmp = (2.0 / (r * r)) + (-1.5 + ((r * ((w * w) * (r / (v - 1.0)))) * 0.375)) else: tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) / ((v - 1.0) / (r * w)))) - 4.5) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 3.9e-100) tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); elseif (r <= 600000.0) tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(Float64(r * Float64(Float64(w * w) * Float64(r / Float64(v - 1.0)))) * 0.375))); else tmp = Float64(3.0 + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) / 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 <= 3.9e-100) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; elseif (r <= 600000.0) tmp = (2.0 / (r * r)) + (-1.5 + ((r * ((w * w) * (r / (v - 1.0)))) * 0.375)); else tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) / ((v - 1.0) / (r * w)))) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 3.9e-100], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 600000.0], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(N[(r * N[(N[(w * w), $MachinePrecision] * N[(r / N[(v - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 + N[(N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] / N[(N[(v - 1.0), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 3.9 \cdot 10^{-100}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{elif}\;r \leq 600000:\\
\;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 + \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{v - 1}\right)\right) \cdot 0.375\right)\\
\mathbf{else}:\\
\;\;\;\;3 + \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \frac{r \cdot w}{\frac{v - 1}{r \cdot w}} - 4.5\right)\\
\end{array}
\end{array}
if r < 3.89999999999999977e-100Initial program 77.5%
Simplified75.4%
Taylor expanded in r around 0 71.7%
associate-/r*71.7%
div-inv71.6%
Applied egg-rr71.6%
associate-*r/71.7%
*-rgt-identity71.7%
Simplified71.7%
if 3.89999999999999977e-100 < r < 6e5Initial program 92.1%
Simplified92.1%
Taylor expanded in v around 0 84.0%
if 6e5 < r Initial program 87.1%
associate--l-87.1%
associate-*l*78.7%
sqr-neg78.7%
associate-*l*87.1%
associate-/l*89.8%
fma-define89.9%
Simplified89.8%
add-sqr-sqrt89.8%
*-un-lft-identity89.8%
times-frac89.8%
associate-*r*80.2%
sqrt-prod80.2%
sqrt-prod89.8%
add-sqr-sqrt89.9%
sqrt-prod38.7%
add-sqr-sqrt53.1%
associate-*r*46.2%
sqrt-prod46.2%
sqrt-prod53.1%
add-sqr-sqrt53.1%
sqrt-prod43.0%
add-sqr-sqrt99.7%
Applied egg-rr99.7%
div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in r around inf 99.8%
div-inv99.7%
clear-num99.8%
frac-times99.8%
metadata-eval99.8%
div-inv99.8%
/-rgt-identity99.8%
*-un-lft-identity99.8%
Applied egg-rr99.8%
Final simplification80.0%
(FPCore (v w r)
:precision binary64
(if (<= r 1.75e-105)
(- (+ 3.0 (/ (/ 2.0 r) r)) 4.5)
(if (<= r 195000.0)
(+ (/ 2.0 (* r r)) (+ -1.5 (* (* r (* (* w w) (/ r (- v 1.0)))) 0.375)))
(+
3.0
(-
(* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (/ (* r w) (- v 1.0))))
4.5)))))
double code(double v, double w, double r) {
double tmp;
if (r <= 1.75e-105) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 195000.0) {
tmp = (2.0 / (r * r)) + (-1.5 + ((r * ((w * w) * (r / (v - 1.0)))) * 0.375));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / (v - 1.0)))) - 4.5);
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: tmp
if (r <= 1.75d-105) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else if (r <= 195000.0d0) then
tmp = (2.0d0 / (r * r)) + ((-1.5d0) + ((r * ((w * w) * (r / (v - 1.0d0)))) * 0.375d0))
else
tmp = 3.0d0 + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * ((r * w) / (v - 1.0d0)))) - 4.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 1.75e-105) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 195000.0) {
tmp = (2.0 / (r * r)) + (-1.5 + ((r * ((w * w) * (r / (v - 1.0)))) * 0.375));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / (v - 1.0)))) - 4.5);
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 1.75e-105: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 elif r <= 195000.0: tmp = (2.0 / (r * r)) + (-1.5 + ((r * ((w * w) * (r / (v - 1.0)))) * 0.375)) else: tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / (v - 1.0)))) - 4.5) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 1.75e-105) tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); elseif (r <= 195000.0) tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(Float64(r * Float64(Float64(w * w) * Float64(r / Float64(v - 1.0)))) * 0.375))); else tmp = Float64(3.0 + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) * Float64(Float64(r * w) / Float64(v - 1.0)))) - 4.5)); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 1.75e-105) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; elseif (r <= 195000.0) tmp = (2.0 / (r * r)) + (-1.5 + ((r * ((w * w) * (r / (v - 1.0)))) * 0.375)); else tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / (v - 1.0)))) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 1.75e-105], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 195000.0], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(N[(r * N[(N[(w * w), $MachinePrecision] * N[(r / N[(v - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 + N[(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[(v - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.75 \cdot 10^{-105}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{elif}\;r \leq 195000:\\
\;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 + \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{v - 1}\right)\right) \cdot 0.375\right)\\
\mathbf{else}:\\
\;\;\;\;3 + \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \frac{r \cdot w}{v - 1}\right) - 4.5\right)\\
\end{array}
\end{array}
if r < 1.75e-105Initial program 77.5%
Simplified75.4%
Taylor expanded in r around 0 71.7%
associate-/r*71.7%
div-inv71.6%
Applied egg-rr71.6%
associate-*r/71.7%
*-rgt-identity71.7%
Simplified71.7%
if 1.75e-105 < r < 195000Initial program 92.1%
Simplified92.1%
Taylor expanded in v around 0 84.0%
if 195000 < r Initial program 87.1%
associate--l-87.1%
associate-*l*78.7%
sqr-neg78.7%
associate-*l*87.1%
associate-/l*89.8%
fma-define89.9%
Simplified89.8%
add-sqr-sqrt89.8%
*-un-lft-identity89.8%
times-frac89.8%
associate-*r*80.2%
sqrt-prod80.2%
sqrt-prod89.8%
add-sqr-sqrt89.9%
sqrt-prod38.7%
add-sqr-sqrt53.1%
associate-*r*46.2%
sqrt-prod46.2%
sqrt-prod53.1%
add-sqr-sqrt53.1%
sqrt-prod43.0%
add-sqr-sqrt99.7%
Applied egg-rr99.7%
Taylor expanded in r around inf 99.7%
/-rgt-identity99.7%
*-commutative99.7%
Applied egg-rr99.7%
Final simplification80.0%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ r (- v 1.0))))
(if (<= r 6.8e-105)
(- (+ 3.0 (/ (/ 2.0 r) r)) 4.5)
(if (<= r 9.2e+49)
(+ (/ 2.0 (* r r)) (+ -1.5 (* (* v -0.25) (* r (* (* w w) t_0)))))
(- (+ 3.0 (* (* w (* r (+ (* v -0.25) 0.375))) (* w t_0))) 4.5)))))
double code(double v, double w, double r) {
double t_0 = r / (v - 1.0);
double tmp;
if (r <= 6.8e-105) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 9.2e+49) {
tmp = (2.0 / (r * r)) + (-1.5 + ((v * -0.25) * (r * ((w * w) * t_0))));
} else {
tmp = (3.0 + ((w * (r * ((v * -0.25) + 0.375))) * (w * t_0))) - 4.5;
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = r / (v - 1.0d0)
if (r <= 6.8d-105) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else if (r <= 9.2d+49) then
tmp = (2.0d0 / (r * r)) + ((-1.5d0) + ((v * (-0.25d0)) * (r * ((w * w) * t_0))))
else
tmp = (3.0d0 + ((w * (r * ((v * (-0.25d0)) + 0.375d0))) * (w * t_0))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = r / (v - 1.0);
double tmp;
if (r <= 6.8e-105) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 9.2e+49) {
tmp = (2.0 / (r * r)) + (-1.5 + ((v * -0.25) * (r * ((w * w) * t_0))));
} else {
tmp = (3.0 + ((w * (r * ((v * -0.25) + 0.375))) * (w * t_0))) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = r / (v - 1.0) tmp = 0 if r <= 6.8e-105: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 elif r <= 9.2e+49: tmp = (2.0 / (r * r)) + (-1.5 + ((v * -0.25) * (r * ((w * w) * t_0)))) else: tmp = (3.0 + ((w * (r * ((v * -0.25) + 0.375))) * (w * t_0))) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(r / Float64(v - 1.0)) tmp = 0.0 if (r <= 6.8e-105) tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); elseif (r <= 9.2e+49) tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(Float64(v * -0.25) * Float64(r * Float64(Float64(w * w) * t_0))))); else tmp = Float64(Float64(3.0 + Float64(Float64(w * Float64(r * Float64(Float64(v * -0.25) + 0.375))) * Float64(w * t_0))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = r / (v - 1.0); tmp = 0.0; if (r <= 6.8e-105) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; elseif (r <= 9.2e+49) tmp = (2.0 / (r * r)) + (-1.5 + ((v * -0.25) * (r * ((w * w) * t_0)))); else tmp = (3.0 + ((w * (r * ((v * -0.25) + 0.375))) * (w * t_0))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(r / N[(v - 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 6.8e-105], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 9.2e+49], 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] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(3.0 + N[(N[(w * N[(r * N[(N[(v * -0.25), $MachinePrecision] + 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{r}{v - 1}\\
\mathbf{if}\;r \leq 6.8 \cdot 10^{-105}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{elif}\;r \leq 9.2 \cdot 10^{+49}:\\
\;\;\;\;\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 t\_0\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(3 + \left(w \cdot \left(r \cdot \left(v \cdot -0.25 + 0.375\right)\right)\right) \cdot \left(w \cdot t\_0\right)\right) - 4.5\\
\end{array}
\end{array}
if r < 6.79999999999999984e-105Initial program 77.5%
Simplified75.4%
Taylor expanded in r around 0 71.7%
associate-/r*71.7%
div-inv71.6%
Applied egg-rr71.6%
associate-*r/71.7%
*-rgt-identity71.7%
Simplified71.7%
if 6.79999999999999984e-105 < r < 9.20000000000000008e49Initial program 93.7%
Simplified93.7%
Taylor expanded in v around inf 87.1%
*-commutative87.1%
Simplified87.1%
if 9.20000000000000008e49 < r Initial program 85.8%
associate-/l*88.8%
cancel-sign-sub-inv88.8%
metadata-eval88.8%
+-commutative88.8%
*-commutative88.8%
fma-undefine88.8%
*-commutative88.8%
*-commutative88.8%
associate-/l*88.8%
*-commutative88.8%
associate-*r/88.8%
associate-*r*83.5%
associate-*l*89.8%
associate-*r*88.4%
Applied egg-rr88.4%
Taylor expanded in r around inf 88.4%
Final simplification77.4%
(FPCore (v w r)
:precision binary64
(if (<= r 24000000.0)
(-
(+
(+ 3.0 (/ 2.0 (* r r)))
(* (* w (* r (+ (* v -0.25) 0.375))) (* w (/ r (- v 1.0)))))
4.5)
(+
3.0
(-
(* (* 0.125 (+ 3.0 (* -2.0 v))) (/ (* r w) (/ (- v 1.0) (* r w))))
4.5))))
double code(double v, double w, double r) {
double tmp;
if (r <= 24000000.0) {
tmp = ((3.0 + (2.0 / (r * r))) + ((w * (r * ((v * -0.25) + 0.375))) * (w * (r / (v - 1.0))))) - 4.5;
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) / ((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 <= 24000000.0d0) then
tmp = ((3.0d0 + (2.0d0 / (r * r))) + ((w * (r * ((v * (-0.25d0)) + 0.375d0))) * (w * (r / (v - 1.0d0))))) - 4.5d0
else
tmp = 3.0d0 + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) / ((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 <= 24000000.0) {
tmp = ((3.0 + (2.0 / (r * r))) + ((w * (r * ((v * -0.25) + 0.375))) * (w * (r / (v - 1.0))))) - 4.5;
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) / ((v - 1.0) / (r * w)))) - 4.5);
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 24000000.0: tmp = ((3.0 + (2.0 / (r * r))) + ((w * (r * ((v * -0.25) + 0.375))) * (w * (r / (v - 1.0))))) - 4.5 else: tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) / ((v - 1.0) / (r * w)))) - 4.5) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 24000000.0) tmp = Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) + Float64(Float64(w * Float64(r * Float64(Float64(v * -0.25) + 0.375))) * Float64(w * Float64(r / Float64(v - 1.0))))) - 4.5); else tmp = Float64(3.0 + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) / 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 <= 24000000.0) tmp = ((3.0 + (2.0 / (r * r))) + ((w * (r * ((v * -0.25) + 0.375))) * (w * (r / (v - 1.0))))) - 4.5; else tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) / ((v - 1.0) / (r * w)))) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 24000000.0], N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(w * N[(r * N[(N[(v * -0.25), $MachinePrecision] + 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r / N[(v - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(3.0 + N[(N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] / N[(N[(v - 1.0), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 24000000:\\
\;\;\;\;\left(\left(3 + \frac{2}{r \cdot r}\right) + \left(w \cdot \left(r \cdot \left(v \cdot -0.25 + 0.375\right)\right)\right) \cdot \left(w \cdot \frac{r}{v - 1}\right)\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;3 + \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \frac{r \cdot w}{\frac{v - 1}{r \cdot w}} - 4.5\right)\\
\end{array}
\end{array}
if r < 2.4e7Initial program 79.4%
associate-/l*82.8%
cancel-sign-sub-inv82.8%
metadata-eval82.8%
+-commutative82.8%
*-commutative82.8%
fma-undefine82.8%
*-commutative82.8%
*-commutative82.8%
associate-/l*82.4%
*-commutative82.4%
associate-*r/82.4%
associate-*r*78.2%
associate-*l*91.3%
associate-*r*92.3%
Applied egg-rr92.3%
if 2.4e7 < r Initial program 87.1%
associate--l-87.1%
associate-*l*78.7%
sqr-neg78.7%
associate-*l*87.1%
associate-/l*89.8%
fma-define89.9%
Simplified89.8%
add-sqr-sqrt89.8%
*-un-lft-identity89.8%
times-frac89.8%
associate-*r*80.2%
sqrt-prod80.2%
sqrt-prod89.8%
add-sqr-sqrt89.9%
sqrt-prod38.7%
add-sqr-sqrt53.1%
associate-*r*46.2%
sqrt-prod46.2%
sqrt-prod53.1%
add-sqr-sqrt53.1%
sqrt-prod43.0%
add-sqr-sqrt99.7%
Applied egg-rr99.7%
div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in r around inf 99.8%
div-inv99.7%
clear-num99.8%
frac-times99.8%
metadata-eval99.8%
div-inv99.8%
/-rgt-identity99.8%
*-un-lft-identity99.8%
Applied egg-rr99.8%
Final simplification94.2%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ r (- v 1.0))))
(if (<= r 1.15e-104)
(- (+ 3.0 (/ (/ 2.0 r) r)) 4.5)
(if (<= r 9.2e+49)
(+ (/ 2.0 (* r r)) (+ -1.5 (* (* r (* (* w w) t_0)) 0.375)))
(- (+ 3.0 (* (* w (* r (+ (* v -0.25) 0.375))) (* w t_0))) 4.5)))))
double code(double v, double w, double r) {
double t_0 = r / (v - 1.0);
double tmp;
if (r <= 1.15e-104) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 9.2e+49) {
tmp = (2.0 / (r * r)) + (-1.5 + ((r * ((w * w) * t_0)) * 0.375));
} else {
tmp = (3.0 + ((w * (r * ((v * -0.25) + 0.375))) * (w * t_0))) - 4.5;
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = r / (v - 1.0d0)
if (r <= 1.15d-104) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else if (r <= 9.2d+49) then
tmp = (2.0d0 / (r * r)) + ((-1.5d0) + ((r * ((w * w) * t_0)) * 0.375d0))
else
tmp = (3.0d0 + ((w * (r * ((v * (-0.25d0)) + 0.375d0))) * (w * t_0))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = r / (v - 1.0);
double tmp;
if (r <= 1.15e-104) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else if (r <= 9.2e+49) {
tmp = (2.0 / (r * r)) + (-1.5 + ((r * ((w * w) * t_0)) * 0.375));
} else {
tmp = (3.0 + ((w * (r * ((v * -0.25) + 0.375))) * (w * t_0))) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = r / (v - 1.0) tmp = 0 if r <= 1.15e-104: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 elif r <= 9.2e+49: tmp = (2.0 / (r * r)) + (-1.5 + ((r * ((w * w) * t_0)) * 0.375)) else: tmp = (3.0 + ((w * (r * ((v * -0.25) + 0.375))) * (w * t_0))) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(r / Float64(v - 1.0)) tmp = 0.0 if (r <= 1.15e-104) tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); elseif (r <= 9.2e+49) tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(Float64(r * Float64(Float64(w * w) * t_0)) * 0.375))); else tmp = Float64(Float64(3.0 + Float64(Float64(w * Float64(r * Float64(Float64(v * -0.25) + 0.375))) * Float64(w * t_0))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = r / (v - 1.0); tmp = 0.0; if (r <= 1.15e-104) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; elseif (r <= 9.2e+49) tmp = (2.0 / (r * r)) + (-1.5 + ((r * ((w * w) * t_0)) * 0.375)); else tmp = (3.0 + ((w * (r * ((v * -0.25) + 0.375))) * (w * t_0))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(r / N[(v - 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 1.15e-104], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[r, 9.2e+49], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(N[(r * N[(N[(w * w), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(3.0 + N[(N[(w * N[(r * N[(N[(v * -0.25), $MachinePrecision] + 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{r}{v - 1}\\
\mathbf{if}\;r \leq 1.15 \cdot 10^{-104}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{elif}\;r \leq 9.2 \cdot 10^{+49}:\\
\;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 + \left(r \cdot \left(\left(w \cdot w\right) \cdot t\_0\right)\right) \cdot 0.375\right)\\
\mathbf{else}:\\
\;\;\;\;\left(3 + \left(w \cdot \left(r \cdot \left(v \cdot -0.25 + 0.375\right)\right)\right) \cdot \left(w \cdot t\_0\right)\right) - 4.5\\
\end{array}
\end{array}
if r < 1.15e-104Initial program 77.5%
Simplified75.4%
Taylor expanded in r around 0 71.7%
associate-/r*71.7%
div-inv71.6%
Applied egg-rr71.6%
associate-*r/71.7%
*-rgt-identity71.7%
Simplified71.7%
if 1.15e-104 < r < 9.20000000000000008e49Initial program 93.7%
Simplified93.7%
Taylor expanded in v around 0 87.1%
if 9.20000000000000008e49 < r Initial program 85.8%
associate-/l*88.8%
cancel-sign-sub-inv88.8%
metadata-eval88.8%
+-commutative88.8%
*-commutative88.8%
fma-undefine88.8%
*-commutative88.8%
*-commutative88.8%
associate-/l*88.8%
*-commutative88.8%
associate-*r/88.8%
associate-*r*83.5%
associate-*l*89.8%
associate-*r*88.4%
Applied egg-rr88.4%
Taylor expanded in r around inf 88.4%
Final simplification77.4%
(FPCore (v w r) :precision binary64 (+ (+ 3.0 (/ 2.0 (* r r))) (- (* (* 0.125 (+ 3.0 (* -2.0 v))) (/ (* r w) (/ (- v 1.0) (* r w)))) 4.5)))
double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) / ((v - 1.0) / (r * w)))) - 4.5);
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (3.0d0 + (2.0d0 / (r * r))) + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) / ((v - 1.0d0) / (r * w)))) - 4.5d0)
end function
public static double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) / ((v - 1.0) / (r * w)))) - 4.5);
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) / ((v - 1.0) / (r * w)))) - 4.5)
function code(v, w, r) return Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) / Float64(Float64(v - 1.0) / Float64(r * w)))) - 4.5)) end
function tmp = code(v, w, r) tmp = (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) / ((v - 1.0) / (r * w)))) - 4.5); end
code[v_, w_, r_] := N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] / N[(N[(v - 1.0), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \frac{2}{r \cdot r}\right) + \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \frac{r \cdot w}{\frac{v - 1}{r \cdot w}} - 4.5\right)
\end{array}
Initial program 81.4%
associate--l-81.4%
associate-*l*76.4%
sqr-neg76.4%
associate-*l*81.4%
associate-/l*84.6%
fma-define84.6%
Simplified84.6%
add-sqr-sqrt84.6%
*-un-lft-identity84.6%
times-frac84.6%
associate-*r*78.6%
sqrt-prod78.6%
sqrt-prod44.3%
add-sqr-sqrt72.6%
sqrt-prod32.9%
add-sqr-sqrt69.0%
associate-*r*61.7%
sqrt-prod61.7%
sqrt-prod35.0%
add-sqr-sqrt69.5%
sqrt-prod45.2%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
div-inv99.8%
Applied egg-rr99.8%
div-inv99.8%
clear-num99.8%
frac-times99.8%
metadata-eval99.8%
div-inv99.8%
/-rgt-identity99.8%
*-un-lft-identity99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (+ (+ 3.0 (/ 2.0 (* r r))) (- (* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (/ (* r w) (- v 1.0)))) 4.5)))
double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / (v - 1.0)))) - 4.5);
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (3.0d0 + (2.0d0 / (r * r))) + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * ((r * w) / (v - 1.0d0)))) - 4.5d0)
end function
public static double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / (v - 1.0)))) - 4.5);
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / (v - 1.0)))) - 4.5)
function code(v, w, r) return Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) * Float64(Float64(r * w) / Float64(v - 1.0)))) - 4.5)) end
function tmp = code(v, w, r) tmp = (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / (v - 1.0)))) - 4.5); end
code[v_, w_, r_] := N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] / N[(v - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \frac{2}{r \cdot r}\right) + \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \frac{r \cdot w}{v - 1}\right) - 4.5\right)
\end{array}
Initial program 81.4%
associate--l-81.4%
associate-*l*76.4%
sqr-neg76.4%
associate-*l*81.4%
associate-/l*84.6%
fma-define84.6%
Simplified84.6%
add-sqr-sqrt84.6%
*-un-lft-identity84.6%
times-frac84.6%
associate-*r*78.6%
sqrt-prod78.6%
sqrt-prod44.3%
add-sqr-sqrt72.6%
sqrt-prod32.9%
add-sqr-sqrt69.0%
associate-*r*61.7%
sqrt-prod61.7%
sqrt-prod35.0%
add-sqr-sqrt69.5%
sqrt-prod45.2%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
/-rgt-identity99.8%
*-commutative99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (+ (+ 3.0 (/ 2.0 (* r r))) (- (* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (* w (/ r (- v 1.0))))) 4.5)))
double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (v - 1.0))))) - 4.5);
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (3.0d0 + (2.0d0 / (r * r))) + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * (w * (r / (v - 1.0d0))))) - 4.5d0)
end function
public static double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (v - 1.0))))) - 4.5);
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (v - 1.0))))) - 4.5)
function code(v, w, r) return Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) * Float64(w * Float64(r / Float64(v - 1.0))))) - 4.5)) end
function tmp = code(v, w, r) tmp = (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (v - 1.0))))) - 4.5); end
code[v_, w_, r_] := N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(w * N[(r / N[(v - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \frac{2}{r \cdot r}\right) + \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \left(w \cdot \frac{r}{v - 1}\right)\right) - 4.5\right)
\end{array}
Initial program 81.4%
associate--l-81.4%
associate-*l*76.4%
sqr-neg76.4%
associate-*l*81.4%
associate-/l*84.6%
fma-define84.6%
Simplified84.6%
associate-/l*84.3%
*-commutative84.3%
associate-*r/84.3%
associate-*l*95.9%
associate-*r*99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (v w r)
:precision binary64
(if (<= r 78000.0)
(-
(+ (+ 3.0 (/ 2.0 (* r r))) (* (* r (* w 0.375)) (* w (/ r (- v 1.0)))))
4.5)
(+
3.0
(-
(* (* 0.125 (+ 3.0 (* -2.0 v))) (/ (* r w) (/ (- v 1.0) (* r w))))
4.5))))
double code(double v, double w, double r) {
double tmp;
if (r <= 78000.0) {
tmp = ((3.0 + (2.0 / (r * r))) + ((r * (w * 0.375)) * (w * (r / (v - 1.0))))) - 4.5;
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) / ((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 <= 78000.0d0) then
tmp = ((3.0d0 + (2.0d0 / (r * r))) + ((r * (w * 0.375d0)) * (w * (r / (v - 1.0d0))))) - 4.5d0
else
tmp = 3.0d0 + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) / ((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 <= 78000.0) {
tmp = ((3.0 + (2.0 / (r * r))) + ((r * (w * 0.375)) * (w * (r / (v - 1.0))))) - 4.5;
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) / ((v - 1.0) / (r * w)))) - 4.5);
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 78000.0: tmp = ((3.0 + (2.0 / (r * r))) + ((r * (w * 0.375)) * (w * (r / (v - 1.0))))) - 4.5 else: tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) / ((v - 1.0) / (r * w)))) - 4.5) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 78000.0) tmp = Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) + Float64(Float64(r * Float64(w * 0.375)) * Float64(w * Float64(r / Float64(v - 1.0))))) - 4.5); else tmp = Float64(3.0 + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) / 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 <= 78000.0) tmp = ((3.0 + (2.0 / (r * r))) + ((r * (w * 0.375)) * (w * (r / (v - 1.0))))) - 4.5; else tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) / ((v - 1.0) / (r * w)))) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 78000.0], N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(r * N[(w * 0.375), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r / N[(v - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(3.0 + N[(N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] / N[(N[(v - 1.0), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 78000:\\
\;\;\;\;\left(\left(3 + \frac{2}{r \cdot r}\right) + \left(r \cdot \left(w \cdot 0.375\right)\right) \cdot \left(w \cdot \frac{r}{v - 1}\right)\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;3 + \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \frac{r \cdot w}{\frac{v - 1}{r \cdot w}} - 4.5\right)\\
\end{array}
\end{array}
if r < 78000Initial program 79.4%
associate-/l*82.8%
cancel-sign-sub-inv82.8%
metadata-eval82.8%
+-commutative82.8%
*-commutative82.8%
fma-undefine82.8%
*-commutative82.8%
*-commutative82.8%
associate-/l*82.4%
*-commutative82.4%
associate-*r/82.4%
associate-*r*78.2%
associate-*l*91.3%
associate-*r*92.3%
Applied egg-rr92.3%
Taylor expanded in v around 0 86.9%
*-commutative86.9%
associate-*l*86.9%
Simplified86.9%
if 78000 < r Initial program 87.1%
associate--l-87.1%
associate-*l*78.7%
sqr-neg78.7%
associate-*l*87.1%
associate-/l*89.8%
fma-define89.9%
Simplified89.8%
add-sqr-sqrt89.8%
*-un-lft-identity89.8%
times-frac89.8%
associate-*r*80.2%
sqrt-prod80.2%
sqrt-prod89.8%
add-sqr-sqrt89.9%
sqrt-prod38.7%
add-sqr-sqrt53.1%
associate-*r*46.2%
sqrt-prod46.2%
sqrt-prod53.1%
add-sqr-sqrt53.1%
sqrt-prod43.0%
add-sqr-sqrt99.7%
Applied egg-rr99.7%
div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in r around inf 99.8%
div-inv99.7%
clear-num99.8%
frac-times99.8%
metadata-eval99.8%
div-inv99.8%
/-rgt-identity99.8%
*-un-lft-identity99.8%
Applied egg-rr99.8%
Final simplification90.2%
(FPCore (v w r) :precision binary64 (if (<= r 1.85e-101) (- (+ 3.0 (/ (/ 2.0 r) r)) 4.5) (+ (/ 2.0 (* r r)) (+ -1.5 (* (* r (* (* w w) (/ r (- v 1.0)))) 0.375)))))
double code(double v, double w, double r) {
double tmp;
if (r <= 1.85e-101) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = (2.0 / (r * r)) + (-1.5 + ((r * ((w * w) * (r / (v - 1.0)))) * 0.375));
}
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.85d-101) then
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
else
tmp = (2.0d0 / (r * r)) + ((-1.5d0) + ((r * ((w * w) * (r / (v - 1.0d0)))) * 0.375d0))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 1.85e-101) {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
} else {
tmp = (2.0 / (r * r)) + (-1.5 + ((r * ((w * w) * (r / (v - 1.0)))) * 0.375));
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 1.85e-101: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 else: tmp = (2.0 / (r * r)) + (-1.5 + ((r * ((w * w) * (r / (v - 1.0)))) * 0.375)) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 1.85e-101) tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); else tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(Float64(r * Float64(Float64(w * w) * Float64(r / Float64(v - 1.0)))) * 0.375))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 1.85e-101) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; else tmp = (2.0 / (r * r)) + (-1.5 + ((r * ((w * w) * (r / (v - 1.0)))) * 0.375)); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 1.85e-101], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(N[(r * N[(N[(w * w), $MachinePrecision] * N[(r / N[(v - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.85 \cdot 10^{-101}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 + \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{v - 1}\right)\right) \cdot 0.375\right)\\
\end{array}
\end{array}
if r < 1.85000000000000002e-101Initial program 77.5%
Simplified75.4%
Taylor expanded in r around 0 71.7%
associate-/r*71.7%
div-inv71.6%
Applied egg-rr71.6%
associate-*r/71.7%
*-rgt-identity71.7%
Simplified71.7%
if 1.85000000000000002e-101 < r Initial program 88.5%
Simplified90.5%
Taylor expanded in v around 0 71.0%
Final simplification71.4%
(FPCore (v w r) :precision binary64 (- (+ 3.0 (/ (/ 2.0 r) r)) 4.5))
double code(double v, double w, double r) {
return (3.0 + ((2.0 / r) / r)) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
end function
public static double code(double v, double w, double r) {
return (3.0 + ((2.0 / r) / r)) - 4.5;
}
def code(v, w, r): return (3.0 + ((2.0 / r) / r)) - 4.5
function code(v, w, r) return Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5) end
function tmp = code(v, w, r) tmp = (3.0 + ((2.0 / r) / r)) - 4.5; end
code[v_, w_, r_] := N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5
\end{array}
Initial program 81.4%
Simplified77.5%
Taylor expanded in r around 0 60.4%
associate-/r*60.5%
div-inv60.4%
Applied egg-rr60.4%
associate-*r/60.5%
*-rgt-identity60.5%
Simplified60.5%
(FPCore (v w r) :precision binary64 (- (+ 3.0 (/ 2.0 (* r r))) 4.5))
double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (3.0d0 + (2.0d0 / (r * r))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) - 4.5;
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) - 4.5
function code(v, w, r) return Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - 4.5) end
function tmp = code(v, w, r) tmp = (3.0 + (2.0 / (r * r))) - 4.5; end
code[v_, w_, r_] := N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \frac{2}{r \cdot r}\right) - 4.5
\end{array}
Initial program 81.4%
Simplified77.5%
Taylor expanded in r around 0 60.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.4%
Simplified77.5%
Taylor expanded in r around 0 60.4%
Taylor expanded in r around inf 14.3%
herbie shell --seed 2024125
(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))