
(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 7 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}
NOTE: r should be positive before calling this function
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ (+ 0.375 (* v -0.25)) (- 1.0 v))) (t_1 (/ 2.0 (* r r))))
(if (<= r 1e+58)
(+ t_1 (- -1.5 (* (* w (* (* r r) w)) t_0)))
(+ t_1 (- -1.5 (* t_0 (* r (* w (* r w)))))))))r = abs(r);
double code(double v, double w, double r) {
double t_0 = (0.375 + (v * -0.25)) / (1.0 - v);
double t_1 = 2.0 / (r * r);
double tmp;
if (r <= 1e+58) {
tmp = t_1 + (-1.5 - ((w * ((r * r) * w)) * t_0));
} else {
tmp = t_1 + (-1.5 - (t_0 * (r * (w * (r * w)))));
}
return tmp;
}
NOTE: r should be positive before calling this function
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (0.375d0 + (v * (-0.25d0))) / (1.0d0 - v)
t_1 = 2.0d0 / (r * r)
if (r <= 1d+58) then
tmp = t_1 + ((-1.5d0) - ((w * ((r * r) * w)) * t_0))
else
tmp = t_1 + ((-1.5d0) - (t_0 * (r * (w * (r * w)))))
end if
code = tmp
end function
r = Math.abs(r);
public static double code(double v, double w, double r) {
double t_0 = (0.375 + (v * -0.25)) / (1.0 - v);
double t_1 = 2.0 / (r * r);
double tmp;
if (r <= 1e+58) {
tmp = t_1 + (-1.5 - ((w * ((r * r) * w)) * t_0));
} else {
tmp = t_1 + (-1.5 - (t_0 * (r * (w * (r * w)))));
}
return tmp;
}
r = abs(r) def code(v, w, r): t_0 = (0.375 + (v * -0.25)) / (1.0 - v) t_1 = 2.0 / (r * r) tmp = 0 if r <= 1e+58: tmp = t_1 + (-1.5 - ((w * ((r * r) * w)) * t_0)) else: tmp = t_1 + (-1.5 - (t_0 * (r * (w * (r * w))))) return tmp
r = abs(r) function code(v, w, r) t_0 = Float64(Float64(0.375 + Float64(v * -0.25)) / Float64(1.0 - v)) t_1 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 1e+58) tmp = Float64(t_1 + Float64(-1.5 - Float64(Float64(w * Float64(Float64(r * r) * w)) * t_0))); else tmp = Float64(t_1 + Float64(-1.5 - Float64(t_0 * Float64(r * Float64(w * Float64(r * w)))))); end return tmp end
r = abs(r) function tmp_2 = code(v, w, r) t_0 = (0.375 + (v * -0.25)) / (1.0 - v); t_1 = 2.0 / (r * r); tmp = 0.0; if (r <= 1e+58) tmp = t_1 + (-1.5 - ((w * ((r * r) * w)) * t_0)); else tmp = t_1 + (-1.5 - (t_0 * (r * (w * (r * w))))); end tmp_2 = tmp; end
NOTE: r should be positive before calling this function
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 1e+58], N[(t$95$1 + N[(-1.5 - N[(N[(w * N[(N[(r * r), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(-1.5 - N[(t$95$0 * N[(r * N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
r = |r|\\
\\
\begin{array}{l}
t_0 := \frac{0.375 + v \cdot -0.25}{1 - v}\\
t_1 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 10^{+58}:\\
\;\;\;\;t_1 + \left(-1.5 - \left(w \cdot \left(\left(r \cdot r\right) \cdot w\right)\right) \cdot t_0\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(-1.5 - t_0 \cdot \left(r \cdot \left(w \cdot \left(r \cdot w\right)\right)\right)\right)\\
\end{array}
\end{array}
if r < 9.99999999999999944e57Initial program 85.8%
associate--l-85.8%
+-commutative85.8%
associate--l+85.8%
+-commutative85.8%
associate--r+85.8%
metadata-eval85.8%
associate-*l/89.4%
*-commutative89.4%
*-commutative89.4%
*-commutative89.4%
Simplified89.4%
Taylor expanded in r around 0 85.7%
unpow285.7%
associate-*l*95.8%
unpow295.8%
Simplified95.8%
if 9.99999999999999944e57 < r Initial program 97.8%
associate--l-97.8%
+-commutative97.8%
associate--l+97.8%
+-commutative97.8%
associate--r+97.8%
metadata-eval97.8%
associate-*l/97.8%
*-commutative97.8%
*-commutative97.8%
*-commutative97.8%
Simplified97.8%
Taylor expanded in r around 0 97.8%
unpow297.8%
associate-*l*99.9%
Simplified99.9%
Final simplification96.5%
NOTE: r should be positive before calling this function
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= r 1e-71)
(+ t_0 (- (* w (* -0.375 (* r (* r w)))) 1.5))
(+
t_0
(- -1.5 (* (/ (+ 0.375 (* v -0.25)) (- 1.0 v)) (* r (* r (* w w)))))))))r = abs(r);
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 1e-71) {
tmp = t_0 + ((w * (-0.375 * (r * (r * w)))) - 1.5);
} else {
tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w)))));
}
return tmp;
}
NOTE: r should be positive before calling this function
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 (r <= 1d-71) then
tmp = t_0 + ((w * ((-0.375d0) * (r * (r * w)))) - 1.5d0)
else
tmp = t_0 + ((-1.5d0) - (((0.375d0 + (v * (-0.25d0))) / (1.0d0 - v)) * (r * (r * (w * w)))))
end if
code = tmp
end function
r = Math.abs(r);
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 1e-71) {
tmp = t_0 + ((w * (-0.375 * (r * (r * w)))) - 1.5);
} else {
tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w)))));
}
return tmp;
}
r = abs(r) def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if r <= 1e-71: tmp = t_0 + ((w * (-0.375 * (r * (r * w)))) - 1.5) else: tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w))))) return tmp
r = abs(r) function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 1e-71) tmp = Float64(t_0 + Float64(Float64(w * Float64(-0.375 * Float64(r * Float64(r * w)))) - 1.5)); else tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(Float64(0.375 + Float64(v * -0.25)) / Float64(1.0 - v)) * Float64(r * Float64(r * Float64(w * w)))))); end return tmp end
r = abs(r) function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (r <= 1e-71) tmp = t_0 + ((w * (-0.375 * (r * (r * w)))) - 1.5); else tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w))))); end tmp_2 = tmp; end
NOTE: r should be positive before calling this function
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 1e-71], N[(t$95$0 + N[(N[(w * N[(-0.375 * N[(r * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.5 - N[(N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
r = |r|\\
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 10^{-71}:\\
\;\;\;\;t_0 + \left(w \cdot \left(-0.375 \cdot \left(r \cdot \left(r \cdot w\right)\right)\right) - 1.5\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 + \left(-1.5 - \frac{0.375 + v \cdot -0.25}{1 - v} \cdot \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right)\right)\\
\end{array}
\end{array}
if r < 9.9999999999999992e-72Initial program 85.7%
sub-neg85.7%
+-commutative85.7%
associate--l+85.7%
associate-/l*87.8%
distribute-neg-frac87.8%
associate-/r/87.8%
fma-def87.8%
sub-neg87.8%
Simplified83.5%
Taylor expanded in v around 0 81.7%
associate--l+81.7%
associate-*r/81.7%
metadata-eval81.7%
unpow281.7%
*-commutative81.7%
unpow281.7%
unpow281.7%
Simplified81.7%
Taylor expanded in w around 0 81.7%
*-commutative81.7%
unpow281.7%
associate-*r*81.7%
unpow281.7%
associate-*l*92.5%
*-commutative92.5%
Simplified92.5%
Taylor expanded in w around 0 92.5%
unpow292.5%
associate-*r*94.9%
Simplified94.9%
if 9.9999999999999992e-72 < r Initial program 93.5%
associate--l-93.5%
+-commutative93.5%
associate--l+93.5%
+-commutative93.5%
associate--r+93.6%
metadata-eval93.6%
associate-*l/98.5%
*-commutative98.5%
*-commutative98.5%
*-commutative98.5%
Simplified98.5%
Final simplification96.0%
NOTE: r should be positive before calling this function
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= r 4.4e-75)
(+ t_0 (- (* w (* -0.375 (* r (* r w)))) 1.5))
(+
t_0
(- -1.5 (* (/ (+ 0.375 (* v -0.25)) (- 1.0 v)) (* r (* w (* r w)))))))))r = abs(r);
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 4.4e-75) {
tmp = t_0 + ((w * (-0.375 * (r * (r * w)))) - 1.5);
} else {
tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (w * (r * w)))));
}
return tmp;
}
NOTE: r should be positive before calling this function
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 (r <= 4.4d-75) then
tmp = t_0 + ((w * ((-0.375d0) * (r * (r * w)))) - 1.5d0)
else
tmp = t_0 + ((-1.5d0) - (((0.375d0 + (v * (-0.25d0))) / (1.0d0 - v)) * (r * (w * (r * w)))))
end if
code = tmp
end function
r = Math.abs(r);
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 4.4e-75) {
tmp = t_0 + ((w * (-0.375 * (r * (r * w)))) - 1.5);
} else {
tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (w * (r * w)))));
}
return tmp;
}
r = abs(r) def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if r <= 4.4e-75: tmp = t_0 + ((w * (-0.375 * (r * (r * w)))) - 1.5) else: tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (w * (r * w))))) return tmp
r = abs(r) function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 4.4e-75) tmp = Float64(t_0 + Float64(Float64(w * Float64(-0.375 * Float64(r * Float64(r * w)))) - 1.5)); else tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(Float64(0.375 + Float64(v * -0.25)) / Float64(1.0 - v)) * Float64(r * Float64(w * Float64(r * w)))))); end return tmp end
r = abs(r) function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (r <= 4.4e-75) tmp = t_0 + ((w * (-0.375 * (r * (r * w)))) - 1.5); else tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (w * (r * w))))); end tmp_2 = tmp; end
NOTE: r should be positive before calling this function
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 4.4e-75], N[(t$95$0 + N[(N[(w * N[(-0.375 * N[(r * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.5 - N[(N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[(r * N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
r = |r|\\
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 4.4 \cdot 10^{-75}:\\
\;\;\;\;t_0 + \left(w \cdot \left(-0.375 \cdot \left(r \cdot \left(r \cdot w\right)\right)\right) - 1.5\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 + \left(-1.5 - \frac{0.375 + v \cdot -0.25}{1 - v} \cdot \left(r \cdot \left(w \cdot \left(r \cdot w\right)\right)\right)\right)\\
\end{array}
\end{array}
if r < 4.40000000000000011e-75Initial program 86.2%
sub-neg86.2%
+-commutative86.2%
associate--l+86.2%
associate-/l*88.3%
distribute-neg-frac88.3%
associate-/r/88.3%
fma-def88.3%
sub-neg88.3%
Simplified83.9%
Taylor expanded in v around 0 82.2%
associate--l+82.2%
associate-*r/82.2%
metadata-eval82.2%
unpow282.2%
*-commutative82.2%
unpow282.2%
unpow282.2%
Simplified82.2%
Taylor expanded in w around 0 82.2%
*-commutative82.2%
unpow282.2%
associate-*r*82.1%
unpow282.1%
associate-*l*92.9%
*-commutative92.9%
Simplified92.9%
Taylor expanded in w around 0 92.9%
unpow292.9%
associate-*r*95.3%
Simplified95.3%
if 4.40000000000000011e-75 < r Initial program 92.4%
associate--l-92.4%
+-commutative92.4%
associate--l+92.4%
+-commutative92.4%
associate--r+92.4%
metadata-eval92.4%
associate-*l/97.3%
*-commutative97.3%
*-commutative97.3%
*-commutative97.3%
Simplified97.3%
Taylor expanded in r around 0 97.3%
unpow297.3%
associate-*l*99.8%
Simplified99.8%
Final simplification96.7%
NOTE: r should be positive before calling this function (FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (- (* w (* -0.375 (* r (* r w)))) 1.5)))
r = abs(r);
double code(double v, double w, double r) {
return (2.0 / (r * r)) + ((w * (-0.375 * (r * (r * w)))) - 1.5);
}
NOTE: r should be positive before calling this function
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)) + ((w * ((-0.375d0) * (r * (r * w)))) - 1.5d0)
end function
r = Math.abs(r);
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + ((w * (-0.375 * (r * (r * w)))) - 1.5);
}
r = abs(r) def code(v, w, r): return (2.0 / (r * r)) + ((w * (-0.375 * (r * (r * w)))) - 1.5)
r = abs(r) function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(Float64(w * Float64(-0.375 * Float64(r * Float64(r * w)))) - 1.5)) end
r = abs(r) function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + ((w * (-0.375 * (r * (r * w)))) - 1.5); end
NOTE: r should be positive before calling this function code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(N[(w * N[(-0.375 * N[(r * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
r = |r|\\
\\
\frac{2}{r \cdot r} + \left(w \cdot \left(-0.375 \cdot \left(r \cdot \left(r \cdot w\right)\right)\right) - 1.5\right)
\end{array}
Initial program 88.0%
sub-neg88.0%
+-commutative88.0%
associate--l+88.1%
associate-/l*91.0%
distribute-neg-frac91.0%
associate-/r/91.0%
fma-def91.0%
sub-neg91.0%
Simplified85.0%
Taylor expanded in v around 0 81.2%
associate--l+81.2%
associate-*r/81.2%
metadata-eval81.2%
unpow281.2%
*-commutative81.2%
unpow281.2%
unpow281.2%
Simplified81.2%
Taylor expanded in w around 0 81.2%
*-commutative81.2%
unpow281.2%
associate-*r*81.1%
unpow281.1%
associate-*l*88.8%
*-commutative88.8%
Simplified88.8%
Taylor expanded in w around 0 88.8%
unpow288.8%
associate-*r*91.7%
Simplified91.7%
Final simplification91.7%
NOTE: r should be positive before calling this function (FPCore (v w r) :precision binary64 (if (<= r 5e+140) (+ (/ 2.0 (* r r)) -1.5) (+ (* (* v (* (* r r) (* w w))) 0.25) -4.5)))
r = abs(r);
double code(double v, double w, double r) {
double tmp;
if (r <= 5e+140) {
tmp = (2.0 / (r * r)) + -1.5;
} else {
tmp = ((v * ((r * r) * (w * w))) * 0.25) + -4.5;
}
return tmp;
}
NOTE: r should be positive before calling this function
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 <= 5d+140) then
tmp = (2.0d0 / (r * r)) + (-1.5d0)
else
tmp = ((v * ((r * r) * (w * w))) * 0.25d0) + (-4.5d0)
end if
code = tmp
end function
r = Math.abs(r);
public static double code(double v, double w, double r) {
double tmp;
if (r <= 5e+140) {
tmp = (2.0 / (r * r)) + -1.5;
} else {
tmp = ((v * ((r * r) * (w * w))) * 0.25) + -4.5;
}
return tmp;
}
r = abs(r) def code(v, w, r): tmp = 0 if r <= 5e+140: tmp = (2.0 / (r * r)) + -1.5 else: tmp = ((v * ((r * r) * (w * w))) * 0.25) + -4.5 return tmp
r = abs(r) function code(v, w, r) tmp = 0.0 if (r <= 5e+140) tmp = Float64(Float64(2.0 / Float64(r * r)) + -1.5); else tmp = Float64(Float64(Float64(v * Float64(Float64(r * r) * Float64(w * w))) * 0.25) + -4.5); end return tmp end
r = abs(r) function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 5e+140) tmp = (2.0 / (r * r)) + -1.5; else tmp = ((v * ((r * r) * (w * w))) * 0.25) + -4.5; end tmp_2 = tmp; end
NOTE: r should be positive before calling this function code[v_, w_, r_] := If[LessEqual[r, 5e+140], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision], N[(N[(N[(v * N[(N[(r * r), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision] + -4.5), $MachinePrecision]]
\begin{array}{l}
r = |r|\\
\\
\begin{array}{l}
\mathbf{if}\;r \leq 5 \cdot 10^{+140}:\\
\;\;\;\;\frac{2}{r \cdot r} + -1.5\\
\mathbf{else}:\\
\;\;\;\;\left(v \cdot \left(\left(r \cdot r\right) \cdot \left(w \cdot w\right)\right)\right) \cdot 0.25 + -4.5\\
\end{array}
\end{array}
if r < 5.00000000000000008e140Initial program 86.5%
sub-neg86.5%
+-commutative86.5%
associate--l+86.5%
associate-/l*89.9%
distribute-neg-frac89.9%
associate-/r/89.9%
fma-def89.9%
sub-neg89.9%
Simplified86.4%
Taylor expanded in r around 0 61.3%
sub-neg61.3%
associate-*r/61.3%
metadata-eval61.3%
unpow261.3%
metadata-eval61.3%
Simplified61.3%
if 5.00000000000000008e140 < r Initial program 97.3%
sub-neg97.3%
associate-/l*97.3%
cancel-sign-sub-inv97.3%
metadata-eval97.3%
*-commutative97.3%
*-commutative97.3%
metadata-eval97.3%
Simplified97.3%
Taylor expanded in v around 0 63.0%
*-commutative63.0%
associate-/r*63.0%
unpow263.0%
associate-/r*63.0%
associate-/r*81.1%
*-commutative81.1%
unpow281.1%
Simplified81.1%
Taylor expanded in r around 0 63.0%
unpow263.0%
*-commutative63.0%
unpow263.0%
Simplified63.0%
Taylor expanded in v around inf 44.4%
*-commutative44.4%
unpow244.4%
unpow244.4%
Simplified44.4%
Final simplification58.9%
NOTE: r should be positive before calling this function (FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) -1.5))
r = abs(r);
double code(double v, double w, double r) {
return (2.0 / (r * r)) + -1.5;
}
NOTE: r should be positive before calling this function
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)
end function
r = Math.abs(r);
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + -1.5;
}
r = abs(r) def code(v, w, r): return (2.0 / (r * r)) + -1.5
r = abs(r) function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + -1.5) end
r = abs(r) function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + -1.5; end
NOTE: r should be positive before calling this function code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision]
\begin{array}{l}
r = |r|\\
\\
\frac{2}{r \cdot r} + -1.5
\end{array}
Initial program 88.0%
sub-neg88.0%
+-commutative88.0%
associate--l+88.1%
associate-/l*91.0%
distribute-neg-frac91.0%
associate-/r/91.0%
fma-def91.0%
sub-neg91.0%
Simplified85.0%
Taylor expanded in r around 0 54.5%
sub-neg54.5%
associate-*r/54.5%
metadata-eval54.5%
unpow254.5%
metadata-eval54.5%
Simplified54.5%
Final simplification54.5%
NOTE: r should be positive before calling this function (FPCore (v w r) :precision binary64 (/ 2.0 (* r r)))
r = abs(r);
double code(double v, double w, double r) {
return 2.0 / (r * r);
}
NOTE: r should be positive before calling this function
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)
end function
r = Math.abs(r);
public static double code(double v, double w, double r) {
return 2.0 / (r * r);
}
r = abs(r) def code(v, w, r): return 2.0 / (r * r)
r = abs(r) function code(v, w, r) return Float64(2.0 / Float64(r * r)) end
r = abs(r) function tmp = code(v, w, r) tmp = 2.0 / (r * r); end
NOTE: r should be positive before calling this function code[v_, w_, r_] := N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
r = |r|\\
\\
\frac{2}{r \cdot r}
\end{array}
Initial program 88.0%
sub-neg88.0%
+-commutative88.0%
associate--l+88.1%
associate-/l*91.0%
distribute-neg-frac91.0%
associate-/r/91.0%
fma-def91.0%
sub-neg91.0%
Simplified85.0%
Taylor expanded in v around 0 81.2%
associate--l+81.2%
associate-*r/81.2%
metadata-eval81.2%
unpow281.2%
*-commutative81.2%
unpow281.2%
unpow281.2%
Simplified81.2%
Taylor expanded in r around 0 45.0%
unpow245.0%
Simplified45.0%
Final simplification45.0%
herbie shell --seed 2023229
(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))