
(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 10 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 (/ 2.0 (* r r))))
(if (<= r 2.8e-95)
(+ (- (+ t_0 3.0) (* (* (* r w) (* r w)) 0.375)) -4.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 <= 2.8e-95) {
tmp = ((t_0 + 3.0) - (((r * w) * (r * w)) * 0.375)) + -4.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 <= 2.8d-95) then
tmp = ((t_0 + 3.0d0) - (((r * w) * (r * w)) * 0.375d0)) + (-4.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 <= 2.8e-95) {
tmp = ((t_0 + 3.0) - (((r * w) * (r * w)) * 0.375)) + -4.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 <= 2.8e-95: tmp = ((t_0 + 3.0) - (((r * w) * (r * w)) * 0.375)) + -4.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 <= 2.8e-95) tmp = Float64(Float64(Float64(t_0 + 3.0) - Float64(Float64(Float64(r * w) * Float64(r * w)) * 0.375)) + -4.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 <= 2.8e-95) tmp = ((t_0 + 3.0) - (((r * w) * (r * w)) * 0.375)) + -4.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, 2.8e-95], N[(N[(N[(t$95$0 + 3.0), $MachinePrecision] - N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] * 0.375), $MachinePrecision]), $MachinePrecision] + -4.5), $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 2.8 \cdot 10^{-95}:\\
\;\;\;\;\left(\left(t_0 + 3\right) - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot 0.375\right) + -4.5\\
\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 < 2.7999999999999999e-95Initial program 87.4%
sub-neg87.4%
associate-/l*89.6%
cancel-sign-sub-inv89.6%
metadata-eval89.6%
*-commutative89.6%
*-commutative89.6%
metadata-eval89.6%
Simplified89.6%
Taylor expanded in v around 0 80.5%
*-commutative80.5%
*-commutative80.5%
unpow280.5%
unpow280.5%
swap-sqr95.3%
unpow295.3%
*-commutative95.3%
Simplified95.3%
unpow295.3%
*-commutative95.3%
*-commutative95.3%
Applied egg-rr95.3%
if 2.7999999999999999e-95 < r Initial program 84.4%
associate--l-84.4%
+-commutative84.4%
associate--l+84.4%
+-commutative84.4%
associate--r+84.4%
metadata-eval84.4%
associate-*l/89.1%
*-commutative89.1%
*-commutative89.1%
*-commutative89.1%
Simplified89.1%
Taylor expanded in r around 0 89.1%
*-commutative89.1%
unpow289.1%
associate-*r*99.8%
*-commutative99.8%
Simplified99.8%
Final simplification96.7%
NOTE: r should be positive before calling this function
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (or (<= w 1.2e-159) (not (<= w 5e+147)))
(+ (- (+ t_0 3.0) (* (* (* r w) (* r w)) 0.375)) -4.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 ((w <= 1.2e-159) || !(w <= 5e+147)) {
tmp = ((t_0 + 3.0) - (((r * w) * (r * w)) * 0.375)) + -4.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 ((w <= 1.2d-159) .or. (.not. (w <= 5d+147))) then
tmp = ((t_0 + 3.0d0) - (((r * w) * (r * w)) * 0.375d0)) + (-4.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 ((w <= 1.2e-159) || !(w <= 5e+147)) {
tmp = ((t_0 + 3.0) - (((r * w) * (r * w)) * 0.375)) + -4.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 (w <= 1.2e-159) or not (w <= 5e+147): tmp = ((t_0 + 3.0) - (((r * w) * (r * w)) * 0.375)) + -4.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 ((w <= 1.2e-159) || !(w <= 5e+147)) tmp = Float64(Float64(Float64(t_0 + 3.0) - Float64(Float64(Float64(r * w) * Float64(r * w)) * 0.375)) + -4.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 ((w <= 1.2e-159) || ~((w <= 5e+147))) tmp = ((t_0 + 3.0) - (((r * w) * (r * w)) * 0.375)) + -4.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[Or[LessEqual[w, 1.2e-159], N[Not[LessEqual[w, 5e+147]], $MachinePrecision]], N[(N[(N[(t$95$0 + 3.0), $MachinePrecision] - N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] * 0.375), $MachinePrecision]), $MachinePrecision] + -4.5), $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}\;w \leq 1.2 \cdot 10^{-159} \lor \neg \left(w \leq 5 \cdot 10^{+147}\right):\\
\;\;\;\;\left(\left(t_0 + 3\right) - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot 0.375\right) + -4.5\\
\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 w < 1.19999999999999999e-159 or 5.0000000000000002e147 < w Initial program 83.9%
sub-neg83.9%
associate-/l*86.6%
cancel-sign-sub-inv86.6%
metadata-eval86.6%
*-commutative86.6%
*-commutative86.6%
metadata-eval86.6%
Simplified86.6%
Taylor expanded in v around 0 76.4%
*-commutative76.4%
*-commutative76.4%
unpow276.4%
unpow276.4%
swap-sqr93.6%
unpow293.6%
*-commutative93.6%
Simplified93.6%
unpow293.6%
*-commutative93.6%
*-commutative93.6%
Applied egg-rr93.6%
if 1.19999999999999999e-159 < w < 5.0000000000000002e147Initial program 96.3%
associate--l-96.3%
+-commutative96.3%
associate--l+96.3%
+-commutative96.3%
associate--r+96.3%
metadata-eval96.3%
associate-*l/99.8%
*-commutative99.8%
*-commutative99.8%
*-commutative99.8%
Simplified99.8%
Final simplification94.9%
NOTE: r should be positive before calling this function (FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (- -1.5 (* (* (* r w) (* r w)) (/ (+ 0.375 (* v -0.25)) (- 1.0 v))))))
r = abs(r);
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - (((r * w) * (r * w)) * ((0.375 + (v * -0.25)) / (1.0 - v))));
}
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) - (((r * w) * (r * w)) * ((0.375d0 + (v * (-0.25d0))) / (1.0d0 - v))))
end function
r = Math.abs(r);
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - (((r * w) * (r * w)) * ((0.375 + (v * -0.25)) / (1.0 - v))));
}
r = abs(r) def code(v, w, r): return (2.0 / (r * r)) + (-1.5 - (((r * w) * (r * w)) * ((0.375 + (v * -0.25)) / (1.0 - v))))
r = abs(r) function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 - Float64(Float64(Float64(r * w) * Float64(r * w)) * Float64(Float64(0.375 + Float64(v * -0.25)) / Float64(1.0 - v))))) end
r = abs(r) function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 - (((r * w) * (r * w)) * ((0.375 + (v * -0.25)) / (1.0 - v)))); end
NOTE: r should be positive before calling this function code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] * N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
r = |r|\\
\\
\frac{2}{r \cdot r} + \left(-1.5 - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot \frac{0.375 + v \cdot -0.25}{1 - v}\right)
\end{array}
Initial program 86.5%
associate--l-86.5%
+-commutative86.5%
associate--l+86.5%
+-commutative86.5%
associate--r+86.5%
metadata-eval86.5%
associate-*l/89.4%
*-commutative89.4%
*-commutative89.4%
*-commutative89.4%
Simplified89.4%
Taylor expanded in r around 0 89.4%
*-commutative89.4%
unpow289.4%
associate-*r*97.2%
*-commutative97.2%
Simplified97.2%
add-cbrt-cube85.0%
associate-*l*85.0%
associate-*l*85.0%
associate-*l*85.0%
Applied egg-rr85.0%
add-cbrt-cube97.2%
associate-*r*99.8%
Applied egg-rr99.8%
Final simplification99.8%
NOTE: r should be positive before calling this function (FPCore (v w r) :precision binary64 (if (<= (* w w) 2e-272) (+ -1.5 (/ (/ 2.0 r) r)) (+ -4.5 (- (+ (/ 2.0 (* r r)) 3.0) (* 0.375 (* w (* (* r r) w)))))))
r = abs(r);
double code(double v, double w, double r) {
double tmp;
if ((w * w) <= 2e-272) {
tmp = -1.5 + ((2.0 / r) / r);
} else {
tmp = -4.5 + (((2.0 / (r * r)) + 3.0) - (0.375 * (w * ((r * 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) :: tmp
if ((w * w) <= 2d-272) then
tmp = (-1.5d0) + ((2.0d0 / r) / r)
else
tmp = (-4.5d0) + (((2.0d0 / (r * r)) + 3.0d0) - (0.375d0 * (w * ((r * r) * w))))
end if
code = tmp
end function
r = Math.abs(r);
public static double code(double v, double w, double r) {
double tmp;
if ((w * w) <= 2e-272) {
tmp = -1.5 + ((2.0 / r) / r);
} else {
tmp = -4.5 + (((2.0 / (r * r)) + 3.0) - (0.375 * (w * ((r * r) * w))));
}
return tmp;
}
r = abs(r) def code(v, w, r): tmp = 0 if (w * w) <= 2e-272: tmp = -1.5 + ((2.0 / r) / r) else: tmp = -4.5 + (((2.0 / (r * r)) + 3.0) - (0.375 * (w * ((r * r) * w)))) return tmp
r = abs(r) function code(v, w, r) tmp = 0.0 if (Float64(w * w) <= 2e-272) tmp = Float64(-1.5 + Float64(Float64(2.0 / r) / r)); else tmp = Float64(-4.5 + Float64(Float64(Float64(2.0 / Float64(r * r)) + 3.0) - Float64(0.375 * Float64(w * Float64(Float64(r * r) * w))))); end return tmp end
r = abs(r) function tmp_2 = code(v, w, r) tmp = 0.0; if ((w * w) <= 2e-272) tmp = -1.5 + ((2.0 / r) / r); else tmp = -4.5 + (((2.0 / (r * r)) + 3.0) - (0.375 * (w * ((r * r) * w)))); end tmp_2 = tmp; end
NOTE: r should be positive before calling this function code[v_, w_, r_] := If[LessEqual[N[(w * w), $MachinePrecision], 2e-272], N[(-1.5 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision], N[(-4.5 + N[(N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision] - N[(0.375 * N[(w * N[(N[(r * r), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
r = |r|\\
\\
\begin{array}{l}
\mathbf{if}\;w \cdot w \leq 2 \cdot 10^{-272}:\\
\;\;\;\;-1.5 + \frac{\frac{2}{r}}{r}\\
\mathbf{else}:\\
\;\;\;\;-4.5 + \left(\left(\frac{2}{r \cdot r} + 3\right) - 0.375 \cdot \left(w \cdot \left(\left(r \cdot r\right) \cdot w\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 w w) < 1.99999999999999986e-272Initial program 88.2%
sub-neg88.2%
+-commutative88.2%
associate--l+88.2%
associate-/l*88.2%
distribute-neg-frac88.2%
associate-/r/88.2%
fma-def88.2%
sub-neg88.2%
Simplified75.3%
Taylor expanded in r around 0 86.8%
sub-neg86.8%
associate-*r/86.8%
metadata-eval86.8%
unpow286.8%
metadata-eval86.8%
Simplified86.8%
div-inv46.0%
pow246.0%
pow-flip46.1%
metadata-eval46.1%
Applied egg-rr86.9%
metadata-eval46.1%
pow-flip46.0%
pow246.0%
div-inv46.0%
associate-/r*46.0%
Applied egg-rr86.8%
if 1.99999999999999986e-272 < (*.f64 w w) Initial program 85.8%
sub-neg85.8%
associate-/l*90.0%
cancel-sign-sub-inv90.0%
metadata-eval90.0%
*-commutative90.0%
*-commutative90.0%
metadata-eval90.0%
Simplified90.0%
Taylor expanded in v around 0 80.6%
*-commutative80.6%
*-commutative80.6%
unpow280.6%
unpow280.6%
swap-sqr92.7%
unpow292.7%
*-commutative92.7%
Simplified92.7%
unpow292.7%
unswap-sqr80.6%
associate-*l*90.1%
Applied egg-rr90.1%
Final simplification89.1%
NOTE: r should be positive before calling this function (FPCore (v w r) :precision binary64 (if (<= r 1.45e-113) (/ (/ 2.0 r) r) (+ (/ 2.0 (* r r)) (- (* (* (* r r) (* w w)) -0.375) 1.5))))
r = abs(r);
double code(double v, double w, double r) {
double tmp;
if (r <= 1.45e-113) {
tmp = (2.0 / r) / r;
} else {
tmp = (2.0 / (r * r)) + ((((r * r) * (w * w)) * -0.375) - 1.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 <= 1.45d-113) then
tmp = (2.0d0 / r) / r
else
tmp = (2.0d0 / (r * r)) + ((((r * r) * (w * w)) * (-0.375d0)) - 1.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 <= 1.45e-113) {
tmp = (2.0 / r) / r;
} else {
tmp = (2.0 / (r * r)) + ((((r * r) * (w * w)) * -0.375) - 1.5);
}
return tmp;
}
r = abs(r) def code(v, w, r): tmp = 0 if r <= 1.45e-113: tmp = (2.0 / r) / r else: tmp = (2.0 / (r * r)) + ((((r * r) * (w * w)) * -0.375) - 1.5) return tmp
r = abs(r) function code(v, w, r) tmp = 0.0 if (r <= 1.45e-113) tmp = Float64(Float64(2.0 / r) / r); else tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(Float64(Float64(Float64(r * r) * Float64(w * w)) * -0.375) - 1.5)); end return tmp end
r = abs(r) function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 1.45e-113) tmp = (2.0 / r) / r; else tmp = (2.0 / (r * r)) + ((((r * r) * (w * w)) * -0.375) - 1.5); end tmp_2 = tmp; end
NOTE: r should be positive before calling this function code[v_, w_, r_] := If[LessEqual[r, 1.45e-113], N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(r * r), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision] * -0.375), $MachinePrecision] - 1.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
r = |r|\\
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.45 \cdot 10^{-113}:\\
\;\;\;\;\frac{\frac{2}{r}}{r}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{r \cdot r} + \left(\left(\left(r \cdot r\right) \cdot \left(w \cdot w\right)\right) \cdot -0.375 - 1.5\right)\\
\end{array}
\end{array}
if r < 1.45000000000000002e-113Initial program 87.8%
sub-neg87.8%
+-commutative87.8%
associate--l+87.8%
associate-/l*90.0%
distribute-neg-frac90.0%
associate-/r/89.9%
fma-def89.9%
sub-neg89.9%
Simplified83.5%
Taylor expanded in v around inf 81.1%
associate--l+81.1%
associate-*r/81.1%
metadata-eval81.1%
unpow281.1%
*-commutative81.1%
unpow281.1%
unpow281.1%
Simplified81.1%
Taylor expanded in r around 0 49.5%
unpow249.5%
Simplified49.5%
div-inv49.5%
pow249.5%
pow-flip49.6%
metadata-eval49.6%
Applied egg-rr49.6%
metadata-eval49.6%
pow-flip49.5%
pow249.5%
div-inv49.5%
associate-/r*49.5%
Applied egg-rr49.5%
if 1.45000000000000002e-113 < r Initial program 83.8%
sub-neg83.8%
+-commutative83.8%
associate--l+83.8%
associate-/l*88.4%
distribute-neg-frac88.4%
associate-/r/88.3%
fma-def88.4%
sub-neg88.4%
Simplified78.5%
Taylor expanded in v around 0 75.4%
associate--l+75.4%
associate-*r/75.4%
metadata-eval75.4%
unpow275.4%
*-commutative75.4%
unpow275.4%
unpow275.4%
Simplified75.4%
Final simplification57.9%
NOTE: r should be positive before calling this function (FPCore (v w r) :precision binary64 (+ (- (+ (/ 2.0 (* r r)) 3.0) (* (* (* r w) (* r w)) 0.375)) -4.5))
r = abs(r);
double code(double v, double w, double r) {
return (((2.0 / (r * r)) + 3.0) - (((r * w) * (r * w)) * 0.375)) + -4.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)) + 3.0d0) - (((r * w) * (r * w)) * 0.375d0)) + (-4.5d0)
end function
r = Math.abs(r);
public static double code(double v, double w, double r) {
return (((2.0 / (r * r)) + 3.0) - (((r * w) * (r * w)) * 0.375)) + -4.5;
}
r = abs(r) def code(v, w, r): return (((2.0 / (r * r)) + 3.0) - (((r * w) * (r * w)) * 0.375)) + -4.5
r = abs(r) function code(v, w, r) return Float64(Float64(Float64(Float64(2.0 / Float64(r * r)) + 3.0) - Float64(Float64(Float64(r * w) * Float64(r * w)) * 0.375)) + -4.5) end
r = abs(r) function tmp = code(v, w, r) tmp = (((2.0 / (r * r)) + 3.0) - (((r * w) * (r * w)) * 0.375)) + -4.5; end
NOTE: r should be positive before calling this function code[v_, w_, r_] := N[(N[(N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision] - N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] * 0.375), $MachinePrecision]), $MachinePrecision] + -4.5), $MachinePrecision]
\begin{array}{l}
r = |r|\\
\\
\left(\left(\frac{2}{r \cdot r} + 3\right) - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot 0.375\right) + -4.5
\end{array}
Initial program 86.5%
sub-neg86.5%
associate-/l*89.4%
cancel-sign-sub-inv89.4%
metadata-eval89.4%
*-commutative89.4%
*-commutative89.4%
metadata-eval89.4%
Simplified89.4%
Taylor expanded in v around 0 79.0%
*-commutative79.0%
*-commutative79.0%
unpow279.0%
unpow279.0%
swap-sqr93.0%
unpow293.0%
*-commutative93.0%
Simplified93.0%
unpow293.0%
*-commutative93.0%
*-commutative93.0%
Applied egg-rr93.0%
Final simplification93.0%
NOTE: r should be positive before calling this function (FPCore (v w r) :precision binary64 (if (<= r 3.9e+26) (+ (/ 2.0 (* r r)) -1.5) (* (* r r) (* (* w w) -0.375))))
r = abs(r);
double code(double v, double w, double r) {
double tmp;
if (r <= 3.9e+26) {
tmp = (2.0 / (r * r)) + -1.5;
} else {
tmp = (r * r) * ((w * w) * -0.375);
}
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 <= 3.9d+26) then
tmp = (2.0d0 / (r * r)) + (-1.5d0)
else
tmp = (r * r) * ((w * w) * (-0.375d0))
end if
code = tmp
end function
r = Math.abs(r);
public static double code(double v, double w, double r) {
double tmp;
if (r <= 3.9e+26) {
tmp = (2.0 / (r * r)) + -1.5;
} else {
tmp = (r * r) * ((w * w) * -0.375);
}
return tmp;
}
r = abs(r) def code(v, w, r): tmp = 0 if r <= 3.9e+26: tmp = (2.0 / (r * r)) + -1.5 else: tmp = (r * r) * ((w * w) * -0.375) return tmp
r = abs(r) function code(v, w, r) tmp = 0.0 if (r <= 3.9e+26) tmp = Float64(Float64(2.0 / Float64(r * r)) + -1.5); else tmp = Float64(Float64(r * r) * Float64(Float64(w * w) * -0.375)); end return tmp end
r = abs(r) function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 3.9e+26) tmp = (2.0 / (r * r)) + -1.5; else tmp = (r * r) * ((w * w) * -0.375); end tmp_2 = tmp; end
NOTE: r should be positive before calling this function code[v_, w_, r_] := If[LessEqual[r, 3.9e+26], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision], N[(N[(r * r), $MachinePrecision] * N[(N[(w * w), $MachinePrecision] * -0.375), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
r = |r|\\
\\
\begin{array}{l}
\mathbf{if}\;r \leq 3.9 \cdot 10^{+26}:\\
\;\;\;\;\frac{2}{r \cdot r} + -1.5\\
\mathbf{else}:\\
\;\;\;\;\left(r \cdot r\right) \cdot \left(\left(w \cdot w\right) \cdot -0.375\right)\\
\end{array}
\end{array}
if r < 3.9e26Initial program 88.6%
sub-neg88.6%
+-commutative88.6%
associate--l+88.6%
associate-/l*90.4%
distribute-neg-frac90.4%
associate-/r/90.4%
fma-def90.4%
sub-neg90.4%
Simplified84.9%
Taylor expanded in r around 0 63.4%
sub-neg63.4%
associate-*r/63.4%
metadata-eval63.4%
unpow263.4%
metadata-eval63.4%
Simplified63.4%
if 3.9e26 < r Initial program 78.5%
sub-neg78.5%
associate-/l*85.6%
cancel-sign-sub-inv85.6%
metadata-eval85.6%
*-commutative85.6%
*-commutative85.6%
metadata-eval85.6%
Simplified85.6%
Taylor expanded in v around 0 65.4%
*-commutative65.4%
*-commutative65.4%
unpow265.4%
unpow265.4%
swap-sqr83.8%
unpow283.8%
*-commutative83.8%
Simplified83.8%
unpow283.8%
*-commutative83.8%
*-commutative83.8%
Applied egg-rr83.8%
Taylor expanded in r around inf 55.4%
associate-*r*55.4%
unpow255.4%
unpow255.4%
Simplified55.4%
Final simplification61.8%
NOTE: r should be positive before calling this function (FPCore (v w r) :precision binary64 (if (<= r 1.15) (/ 2.0 (* r r)) -1.5))
r = abs(r);
double code(double v, double w, double r) {
double tmp;
if (r <= 1.15) {
tmp = 2.0 / (r * r);
} else {
tmp = -1.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 <= 1.15d0) then
tmp = 2.0d0 / (r * r)
else
tmp = -1.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 <= 1.15) {
tmp = 2.0 / (r * r);
} else {
tmp = -1.5;
}
return tmp;
}
r = abs(r) def code(v, w, r): tmp = 0 if r <= 1.15: tmp = 2.0 / (r * r) else: tmp = -1.5 return tmp
r = abs(r) function code(v, w, r) tmp = 0.0 if (r <= 1.15) tmp = Float64(2.0 / Float64(r * r)); else tmp = -1.5; end return tmp end
r = abs(r) function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 1.15) tmp = 2.0 / (r * r); else tmp = -1.5; end tmp_2 = tmp; end
NOTE: r should be positive before calling this function code[v_, w_, r_] := If[LessEqual[r, 1.15], N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision], -1.5]
\begin{array}{l}
r = |r|\\
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.15:\\
\;\;\;\;\frac{2}{r \cdot r}\\
\mathbf{else}:\\
\;\;\;\;-1.5\\
\end{array}
\end{array}
if r < 1.1499999999999999Initial program 88.3%
sub-neg88.3%
+-commutative88.3%
associate--l+88.3%
associate-/l*90.2%
distribute-neg-frac90.2%
associate-/r/90.2%
fma-def90.2%
sub-neg90.2%
Simplified84.5%
Taylor expanded in v around inf 81.3%
associate--l+81.3%
associate-*r/81.3%
metadata-eval81.3%
unpow281.3%
*-commutative81.3%
unpow281.3%
unpow281.3%
Simplified81.3%
Taylor expanded in r around 0 51.8%
unpow251.8%
Simplified51.8%
if 1.1499999999999999 < r Initial program 80.3%
sub-neg80.3%
+-commutative80.3%
associate--l+80.3%
associate-/l*86.9%
distribute-neg-frac86.9%
associate-/r/86.8%
fma-def86.8%
sub-neg86.8%
Simplified72.8%
Taylor expanded in r around 0 20.0%
sub-neg20.0%
associate-*r/20.0%
metadata-eval20.0%
unpow220.0%
metadata-eval20.0%
Simplified20.0%
Taylor expanded in r around inf 20.0%
Final simplification44.6%
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 86.5%
sub-neg86.5%
+-commutative86.5%
associate--l+86.5%
associate-/l*89.4%
distribute-neg-frac89.4%
associate-/r/89.4%
fma-def89.4%
sub-neg89.4%
Simplified81.9%
Taylor expanded in r around 0 54.4%
sub-neg54.4%
associate-*r/54.4%
metadata-eval54.4%
unpow254.4%
metadata-eval54.4%
Simplified54.4%
Final simplification54.4%
NOTE: r should be positive before calling this function (FPCore (v w r) :precision binary64 -1.5)
r = abs(r);
double code(double v, double w, double r) {
return -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 = -1.5d0
end function
r = Math.abs(r);
public static double code(double v, double w, double r) {
return -1.5;
}
r = abs(r) def code(v, w, r): return -1.5
r = abs(r) function code(v, w, r) return -1.5 end
r = abs(r) function tmp = code(v, w, r) tmp = -1.5; end
NOTE: r should be positive before calling this function code[v_, w_, r_] := -1.5
\begin{array}{l}
r = |r|\\
\\
-1.5
\end{array}
Initial program 86.5%
sub-neg86.5%
+-commutative86.5%
associate--l+86.5%
associate-/l*89.4%
distribute-neg-frac89.4%
associate-/r/89.4%
fma-def89.4%
sub-neg89.4%
Simplified81.9%
Taylor expanded in r around 0 54.4%
sub-neg54.4%
associate-*r/54.4%
metadata-eval54.4%
unpow254.4%
metadata-eval54.4%
Simplified54.4%
Taylor expanded in r around inf 14.0%
Final simplification14.0%
herbie shell --seed 2023215
(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))