
(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 9 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))) (- (* (* 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 91.4%
associate--l-91.4%
associate-*l*87.0%
sqr-neg87.0%
associate-*l*91.4%
+-commutative91.4%
+-commutative91.4%
associate-/l*93.2%
fma-define93.2%
Simplified93.2%
associate-/l*92.9%
*-commutative92.9%
associate-*r/92.9%
associate-*l*98.8%
associate-*r*99.8%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (v w r)
:precision binary64
(if (<= r 1.6e-5)
(- (- (+ 3.0 (/ 2.0 (* r r))) (* (* r w) (* (* r w) 0.375))) 4.5)
(+
3.0
(-
(* (* 0.125 (+ 3.0 (* -2.0 v))) (/ (* w (* r w)) (/ (+ v -1.0) r)))
4.5))))
double code(double v, double w, double r) {
double tmp;
if (r <= 1.6e-5) {
tmp = ((3.0 + (2.0 / (r * r))) - ((r * w) * ((r * w) * 0.375))) - 4.5;
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((w * (r * w)) / ((v + -1.0) / r))) - 4.5);
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: tmp
if (r <= 1.6d-5) then
tmp = ((3.0d0 + (2.0d0 / (r * r))) - ((r * w) * ((r * w) * 0.375d0))) - 4.5d0
else
tmp = 3.0d0 + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((w * (r * w)) / ((v + (-1.0d0)) / r))) - 4.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 1.6e-5) {
tmp = ((3.0 + (2.0 / (r * r))) - ((r * w) * ((r * w) * 0.375))) - 4.5;
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((w * (r * w)) / ((v + -1.0) / r))) - 4.5);
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 1.6e-5: tmp = ((3.0 + (2.0 / (r * r))) - ((r * w) * ((r * w) * 0.375))) - 4.5 else: tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((w * (r * w)) / ((v + -1.0) / r))) - 4.5) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 1.6e-5) tmp = Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(r * w) * Float64(Float64(r * w) * 0.375))) - 4.5); else tmp = Float64(3.0 + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(w * Float64(r * w)) / Float64(Float64(v + -1.0) / r))) - 4.5)); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 1.6e-5) tmp = ((3.0 + (2.0 / (r * r))) - ((r * w) * ((r * w) * 0.375))) - 4.5; else tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((w * (r * w)) / ((v + -1.0) / r))) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 1.6e-5], N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(r * w), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * 0.375), $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[(w * N[(r * w), $MachinePrecision]), $MachinePrecision] / N[(N[(v + -1.0), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.6 \cdot 10^{-5}:\\
\;\;\;\;\left(\left(3 + \frac{2}{r \cdot r}\right) - \left(r \cdot w\right) \cdot \left(\left(r \cdot w\right) \cdot 0.375\right)\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;3 + \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \frac{w \cdot \left(r \cdot w\right)}{\frac{v + -1}{r}} - 4.5\right)\\
\end{array}
\end{array}
if r < 1.59999999999999993e-5Initial program 91.3%
associate-/l*91.7%
cancel-sign-sub-inv91.7%
metadata-eval91.7%
+-commutative91.7%
*-commutative91.7%
fma-undefine91.7%
*-commutative91.7%
*-commutative91.7%
associate-/l*91.7%
*-commutative91.7%
associate-*r/91.7%
associate-*r*90.2%
associate-*l*97.5%
associate-*r*98.0%
Applied egg-rr98.0%
Taylor expanded in v around 0 91.9%
Taylor expanded in v around 0 97.4%
if 1.59999999999999993e-5 < r Initial program 91.9%
associate--l-91.8%
associate-*l*84.9%
sqr-neg84.9%
associate-*l*91.8%
+-commutative91.8%
+-commutative91.8%
associate-/l*98.3%
fma-define98.3%
Simplified98.3%
associate-/l*96.7%
*-commutative96.7%
associate-*r/96.7%
associate-*l*98.3%
associate-*r*99.7%
clear-num99.8%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in r around inf 99.8%
associate-*r/99.9%
Applied egg-rr99.9%
Final simplification98.0%
(FPCore (v w r)
:precision binary64
(if (<= r 1.6e-5)
(- (- (+ 3.0 (/ 2.0 (* r r))) (* (* r w) (* (* r w) 0.375))) 4.5)
(+
3.0
(-
(* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (/ w (/ (+ v -1.0) r))))
4.5))))
double code(double v, double w, double r) {
double tmp;
if (r <= 1.6e-5) {
tmp = ((3.0 + (2.0 / (r * r))) - ((r * w) * ((r * w) * 0.375))) - 4.5;
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w / ((v + -1.0) / r)))) - 4.5);
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: tmp
if (r <= 1.6d-5) then
tmp = ((3.0d0 + (2.0d0 / (r * r))) - ((r * w) * ((r * w) * 0.375d0))) - 4.5d0
else
tmp = 3.0d0 + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * (w / ((v + (-1.0d0)) / r)))) - 4.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 1.6e-5) {
tmp = ((3.0 + (2.0 / (r * r))) - ((r * w) * ((r * w) * 0.375))) - 4.5;
} else {
tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w / ((v + -1.0) / r)))) - 4.5);
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 1.6e-5: tmp = ((3.0 + (2.0 / (r * r))) - ((r * w) * ((r * w) * 0.375))) - 4.5 else: tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w / ((v + -1.0) / r)))) - 4.5) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 1.6e-5) tmp = Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(r * w) * Float64(Float64(r * w) * 0.375))) - 4.5); else tmp = Float64(3.0 + 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 return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 1.6e-5) tmp = ((3.0 + (2.0 / (r * r))) - ((r * w) * ((r * w) * 0.375))) - 4.5; else tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w / ((v + -1.0) / r)))) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 1.6e-5], N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(r * w), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * 0.375), $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[(w / N[(N[(v + -1.0), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.6 \cdot 10^{-5}:\\
\;\;\;\;\left(\left(3 + \frac{2}{r \cdot r}\right) - \left(r \cdot w\right) \cdot \left(\left(r \cdot w\right) \cdot 0.375\right)\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;3 + \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}
\end{array}
if r < 1.59999999999999993e-5Initial program 91.3%
associate-/l*91.7%
cancel-sign-sub-inv91.7%
metadata-eval91.7%
+-commutative91.7%
*-commutative91.7%
fma-undefine91.7%
*-commutative91.7%
*-commutative91.7%
associate-/l*91.7%
*-commutative91.7%
associate-*r/91.7%
associate-*r*90.2%
associate-*l*97.5%
associate-*r*98.0%
Applied egg-rr98.0%
Taylor expanded in v around 0 91.9%
Taylor expanded in v around 0 97.4%
if 1.59999999999999993e-5 < r Initial program 91.9%
associate--l-91.8%
associate-*l*84.9%
sqr-neg84.9%
associate-*l*91.8%
+-commutative91.8%
+-commutative91.8%
associate-/l*98.3%
fma-define98.3%
Simplified98.3%
associate-/l*96.7%
*-commutative96.7%
associate-*r/96.7%
associate-*l*98.3%
associate-*r*99.7%
clear-num99.8%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in r around inf 99.8%
Final simplification98.0%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (+ -1.5 (/ (+ (* v -0.25) 0.375) (/ (+ v -1.0) (* (* r w) (* r w)))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) / ((v + -1.0) / ((r * w) * (r * w)))));
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (2.0d0 / (r * r)) + ((-1.5d0) + (((v * (-0.25d0)) + 0.375d0) / ((v + (-1.0d0)) / ((r * w) * (r * w)))))
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) / ((v + -1.0) / ((r * w) * (r * w)))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) / ((v + -1.0) / ((r * w) * (r * w)))))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(Float64(Float64(v * -0.25) + 0.375) / Float64(Float64(v + -1.0) / Float64(Float64(r * w) * Float64(r * w)))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) / ((v + -1.0) / ((r * w) * (r * w))))); end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(N[(N[(v * -0.25), $MachinePrecision] + 0.375), $MachinePrecision] / N[(N[(v + -1.0), $MachinePrecision] / N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 + \frac{v \cdot -0.25 + 0.375}{\frac{v + -1}{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}}\right)
\end{array}
Initial program 91.4%
Simplified92.9%
fma-undefine92.9%
*-commutative92.9%
+-commutative92.9%
metadata-eval92.9%
cancel-sign-sub-inv92.9%
associate-*r/92.9%
*-commutative92.9%
associate-/l*93.2%
clear-num93.2%
un-div-inv93.2%
Applied egg-rr99.9%
unpow299.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (* (* r w) (* w (* r 0.375)))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - ((r * w) * (w * (r * 0.375)))) - 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))) - ((r * w) * (w * (r * 0.375d0)))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - ((r * w) * (w * (r * 0.375)))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - ((r * w) * (w * (r * 0.375)))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(r * w) * Float64(w * Float64(r * 0.375)))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - ((r * w) * (w * (r * 0.375)))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(r * w), $MachinePrecision] * N[(w * N[(r * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \left(r \cdot w\right) \cdot \left(w \cdot \left(r \cdot 0.375\right)\right)\right) - 4.5
\end{array}
Initial program 91.4%
associate-/l*93.2%
cancel-sign-sub-inv93.2%
metadata-eval93.2%
+-commutative93.2%
*-commutative93.2%
fma-undefine93.2%
*-commutative93.2%
*-commutative93.2%
associate-/l*92.9%
*-commutative92.9%
associate-*r/92.9%
associate-*r*89.4%
associate-*l*95.3%
associate-*r*95.8%
Applied egg-rr95.8%
Taylor expanded in v around 0 87.5%
Taylor expanded in v around 0 95.9%
*-commutative95.9%
Simplified95.9%
Final simplification95.9%
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (* (* r w) (* (* r w) 0.375))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - ((r * w) * ((r * w) * 0.375))) - 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))) - ((r * w) * ((r * w) * 0.375d0))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - ((r * w) * ((r * w) * 0.375))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - ((r * w) * ((r * w) * 0.375))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(r * w) * Float64(Float64(r * w) * 0.375))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - ((r * w) * ((r * w) * 0.375))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(r * w), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \left(r \cdot w\right) \cdot \left(\left(r \cdot w\right) \cdot 0.375\right)\right) - 4.5
\end{array}
Initial program 91.4%
associate-/l*93.2%
cancel-sign-sub-inv93.2%
metadata-eval93.2%
+-commutative93.2%
*-commutative93.2%
fma-undefine93.2%
*-commutative93.2%
*-commutative93.2%
associate-/l*92.9%
*-commutative92.9%
associate-*r/92.9%
associate-*r*89.4%
associate-*l*95.3%
associate-*r*95.8%
Applied egg-rr95.8%
Taylor expanded in v around 0 87.5%
Taylor expanded in v around 0 95.8%
Final simplification95.8%
(FPCore (v w r) :precision binary64 (if (<= r 9.2e-34) (- (+ 3.0 (/ 2.0 (* r r))) 4.5) (- (- 3.0 (* (* r w) (* w (* r 0.375)))) 4.5)))
double code(double v, double w, double r) {
double tmp;
if (r <= 9.2e-34) {
tmp = (3.0 + (2.0 / (r * r))) - 4.5;
} else {
tmp = (3.0 - ((r * w) * (w * (r * 0.375)))) - 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 <= 9.2d-34) then
tmp = (3.0d0 + (2.0d0 / (r * r))) - 4.5d0
else
tmp = (3.0d0 - ((r * w) * (w * (r * 0.375d0)))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 9.2e-34) {
tmp = (3.0 + (2.0 / (r * r))) - 4.5;
} else {
tmp = (3.0 - ((r * w) * (w * (r * 0.375)))) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 9.2e-34: tmp = (3.0 + (2.0 / (r * r))) - 4.5 else: tmp = (3.0 - ((r * w) * (w * (r * 0.375)))) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 9.2e-34) tmp = Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - 4.5); else tmp = Float64(Float64(3.0 - Float64(Float64(r * w) * Float64(w * Float64(r * 0.375)))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 9.2e-34) tmp = (3.0 + (2.0 / (r * r))) - 4.5; else tmp = (3.0 - ((r * w) * (w * (r * 0.375)))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 9.2e-34], N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(3.0 - N[(N[(r * w), $MachinePrecision] * N[(w * N[(r * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 9.2 \cdot 10^{-34}:\\
\;\;\;\;\left(3 + \frac{2}{r \cdot r}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(3 - \left(r \cdot w\right) \cdot \left(w \cdot \left(r \cdot 0.375\right)\right)\right) - 4.5\\
\end{array}
\end{array}
if r < 9.20000000000000045e-34Initial program 91.0%
Simplified87.2%
Taylor expanded in r around 0 67.4%
if 9.20000000000000045e-34 < r Initial program 92.6%
associate-/l*98.5%
cancel-sign-sub-inv98.5%
metadata-eval98.5%
+-commutative98.5%
*-commutative98.5%
fma-undefine98.5%
*-commutative98.5%
*-commutative98.5%
associate-/l*97.1%
*-commutative97.1%
associate-*r/97.1%
associate-*r*87.8%
associate-*l*89.2%
associate-*r*89.3%
Applied egg-rr89.3%
Taylor expanded in v around 0 73.8%
Taylor expanded in v around 0 91.5%
*-commutative91.5%
Simplified91.5%
Taylor expanded in r around inf 88.4%
Final simplification72.6%
(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 91.4%
Simplified86.6%
Taylor expanded in r around 0 57.3%
(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 91.4%
Simplified86.6%
Taylor expanded in r around 0 57.3%
Taylor expanded in r around inf 14.2%
herbie shell --seed 2024152
(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))