
(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
(let* ((t_0 (/ 2.0 (* r r))))
(if (or (<= v -100.0) (not (<= v 5.8e-90)))
(- (+ t_0 -1.5) (* (* r w) (/ r (/ 4.0 w))))
(+
-4.5
(- (+ 3.0 t_0) (/ 0.375 (* (/ 1.0 (* r w)) (/ (- 1.0 v) (* r w)))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((v <= -100.0) || !(v <= 5.8e-90)) {
tmp = (t_0 + -1.5) - ((r * w) * (r / (4.0 / w)));
} else {
tmp = -4.5 + ((3.0 + t_0) - (0.375 / ((1.0 / (r * w)) * ((1.0 - v) / (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 <= (-100.0d0)) .or. (.not. (v <= 5.8d-90))) then
tmp = (t_0 + (-1.5d0)) - ((r * w) * (r / (4.0d0 / w)))
else
tmp = (-4.5d0) + ((3.0d0 + t_0) - (0.375d0 / ((1.0d0 / (r * w)) * ((1.0d0 - v) / (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 <= -100.0) || !(v <= 5.8e-90)) {
tmp = (t_0 + -1.5) - ((r * w) * (r / (4.0 / w)));
} else {
tmp = -4.5 + ((3.0 + t_0) - (0.375 / ((1.0 / (r * w)) * ((1.0 - v) / (r * w)))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if (v <= -100.0) or not (v <= 5.8e-90): tmp = (t_0 + -1.5) - ((r * w) * (r / (4.0 / w))) else: tmp = -4.5 + ((3.0 + t_0) - (0.375 / ((1.0 / (r * w)) * ((1.0 - v) / (r * w))))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((v <= -100.0) || !(v <= 5.8e-90)) tmp = Float64(Float64(t_0 + -1.5) - Float64(Float64(r * w) * Float64(r / Float64(4.0 / w)))); else tmp = Float64(-4.5 + Float64(Float64(3.0 + t_0) - Float64(0.375 / Float64(Float64(1.0 / Float64(r * w)) * Float64(Float64(1.0 - v) / 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 <= -100.0) || ~((v <= 5.8e-90))) tmp = (t_0 + -1.5) - ((r * w) * (r / (4.0 / w))); else tmp = -4.5 + ((3.0 + t_0) - (0.375 / ((1.0 / (r * w)) * ((1.0 - v) / (r * w))))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -100.0], N[Not[LessEqual[v, 5.8e-90]], $MachinePrecision]], N[(N[(t$95$0 + -1.5), $MachinePrecision] - N[(N[(r * w), $MachinePrecision] * N[(r / N[(4.0 / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 + N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(0.375 / N[(N[(1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 - v), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -100 \lor \neg \left(v \leq 5.8 \cdot 10^{-90}\right):\\
\;\;\;\;\left(t_0 + -1.5\right) - \left(r \cdot w\right) \cdot \frac{r}{\frac{4}{w}}\\
\mathbf{else}:\\
\;\;\;\;-4.5 + \left(\left(3 + t_0\right) - \frac{0.375}{\frac{1}{r \cdot w} \cdot \frac{1 - v}{r \cdot w}}\right)\\
\end{array}
\end{array}
if v < -100 or 5.79999999999999967e-90 < v Initial program 83.1%
associate--l-83.1%
+-commutative83.1%
associate--l+83.1%
+-commutative83.1%
associate--r+83.1%
metadata-eval83.1%
associate-*r*82.5%
*-commutative82.5%
associate-/l*84.3%
*-commutative84.3%
Simplified85.0%
Taylor expanded in v around inf 87.6%
unpow287.6%
*-commutative87.6%
associate-*l*96.1%
*-commutative96.1%
Simplified96.1%
Taylor expanded in w around 0 87.6%
*-commutative87.6%
unpow287.6%
associate-*r*96.1%
associate-/r*96.1%
*-commutative96.1%
Simplified96.1%
associate-+r-96.1%
associate-/r/99.4%
*-commutative99.4%
Applied egg-rr99.4%
if -100 < v < 5.79999999999999967e-90Initial program 84.7%
Simplified74.2%
*-un-lft-identity74.2%
add-sqr-sqrt74.2%
times-frac74.1%
unswap-sqr74.2%
sqrt-prod35.8%
add-sqr-sqrt54.0%
unswap-sqr74.2%
sqrt-prod47.1%
add-sqr-sqrt99.7%
Applied egg-rr99.7%
Taylor expanded in v around 0 99.7%
Final simplification99.5%
(FPCore (v w r) :precision binary64 (+ (- (+ 3.0 (/ 2.0 (* r r))) (/ (* 0.125 (+ 3.0 (* -2.0 v))) (* (/ 1.0 (* r w)) (/ (- 1.0 v) (* r w))))) -4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - ((0.125 * (3.0 + (-2.0 * v))) / ((1.0 / (r * w)) * ((1.0 - v) / (r * w))))) + -4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((3.0d0 + (2.0d0 / (r * r))) - ((0.125d0 * (3.0d0 + ((-2.0d0) * v))) / ((1.0d0 / (r * w)) * ((1.0d0 - v) / (r * w))))) + (-4.5d0)
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - ((0.125 * (3.0 + (-2.0 * v))) / ((1.0 / (r * w)) * ((1.0 - v) / (r * w))))) + -4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - ((0.125 * (3.0 + (-2.0 * v))) / ((1.0 / (r * w)) * ((1.0 - v) / (r * w))))) + -4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) / Float64(Float64(1.0 / Float64(r * w)) * Float64(Float64(1.0 - v) / Float64(r * w))))) + -4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - ((0.125 * (3.0 + (-2.0 * v))) / ((1.0 / (r * w)) * ((1.0 - v) / (r * w))))) + -4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 - v), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{0.125 \cdot \left(3 + -2 \cdot v\right)}{\frac{1}{r \cdot w} \cdot \frac{1 - v}{r \cdot w}}\right) + -4.5
\end{array}
Initial program 83.8%
Simplified76.9%
*-un-lft-identity76.9%
add-sqr-sqrt76.9%
times-frac76.9%
unswap-sqr76.9%
sqrt-prod41.6%
add-sqr-sqrt58.7%
unswap-sqr77.1%
sqrt-prod53.4%
add-sqr-sqrt99.0%
Applied egg-rr99.0%
Final simplification99.0%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= w 1e+183)
(+
t_0
(- -1.5 (* (* r (* w (* r w))) (/ (+ 0.375 (* v -0.25)) (- 1.0 v)))))
(- (+ t_0 -1.5) (* (* r w) (/ r (/ 4.0 w)))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (w <= 1e+183) {
tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * ((0.375 + (v * -0.25)) / (1.0 - v))));
} else {
tmp = (t_0 + -1.5) - ((r * w) * (r / (4.0 / 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 (w <= 1d+183) then
tmp = t_0 + ((-1.5d0) - ((r * (w * (r * w))) * ((0.375d0 + (v * (-0.25d0))) / (1.0d0 - v))))
else
tmp = (t_0 + (-1.5d0)) - ((r * w) * (r / (4.0d0 / 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 (w <= 1e+183) {
tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * ((0.375 + (v * -0.25)) / (1.0 - v))));
} else {
tmp = (t_0 + -1.5) - ((r * w) * (r / (4.0 / w)));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if w <= 1e+183: tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * ((0.375 + (v * -0.25)) / (1.0 - v)))) else: tmp = (t_0 + -1.5) - ((r * w) * (r / (4.0 / w))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (w <= 1e+183) tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(r * Float64(w * Float64(r * w))) * Float64(Float64(0.375 + Float64(v * -0.25)) / Float64(1.0 - v))))); else tmp = Float64(Float64(t_0 + -1.5) - Float64(Float64(r * w) * Float64(r / Float64(4.0 / w)))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (w <= 1e+183) tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * ((0.375 + (v * -0.25)) / (1.0 - v)))); else tmp = (t_0 + -1.5) - ((r * w) * (r / (4.0 / w))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, 1e+183], N[(t$95$0 + N[(-1.5 - N[(N[(r * N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 + -1.5), $MachinePrecision] - N[(N[(r * w), $MachinePrecision] * N[(r / N[(4.0 / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;w \leq 10^{+183}:\\
\;\;\;\;t_0 + \left(-1.5 - \left(r \cdot \left(w \cdot \left(r \cdot w\right)\right)\right) \cdot \frac{0.375 + v \cdot -0.25}{1 - v}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_0 + -1.5\right) - \left(r \cdot w\right) \cdot \frac{r}{\frac{4}{w}}\\
\end{array}
\end{array}
if w < 9.99999999999999947e182Initial program 85.1%
associate--l-85.1%
+-commutative85.1%
associate--l+85.1%
+-commutative85.1%
associate--r+85.1%
metadata-eval85.1%
associate-*l/87.1%
*-commutative87.1%
*-commutative87.1%
*-commutative87.1%
Simplified88.0%
Taylor expanded in r around 0 88.0%
unpow288.0%
*-commutative88.0%
associate-*l*98.1%
*-commutative98.1%
Simplified98.1%
if 9.99999999999999947e182 < w Initial program 74.8%
associate--l-74.8%
+-commutative74.8%
associate--l+74.8%
+-commutative74.8%
associate--r+74.8%
metadata-eval74.8%
associate-*r*74.8%
*-commutative74.8%
associate-/l*74.8%
*-commutative74.8%
Simplified74.8%
Taylor expanded in v around inf 74.8%
unpow274.8%
*-commutative74.8%
associate-*l*87.6%
*-commutative87.6%
Simplified87.6%
Taylor expanded in w around 0 74.8%
*-commutative74.8%
unpow274.8%
associate-*r*87.6%
associate-/r*87.6%
*-commutative87.6%
Simplified87.6%
associate-+r-87.6%
associate-/r/99.9%
*-commutative99.9%
Applied egg-rr99.9%
Final simplification98.4%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (or (<= v -100.0) (not (<= v 8.8e-108)))
(- (+ t_0 -1.5) (* (* r w) (/ r (/ 4.0 w))))
(+ t_0 (- -1.5 (* (* r 0.375) (* w (* r w))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((v <= -100.0) || !(v <= 8.8e-108)) {
tmp = (t_0 + -1.5) - ((r * w) * (r / (4.0 / w)));
} else {
tmp = t_0 + (-1.5 - ((r * 0.375) * (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 <= (-100.0d0)) .or. (.not. (v <= 8.8d-108))) then
tmp = (t_0 + (-1.5d0)) - ((r * w) * (r / (4.0d0 / w)))
else
tmp = t_0 + ((-1.5d0) - ((r * 0.375d0) * (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 <= -100.0) || !(v <= 8.8e-108)) {
tmp = (t_0 + -1.5) - ((r * w) * (r / (4.0 / w)));
} else {
tmp = t_0 + (-1.5 - ((r * 0.375) * (w * (r * w))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if (v <= -100.0) or not (v <= 8.8e-108): tmp = (t_0 + -1.5) - ((r * w) * (r / (4.0 / w))) else: tmp = t_0 + (-1.5 - ((r * 0.375) * (w * (r * w)))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((v <= -100.0) || !(v <= 8.8e-108)) tmp = Float64(Float64(t_0 + -1.5) - Float64(Float64(r * w) * Float64(r / Float64(4.0 / w)))); else tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(r * 0.375) * Float64(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 <= -100.0) || ~((v <= 8.8e-108))) tmp = (t_0 + -1.5) - ((r * w) * (r / (4.0 / w))); else tmp = t_0 + (-1.5 - ((r * 0.375) * (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[Or[LessEqual[v, -100.0], N[Not[LessEqual[v, 8.8e-108]], $MachinePrecision]], N[(N[(t$95$0 + -1.5), $MachinePrecision] - N[(N[(r * w), $MachinePrecision] * N[(r / N[(4.0 / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.5 - N[(N[(r * 0.375), $MachinePrecision] * N[(w * 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 -100 \lor \neg \left(v \leq 8.8 \cdot 10^{-108}\right):\\
\;\;\;\;\left(t_0 + -1.5\right) - \left(r \cdot w\right) \cdot \frac{r}{\frac{4}{w}}\\
\mathbf{else}:\\
\;\;\;\;t_0 + \left(-1.5 - \left(r \cdot 0.375\right) \cdot \left(w \cdot \left(r \cdot w\right)\right)\right)\\
\end{array}
\end{array}
if v < -100 or 8.8000000000000005e-108 < v Initial program 82.3%
associate--l-82.3%
+-commutative82.3%
associate--l+82.3%
+-commutative82.3%
associate--r+82.3%
metadata-eval82.3%
associate-*r*81.6%
*-commutative81.6%
associate-/l*83.4%
*-commutative83.4%
Simplified84.1%
Taylor expanded in v around inf 86.6%
unpow286.6%
*-commutative86.6%
associate-*l*95.0%
*-commutative95.0%
Simplified95.0%
Taylor expanded in w around 0 86.6%
*-commutative86.6%
unpow286.6%
associate-*r*95.0%
associate-/r*95.0%
*-commutative95.0%
Simplified95.0%
associate-+r-95.0%
associate-/r/98.9%
*-commutative98.9%
Applied egg-rr98.9%
if -100 < v < 8.8000000000000005e-108Initial program 86.0%
associate--l-86.0%
+-commutative86.0%
associate--l+86.0%
+-commutative86.0%
associate--r+86.0%
metadata-eval86.0%
associate-*r*86.8%
*-commutative86.8%
associate-/l*86.8%
*-commutative86.8%
Simplified86.8%
Taylor expanded in v around 0 86.8%
unpow286.8%
Simplified86.8%
associate-/r/86.8%
associate-*r*98.9%
*-commutative98.9%
*-commutative98.9%
Applied egg-rr98.9%
div-inv98.9%
metadata-eval98.9%
Applied egg-rr98.9%
Final simplification98.9%
(FPCore (v w r) :precision binary64 (if (<= r 2.8e-100) (/ 1.0 (/ r (/ 2.0 r))) (+ (/ 2.0 (* r r)) (- -1.5 (* (* r 0.375) (* w (* r w)))))))
double code(double v, double w, double r) {
double tmp;
if (r <= 2.8e-100) {
tmp = 1.0 / (r / (2.0 / r));
} else {
tmp = (2.0 / (r * r)) + (-1.5 - ((r * 0.375) * (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) :: tmp
if (r <= 2.8d-100) then
tmp = 1.0d0 / (r / (2.0d0 / r))
else
tmp = (2.0d0 / (r * r)) + ((-1.5d0) - ((r * 0.375d0) * (w * (r * w))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 2.8e-100) {
tmp = 1.0 / (r / (2.0 / r));
} else {
tmp = (2.0 / (r * r)) + (-1.5 - ((r * 0.375) * (w * (r * w))));
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 2.8e-100: tmp = 1.0 / (r / (2.0 / r)) else: tmp = (2.0 / (r * r)) + (-1.5 - ((r * 0.375) * (w * (r * w)))) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 2.8e-100) tmp = Float64(1.0 / Float64(r / Float64(2.0 / r))); else tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 - Float64(Float64(r * 0.375) * Float64(w * Float64(r * w))))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 2.8e-100) tmp = 1.0 / (r / (2.0 / r)); else tmp = (2.0 / (r * r)) + (-1.5 - ((r * 0.375) * (w * (r * w)))); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 2.8e-100], N[(1.0 / N[(r / N[(2.0 / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[(N[(r * 0.375), $MachinePrecision] * N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 2.8 \cdot 10^{-100}:\\
\;\;\;\;\frac{1}{\frac{r}{\frac{2}{r}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 - \left(r \cdot 0.375\right) \cdot \left(w \cdot \left(r \cdot w\right)\right)\right)\\
\end{array}
\end{array}
if r < 2.79999999999999995e-100Initial program 81.6%
associate--l-81.6%
+-commutative81.6%
associate--l+81.6%
+-commutative81.6%
associate--r+81.6%
metadata-eval81.6%
associate-*r*81.0%
*-commutative81.0%
associate-/l*82.1%
*-commutative82.1%
Simplified82.8%
Taylor expanded in v around inf 80.6%
unpow280.6%
*-commutative80.6%
associate-*l*90.7%
*-commutative90.7%
Simplified90.7%
Taylor expanded in w around 0 80.6%
*-commutative80.6%
unpow280.6%
associate-*r*90.7%
associate-/r*90.7%
*-commutative90.7%
Simplified90.7%
Taylor expanded in r around 0 50.1%
unpow250.1%
Simplified50.1%
clear-num50.1%
inv-pow50.1%
Applied egg-rr50.1%
unpow-150.1%
associate-/l*50.1%
Simplified50.1%
if 2.79999999999999995e-100 < r Initial program 87.6%
associate--l-87.6%
+-commutative87.6%
associate--l+87.6%
+-commutative87.6%
associate--r+87.6%
metadata-eval87.6%
associate-*r*88.5%
*-commutative88.5%
associate-/l*89.3%
*-commutative89.3%
Simplified89.3%
Taylor expanded in v around 0 87.1%
unpow287.1%
Simplified87.1%
associate-/r/87.1%
associate-*r*92.4%
*-commutative92.4%
*-commutative92.4%
Applied egg-rr92.4%
div-inv92.4%
metadata-eval92.4%
Applied egg-rr92.4%
Final simplification65.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* w (* r w))) (t_1 (/ 2.0 (* r r))))
(if (<= v 5e-90)
(+ t_1 (- -1.5 (* (* r 0.375) t_0)))
(+ t_1 (- -1.5 (* t_0 (/ r 4.0)))))))
double code(double v, double w, double r) {
double t_0 = w * (r * w);
double t_1 = 2.0 / (r * r);
double tmp;
if (v <= 5e-90) {
tmp = t_1 + (-1.5 - ((r * 0.375) * t_0));
} else {
tmp = t_1 + (-1.5 - (t_0 * (r / 4.0)));
}
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) :: t_1
real(8) :: tmp
t_0 = w * (r * w)
t_1 = 2.0d0 / (r * r)
if (v <= 5d-90) then
tmp = t_1 + ((-1.5d0) - ((r * 0.375d0) * t_0))
else
tmp = t_1 + ((-1.5d0) - (t_0 * (r / 4.0d0)))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = w * (r * w);
double t_1 = 2.0 / (r * r);
double tmp;
if (v <= 5e-90) {
tmp = t_1 + (-1.5 - ((r * 0.375) * t_0));
} else {
tmp = t_1 + (-1.5 - (t_0 * (r / 4.0)));
}
return tmp;
}
def code(v, w, r): t_0 = w * (r * w) t_1 = 2.0 / (r * r) tmp = 0 if v <= 5e-90: tmp = t_1 + (-1.5 - ((r * 0.375) * t_0)) else: tmp = t_1 + (-1.5 - (t_0 * (r / 4.0))) return tmp
function code(v, w, r) t_0 = Float64(w * Float64(r * w)) t_1 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (v <= 5e-90) tmp = Float64(t_1 + Float64(-1.5 - Float64(Float64(r * 0.375) * t_0))); else tmp = Float64(t_1 + Float64(-1.5 - Float64(t_0 * Float64(r / 4.0)))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = w * (r * w); t_1 = 2.0 / (r * r); tmp = 0.0; if (v <= 5e-90) tmp = t_1 + (-1.5 - ((r * 0.375) * t_0)); else tmp = t_1 + (-1.5 - (t_0 * (r / 4.0))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, 5e-90], N[(t$95$1 + N[(-1.5 - N[(N[(r * 0.375), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(-1.5 - N[(t$95$0 * N[(r / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := w \cdot \left(r \cdot w\right)\\
t_1 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq 5 \cdot 10^{-90}:\\
\;\;\;\;t_1 + \left(-1.5 - \left(r \cdot 0.375\right) \cdot t_0\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(-1.5 - t_0 \cdot \frac{r}{4}\right)\\
\end{array}
\end{array}
if v < 5.00000000000000019e-90Initial program 83.1%
associate--l-83.1%
+-commutative83.1%
associate--l+83.1%
+-commutative83.1%
associate--r+83.1%
metadata-eval83.1%
associate-*r*83.6%
*-commutative83.6%
associate-/l*84.1%
*-commutative84.1%
Simplified84.7%
Taylor expanded in v around 0 84.6%
unpow284.6%
Simplified84.6%
associate-/r/84.6%
associate-*r*94.2%
*-commutative94.2%
*-commutative94.2%
Applied egg-rr94.2%
div-inv94.2%
metadata-eval94.2%
Applied egg-rr94.2%
if 5.00000000000000019e-90 < v Initial program 85.1%
associate--l-85.1%
+-commutative85.1%
associate--l+85.1%
+-commutative85.1%
associate--r+85.1%
metadata-eval85.1%
associate-*r*84.0%
*-commutative84.0%
associate-/l*86.1%
*-commutative86.1%
Simplified86.1%
Taylor expanded in v around inf 87.2%
unpow287.2%
*-commutative87.2%
associate-*l*97.6%
*-commutative97.6%
Simplified97.6%
associate-/r/97.7%
*-commutative97.7%
Applied egg-rr97.7%
Final simplification95.4%
(FPCore (v w r) :precision binary64 (if (<= r 0.00082) (+ (/ 2.0 (* r r)) -1.5) (* -0.25 (* (* r r) (* w w)))))
double code(double v, double w, double r) {
double tmp;
if (r <= 0.00082) {
tmp = (2.0 / (r * r)) + -1.5;
} else {
tmp = -0.25 * ((r * r) * (w * 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) :: tmp
if (r <= 0.00082d0) then
tmp = (2.0d0 / (r * r)) + (-1.5d0)
else
tmp = (-0.25d0) * ((r * r) * (w * w))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 0.00082) {
tmp = (2.0 / (r * r)) + -1.5;
} else {
tmp = -0.25 * ((r * r) * (w * w));
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 0.00082: tmp = (2.0 / (r * r)) + -1.5 else: tmp = -0.25 * ((r * r) * (w * w)) return tmp
function code(v, w, r) tmp = 0.0 if (r <= 0.00082) tmp = Float64(Float64(2.0 / Float64(r * r)) + -1.5); else tmp = Float64(-0.25 * Float64(Float64(r * r) * Float64(w * w))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 0.00082) tmp = (2.0 / (r * r)) + -1.5; else tmp = -0.25 * ((r * r) * (w * w)); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 0.00082], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision], N[(-0.25 * N[(N[(r * r), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 0.00082:\\
\;\;\;\;\frac{2}{r \cdot r} + -1.5\\
\mathbf{else}:\\
\;\;\;\;-0.25 \cdot \left(\left(r \cdot r\right) \cdot \left(w \cdot w\right)\right)\\
\end{array}
\end{array}
if r < 8.1999999999999998e-4Initial program 83.2%
associate--l-83.2%
+-commutative83.2%
associate--l+83.2%
+-commutative83.2%
associate--r+83.2%
metadata-eval83.2%
associate-*r*82.7%
*-commutative82.7%
associate-/l*83.7%
*-commutative83.7%
Simplified84.2%
Taylor expanded in v around inf 82.4%
unpow282.4%
*-commutative82.4%
associate-*l*91.1%
*-commutative91.1%
Simplified91.1%
Taylor expanded in w around 0 82.4%
*-commutative82.4%
unpow282.4%
associate-*r*91.1%
associate-/r*91.1%
*-commutative91.1%
Simplified91.1%
Taylor expanded in r around 0 68.3%
sub-neg68.3%
associate-*r/68.3%
metadata-eval68.3%
unpow268.3%
metadata-eval68.3%
Simplified68.3%
if 8.1999999999999998e-4 < r Initial program 85.5%
associate--l-85.5%
+-commutative85.5%
associate--l+85.5%
+-commutative85.5%
associate--r+85.5%
metadata-eval85.5%
associate-*r*86.7%
*-commutative86.7%
associate-/l*87.9%
*-commutative87.9%
Simplified87.9%
Taylor expanded in v around inf 83.3%
unpow283.3%
*-commutative83.3%
associate-*l*89.4%
*-commutative89.4%
Simplified89.4%
Taylor expanded in w around 0 83.3%
*-commutative83.3%
unpow283.3%
associate-*r*89.4%
associate-/r*89.4%
*-commutative89.4%
Simplified89.4%
Taylor expanded in r around inf 63.2%
*-commutative63.2%
unpow263.2%
unpow263.2%
Simplified63.2%
Final simplification67.0%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) -1.5))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + -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 = (2.0d0 / (r * r)) + (-1.5d0)
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + -1.5;
}
def code(v, w, r): return (2.0 / (r * r)) + -1.5
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + -1.5) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + -1.5; end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + -1.5
\end{array}
Initial program 83.8%
associate--l-83.8%
+-commutative83.8%
associate--l+83.8%
+-commutative83.8%
associate--r+83.8%
metadata-eval83.8%
associate-*r*83.8%
*-commutative83.8%
associate-/l*84.8%
*-commutative84.8%
Simplified85.2%
Taylor expanded in v around inf 82.6%
unpow282.6%
*-commutative82.6%
associate-*l*90.6%
*-commutative90.6%
Simplified90.6%
Taylor expanded in w around 0 82.6%
*-commutative82.6%
unpow282.6%
associate-*r*90.6%
associate-/r*90.6%
*-commutative90.6%
Simplified90.6%
Taylor expanded in r around 0 55.4%
sub-neg55.4%
associate-*r/55.4%
metadata-eval55.4%
unpow255.4%
metadata-eval55.4%
Simplified55.4%
Final simplification55.4%
(FPCore (v w r) :precision binary64 (/ 2.0 (* r r)))
double code(double v, double w, double r) {
return 2.0 / (r * r);
}
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
public static double code(double v, double w, double r) {
return 2.0 / (r * r);
}
def code(v, w, r): return 2.0 / (r * r)
function code(v, w, r) return Float64(2.0 / Float64(r * r)) end
function tmp = code(v, w, r) tmp = 2.0 / (r * r); end
code[v_, w_, r_] := N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r}
\end{array}
Initial program 83.8%
associate--l-83.8%
+-commutative83.8%
associate--l+83.8%
+-commutative83.8%
associate--r+83.8%
metadata-eval83.8%
associate-*r*83.8%
*-commutative83.8%
associate-/l*84.8%
*-commutative84.8%
Simplified85.2%
Taylor expanded in v around inf 82.6%
unpow282.6%
*-commutative82.6%
associate-*l*90.6%
*-commutative90.6%
Simplified90.6%
Taylor expanded in w around 0 82.6%
*-commutative82.6%
unpow282.6%
associate-*r*90.6%
associate-/r*90.6%
*-commutative90.6%
Simplified90.6%
Taylor expanded in r around 0 39.4%
unpow239.4%
Simplified39.4%
Final simplification39.4%
herbie shell --seed 2023275
(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))