
(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 6 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 w))) (t_1 (* (* r w) 0.5)) (t_2 (/ 2.0 (* r r))))
(if (<= v -54000000000000.0)
(+ t_2 (+ -1.5 (/ -1.0 (* t_0 t_0))))
(if (<= v 2.5e-33)
(+
t_2
(+
-1.5
(/ (+ 0.375 (* v -0.25)) (* (/ (/ 1.0 r) w) (/ -1.0 (* r w))))))
(+ t_2 (- -1.5 (* t_1 t_1)))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * w);
double t_1 = (r * w) * 0.5;
double t_2 = 2.0 / (r * r);
double tmp;
if (v <= -54000000000000.0) {
tmp = t_2 + (-1.5 + (-1.0 / (t_0 * t_0)));
} else if (v <= 2.5e-33) {
tmp = t_2 + (-1.5 + ((0.375 + (v * -0.25)) / (((1.0 / r) / w) * (-1.0 / (r * w)))));
} else {
tmp = t_2 + (-1.5 - (t_1 * t_1));
}
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) :: t_2
real(8) :: tmp
t_0 = 2.0d0 / (r * w)
t_1 = (r * w) * 0.5d0
t_2 = 2.0d0 / (r * r)
if (v <= (-54000000000000.0d0)) then
tmp = t_2 + ((-1.5d0) + ((-1.0d0) / (t_0 * t_0)))
else if (v <= 2.5d-33) then
tmp = t_2 + ((-1.5d0) + ((0.375d0 + (v * (-0.25d0))) / (((1.0d0 / r) / w) * ((-1.0d0) / (r * w)))))
else
tmp = t_2 + ((-1.5d0) - (t_1 * t_1))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * w);
double t_1 = (r * w) * 0.5;
double t_2 = 2.0 / (r * r);
double tmp;
if (v <= -54000000000000.0) {
tmp = t_2 + (-1.5 + (-1.0 / (t_0 * t_0)));
} else if (v <= 2.5e-33) {
tmp = t_2 + (-1.5 + ((0.375 + (v * -0.25)) / (((1.0 / r) / w) * (-1.0 / (r * w)))));
} else {
tmp = t_2 + (-1.5 - (t_1 * t_1));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * w) t_1 = (r * w) * 0.5 t_2 = 2.0 / (r * r) tmp = 0 if v <= -54000000000000.0: tmp = t_2 + (-1.5 + (-1.0 / (t_0 * t_0))) elif v <= 2.5e-33: tmp = t_2 + (-1.5 + ((0.375 + (v * -0.25)) / (((1.0 / r) / w) * (-1.0 / (r * w))))) else: tmp = t_2 + (-1.5 - (t_1 * t_1)) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * w)) t_1 = Float64(Float64(r * w) * 0.5) t_2 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (v <= -54000000000000.0) tmp = Float64(t_2 + Float64(-1.5 + Float64(-1.0 / Float64(t_0 * t_0)))); elseif (v <= 2.5e-33) tmp = Float64(t_2 + Float64(-1.5 + Float64(Float64(0.375 + Float64(v * -0.25)) / Float64(Float64(Float64(1.0 / r) / w) * Float64(-1.0 / Float64(r * w)))))); else tmp = Float64(t_2 + Float64(-1.5 - Float64(t_1 * t_1))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * w); t_1 = (r * w) * 0.5; t_2 = 2.0 / (r * r); tmp = 0.0; if (v <= -54000000000000.0) tmp = t_2 + (-1.5 + (-1.0 / (t_0 * t_0))); elseif (v <= 2.5e-33) tmp = t_2 + (-1.5 + ((0.375 + (v * -0.25)) / (((1.0 / r) / w) * (-1.0 / (r * w))))); else tmp = t_2 + (-1.5 - (t_1 * t_1)); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(r * w), $MachinePrecision] * 0.5), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, -54000000000000.0], N[(t$95$2 + N[(-1.5 + N[(-1.0 / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[v, 2.5e-33], N[(t$95$2 + N[(-1.5 + N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(1.0 / r), $MachinePrecision] / w), $MachinePrecision] * N[(-1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(-1.5 - N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot w}\\
t_1 := \left(r \cdot w\right) \cdot 0.5\\
t_2 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -54000000000000:\\
\;\;\;\;t\_2 + \left(-1.5 + \frac{-1}{t\_0 \cdot t\_0}\right)\\
\mathbf{elif}\;v \leq 2.5 \cdot 10^{-33}:\\
\;\;\;\;t\_2 + \left(-1.5 + \frac{0.375 + v \cdot -0.25}{\frac{\frac{1}{r}}{w} \cdot \frac{-1}{r \cdot w}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2 + \left(-1.5 - t\_1 \cdot t\_1\right)\\
\end{array}
\end{array}
if v < -5.4e13Initial program 78.6%
Simplified89.6%
associate-*l*89.6%
fma-undefine89.6%
*-commutative89.6%
+-commutative89.6%
associate-*r/89.6%
*-commutative89.6%
associate-/l*89.6%
associate-*l*89.6%
associate-*r/78.6%
clear-num78.6%
*-commutative78.6%
associate-*r*72.0%
pow272.0%
pow272.0%
pow-prod-down83.6%
*-commutative83.6%
distribute-rgt-in83.6%
Applied egg-rr83.6%
Taylor expanded in v around inf 78.2%
*-commutative78.2%
unpow278.2%
unpow278.2%
swap-sqr99.7%
unpow299.7%
*-commutative99.7%
Simplified99.7%
*-commutative99.7%
pow299.7%
add-sqr-sqrt99.7%
sqrt-div99.7%
metadata-eval99.7%
pow299.7%
*-commutative99.7%
sqrt-pow177.9%
metadata-eval77.9%
pow177.9%
*-commutative77.9%
sqrt-div77.9%
metadata-eval77.9%
pow277.9%
*-commutative77.9%
sqrt-pow199.8%
metadata-eval99.8%
pow199.8%
*-commutative99.8%
Applied egg-rr99.8%
if -5.4e13 < v < 2.50000000000000014e-33Initial program 86.4%
Simplified86.4%
fma-undefine86.4%
*-commutative86.4%
+-commutative86.4%
associate-*r/86.4%
*-commutative86.4%
associate-/l*86.4%
clear-num86.4%
un-div-inv86.4%
distribute-rgt-in86.4%
metadata-eval86.4%
*-commutative86.4%
associate-*l*86.4%
metadata-eval86.4%
associate-*r*82.8%
pow282.8%
pow282.8%
pow-prod-down99.8%
*-commutative99.8%
Applied egg-rr99.8%
unpow299.8%
Applied egg-rr99.8%
associate-/r*99.8%
*-commutative99.8%
associate-/l/99.8%
div-inv99.8%
*-commutative99.8%
times-frac99.8%
associate-/l/99.9%
*-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in v around 0 99.9%
if 2.50000000000000014e-33 < v Initial program 80.0%
Simplified90.2%
associate-*l*90.2%
fma-undefine90.2%
*-commutative90.2%
+-commutative90.2%
associate-*r/91.5%
*-commutative91.5%
associate-/l*92.6%
associate-*l*92.6%
associate-*r/80.0%
clear-num79.9%
*-commutative79.9%
associate-*r*73.9%
pow273.9%
pow273.9%
pow-prod-down86.0%
*-commutative86.0%
distribute-rgt-in86.0%
Applied egg-rr86.0%
Taylor expanded in v around inf 84.3%
*-commutative84.3%
unpow284.3%
unpow284.3%
swap-sqr99.9%
unpow299.9%
*-commutative99.9%
Simplified99.9%
associate-/r/99.9%
*-commutative99.9%
pow299.9%
add-sqr-sqrt99.9%
sqrt-prod99.9%
metadata-eval99.9%
metadata-eval99.9%
pow299.9%
*-commutative99.9%
sqrt-pow181.6%
metadata-eval81.6%
pow181.6%
*-commutative81.6%
sqrt-prod81.6%
metadata-eval81.6%
metadata-eval81.6%
pow281.6%
*-commutative81.6%
sqrt-pow199.9%
metadata-eval99.9%
pow199.9%
*-commutative99.9%
Applied egg-rr99.9%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r w))) (t_1 (* (* r w) 0.5)) (t_2 (/ 2.0 (* r r))))
(if (<= v -54000000000000.0)
(+ t_2 (+ -1.5 (/ -1.0 (* t_0 t_0))))
(if (<= v 2.5e-33)
(+ t_2 (+ -1.5 (/ (+ 0.375 (* v -0.25)) (/ (/ -1.0 (* r w)) (* r w)))))
(+ t_2 (- -1.5 (* t_1 t_1)))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * w);
double t_1 = (r * w) * 0.5;
double t_2 = 2.0 / (r * r);
double tmp;
if (v <= -54000000000000.0) {
tmp = t_2 + (-1.5 + (-1.0 / (t_0 * t_0)));
} else if (v <= 2.5e-33) {
tmp = t_2 + (-1.5 + ((0.375 + (v * -0.25)) / ((-1.0 / (r * w)) / (r * w))));
} else {
tmp = t_2 + (-1.5 - (t_1 * t_1));
}
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) :: t_2
real(8) :: tmp
t_0 = 2.0d0 / (r * w)
t_1 = (r * w) * 0.5d0
t_2 = 2.0d0 / (r * r)
if (v <= (-54000000000000.0d0)) then
tmp = t_2 + ((-1.5d0) + ((-1.0d0) / (t_0 * t_0)))
else if (v <= 2.5d-33) then
tmp = t_2 + ((-1.5d0) + ((0.375d0 + (v * (-0.25d0))) / (((-1.0d0) / (r * w)) / (r * w))))
else
tmp = t_2 + ((-1.5d0) - (t_1 * t_1))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * w);
double t_1 = (r * w) * 0.5;
double t_2 = 2.0 / (r * r);
double tmp;
if (v <= -54000000000000.0) {
tmp = t_2 + (-1.5 + (-1.0 / (t_0 * t_0)));
} else if (v <= 2.5e-33) {
tmp = t_2 + (-1.5 + ((0.375 + (v * -0.25)) / ((-1.0 / (r * w)) / (r * w))));
} else {
tmp = t_2 + (-1.5 - (t_1 * t_1));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * w) t_1 = (r * w) * 0.5 t_2 = 2.0 / (r * r) tmp = 0 if v <= -54000000000000.0: tmp = t_2 + (-1.5 + (-1.0 / (t_0 * t_0))) elif v <= 2.5e-33: tmp = t_2 + (-1.5 + ((0.375 + (v * -0.25)) / ((-1.0 / (r * w)) / (r * w)))) else: tmp = t_2 + (-1.5 - (t_1 * t_1)) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * w)) t_1 = Float64(Float64(r * w) * 0.5) t_2 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (v <= -54000000000000.0) tmp = Float64(t_2 + Float64(-1.5 + Float64(-1.0 / Float64(t_0 * t_0)))); elseif (v <= 2.5e-33) tmp = Float64(t_2 + Float64(-1.5 + Float64(Float64(0.375 + Float64(v * -0.25)) / Float64(Float64(-1.0 / Float64(r * w)) / Float64(r * w))))); else tmp = Float64(t_2 + Float64(-1.5 - Float64(t_1 * t_1))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * w); t_1 = (r * w) * 0.5; t_2 = 2.0 / (r * r); tmp = 0.0; if (v <= -54000000000000.0) tmp = t_2 + (-1.5 + (-1.0 / (t_0 * t_0))); elseif (v <= 2.5e-33) tmp = t_2 + (-1.5 + ((0.375 + (v * -0.25)) / ((-1.0 / (r * w)) / (r * w)))); else tmp = t_2 + (-1.5 - (t_1 * t_1)); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(r * w), $MachinePrecision] * 0.5), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, -54000000000000.0], N[(t$95$2 + N[(-1.5 + N[(-1.0 / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[v, 2.5e-33], N[(t$95$2 + N[(-1.5 + N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] / N[(N[(-1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 + N[(-1.5 - N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot w}\\
t_1 := \left(r \cdot w\right) \cdot 0.5\\
t_2 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -54000000000000:\\
\;\;\;\;t\_2 + \left(-1.5 + \frac{-1}{t\_0 \cdot t\_0}\right)\\
\mathbf{elif}\;v \leq 2.5 \cdot 10^{-33}:\\
\;\;\;\;t\_2 + \left(-1.5 + \frac{0.375 + v \cdot -0.25}{\frac{\frac{-1}{r \cdot w}}{r \cdot w}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2 + \left(-1.5 - t\_1 \cdot t\_1\right)\\
\end{array}
\end{array}
if v < -5.4e13Initial program 78.6%
Simplified89.6%
associate-*l*89.6%
fma-undefine89.6%
*-commutative89.6%
+-commutative89.6%
associate-*r/89.6%
*-commutative89.6%
associate-/l*89.6%
associate-*l*89.6%
associate-*r/78.6%
clear-num78.6%
*-commutative78.6%
associate-*r*72.0%
pow272.0%
pow272.0%
pow-prod-down83.6%
*-commutative83.6%
distribute-rgt-in83.6%
Applied egg-rr83.6%
Taylor expanded in v around inf 78.2%
*-commutative78.2%
unpow278.2%
unpow278.2%
swap-sqr99.7%
unpow299.7%
*-commutative99.7%
Simplified99.7%
*-commutative99.7%
pow299.7%
add-sqr-sqrt99.7%
sqrt-div99.7%
metadata-eval99.7%
pow299.7%
*-commutative99.7%
sqrt-pow177.9%
metadata-eval77.9%
pow177.9%
*-commutative77.9%
sqrt-div77.9%
metadata-eval77.9%
pow277.9%
*-commutative77.9%
sqrt-pow199.8%
metadata-eval99.8%
pow199.8%
*-commutative99.8%
Applied egg-rr99.8%
if -5.4e13 < v < 2.50000000000000014e-33Initial program 86.4%
Simplified86.4%
fma-undefine86.4%
*-commutative86.4%
+-commutative86.4%
associate-*r/86.4%
*-commutative86.4%
associate-/l*86.4%
clear-num86.4%
un-div-inv86.4%
distribute-rgt-in86.4%
metadata-eval86.4%
*-commutative86.4%
associate-*l*86.4%
metadata-eval86.4%
associate-*r*82.8%
pow282.8%
pow282.8%
pow-prod-down99.8%
*-commutative99.8%
Applied egg-rr99.8%
*-un-lft-identity99.8%
unpow299.8%
times-frac99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-lft-identity99.8%
associate-/r*99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in v around 0 99.8%
if 2.50000000000000014e-33 < v Initial program 80.0%
Simplified90.2%
associate-*l*90.2%
fma-undefine90.2%
*-commutative90.2%
+-commutative90.2%
associate-*r/91.5%
*-commutative91.5%
associate-/l*92.6%
associate-*l*92.6%
associate-*r/80.0%
clear-num79.9%
*-commutative79.9%
associate-*r*73.9%
pow273.9%
pow273.9%
pow-prod-down86.0%
*-commutative86.0%
distribute-rgt-in86.0%
Applied egg-rr86.0%
Taylor expanded in v around inf 84.3%
*-commutative84.3%
unpow284.3%
unpow284.3%
swap-sqr99.9%
unpow299.9%
*-commutative99.9%
Simplified99.9%
associate-/r/99.9%
*-commutative99.9%
pow299.9%
add-sqr-sqrt99.9%
sqrt-prod99.9%
metadata-eval99.9%
metadata-eval99.9%
pow299.9%
*-commutative99.9%
sqrt-pow181.6%
metadata-eval81.6%
pow181.6%
*-commutative81.6%
sqrt-prod81.6%
metadata-eval81.6%
metadata-eval81.6%
pow281.6%
*-commutative81.6%
sqrt-pow199.9%
metadata-eval99.9%
pow199.9%
*-commutative99.9%
Applied egg-rr99.9%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (+ -1.5 (/ (+ 0.375 (* v -0.25)) (* (/ (- 1.0 v) (* r w)) (/ (/ -1.0 r) w))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + ((0.375 + (v * -0.25)) / (((1.0 - v) / (r * w)) * ((-1.0 / 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 + (v * (-0.25d0))) / (((1.0d0 - v) / (r * w)) * (((-1.0d0) / r) / w))))
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + ((0.375 + (v * -0.25)) / (((1.0 - v) / (r * w)) * ((-1.0 / r) / w))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 + ((0.375 + (v * -0.25)) / (((1.0 - v) / (r * w)) * ((-1.0 / r) / w))))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(Float64(0.375 + Float64(v * -0.25)) / Float64(Float64(Float64(1.0 - v) / Float64(r * w)) * Float64(Float64(-1.0 / r) / w))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 + ((0.375 + (v * -0.25)) / (((1.0 - v) / (r * w)) * ((-1.0 / r) / w)))); end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(1.0 - v), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision] * N[(N[(-1.0 / r), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 + \frac{0.375 + v \cdot -0.25}{\frac{1 - v}{r \cdot w} \cdot \frac{\frac{-1}{r}}{w}}\right)
\end{array}
Initial program 82.5%
Simplified88.3%
fma-undefine88.3%
*-commutative88.3%
+-commutative88.3%
associate-*r/88.7%
*-commutative88.7%
associate-/l*89.1%
clear-num89.1%
un-div-inv89.1%
distribute-rgt-in89.1%
metadata-eval89.1%
*-commutative89.1%
associate-*l*89.1%
metadata-eval89.1%
associate-*r*82.2%
pow282.2%
pow282.2%
pow-prod-down99.8%
*-commutative99.8%
Applied egg-rr99.8%
unpow299.8%
Applied egg-rr99.8%
associate-/r*99.8%
*-commutative99.8%
associate-/l/98.4%
div-inv98.4%
*-commutative98.4%
times-frac98.3%
associate-/l/99.8%
*-commutative99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (+ -1.5 (/ (+ 0.375 (* v -0.25)) (/ (+ v -1.0) (* (* r w) (* r w)))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + ((0.375 + (v * -0.25)) / ((v + -1.0) / ((r * w) * (r * w)))));
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (2.0d0 / (r * r)) + ((-1.5d0) + ((0.375d0 + (v * (-0.25d0))) / ((v + (-1.0d0)) / ((r * w) * (r * w)))))
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + ((0.375 + (v * -0.25)) / ((v + -1.0) / ((r * w) * (r * w)))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 + ((0.375 + (v * -0.25)) / ((v + -1.0) / ((r * w) * (r * w)))))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(Float64(0.375 + Float64(v * -0.25)) / Float64(Float64(v + -1.0) / Float64(Float64(r * w) * Float64(r * w)))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 + ((0.375 + (v * -0.25)) / ((v + -1.0) / ((r * w) * (r * w))))); end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] / N[(N[(v + -1.0), $MachinePrecision] / N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 + \frac{0.375 + v \cdot -0.25}{\frac{v + -1}{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}}\right)
\end{array}
Initial program 82.5%
Simplified88.3%
fma-undefine88.3%
*-commutative88.3%
+-commutative88.3%
associate-*r/88.7%
*-commutative88.7%
associate-/l*89.1%
clear-num89.1%
un-div-inv89.1%
distribute-rgt-in89.1%
metadata-eval89.1%
*-commutative89.1%
associate-*l*89.1%
metadata-eval89.1%
associate-*r*82.2%
pow282.2%
pow282.2%
pow-prod-down99.8%
*-commutative99.8%
Applied egg-rr99.8%
unpow299.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (let* ((t_0 (/ 2.0 (* r w)))) (+ (/ 2.0 (* r r)) (+ -1.5 (/ -1.0 (* t_0 t_0))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * w);
return (2.0 / (r * r)) + (-1.5 + (-1.0 / (t_0 * t_0)));
}
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
t_0 = 2.0d0 / (r * w)
code = (2.0d0 / (r * r)) + ((-1.5d0) + ((-1.0d0) / (t_0 * t_0)))
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * w);
return (2.0 / (r * r)) + (-1.5 + (-1.0 / (t_0 * t_0)));
}
def code(v, w, r): t_0 = 2.0 / (r * w) return (2.0 / (r * r)) + (-1.5 + (-1.0 / (t_0 * t_0)))
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * w)) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(-1.0 / Float64(t_0 * t_0)))) end
function tmp = code(v, w, r) t_0 = 2.0 / (r * w); tmp = (2.0 / (r * r)) + (-1.5 + (-1.0 / (t_0 * t_0))); end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * w), $MachinePrecision]), $MachinePrecision]}, N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(-1.0 / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot w}\\
\frac{2}{r \cdot r} + \left(-1.5 + \frac{-1}{t\_0 \cdot t\_0}\right)
\end{array}
\end{array}
Initial program 82.5%
Simplified88.3%
associate-*l*88.3%
fma-undefine88.3%
*-commutative88.3%
+-commutative88.3%
associate-*r/88.7%
*-commutative88.7%
associate-/l*89.1%
associate-*l*89.1%
associate-*r/82.5%
clear-num82.5%
*-commutative82.5%
associate-*r*77.5%
pow277.5%
pow277.5%
pow-prod-down91.7%
*-commutative91.7%
distribute-rgt-in91.7%
Applied egg-rr91.7%
Taylor expanded in v around inf 78.8%
*-commutative78.8%
unpow278.8%
unpow278.8%
swap-sqr94.2%
unpow294.2%
*-commutative94.2%
Simplified94.2%
*-commutative94.2%
pow294.2%
add-sqr-sqrt94.2%
sqrt-div94.2%
metadata-eval94.2%
pow294.2%
*-commutative94.2%
sqrt-pow175.7%
metadata-eval75.7%
pow175.7%
*-commutative75.7%
sqrt-div75.7%
metadata-eval75.7%
pow275.7%
*-commutative75.7%
sqrt-pow194.2%
metadata-eval94.2%
pow194.2%
*-commutative94.2%
Applied egg-rr94.2%
Final simplification94.2%
(FPCore (v w r) :precision binary64 (let* ((t_0 (* (* r w) 0.5))) (+ (/ 2.0 (* r r)) (- -1.5 (* t_0 t_0)))))
double code(double v, double w, double r) {
double t_0 = (r * w) * 0.5;
return (2.0 / (r * r)) + (-1.5 - (t_0 * t_0));
}
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
t_0 = (r * w) * 0.5d0
code = (2.0d0 / (r * r)) + ((-1.5d0) - (t_0 * t_0))
end function
public static double code(double v, double w, double r) {
double t_0 = (r * w) * 0.5;
return (2.0 / (r * r)) + (-1.5 - (t_0 * t_0));
}
def code(v, w, r): t_0 = (r * w) * 0.5 return (2.0 / (r * r)) + (-1.5 - (t_0 * t_0))
function code(v, w, r) t_0 = Float64(Float64(r * w) * 0.5) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 - Float64(t_0 * t_0))) end
function tmp = code(v, w, r) t_0 = (r * w) * 0.5; tmp = (2.0 / (r * r)) + (-1.5 - (t_0 * t_0)); end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(r * w), $MachinePrecision] * 0.5), $MachinePrecision]}, N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(r \cdot w\right) \cdot 0.5\\
\frac{2}{r \cdot r} + \left(-1.5 - t\_0 \cdot t\_0\right)
\end{array}
\end{array}
Initial program 82.5%
Simplified88.3%
associate-*l*88.3%
fma-undefine88.3%
*-commutative88.3%
+-commutative88.3%
associate-*r/88.7%
*-commutative88.7%
associate-/l*89.1%
associate-*l*89.1%
associate-*r/82.5%
clear-num82.5%
*-commutative82.5%
associate-*r*77.5%
pow277.5%
pow277.5%
pow-prod-down91.7%
*-commutative91.7%
distribute-rgt-in91.7%
Applied egg-rr91.7%
Taylor expanded in v around inf 78.8%
*-commutative78.8%
unpow278.8%
unpow278.8%
swap-sqr94.2%
unpow294.2%
*-commutative94.2%
Simplified94.2%
associate-/r/94.2%
*-commutative94.2%
pow294.2%
add-sqr-sqrt94.2%
sqrt-prod94.2%
metadata-eval94.2%
metadata-eval94.2%
pow294.2%
*-commutative94.2%
sqrt-pow175.7%
metadata-eval75.7%
pow175.7%
*-commutative75.7%
sqrt-prod75.7%
metadata-eval75.7%
metadata-eval75.7%
pow275.7%
*-commutative75.7%
sqrt-pow194.2%
metadata-eval94.2%
pow194.2%
*-commutative94.2%
Applied egg-rr94.2%
Final simplification94.2%
herbie shell --seed 2024105
(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))