
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5
\end{array}
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= v -1.15e-10)
(+ t_0 (+ -1.5 (* 0.25 (/ (* r w) (/ -1.0 (* r w))))))
(if (<= v 1.1e-51)
(- (- (+ 3.0 t_0) (* (/ w (/ (- 1.0 v) r)) (* (* r w) 0.375))) 4.5)
(+ t_0 (- -1.5 (* 0.25 (* (* r w) (* r w)))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (v <= -1.15e-10) {
tmp = t_0 + (-1.5 + (0.25 * ((r * w) / (-1.0 / (r * w)))));
} else if (v <= 1.1e-51) {
tmp = ((3.0 + t_0) - ((w / ((1.0 - v) / r)) * ((r * w) * 0.375))) - 4.5;
} else {
tmp = t_0 + (-1.5 - (0.25 * ((r * w) * (r * w))));
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if (v <= (-1.15d-10)) then
tmp = t_0 + ((-1.5d0) + (0.25d0 * ((r * w) / ((-1.0d0) / (r * w)))))
else if (v <= 1.1d-51) then
tmp = ((3.0d0 + t_0) - ((w / ((1.0d0 - v) / r)) * ((r * w) * 0.375d0))) - 4.5d0
else
tmp = t_0 + ((-1.5d0) - (0.25d0 * ((r * w) * (r * w))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (v <= -1.15e-10) {
tmp = t_0 + (-1.5 + (0.25 * ((r * w) / (-1.0 / (r * w)))));
} else if (v <= 1.1e-51) {
tmp = ((3.0 + t_0) - ((w / ((1.0 - v) / r)) * ((r * w) * 0.375))) - 4.5;
} else {
tmp = t_0 + (-1.5 - (0.25 * ((r * w) * (r * w))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if v <= -1.15e-10: tmp = t_0 + (-1.5 + (0.25 * ((r * w) / (-1.0 / (r * w))))) elif v <= 1.1e-51: tmp = ((3.0 + t_0) - ((w / ((1.0 - v) / r)) * ((r * w) * 0.375))) - 4.5 else: tmp = t_0 + (-1.5 - (0.25 * ((r * w) * (r * w)))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (v <= -1.15e-10) tmp = Float64(t_0 + Float64(-1.5 + Float64(0.25 * Float64(Float64(r * w) / Float64(-1.0 / Float64(r * w)))))); elseif (v <= 1.1e-51) tmp = Float64(Float64(Float64(3.0 + t_0) - Float64(Float64(w / Float64(Float64(1.0 - v) / r)) * Float64(Float64(r * w) * 0.375))) - 4.5); else tmp = Float64(t_0 + Float64(-1.5 - Float64(0.25 * Float64(Float64(r * w) * Float64(r * w))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (v <= -1.15e-10) tmp = t_0 + (-1.5 + (0.25 * ((r * w) / (-1.0 / (r * w))))); elseif (v <= 1.1e-51) tmp = ((3.0 + t_0) - ((w / ((1.0 - v) / r)) * ((r * w) * 0.375))) - 4.5; else tmp = t_0 + (-1.5 - (0.25 * ((r * w) * (r * w)))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, -1.15e-10], N[(t$95$0 + N[(-1.5 + N[(0.25 * N[(N[(r * w), $MachinePrecision] / N[(-1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[v, 1.1e-51], N[(N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(N[(w / N[(N[(1.0 - v), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(t$95$0 + N[(-1.5 - N[(0.25 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -1.15 \cdot 10^{-10}:\\
\;\;\;\;t\_0 + \left(-1.5 + 0.25 \cdot \frac{r \cdot w}{\frac{-1}{r \cdot w}}\right)\\
\mathbf{elif}\;v \leq 1.1 \cdot 10^{-51}:\\
\;\;\;\;\left(\left(3 + t\_0\right) - \frac{w}{\frac{1 - v}{r}} \cdot \left(\left(r \cdot w\right) \cdot 0.375\right)\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \left(-1.5 - 0.25 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\
\end{array}
\end{array}
if v < -1.15000000000000004e-10Initial program 81.8%
Simplified88.2%
Taylor expanded in v around inf 85.2%
*-commutative85.2%
*-commutative85.2%
unpow285.2%
unpow285.2%
swap-sqr99.8%
unpow299.8%
*-commutative99.8%
Simplified99.8%
*-commutative99.8%
pow299.8%
remove-double-div99.8%
un-div-inv99.8%
Applied egg-rr99.8%
if -1.15000000000000004e-10 < v < 1.1e-51Initial program 91.1%
associate-/l*91.1%
cancel-sign-sub-inv91.1%
metadata-eval91.1%
+-commutative91.1%
*-commutative91.1%
fma-undefine91.1%
*-commutative91.1%
*-commutative91.1%
associate-/l*91.1%
*-commutative91.1%
associate-*r/91.1%
associate-*r*91.1%
associate-*l*96.4%
associate-*r*99.8%
Applied egg-rr99.8%
Taylor expanded in v around 0 99.8%
if 1.1e-51 < v Initial program 76.7%
Simplified82.1%
Taylor expanded in v around inf 77.9%
*-commutative77.9%
*-commutative77.9%
unpow277.9%
unpow277.9%
swap-sqr99.9%
unpow299.9%
*-commutative99.9%
Simplified99.9%
*-commutative99.9%
pow299.9%
Applied egg-rr99.9%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(if (<= r 14000000.0)
(-
(+ 3.0 (/ 2.0 (* r r)))
(+ 4.5 (/ (* (* r w) (+ 0.375 (* v -0.25))) (/ (- 1.0 v) (* r w)))))
(+
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 <= 14000000.0) {
tmp = (3.0 + (2.0 / (r * r))) - (4.5 + (((r * w) * (0.375 + (v * -0.25))) / ((1.0 - v) / (r * w))));
} 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 <= 14000000.0d0) then
tmp = (3.0d0 + (2.0d0 / (r * r))) - (4.5d0 + (((r * w) * (0.375d0 + (v * (-0.25d0)))) / ((1.0d0 - v) / (r * w))))
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 <= 14000000.0) {
tmp = (3.0 + (2.0 / (r * r))) - (4.5 + (((r * w) * (0.375 + (v * -0.25))) / ((1.0 - v) / (r * w))));
} 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 <= 14000000.0: tmp = (3.0 + (2.0 / (r * r))) - (4.5 + (((r * w) * (0.375 + (v * -0.25))) / ((1.0 - v) / (r * w)))) 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 <= 14000000.0) tmp = Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(4.5 + Float64(Float64(Float64(r * w) * Float64(0.375 + Float64(v * -0.25))) / Float64(Float64(1.0 - v) / Float64(r * w))))); 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 <= 14000000.0) tmp = (3.0 + (2.0 / (r * r))) - (4.5 + (((r * w) * (0.375 + (v * -0.25))) / ((1.0 - v) / (r * w)))); 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, 14000000.0], N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 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], 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 14000000:\\
\;\;\;\;\left(3 + \frac{2}{r \cdot r}\right) - \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)\\
\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.4e7Initial program 84.1%
associate--l-84.1%
associate-*l*81.0%
sqr-neg81.0%
associate-*l*84.1%
associate-/l*85.7%
fma-define85.7%
Simplified85.7%
*-un-lft-identity85.7%
add-sqr-sqrt85.7%
times-frac85.7%
*-commutative85.7%
sqrt-prod34.4%
*-commutative34.4%
sqrt-prod34.4%
sqrt-prod18.9%
add-sqr-sqrt32.7%
associate-*r*32.7%
add-sqr-sqrt77.1%
Applied egg-rr99.8%
/-rgt-identity99.8%
associate-*r*97.4%
clear-num97.4%
un-div-inv97.4%
distribute-lft-in97.4%
metadata-eval97.4%
associate-*r*97.4%
metadata-eval97.4%
Applied egg-rr97.4%
if 1.4e7 < r Initial program 85.7%
associate--l-85.7%
associate-*l*82.5%
sqr-neg82.5%
associate-*l*85.7%
associate-/l*98.3%
fma-define98.3%
Simplified98.3%
*-un-lft-identity98.3%
add-sqr-sqrt98.3%
times-frac98.2%
*-commutative98.2%
sqrt-prod98.2%
*-commutative98.2%
sqrt-prod98.2%
sqrt-prod45.1%
add-sqr-sqrt57.5%
associate-*r*57.5%
add-sqr-sqrt57.5%
Applied egg-rr99.7%
Taylor expanded in r around inf 99.7%
Final simplification98.0%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= v -1.15e-10)
(+ t_0 (+ -1.5 (* 0.25 (/ (* r w) (/ -1.0 (* r w))))))
(if (<= v 1.1e-51)
(- (- (+ 3.0 t_0) (* (* r w) (* (* r w) 0.375))) 4.5)
(+ t_0 (- -1.5 (* 0.25 (* (* r w) (* r w)))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (v <= -1.15e-10) {
tmp = t_0 + (-1.5 + (0.25 * ((r * w) / (-1.0 / (r * w)))));
} else if (v <= 1.1e-51) {
tmp = ((3.0 + t_0) - ((r * w) * ((r * w) * 0.375))) - 4.5;
} else {
tmp = t_0 + (-1.5 - (0.25 * ((r * w) * (r * w))));
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if (v <= (-1.15d-10)) then
tmp = t_0 + ((-1.5d0) + (0.25d0 * ((r * w) / ((-1.0d0) / (r * w)))))
else if (v <= 1.1d-51) then
tmp = ((3.0d0 + t_0) - ((r * w) * ((r * w) * 0.375d0))) - 4.5d0
else
tmp = t_0 + ((-1.5d0) - (0.25d0 * ((r * w) * (r * w))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (v <= -1.15e-10) {
tmp = t_0 + (-1.5 + (0.25 * ((r * w) / (-1.0 / (r * w)))));
} else if (v <= 1.1e-51) {
tmp = ((3.0 + t_0) - ((r * w) * ((r * w) * 0.375))) - 4.5;
} else {
tmp = t_0 + (-1.5 - (0.25 * ((r * w) * (r * w))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if v <= -1.15e-10: tmp = t_0 + (-1.5 + (0.25 * ((r * w) / (-1.0 / (r * w))))) elif v <= 1.1e-51: tmp = ((3.0 + t_0) - ((r * w) * ((r * w) * 0.375))) - 4.5 else: tmp = t_0 + (-1.5 - (0.25 * ((r * w) * (r * w)))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (v <= -1.15e-10) tmp = Float64(t_0 + Float64(-1.5 + Float64(0.25 * Float64(Float64(r * w) / Float64(-1.0 / Float64(r * w)))))); elseif (v <= 1.1e-51) tmp = Float64(Float64(Float64(3.0 + t_0) - Float64(Float64(r * w) * Float64(Float64(r * w) * 0.375))) - 4.5); else tmp = Float64(t_0 + Float64(-1.5 - Float64(0.25 * Float64(Float64(r * w) * Float64(r * w))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (v <= -1.15e-10) tmp = t_0 + (-1.5 + (0.25 * ((r * w) / (-1.0 / (r * w))))); elseif (v <= 1.1e-51) tmp = ((3.0 + t_0) - ((r * w) * ((r * w) * 0.375))) - 4.5; else tmp = t_0 + (-1.5 - (0.25 * ((r * w) * (r * w)))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, -1.15e-10], N[(t$95$0 + N[(-1.5 + N[(0.25 * N[(N[(r * w), $MachinePrecision] / N[(-1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[v, 1.1e-51], N[(N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(N[(r * w), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(t$95$0 + N[(-1.5 - N[(0.25 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -1.15 \cdot 10^{-10}:\\
\;\;\;\;t\_0 + \left(-1.5 + 0.25 \cdot \frac{r \cdot w}{\frac{-1}{r \cdot w}}\right)\\
\mathbf{elif}\;v \leq 1.1 \cdot 10^{-51}:\\
\;\;\;\;\left(\left(3 + t\_0\right) - \left(r \cdot w\right) \cdot \left(\left(r \cdot w\right) \cdot 0.375\right)\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \left(-1.5 - 0.25 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\
\end{array}
\end{array}
if v < -1.15000000000000004e-10Initial program 81.8%
Simplified88.2%
Taylor expanded in v around inf 85.2%
*-commutative85.2%
*-commutative85.2%
unpow285.2%
unpow285.2%
swap-sqr99.8%
unpow299.8%
*-commutative99.8%
Simplified99.8%
*-commutative99.8%
pow299.8%
remove-double-div99.8%
un-div-inv99.8%
Applied egg-rr99.8%
if -1.15000000000000004e-10 < v < 1.1e-51Initial program 91.1%
associate-/l*91.1%
cancel-sign-sub-inv91.1%
metadata-eval91.1%
+-commutative91.1%
*-commutative91.1%
fma-undefine91.1%
*-commutative91.1%
*-commutative91.1%
associate-/l*91.1%
*-commutative91.1%
associate-*r/91.1%
associate-*r*91.1%
associate-*l*96.4%
associate-*r*99.8%
Applied egg-rr99.8%
Taylor expanded in v around 0 99.8%
Taylor expanded in v around 0 99.8%
if 1.1e-51 < v Initial program 76.7%
Simplified82.1%
Taylor expanded in v around inf 77.9%
*-commutative77.9%
*-commutative77.9%
unpow277.9%
unpow277.9%
swap-sqr99.9%
unpow299.9%
*-commutative99.9%
Simplified99.9%
*-commutative99.9%
pow299.9%
Applied egg-rr99.9%
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 84.5%
associate--l-84.5%
associate-*l*81.4%
sqr-neg81.4%
associate-*l*84.5%
associate-/l*88.9%
fma-define88.9%
Simplified88.9%
*-un-lft-identity88.9%
add-sqr-sqrt88.9%
times-frac88.9%
*-commutative88.9%
sqrt-prod50.8%
*-commutative50.8%
sqrt-prod50.8%
sqrt-prod25.7%
add-sqr-sqrt39.1%
associate-*r*39.1%
add-sqr-sqrt72.1%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (- (+ 3.0 (/ 2.0 (* r r))) (+ 4.5 (* (* 0.125 (+ 3.0 (* -2.0 v))) (* w (* (* r w) (/ r (- 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))) * (w * ((r * w) * (r / (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))) * (w * ((r * w) * (r / (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))) * (w * ((r * w) * (r / (1.0 - v))))));
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * (w * ((r * w) * (r / (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(w * Float64(Float64(r * w) * Float64(r / 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))) * (w * ((r * w) * (r / (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[(w * N[(N[(r * w), $MachinePrecision] * N[(r / N[(1.0 - v), $MachinePrecision]), $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(w \cdot \left(\left(r \cdot w\right) \cdot \frac{r}{1 - v}\right)\right)\right)
\end{array}
Initial program 84.5%
associate--l-84.5%
associate-*l*81.4%
sqr-neg81.4%
associate-*l*84.5%
associate-/l*88.9%
fma-define88.9%
Simplified88.9%
div-inv88.9%
*-commutative88.9%
associate-*r*88.4%
*-commutative88.4%
associate-*l*94.9%
add-sqr-sqrt54.3%
associate-*r*54.3%
add-sqr-sqrt27.7%
sqrt-prod38.7%
sqrt-prod38.7%
*-commutative38.7%
sqrt-prod71.2%
*-commutative71.2%
div-inv71.2%
associate-*l*71.2%
Applied egg-rr97.5%
Final simplification97.5%
(FPCore (v w r) :precision binary64 (- (+ 3.0 (/ 2.0 (* r r))) (+ 4.5 (* (* 0.125 (+ 3.0 (* -2.0 v))) (* w (* r (/ w (/ (- 1.0 v) r))))))))
double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * (w * (r * (w / ((1.0 - v) / r))))));
}
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))) * (w * (r * (w / ((1.0d0 - v) / r))))))
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))) * (w * (r * (w / ((1.0 - v) / r))))));
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * (w * (r * (w / ((1.0 - v) / r))))))
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(w * Float64(r * Float64(w / Float64(Float64(1.0 - v) / r))))))) end
function tmp = code(v, w, r) tmp = (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * (w * (r * (w / ((1.0 - v) / r)))))); 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[(w * N[(r * N[(w / N[(N[(1.0 - v), $MachinePrecision] / r), $MachinePrecision]), $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(w \cdot \left(r \cdot \frac{w}{\frac{1 - v}{r}}\right)\right)\right)
\end{array}
Initial program 84.5%
associate--l-84.5%
associate-*l*81.4%
sqr-neg81.4%
associate-*l*84.5%
associate-/l*88.9%
fma-define88.9%
Simplified88.9%
associate-/l*88.4%
*-commutative88.4%
associate-*r/87.9%
*-commutative87.9%
associate-*l*95.1%
associate-*l*97.5%
clear-num97.5%
un-div-inv97.5%
Applied egg-rr97.5%
Final simplification97.5%
(FPCore (v w r) :precision binary64 (+ (+ 3.0 (/ 2.0 (* r r))) (- (* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (/ w (/ (+ v -1.0) r)))) 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 / ((v + -1.0) / 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))) + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * (w / ((v + (-1.0d0)) / r)))) - 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 / ((v + -1.0) / r)))) - 4.5);
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w / ((v + -1.0) / r)))) - 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(Float64(v + -1.0) / r)))) - 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 / ((v + -1.0) / r)))) - 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[(N[(v + -1.0), $MachinePrecision] / r), $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{w}{\frac{v + -1}{r}}\right) - 4.5\right)
\end{array}
Initial program 84.5%
associate--l-84.5%
associate-*l*81.4%
sqr-neg81.4%
associate-*l*84.5%
associate-/l*88.9%
fma-define88.9%
Simplified88.9%
associate-/l*88.4%
*-commutative88.4%
associate-*r/87.9%
associate-*l*95.1%
associate-*r*98.2%
add-sqr-sqrt56.5%
associate-*l*56.5%
add-sqr-sqrt29.2%
sqrt-prod38.7%
sqrt-prod38.7%
sqrt-prod71.2%
*-commutative71.2%
sqrt-prod38.7%
*-commutative38.7%
sqrt-prod38.7%
sqrt-prod29.2%
add-sqr-sqrt56.5%
associate-*r*56.5%
add-sqr-sqrt98.2%
clear-num98.2%
un-div-inv98.3%
Applied egg-rr98.3%
Final simplification98.3%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (+ -1.5 (* 0.25 (/ (* r w) (/ -1.0 (* r w)))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + (0.25 * ((r * w) / (-1.0 / (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.25d0 * ((r * w) / ((-1.0d0) / (r * w)))))
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + (0.25 * ((r * w) / (-1.0 / (r * w)))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 + (0.25 * ((r * w) / (-1.0 / (r * w)))))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(0.25 * Float64(Float64(r * w) / Float64(-1.0 / Float64(r * w)))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 + (0.25 * ((r * w) / (-1.0 / (r * w))))); end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(0.25 * N[(N[(r * w), $MachinePrecision] / N[(-1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 + 0.25 \cdot \frac{r \cdot w}{\frac{-1}{r \cdot w}}\right)
\end{array}
Initial program 84.5%
Simplified87.9%
Taylor expanded in v around inf 80.1%
*-commutative80.1%
*-commutative80.1%
unpow280.1%
unpow280.1%
swap-sqr93.4%
unpow293.4%
*-commutative93.4%
Simplified93.4%
*-commutative93.4%
pow293.4%
remove-double-div93.4%
un-div-inv93.4%
Applied egg-rr93.4%
Final simplification93.4%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (- -1.5 (* 0.25 (* (* r w) (* r w))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - (0.25 * ((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.25d0 * ((r * w) * (r * w))))
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - (0.25 * ((r * w) * (r * w))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 - (0.25 * ((r * w) * (r * w))))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 - Float64(0.25 * Float64(Float64(r * w) * Float64(r * w))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 - (0.25 * ((r * w) * (r * w)))); end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[(0.25 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 - 0.25 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)
\end{array}
Initial program 84.5%
Simplified87.9%
Taylor expanded in v around inf 80.1%
*-commutative80.1%
*-commutative80.1%
unpow280.1%
unpow280.1%
swap-sqr93.4%
unpow293.4%
*-commutative93.4%
Simplified93.4%
*-commutative93.4%
pow293.4%
Applied egg-rr93.4%
Final simplification93.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(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 84.5%
Simplified83.2%
Taylor expanded in r around 0 61.1%
Final simplification61.1%
(FPCore (v w r) :precision binary64 -1.5)
double code(double v, double w, double r) {
return -1.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = -1.5d0
end function
public static double code(double v, double w, double r) {
return -1.5;
}
def code(v, w, r): return -1.5
function code(v, w, r) return -1.5 end
function tmp = code(v, w, r) tmp = -1.5; end
code[v_, w_, r_] := -1.5
\begin{array}{l}
\\
-1.5
\end{array}
Initial program 84.5%
Simplified83.2%
Taylor expanded in r around 0 61.1%
Taylor expanded in r around inf 13.1%
Final simplification13.1%
herbie shell --seed 2024079
(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))