
(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 12 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) (/ (* r w) (- 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))) * ((r * w) * ((r * w) / (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))) * ((r * w) * ((r * w) / (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))) * ((r * w) * ((r * w) / (1.0 - v)))) + 4.5);
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / (1.0 - v)))) + 4.5)
function code(v, w, r) return Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) * Float64(Float64(r * w) / Float64(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))) * ((r * w) * ((r * w) / (1.0 - v)))) + 4.5); end
code[v_, w_, r_] := N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 4.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \frac{r \cdot w}{1 - v}\right) + 4.5\right)
\end{array}
Initial program 85.4%
associate--l-85.3%
associate-*l*78.4%
sqr-neg78.4%
associate-*l*85.3%
associate-/l*87.2%
fma-define87.2%
Simplified87.2%
*-un-lft-identity87.2%
add-sqr-sqrt87.1%
times-frac87.1%
*-commutative87.1%
sqrt-prod41.4%
*-commutative41.4%
sqrt-prod41.4%
sqrt-prod18.7%
add-sqr-sqrt32.9%
associate-*r*32.9%
add-sqr-sqrt70.2%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (or (<= v -4.8e+97) (not (<= v 8.4e-72)))
(+
(+ 3.0 t_0)
(- (* (/ v (- 1.0 v)) (/ (* w (* r -0.25)) (/ (/ -1.0 w) r))) 4.5))
(+ t_0 (- -1.5 (/ (* (* r w) 0.375) (* (/ 1.0 w) (/ 1.0 r))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((v <= -4.8e+97) || !(v <= 8.4e-72)) {
tmp = (3.0 + t_0) + (((v / (1.0 - v)) * ((w * (r * -0.25)) / ((-1.0 / w) / r))) - 4.5);
} else {
tmp = t_0 + (-1.5 - (((r * w) * 0.375) / ((1.0 / w) * (1.0 / r))));
}
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 <= (-4.8d+97)) .or. (.not. (v <= 8.4d-72))) then
tmp = (3.0d0 + t_0) + (((v / (1.0d0 - v)) * ((w * (r * (-0.25d0))) / (((-1.0d0) / w) / r))) - 4.5d0)
else
tmp = t_0 + ((-1.5d0) - (((r * w) * 0.375d0) / ((1.0d0 / w) * (1.0d0 / r))))
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 <= -4.8e+97) || !(v <= 8.4e-72)) {
tmp = (3.0 + t_0) + (((v / (1.0 - v)) * ((w * (r * -0.25)) / ((-1.0 / w) / r))) - 4.5);
} else {
tmp = t_0 + (-1.5 - (((r * w) * 0.375) / ((1.0 / w) * (1.0 / r))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if (v <= -4.8e+97) or not (v <= 8.4e-72): tmp = (3.0 + t_0) + (((v / (1.0 - v)) * ((w * (r * -0.25)) / ((-1.0 / w) / r))) - 4.5) else: tmp = t_0 + (-1.5 - (((r * w) * 0.375) / ((1.0 / w) * (1.0 / r)))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((v <= -4.8e+97) || !(v <= 8.4e-72)) tmp = Float64(Float64(3.0 + t_0) + Float64(Float64(Float64(v / Float64(1.0 - v)) * Float64(Float64(w * Float64(r * -0.25)) / Float64(Float64(-1.0 / w) / r))) - 4.5)); else tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(Float64(r * w) * 0.375) / Float64(Float64(1.0 / w) * Float64(1.0 / r))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if ((v <= -4.8e+97) || ~((v <= 8.4e-72))) tmp = (3.0 + t_0) + (((v / (1.0 - v)) * ((w * (r * -0.25)) / ((-1.0 / w) / r))) - 4.5); else tmp = t_0 + (-1.5 - (((r * w) * 0.375) / ((1.0 / w) * (1.0 / r)))); 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, -4.8e+97], N[Not[LessEqual[v, 8.4e-72]], $MachinePrecision]], N[(N[(3.0 + t$95$0), $MachinePrecision] + N[(N[(N[(v / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[(N[(w * N[(r * -0.25), $MachinePrecision]), $MachinePrecision] / N[(N[(-1.0 / w), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.5 - N[(N[(N[(r * w), $MachinePrecision] * 0.375), $MachinePrecision] / N[(N[(1.0 / w), $MachinePrecision] * N[(1.0 / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -4.8 \cdot 10^{+97} \lor \neg \left(v \leq 8.4 \cdot 10^{-72}\right):\\
\;\;\;\;\left(3 + t\_0\right) + \left(\frac{v}{1 - v} \cdot \frac{w \cdot \left(r \cdot -0.25\right)}{\frac{\frac{-1}{w}}{r}} - 4.5\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \left(-1.5 - \frac{\left(r \cdot w\right) \cdot 0.375}{\frac{1}{w} \cdot \frac{1}{r}}\right)\\
\end{array}
\end{array}
if v < -4.8e97 or 8.4e-72 < v Initial program 81.4%
associate--l-81.4%
associate-*l*74.5%
sqr-neg74.5%
associate-*l*81.4%
associate-/l*85.7%
fma-define85.7%
Simplified85.7%
*-un-lft-identity85.7%
add-sqr-sqrt85.6%
times-frac85.6%
*-commutative85.6%
sqrt-prod42.2%
*-commutative42.2%
sqrt-prod42.2%
sqrt-prod18.1%
add-sqr-sqrt31.3%
associate-*r*31.3%
add-sqr-sqrt68.4%
Applied egg-rr99.7%
/-rgt-identity99.7%
associate-*r*95.4%
clear-num95.4%
un-div-inv95.4%
distribute-lft-in95.4%
metadata-eval95.4%
associate-*r*95.4%
metadata-eval95.4%
Applied egg-rr95.4%
Taylor expanded in v around inf 87.0%
*-commutative87.0%
*-commutative87.0%
associate-*l*95.3%
associate-*r*95.3%
associate-*l*95.3%
Simplified95.3%
div-inv95.2%
times-frac99.6%
associate-/r*99.6%
Applied egg-rr99.6%
if -4.8e97 < v < 8.4e-72Initial program 88.2%
Simplified88.2%
Taylor expanded in v around 0 81.2%
*-commutative81.2%
unpow281.2%
unpow281.2%
swap-sqr99.3%
unpow299.3%
*-commutative99.3%
*-commutative99.3%
Simplified99.3%
*-commutative99.3%
pow299.3%
Applied egg-rr99.3%
pow299.3%
metadata-eval99.3%
pow-div99.3%
pow199.3%
inv-pow99.3%
associate-*l/99.3%
Applied egg-rr99.3%
inv-pow99.3%
unpow-prod-down99.4%
inv-pow99.4%
inv-pow99.4%
Applied egg-rr99.4%
Final simplification99.5%
(FPCore (v w r) :precision binary64 (- (+ 3.0 (/ 2.0 (* r r))) (+ 4.5 (* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (/ w (/ (- 1.0 v) r)))))))
double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w / ((1.0 - v) / r)))));
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (3.0d0 + (2.0d0 / (r * r))) - (4.5d0 + ((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * (w / ((1.0d0 - v) / r)))))
end function
public static double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w / ((1.0 - v) / r)))));
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w / ((1.0 - v) / r)))))
function code(v, w, r) return Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(4.5 + Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) * Float64(w / Float64(Float64(1.0 - v) / r)))))) end
function tmp = code(v, w, r) tmp = (3.0 + (2.0 / (r * r))) - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w / ((1.0 - v) / r))))); end
code[v_, w_, r_] := N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(4.5 + N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(w / N[(N[(1.0 - v), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \frac{2}{r \cdot r}\right) - \left(4.5 + \left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \frac{w}{\frac{1 - v}{r}}\right)\right)
\end{array}
Initial program 85.4%
associate--l-85.3%
associate-*l*78.4%
sqr-neg78.4%
associate-*l*85.3%
associate-/l*87.2%
fma-define87.2%
Simplified87.2%
associate-/l*87.0%
*-commutative87.0%
associate-*r/87.0%
associate-*l*97.7%
associate-*r*99.7%
add-sqr-sqrt48.7%
associate-*l*48.7%
add-sqr-sqrt22.2%
sqrt-prod32.1%
sqrt-prod32.1%
sqrt-prod69.0%
*-commutative69.0%
sqrt-prod32.1%
*-commutative32.1%
sqrt-prod32.1%
sqrt-prod22.2%
add-sqr-sqrt48.7%
associate-*r*48.7%
add-sqr-sqrt99.7%
clear-num99.3%
un-div-inv99.4%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= v 8.4e-72)
(+ t_0 (+ -1.5 (/ (* (* r w) 0.375) (* (/ 1.0 r) (/ -1.0 w)))))
(+ (+ 3.0 t_0) (- (/ (* v (* w (* r -0.25))) (/ v (* r w))) 4.5)))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (v <= 8.4e-72) {
tmp = t_0 + (-1.5 + (((r * w) * 0.375) / ((1.0 / r) * (-1.0 / w))));
} else {
tmp = (3.0 + t_0) + (((v * (w * (r * -0.25))) / (v / (r * w))) - 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) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if (v <= 8.4d-72) then
tmp = t_0 + ((-1.5d0) + (((r * w) * 0.375d0) / ((1.0d0 / r) * ((-1.0d0) / w))))
else
tmp = (3.0d0 + t_0) + (((v * (w * (r * (-0.25d0)))) / (v / (r * w))) - 4.5d0)
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 <= 8.4e-72) {
tmp = t_0 + (-1.5 + (((r * w) * 0.375) / ((1.0 / r) * (-1.0 / w))));
} else {
tmp = (3.0 + t_0) + (((v * (w * (r * -0.25))) / (v / (r * w))) - 4.5);
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if v <= 8.4e-72: tmp = t_0 + (-1.5 + (((r * w) * 0.375) / ((1.0 / r) * (-1.0 / w)))) else: tmp = (3.0 + t_0) + (((v * (w * (r * -0.25))) / (v / (r * w))) - 4.5) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (v <= 8.4e-72) tmp = Float64(t_0 + Float64(-1.5 + Float64(Float64(Float64(r * w) * 0.375) / Float64(Float64(1.0 / r) * Float64(-1.0 / w))))); else tmp = Float64(Float64(3.0 + t_0) + Float64(Float64(Float64(v * Float64(w * Float64(r * -0.25))) / Float64(v / Float64(r * w))) - 4.5)); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (v <= 8.4e-72) tmp = t_0 + (-1.5 + (((r * w) * 0.375) / ((1.0 / r) * (-1.0 / w)))); else tmp = (3.0 + t_0) + (((v * (w * (r * -0.25))) / (v / (r * w))) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, 8.4e-72], N[(t$95$0 + N[(-1.5 + N[(N[(N[(r * w), $MachinePrecision] * 0.375), $MachinePrecision] / N[(N[(1.0 / r), $MachinePrecision] * N[(-1.0 / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(3.0 + t$95$0), $MachinePrecision] + N[(N[(N[(v * N[(w * N[(r * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(v / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq 8.4 \cdot 10^{-72}:\\
\;\;\;\;t\_0 + \left(-1.5 + \frac{\left(r \cdot w\right) \cdot 0.375}{\frac{1}{r} \cdot \frac{-1}{w}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(3 + t\_0\right) + \left(\frac{v \cdot \left(w \cdot \left(r \cdot -0.25\right)\right)}{\frac{v}{r \cdot w}} - 4.5\right)\\
\end{array}
\end{array}
if v < 8.4e-72Initial program 87.2%
Simplified88.5%
Taylor expanded in v around 0 78.6%
*-commutative78.6%
unpow278.6%
unpow278.6%
swap-sqr96.3%
unpow296.3%
*-commutative96.3%
*-commutative96.3%
Simplified96.3%
*-commutative96.3%
pow296.3%
Applied egg-rr96.3%
pow296.3%
metadata-eval96.3%
pow-div96.2%
pow196.2%
inv-pow96.2%
associate-*l/96.3%
Applied egg-rr96.3%
inv-pow96.3%
unpow-prod-down96.3%
inv-pow96.3%
inv-pow96.3%
Applied egg-rr96.3%
if 8.4e-72 < v Initial program 80.0%
associate--l-80.0%
associate-*l*76.3%
sqr-neg76.3%
associate-*l*80.0%
associate-/l*82.9%
fma-define82.9%
Simplified82.9%
*-un-lft-identity82.9%
add-sqr-sqrt82.9%
times-frac82.8%
*-commutative82.8%
sqrt-prod45.6%
*-commutative45.6%
sqrt-prod45.5%
sqrt-prod20.2%
add-sqr-sqrt32.3%
associate-*r*32.3%
add-sqr-sqrt68.2%
Applied egg-rr99.8%
/-rgt-identity99.8%
associate-*r*98.3%
clear-num98.3%
un-div-inv98.3%
distribute-lft-in98.3%
metadata-eval98.3%
associate-*r*98.3%
metadata-eval98.3%
Applied egg-rr98.3%
Taylor expanded in v around inf 89.3%
*-commutative89.3%
*-commutative89.3%
associate-*l*98.1%
associate-*r*98.1%
associate-*l*98.1%
Simplified98.1%
Taylor expanded in v around inf 98.2%
associate-*r/98.2%
neg-mul-198.2%
Simplified98.2%
Final simplification96.8%
(FPCore (v w r) :precision binary64 (+ (+ 3.0 (/ 2.0 (* r r))) (- (/ (* (* r w) (+ 0.375 (* v -0.25))) (/ (+ v -1.0) (* r w))) 4.5)))
double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) + ((((r * w) * (0.375 + (v * -0.25))) / ((v + -1.0) / (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))) + ((((r * w) * (0.375d0 + (v * (-0.25d0)))) / ((v + (-1.0d0)) / (r * w))) - 4.5d0)
end function
public static double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) + ((((r * w) * (0.375 + (v * -0.25))) / ((v + -1.0) / (r * w))) - 4.5);
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) + ((((r * w) * (0.375 + (v * -0.25))) / ((v + -1.0) / (r * w))) - 4.5)
function code(v, w, r) return Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) + Float64(Float64(Float64(Float64(r * w) * Float64(0.375 + Float64(v * -0.25))) / Float64(Float64(v + -1.0) / Float64(r * w))) - 4.5)) end
function tmp = code(v, w, r) tmp = (3.0 + (2.0 / (r * r))) + ((((r * w) * (0.375 + (v * -0.25))) / ((v + -1.0) / (r * w))) - 4.5); end
code[v_, w_, r_] := N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(r * w), $MachinePrecision] * N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(v + -1.0), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \frac{2}{r \cdot r}\right) + \left(\frac{\left(r \cdot w\right) \cdot \left(0.375 + v \cdot -0.25\right)}{\frac{v + -1}{r \cdot w}} - 4.5\right)
\end{array}
Initial program 85.4%
associate--l-85.3%
associate-*l*78.4%
sqr-neg78.4%
associate-*l*85.3%
associate-/l*87.2%
fma-define87.2%
Simplified87.2%
*-un-lft-identity87.2%
add-sqr-sqrt87.1%
times-frac87.1%
*-commutative87.1%
sqrt-prod41.4%
*-commutative41.4%
sqrt-prod41.4%
sqrt-prod18.7%
add-sqr-sqrt32.9%
associate-*r*32.9%
add-sqr-sqrt70.2%
Applied egg-rr99.7%
/-rgt-identity99.7%
associate-*r*97.9%
clear-num97.9%
un-div-inv97.9%
distribute-lft-in97.9%
metadata-eval97.9%
associate-*r*97.9%
metadata-eval97.9%
Applied egg-rr97.9%
Final simplification97.9%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (+ -1.5 (/ (* (* r w) 0.375) (* (/ 1.0 r) (/ -1.0 w))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + (((r * w) * 0.375) / ((1.0 / r) * (-1.0 / 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) + (((r * w) * 0.375d0) / ((1.0d0 / r) * ((-1.0d0) / w))))
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + (((r * w) * 0.375) / ((1.0 / r) * (-1.0 / w))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 + (((r * w) * 0.375) / ((1.0 / r) * (-1.0 / w))))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(Float64(Float64(r * w) * 0.375) / Float64(Float64(1.0 / r) * Float64(-1.0 / w))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 + (((r * w) * 0.375) / ((1.0 / r) * (-1.0 / w)))); end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(N[(N[(r * w), $MachinePrecision] * 0.375), $MachinePrecision] / N[(N[(1.0 / r), $MachinePrecision] * N[(-1.0 / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 + \frac{\left(r \cdot w\right) \cdot 0.375}{\frac{1}{r} \cdot \frac{-1}{w}}\right)
\end{array}
Initial program 85.4%
Simplified87.0%
Taylor expanded in v around 0 76.2%
*-commutative76.2%
unpow276.2%
unpow276.2%
swap-sqr93.6%
unpow293.6%
*-commutative93.6%
*-commutative93.6%
Simplified93.6%
*-commutative93.6%
pow293.6%
Applied egg-rr93.6%
pow293.6%
metadata-eval93.6%
pow-div93.6%
pow193.6%
inv-pow93.6%
associate-*l/93.6%
Applied egg-rr93.6%
inv-pow93.6%
unpow-prod-down93.6%
inv-pow93.6%
inv-pow93.6%
Applied egg-rr93.6%
Final simplification93.6%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (+ -1.5 (* 0.375 (/ (* r w) (/ (/ -1.0 w) r))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + (0.375 * ((r * w) / ((-1.0 / w) / 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)) + ((-1.5d0) + (0.375d0 * ((r * w) / (((-1.0d0) / w) / r))))
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + (0.375 * ((r * w) / ((-1.0 / w) / r))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 + (0.375 * ((r * w) / ((-1.0 / w) / r))))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(0.375 * Float64(Float64(r * w) / Float64(Float64(-1.0 / w) / r))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 + (0.375 * ((r * w) / ((-1.0 / w) / r)))); end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(0.375 * N[(N[(r * w), $MachinePrecision] / N[(N[(-1.0 / w), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 + 0.375 \cdot \frac{r \cdot w}{\frac{\frac{-1}{w}}{r}}\right)
\end{array}
Initial program 85.4%
Simplified87.0%
Taylor expanded in v around 0 76.2%
*-commutative76.2%
unpow276.2%
unpow276.2%
swap-sqr93.6%
unpow293.6%
*-commutative93.6%
*-commutative93.6%
Simplified93.6%
*-commutative93.6%
pow293.6%
Applied egg-rr93.6%
pow293.6%
metadata-eval93.6%
pow-div93.6%
pow193.6%
inv-pow93.6%
associate-*l/93.6%
Applied egg-rr93.6%
*-commutative93.6%
*-un-lft-identity93.6%
times-frac93.6%
metadata-eval93.6%
associate-/r*93.6%
Applied egg-rr93.6%
Final simplification93.6%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (- -1.5 (* w (* (* r w) (* r 0.375))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - (w * ((r * w) * (r * 0.375))));
}
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) - (w * ((r * w) * (r * 0.375d0))))
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - (w * ((r * w) * (r * 0.375))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 - (w * ((r * w) * (r * 0.375))))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 - Float64(w * Float64(Float64(r * w) * Float64(r * 0.375))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 - (w * ((r * w) * (r * 0.375)))); end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[(w * N[(N[(r * w), $MachinePrecision] * N[(r * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 - w \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot 0.375\right)\right)\right)
\end{array}
Initial program 85.4%
Simplified87.0%
Taylor expanded in v around 0 76.2%
*-commutative76.2%
unpow276.2%
unpow276.2%
swap-sqr93.6%
unpow293.6%
*-commutative93.6%
*-commutative93.6%
Simplified93.6%
*-commutative93.6%
pow293.6%
Applied egg-rr93.6%
pow293.6%
metadata-eval93.6%
pow-div93.6%
pow193.6%
inv-pow93.6%
associate-*l/93.6%
Applied egg-rr93.6%
*-un-lft-identity93.6%
div-inv93.6%
associate-*l*93.6%
inv-pow93.6%
pow-flip93.6%
metadata-eval93.6%
pow193.6%
Applied egg-rr93.6%
*-lft-identity93.6%
associate-*l*91.9%
*-commutative91.9%
Simplified91.9%
Final simplification91.9%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (- -1.5 (* (* r w) (* w (* r 0.375))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - ((r * w) * (w * (r * 0.375))));
}
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) * (w * (r * 0.375d0))))
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - ((r * w) * (w * (r * 0.375))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 - ((r * w) * (w * (r * 0.375))))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 - Float64(Float64(r * w) * Float64(w * Float64(r * 0.375))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 - ((r * w) * (w * (r * 0.375)))); end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[(N[(r * w), $MachinePrecision] * N[(w * N[(r * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 - \left(r \cdot w\right) \cdot \left(w \cdot \left(r \cdot 0.375\right)\right)\right)
\end{array}
Initial program 85.4%
Simplified87.0%
Taylor expanded in v around 0 76.2%
*-commutative76.2%
unpow276.2%
unpow276.2%
swap-sqr93.6%
unpow293.6%
*-commutative93.6%
*-commutative93.6%
Simplified93.6%
*-commutative93.6%
pow293.6%
Applied egg-rr93.6%
pow293.6%
metadata-eval93.6%
pow-div93.6%
pow193.6%
inv-pow93.6%
associate-*l/93.6%
Applied egg-rr93.6%
div-inv93.6%
associate-*l*93.6%
inv-pow93.6%
pow-flip93.6%
metadata-eval93.6%
pow193.6%
Applied egg-rr93.6%
Final simplification93.6%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (- -1.5 (* 0.375 (* (* r w) (* r w))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - (0.375 * ((r * w) * (r * w))));
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (2.0d0 / (r * r)) + ((-1.5d0) - (0.375d0 * ((r * w) * (r * w))))
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - (0.375 * ((r * w) * (r * w))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 - (0.375 * ((r * w) * (r * w))))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 - Float64(0.375 * Float64(Float64(r * w) * Float64(r * w))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 - (0.375 * ((r * w) * (r * w)))); end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[(0.375 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 - 0.375 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)
\end{array}
Initial program 85.4%
Simplified87.0%
Taylor expanded in v around 0 76.2%
*-commutative76.2%
unpow276.2%
unpow276.2%
swap-sqr93.6%
unpow293.6%
*-commutative93.6%
*-commutative93.6%
Simplified93.6%
*-commutative93.6%
pow293.6%
Applied egg-rr93.6%
Final simplification93.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 85.4%
Simplified78.9%
Taylor expanded in r around 0 58.1%
Final simplification58.1%
(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(Float64(2.0 / 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[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5
\end{array}
Initial program 85.4%
Simplified78.9%
Taylor expanded in r around 0 58.1%
associate-/r*58.2%
div-inv58.1%
Applied egg-rr58.1%
associate-*r/58.2%
*-rgt-identity58.2%
Simplified58.2%
Final simplification58.2%
herbie shell --seed 2024074
(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))